diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-10-09 18:18:23 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-10-09 18:18:23 +0200 |
commit | 57cce481460efd7c9897c59652b544ef65063837 (patch) | |
tree | d3e8f4d1465e32c20028258d941c7eb56f15943d /module/web/pyload_app.py | |
parent | add filejungle.com, fix sharerapid.com (diff) | |
download | pyload-57cce481460efd7c9897c59652b544ef65063837.tar.xz |
updated js/mootools, some parts now coffeescript
Diffstat (limited to 'module/web/pyload_app.py')
-rw-r--r-- | module/web/pyload_app.py | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/module/web/pyload_app.py b/module/web/pyload_app.py index 0370e19cb..c64619c57 100644 --- a/module/web/pyload_app.py +++ b/module/web/pyload_app.py @@ -29,7 +29,7 @@ from urllib import unquote from bottle import route, static_file, request, response, redirect, HTTPError, error -from webinterface import PYLOAD, PYLOAD_DIR, PROJECT_DIR, SETUP +from webinterface import PYLOAD, PYLOAD_DIR, PROJECT_DIR, SETUP, env from utils import render_to_response, parse_permissions, parse_userdata, \ login_required, get_permission, set_permission, permlist, toDict, set_session @@ -82,15 +82,31 @@ def error500(error): return base(["An Error occured, please enable debug mode to get more details.", error, error.traceback.replace("\n", "<br>") if error.traceback else "No Traceback"]) +# render js +@route("/media/js/:path#.+\.js#") +def js_dynamic(path): + response.headers['Expires'] = time.strftime("%a, %d %b %Y %H:%M:%S GMT", + time.gmtime(time.time() + 60 * 60 * 24 * 2)) + response.headers['Cache-control'] = "public" + response.headers['Content-Type'] = "text/javascript; charset=UTF-8" + + try: + # static files are not rendered + if "static" not in path and "mootools" not in path: + t = env.get_template("js/%s" % path) + return t.render() + else: + return static_file(path, root=join(PROJECT_DIR, "media", "js")) + except: + return HTTPError(404, "Not Found") @route('/media/:path#.+#') def server_static(path): response.headers['Expires'] = time.strftime("%a, %d %b %Y %H:%M:%S GMT", - time.gmtime(time.time() + 60 * 60 * 24 * 2)) + time.gmtime(time.time() + 60 * 60 * 24 * 7)) response.headers['Cache-control'] = "public" return static_file(path, root=join(PROJECT_DIR, "media")) - @route('/favicon.ico') def favicon(): return static_file("favicon.ico", root=join(PROJECT_DIR, "media", "img")) @@ -271,24 +287,6 @@ def config(): [pre_processor]) -@route("/package_ui.js") -@login_required('LIST') -def package_ui(): - response.headers['Expires'] = time.strftime("%a, %d %b %Y %H:%M:%S GMT", - time.gmtime(time.time() + 60 * 60 * 24 * 7)) - response.headers['Cache-control'] = "public" - return render_to_response('package_ui.js') - - -@route("/filemanager_ui.js") -@login_required('LIST') -def package_ui(): - response.headers['Expires'] = time.strftime("%a, %d %b %Y %H:%M:%S GMT", - time.gmtime(time.time() + 60 * 60 * 24 * 7)) - response.headers['Cache-control'] = "public" - return render_to_response('filemanager_ui.js') - - @route("/filechooser") @route("/pathchooser") @route("/filechooser/:file#.+#") |