From 3b5c6ac1b27189ff017910816324420cb3b2cec6 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Thu, 21 Jul 2011 13:01:24 +0200 Subject: show updates on webif --- module/plugins/hooks/UpdateManager.py | 3 +++ module/web/pyload_app.py | 17 ++++++++++++++--- module/web/templates/default/base.html | 16 +++++++++++++++- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/module/plugins/hooks/UpdateManager.py b/module/plugins/hooks/UpdateManager.py index 7f4d57947..705ed8eca 100644 --- a/module/plugins/hooks/UpdateManager.py +++ b/module/plugins/hooks/UpdateManager.py @@ -80,6 +80,9 @@ class UpdateManager(Hook): def checkPlugins(self): """ checks for plugins updates""" + # plugins were already updated + if self.info["plugins"]: return + try: updates = getURL("http://get.pyload.org/plugins/check/") except: diff --git a/module/web/pyload_app.py b/module/web/pyload_app.py index 7492114ca..35203ad7b 100644 --- a/module/web/pyload_app.py +++ b/module/web/pyload_app.py @@ -45,16 +45,27 @@ def pre_processor(): user = parse_userdata(s) perms = parse_permissions(s) status = {} - if user["is_authenticated"]: - status = PYLOAD.statusServer() captcha = False + update = False + plugins = False if user["is_authenticated"]: + status = PYLOAD.statusServer() + info = PYLOAD.getInfoByPlugin("UpdateManager") captcha = PYLOAD.isCaptchaWaiting() + + # check if update check is available + if info: + if info["pyload"] == "True": update = True + if info["plugins"] == "True": plugins = True + + return {"user": user, 'status': status, 'captcha': captcha, 'perms': perms, - 'url': request.url} + 'url': request.url, + 'update': update, + 'plugins': plugins} def base(messages): diff --git a/module/web/templates/default/base.html b/module/web/templates/default/base.html index c247a7dc8..5b6854525 100644 --- a/module/web/templates/default/base.html +++ b/module/web/templates/default/base.html @@ -181,12 +181,26 @@ function AddBox(){ {% if user.is_authenticated %} + +{% if update %} + +{{_("pyLoad Update available!")}} + +{% endif %} + + +{% if plugins %} + +{{_("Plugins updated, please restart!")}} + +{% endif %} + Captcha: {{_("Captcha waiting")}} -User:{{user.name}} + User:{{user.name}}