diff options
Diffstat (limited to 'module/web')
-rw-r--r-- | module/web/WebServer.py | 13 | ||||
-rw-r--r-- | module/web/static/default/status.js | 4 | ||||
-rw-r--r-- | module/web/templates/default.tpl | 6 |
3 files changed, 17 insertions, 6 deletions
diff --git a/module/web/WebServer.py b/module/web/WebServer.py index 29b0aafe8..3486bf7cb 100644 --- a/module/web/WebServer.py +++ b/module/web/WebServer.py @@ -184,7 +184,7 @@ def queue(): username = request.COOKIES.get('user') - return template('default', page='queue', links=core.get_links(), user=username, status=core_methods.status_server()) + return template('default', page='queue', links=core_methods.get_queue(), user=username, status=core_methods.status_server()) @route('/downloads') def downloads(): @@ -252,6 +252,17 @@ def get_status(): json = '{ "status": "%s", "speed": "%s", "queue": "%s" }' % (status, str(int(data['speed'])), str(data['queue'])) return json +@route('json/addpackage', method='POST') +def add_package(): + response.header['Cache-Control'] = 'no-cache, must-revalidate' + response.content_type = 'application/json' + + if not check_auth(request): + abort(404, "No Access") + + links = request.POST['links'].split('\n') + name = request.POST['name'] + core_methods.add_package(name, links) @route('/json/addlinks', method='POST') def add_links(): diff --git a/module/web/static/default/status.js b/module/web/static/default/status.js index 31a4e0032..3923e80ca 100644 --- a/module/web/static/default/status.js +++ b/module/web/static/default/status.js @@ -39,11 +39,11 @@ window.addEvent('domready', function(){ new Request({ method: 'post', - url: '/json/addlinks', + url: '/json/addpackage', onSuccess: function(){ document.id('linkarea').value = "" } - }).send('links='+document.id('linkarea').value) + }).send('links='+document.id('linkarea').value+"&name="+document.id('pname').value) }) diff --git a/module/web/templates/default.tpl b/module/web/templates/default.tpl index 13be260b6..3f5e8d8e8 100644 --- a/module/web/templates/default.tpl +++ b/module/web/templates/default.tpl @@ -11,7 +11,7 @@ %include header title=header, use_js=js, use_css=['default.css','window.css'], redirect=red -%include window id="addlinks", width=400, caption="Add links", body="<textarea rows=10 style='width: 345px;' id='linkarea'></textarea>", button="Add" +%include window id="addlinks", width=400, caption="Add links", body="<input id='pname' type='text' style='width: 345px;' value='Package'/><textarea rows=10 style='width: 345px;' id='linkarea'></textarea>", button="Add" <a class="anchor" name="top" id="top"></a> @@ -199,9 +199,9 @@ this.morph({'color': '#000'}); <ul> -%for id in links['order']: +%for package in links: -<li>{{links[id].url}}</li> +<li>{{package.name}}</li> %end |