diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-02-10 21:59:31 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-02-10 21:59:31 +0100 |
commit | 6c4eabfc4b686a72224ff06cb56c385bfc489790 (patch) | |
tree | 913239e4a2d994e813134b94f66a49eec9a4b201 | |
parent | webif patch #75 (thx kepheus) (diff) | |
download | pyload-6c4eabfc4b686a72224ff06cb56c385bfc489790.tar.xz |
Webinterface with lighttpd! locale fixing try.
-rw-r--r-- | module/web/ServerThread.py | 97 | ||||
-rw-r--r-- | module/web/cnl/views.py | 56 | ||||
-rw-r--r-- | module/web/lighttpd/lighttpd_default.conf | 151 | ||||
-rw-r--r-- | module/web/locale/de/LC_MESSAGES/django.po | 94 | ||||
-rw-r--r-- | module/web/locale/en/LC_MESSAGES/django.po | 94 | ||||
-rw-r--r-- | module/web/pyload/urls.py | 2 | ||||
-rw-r--r-- | module/web/pyload/views.py | 6 | ||||
-rw-r--r-- | module/web/settings.py | 6 | ||||
-rw-r--r-- | module/web/templates/default/downloads.html | 4 | ||||
-rwxr-xr-x | pyLoadCli.py | 11 | ||||
-rwxr-xr-x | pyLoadCore.py | 10 | ||||
-rwxr-xr-x | pyLoadGui.py | 15 | ||||
-rw-r--r-- | systemCheck.py | 14 |
13 files changed, 458 insertions, 102 deletions
diff --git a/module/web/ServerThread.py b/module/web/ServerThread.py index 1276966ef..5d0dc8738 100644 --- a/module/web/ServerThread.py +++ b/module/web/ServerThread.py @@ -1,52 +1,97 @@ #!/usr/bin/env python from __future__ import with_statement -import threading -from os.path import join +import os from os.path import exists -from subprocess import Popen, PIPE, STDOUT -from time import sleep +from os.path import join from signal import SIGINT -import os +from subprocess import PIPE +from subprocess import Popen +from subprocess import call +from sys import version_info +import threading +from time import sleep class WebServer(threading.Thread): def __init__(self, pycore): threading.Thread.__init__(self) self.pycore = pycore self.running = True + self.lighttpd = False self.setDaemon(True) def run(self): host = self.pycore.config['webinterface']['host'] port = self.pycore.config['webinterface']['port'] + path = join(self.pycore.path, "module", "web") - if not exists(join(self.pycore.path,"module","web","pyload.db")): + if not exists(join(self.pycore.path, "module", "web", "pyload.db")): print "########## IMPORTANT ###########" print "### Database for Webinterface doesnt exitst, it will not be available." - print "### Please run: python %s syncdb" % join(self.pycore.path,"module","web","manage.py") - print "### You have to add at least one User, to gain access to webinterface: python %s createsuperuser" % join(self.pycore.path,"module","web","manage.py") + print "### Please run: python %s syncdb" % join(self.pycore.path, "module", "web", "manage.py") + print "### You have to add at least one User, to gain access to webinterface: python %s createsuperuser" % join(self.pycore.path, "module", "web", "manage.py") print "### Dont forget to restart pyLoad if you are done." print "################################" - raise Exception, "Database doesnt exists, please use syncdb" - - self.pycore.logger.info("Starting Webserver: %s:%s" % (host,port) ) - - if os.name == 'posix': - command = ['python',join(self.pycore.path,"module","web","run_unix.py"), "runserver", "%s:%s" % (host,port)] - self.p = Popen(command, close_fds=True, stderr=PIPE, stdin=PIPE, stdout=PIPE) - #os.system("python " + join(self.pycore.path,"module","web","manage.py runserver %s:%s" % (host,port))) - #@TODO: better would be real python code - sleep(1) - with open("webserver.pid", "r") as f: - self.pid = int(f.read().strip()) - while self.running: - sleep(1) - else: - command = ['python',join(self.pycore.path,"module","web","manage.py"), "runserver", "%s:%s" % (host,port)] + return None + + try: + call(["lighttpd", "-v"], stdout=PIPE, stderr=PIPE) + import flup + self.lighttpd = True + + except Exception: + self.lighttpd = False + + if self.lighttpd: + self.pycore.logger.info("Starting lighttpd Webserver: %s:%s" % (host, port)) + config = file(join(path, "lighttpd", "lighttpd_default.conf"), "rb") + content = config.readlines() + config.close() + content = "".join(content) + + content = content.replace("%(path)", join(path, "lighttpd")) + content = content.replace("%(host)", host) + content = content.replace("%(port)", port) + content = content.replace("%(media)", join(path, "media")) + content = content.replace("%(version)", ".".join(map(str,version_info[0:2]))) + + new_config = file(join(path, "lighttpd", "lighttpd.conf"), "wb") + new_config.write(content) + new_config.close() + + command = ['python', join(self.pycore.path, "module", "web", "manage.py"), "runfcgi", "daemonize=false", "method=threaded", "host=127.0.0.1", "port=9295"] self.p = Popen(command, stderr=PIPE, stdin=PIPE, stdout=PIPE) - while self.running: + + command2 = ['lighttpd', '-D', '-f', join(path, "lighttpd", "lighttpd.conf")] + self.p2 = Popen(command2, stderr=PIPE, stdin=PIPE, stdout=PIPE) + + + + else: + self.pycore.logger.info("Starting django buildin Webserver: %s:%s" % (host, port)) + + if os.name == 'posix': + command = ['python', join(self.pycore.path, "module", "web", "run_unix.py"), "runserver", "%s:%s" % (host, port)] + self.p = Popen(command, close_fds=True, stderr=PIPE, stdin=PIPE, stdout=PIPE) + #os.system("python " + join(self.pycore.path,"module","web","manage.py runserver %s:%s" % (host,port))) + #@TODO: better would be real python code sleep(1) - + with open("webserver.pid", "r") as f: + self.pid = int(f.read().strip()) + while self.running: + sleep(1) + else: + command = ['python', join(self.pycore.path, "module", "web", "manage.py"), "runserver", "%s:%s" % (host, port)] + self.p = Popen(command, stderr=PIPE, stdin=PIPE, stdout=PIPE) + while self.running: + sleep(1) + def quit(self): + + if self.lighttpd: + self.p.kill() + self.p2.kill() + return True + if os.name == 'posix': try: os.kill(self.pid, SIGINT) diff --git a/module/web/cnl/views.py b/module/web/cnl/views.py index 490a445f1..9d309dbf6 100644 --- a/module/web/cnl/views.py +++ b/module/web/cnl/views.py @@ -1,37 +1,60 @@ # Create your views here. +import base64 +import binascii +from os.path import join +import re +from urllib import unquote + from django.conf import settings from django.http import HttpResponse from django.http import HttpResponseServerError -from os.path import join -import binascii -from urllib import unquote -import re -import base64 try: from Crypto.Cipher import AES except: pass +def local_check(function): + def _dec(view_func): + def _view(request, * args, ** kwargs): + if request.META['REMOTE_ADDR'] == '127.0.0.1' or request.META['REMOTE_ADDR'] == 'localhost': + return view_func(request, * args, ** kwargs) + else: + return HttpResponseServerError() + + _view.__name__ = view_func.__name__ + _view.__dict__ = view_func.__dict__ + _view.__doc__ = view_func.__doc__ + + return _view + + if function is None: + return _dec + else: + return _dec(function) + +@local_check def flash(request): return HttpResponse() +@local_check def add(request): - package = request.POST.get('referer','ClickAndLoad Package') + package = request.POST.get('referer', 'ClickAndLoad Package') urls = filter(lambda x: x != "", request.POST['urls'].split("\n")) settings.PYLOAD.add_package(package, urls, False) return HttpResponse() +@local_check def addcrypted(request): - package = request.POST.get('referer','ClickAndLoad Package') - dlc = request.POST['crypted'].replace(" ","+") + package = request.POST.get('referer', 'ClickAndLoad Package') + dlc = request.POST['crypted'].replace(" ", "+") - dlc_path = join(settings.DL_ROOT, package.replace("/","").replace("\\","").replace(":","")+".dlc") + dlc_path = join(settings.DL_ROOT, package.replace("/", "").replace("\\", "").replace(":", "") + ".dlc") dlc_file = file(dlc_path, "wb") dlc_file.write(dlc) dlc_file.close() @@ -41,13 +64,14 @@ def addcrypted(request): return HttpResponse() +@local_check def addcrypted2(request): package = request.POST.get("source", "ClickAndLoad Package") crypted = request.POST["crypted"] jk = request.POST["jk"] - crypted = base64.standard_b64decode(unquote(crypted.replace(" ","+"))) + crypted = base64.standard_b64decode(unquote(crypted.replace(" ", "+"))) jk = re.findall(r"return ('|\")(.+)('|\")", jk)[0][1] @@ -55,25 +79,29 @@ def addcrypted2(request): IV = Key obj = AES.new(Key, AES.MODE_CBC, IV) - result = obj.decrypt(crypted).replace("\x00","").split("\n") - + result = obj.decrypt(crypted).replace("\x00", "").split("\n") + + result = filter(lambda x: x != "", result) + settings.PYLOAD.add_package(package, result, False) return HttpResponse() +@local_check def flashgot(request): if request.META['HTTP_REFERER'] != "http://localhost:9666/flashgot" and request.META['HTTP_REFERER'] != "http://127.0.0.1:9666/flashgot": return HttpResponseServerError() - autostart = int(request.POST.get('autostart',0)) + autostart = int(request.POST.get('autostart', 0)) package = request.POST.get('package', "FlashGot") - urls = request.POST['urls'].split("\n") + urls = urls = filter(lambda x: x != "", request.POST['urls'].split("\n")) folder = request.POST.get('dir', None) settings.PYLOAD.add_package(package, urls, autostart) return HttpResponse("") +@local_check def crossdomain(request): rep = "<?xml version=\"1.0\"?>\r\n" rep += "<!DOCTYPE cross-domain-policy SYSTEM \"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd\">\r\n" diff --git a/module/web/lighttpd/lighttpd_default.conf b/module/web/lighttpd/lighttpd_default.conf new file mode 100644 index 000000000..fb971ffbe --- /dev/null +++ b/module/web/lighttpd/lighttpd_default.conf @@ -0,0 +1,151 @@ +# lighttpd configuration file +# +# use it as a base for lighttpd 1.0.0 and above +# +# $Id: lighttpd.conf,v 1.7 2004/11/03 22:26:05 weigon Exp $ + +############ Options you really have to take care of #################### + +## modules to load +# at least mod_access and mod_accesslog should be loaded +# all other module should only be loaded if really neccesary +# - saves some time +# - saves memory +server.modules = ( + "mod_rewrite", + "mod_redirect", + "mod_alias", + "mod_access", +# "mod_trigger_b4_dl", +# "mod_auth", +# "mod_status", +# "mod_setenv", + "mod_fastcgi", +# "mod_proxy", +# "mod_simple_vhost", +# "mod_evhost", +# "mod_userdir", +# "mod_cgi", +# "mod_compress", +# "mod_ssi", +# "mod_usertrack", +# "mod_expire", +# "mod_secdownload", +# "mod_rrdtool", +# "mod_accesslog" + ) + +## A static document-root. For virtual hosting take a look at the +## mod_simple_vhost module. +server.document-root = "/srv/http/" + +## where to send error-messages to +server.errorlog = "%(path)/error.log" + +# files to check for if .../ is requested +index-file.names = ( "index.php", "index.html", + "index.htm", "default.htm" ) + +## set the event-handler (read the performance section in the manual) +# server.event-handler = "freebsd-kqueue" # needed on OS X + +# mimetype mapping +mimetype.assign = ( + ".pdf" => "application/pdf", + ".sig" => "application/pgp-signature", + ".spl" => "application/futuresplash", + ".class" => "application/octet-stream", + ".ps" => "application/postscript", + ".torrent" => "application/x-bittorrent", + ".dvi" => "application/x-dvi", + ".gz" => "application/x-gzip", + ".pac" => "application/x-ns-proxy-autoconfig", + ".swf" => "application/x-shockwave-flash", + ".tar.gz" => "application/x-tgz", + ".tgz" => "application/x-tgz", + ".tar" => "application/x-tar", + ".zip" => "application/zip", + ".mp3" => "audio/mpeg", + ".m3u" => "audio/x-mpegurl", + ".wma" => "audio/x-ms-wma", + ".wax" => "audio/x-ms-wax", + ".ogg" => "application/ogg", + ".wav" => "audio/x-wav", + ".gif" => "image/gif", + ".jar" => "application/x-java-archive", + ".jpg" => "image/jpeg", + ".jpeg" => "image/jpeg", + ".png" => "image/png", + ".xbm" => "image/x-xbitmap", + ".xpm" => "image/x-xpixmap", + ".xwd" => "image/x-xwindowdump", + ".css" => "text/css", + ".html" => "text/html", + ".htm" => "text/html", + ".js" => "text/javascript", + ".asc" => "text/plain", + ".c" => "text/plain", + ".cpp" => "text/plain", + ".log" => "text/plain", + ".conf" => "text/plain", + ".text" => "text/plain", + ".txt" => "text/plain", + ".dtd" => "text/xml", + ".xml" => "text/xml", + ".mpeg" => "video/mpeg", + ".mpg" => "video/mpeg", + ".mov" => "video/quicktime", + ".qt" => "video/quicktime", + ".avi" => "video/x-msvideo", + ".asf" => "video/x-ms-asf", + ".asx" => "video/x-ms-asf", + ".wmv" => "video/x-ms-wmv", + ".bz2" => "application/x-bzip", + ".tbz" => "application/x-bzip-compressed-tar", + ".tar.bz2" => "application/x-bzip-compressed-tar", + # default mime type + "" => "application/octet-stream", + ) + +# Use the "Content-Type" extended attribute to obtain mime type if possible +#mimetype.use-xattr = "enable" + +#### accesslog module +accesslog.filename = "%(path)/access.log" + +url.access-deny = ( "~", ".inc" ) + +$HTTP["url"] =~ "\.pdf$" { + server.range-requests = "disable" +} +static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" ) + +server.pid-file = "%(path)/lighttpd.pid" + +server.bind = "%(host)" +server.port = %(port) + +#server.document-root = "/home/user/public_html" +fastcgi.server = ( + "/pyload.fcgi" => ( + "main" => ( + "host" => "127.0.0.1", + "port" => 9295, + "check-local" => "disable", + "docroot" => "/", + ) + ), +) + +alias.url = ( + "/media/" => "%(media)/", + "/admin/media/" => "/usr/lib/python%(version)/site-packages/django/contrib/admin/media/", +) + +url.rewrite-once = ( + "^(/media.*)$" => "$1", + "^(/admin/media.*)$" => "$1", + "^/favicon\.ico$" => "/media/img/favicon.ico", + "^(/pyload.fcgi.*)$" => "$1", + "^(/.*)$" => "/pyload.fcgi$1", +) diff --git a/module/web/locale/de/LC_MESSAGES/django.po b/module/web/locale/de/LC_MESSAGES/django.po index 8a086dff1..3056c2b1d 100644 --- a/module/web/locale/de/LC_MESSAGES/django.po +++ b/module/web/locale/de/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-02-04 15:16+0000\n" +"POT-Creation-Date: 2010-02-06 11:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -26,11 +26,11 @@ msgstr "" msgid "You don't have permission to view this page." msgstr "" -#: pyload/views.py:88 +#: pyload/views.py:86 msgid "Download directory not found." msgstr "" -#: templates/default/base.html:21 templates/default/base.html.py:185 +#: templates/default/base.html:21 templates/default/base.html.py:193 msgid "Webinterface" msgstr "" @@ -50,62 +50,108 @@ msgstr "" msgid "Please Login!" msgstr "" -#: templates/default/base.html:147 templates/default/queue.html:79 +#: templates/default/base.html:147 templates/default/collector.html:90 +#: templates/default/downloads.html:8 templates/default/logs.html:9 +#: templates/default/queue.html:80 templates/default/settings.html:9 msgid "Home" msgstr "" -#: templates/default/base.html:150 templates/default/queue.html:75 -#: templates/default/queue.html.py:76 templates/default/queue.html:80 +#: templates/default/base.html:150 templates/default/collector.html:93 +#: templates/default/downloads.html:11 templates/default/logs.html:12 +#: templates/default/queue.html:75 templates/default/queue.html.py:76 +#: templates/default/queue.html:83 templates/default/settings.html:12 msgid "Queue" msgstr "" -#: templates/default/base.html:152 templates/default/downloads.html:20 -#: templates/default/queue.html:81 +#: templates/default/base.html:153 templates/default/collector.html:85 +#: templates/default/collector.html:86 templates/default/collector.html:96 +#: templates/default/downloads.html:14 templates/default/logs.html:15 +#: templates/default/queue.html:86 templates/default/settings.html:15 +msgid "Collector" +msgstr "" + +#: templates/default/base.html:156 templates/default/collector.html:99 +#: templates/default/downloads.html:17 templates/default/downloads.html:28 +#: templates/default/logs.html:18 templates/default/queue.html:89 +#: templates/default/settings.html:18 msgid "Downloads" msgstr "" -#: templates/default/base.html:154 templates/default/logs.html:4 -#: templates/default/logs.html.py:5 templates/default/queue.html:82 +#: templates/default/base.html:159 templates/default/collector.html:102 +#: templates/default/downloads.html:20 templates/default/logs.html:4 +#: templates/default/logs.html.py:5 templates/default/logs.html:21 +#: templates/default/queue.html:92 templates/default/settings.html:21 msgid "Logs" msgstr "" -#: templates/default/base.html:166 +#: templates/default/base.html:162 templates/default/collector.html:105 +#: templates/default/downloads.html:23 templates/default/logs.html:24 +#: templates/default/queue.html:95 templates/default/settings.html:4 +#: templates/default/settings.html.py:5 templates/default/settings.html:24 +msgid "Config" +msgstr "" + +#: templates/default/base.html:174 msgid "Play" msgstr "" -#: templates/default/base.html:167 +#: templates/default/base.html:175 msgid "Cancel" msgstr "" -#: templates/default/base.html:168 +#: templates/default/base.html:176 msgid "Stop" msgstr "" -#: templates/default/base.html:169 +#: templates/default/base.html:177 msgid "Add" msgstr "" -#: templates/default/base.html:175 +#: templates/default/base.html:183 msgid "Speed:" msgstr "" -#: templates/default/base.html:176 +#: templates/default/base.html:184 msgid "Active:" msgstr "" -#: templates/default/base.html:177 +#: templates/default/base.html:185 msgid "Reload page" msgstr "" -#: templates/default/base.html:205 +#: templates/default/base.html:213 msgid "© 2008-2010 the pyLoad Team" msgstr "© 2008-2010 das pyLoad Team" -#: templates/default/base.html:207 +#: templates/default/base.html:215 msgid "Back to top" msgstr "" -#: templates/default/downloads.html:25 +#: templates/default/collector.html:114 templates/default/queue.html:104 +msgid "Delete Package" +msgstr "" + +#: templates/default/collector.html:116 +msgid "Reset Package" +msgstr "" + +#: templates/default/collector.html:118 +msgid "Push Package to Queue" +msgstr "" + +#: templates/default/collector.html:131 templates/default/queue.html:119 +msgid "Folder:" +msgstr "" + +#: templates/default/collector.html:133 templates/default/queue.html:121 +msgid "Delete Link" +msgstr "" + +#: templates/default/collector.html:135 templates/default/queue.html:123 +msgid "Restart Link" +msgstr "" + +#: templates/default/downloads.html:33 msgid "It's recommend not to download Files bigger than ~10MB from here." msgstr "" @@ -153,20 +199,20 @@ msgstr "" msgid "You were successfully logged out." msgstr "" -#: templates/default/logs.html:26 +#: templates/default/logs.html:34 msgid "Start" msgstr "" -#: templates/default/logs.html:26 +#: templates/default/logs.html:34 msgid "prev" msgstr "" -#: templates/default/logs.html:26 +#: templates/default/logs.html:34 msgid "next" msgstr "" #: templates/default/queue.html:106 -msgid "Folder:" +msgid "Restart Package" msgstr "" #: templates/default/window.html:9 templates/default/window.html.py:26 diff --git a/module/web/locale/en/LC_MESSAGES/django.po b/module/web/locale/en/LC_MESSAGES/django.po index 3676a800a..647768811 100644 --- a/module/web/locale/en/LC_MESSAGES/django.po +++ b/module/web/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-02-04 15:16+0000\n" +"POT-Creation-Date: 2010-02-06 11:06+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -26,11 +26,11 @@ msgstr "" msgid "You don't have permission to view this page." msgstr "" -#: pyload/views.py:88 +#: pyload/views.py:86 msgid "Download directory not found." msgstr "" -#: templates/default/base.html:21 templates/default/base.html.py:185 +#: templates/default/base.html:21 templates/default/base.html.py:193 msgid "Webinterface" msgstr "" @@ -50,62 +50,108 @@ msgstr "" msgid "Please Login!" msgstr "" -#: templates/default/base.html:147 templates/default/queue.html:79 +#: templates/default/base.html:147 templates/default/collector.html:90 +#: templates/default/downloads.html:8 templates/default/logs.html:9 +#: templates/default/queue.html:80 templates/default/settings.html:9 msgid "Home" msgstr "" -#: templates/default/base.html:150 templates/default/queue.html:75 -#: templates/default/queue.html.py:76 templates/default/queue.html:80 +#: templates/default/base.html:150 templates/default/collector.html:93 +#: templates/default/downloads.html:11 templates/default/logs.html:12 +#: templates/default/queue.html:75 templates/default/queue.html.py:76 +#: templates/default/queue.html:83 templates/default/settings.html:12 msgid "Queue" msgstr "" -#: templates/default/base.html:152 templates/default/downloads.html:20 -#: templates/default/queue.html:81 +#: templates/default/base.html:153 templates/default/collector.html:85 +#: templates/default/collector.html:86 templates/default/collector.html:96 +#: templates/default/downloads.html:14 templates/default/logs.html:15 +#: templates/default/queue.html:86 templates/default/settings.html:15 +msgid "Collector" +msgstr "" + +#: templates/default/base.html:156 templates/default/collector.html:99 +#: templates/default/downloads.html:17 templates/default/downloads.html:28 +#: templates/default/logs.html:18 templates/default/queue.html:89 +#: templates/default/settings.html:18 msgid "Downloads" msgstr "" -#: templates/default/base.html:154 templates/default/logs.html:4 -#: templates/default/logs.html.py:5 templates/default/queue.html:82 +#: templates/default/base.html:159 templates/default/collector.html:102 +#: templates/default/downloads.html:20 templates/default/logs.html:4 +#: templates/default/logs.html.py:5 templates/default/logs.html:21 +#: templates/default/queue.html:92 templates/default/settings.html:21 msgid "Logs" msgstr "" -#: templates/default/base.html:166 +#: templates/default/base.html:162 templates/default/collector.html:105 +#: templates/default/downloads.html:23 templates/default/logs.html:24 +#: templates/default/queue.html:95 templates/default/settings.html:4 +#: templates/default/settings.html.py:5 templates/default/settings.html:24 +msgid "Config" +msgstr "" + +#: templates/default/base.html:174 msgid "Play" msgstr "" -#: templates/default/base.html:167 +#: templates/default/base.html:175 msgid "Cancel" msgstr "" -#: templates/default/base.html:168 +#: templates/default/base.html:176 msgid "Stop" msgstr "" -#: templates/default/base.html:169 +#: templates/default/base.html:177 msgid "Add" msgstr "" -#: templates/default/base.html:175 +#: templates/default/base.html:183 msgid "Speed:" msgstr "" -#: templates/default/base.html:176 +#: templates/default/base.html:184 msgid "Active:" msgstr "" -#: templates/default/base.html:177 +#: templates/default/base.html:185 msgid "Reload page" msgstr "" -#: templates/default/base.html:205 +#: templates/default/base.html:213 msgid "© 2008-2010 the pyLoad Team" msgstr "" -#: templates/default/base.html:207 +#: templates/default/base.html:215 msgid "Back to top" msgstr "" -#: templates/default/downloads.html:25 +#: templates/default/collector.html:114 templates/default/queue.html:104 +msgid "Delete Package" +msgstr "" + +#: templates/default/collector.html:116 +msgid "Reset Package" +msgstr "" + +#: templates/default/collector.html:118 +msgid "Push Package to Queue" +msgstr "" + +#: templates/default/collector.html:131 templates/default/queue.html:119 +msgid "Folder:" +msgstr "" + +#: templates/default/collector.html:133 templates/default/queue.html:121 +msgid "Delete Link" +msgstr "" + +#: templates/default/collector.html:135 templates/default/queue.html:123 +msgid "Restart Link" +msgstr "" + +#: templates/default/downloads.html:33 msgid "It's recommend not to download Files bigger than ~10MB from here." msgstr "" @@ -153,20 +199,20 @@ msgstr "" msgid "You were successfully logged out." msgstr "" -#: templates/default/logs.html:26 +#: templates/default/logs.html:34 msgid "Start" msgstr "" -#: templates/default/logs.html:26 +#: templates/default/logs.html:34 msgid "prev" msgstr "" -#: templates/default/logs.html:26 +#: templates/default/logs.html:34 msgid "next" msgstr "" #: templates/default/queue.html:106 -msgid "Folder:" +msgid "Restart Package" msgstr "" #: templates/default/window.html:9 templates/default/window.html.py:26 diff --git a/module/web/pyload/urls.py b/module/web/pyload/urls.py index 34c3aee18..420bc8ce1 100644 --- a/module/web/pyload/urls.py +++ b/module/web/pyload/urls.py @@ -9,7 +9,7 @@ from django.conf.urls.defaults import * urlpatterns = patterns('pyload', (r'^home/$', 'views.home'), (r'^downloads/$', 'views.downloads',{},'downloads'), - (r'^download/(?P<path>[a-zA-z\.0-9\-/_%]+)$', 'views.download',{},'download'), + (r'^download/(?P<path>[a-zA-z\.0-9\-/_% "\\]+)$', 'views.download',{},'download'), (r'^queue/$', 'views.queue',{}, 'queue'), (r'^collector/$', 'views.collector',{}, 'collector'), (r'^settings/$', 'views.config',{}, 'config'), diff --git a/module/web/pyload/views.py b/module/web/pyload/views.py index 2891b373d..e8df50596 100644 --- a/module/web/pyload/views.py +++ b/module/web/pyload/views.py @@ -7,6 +7,7 @@ from os import stat from os.path import isdir from os.path import isfile from os.path import join +from urllib import unquote from django.conf import settings from django.contrib.auth.decorators import login_required @@ -16,7 +17,6 @@ from django.shortcuts import render_to_response from django.template import RequestContext from django.utils.translation import ugettext as _ - def check_server(function): def _dec(view_func): def _view(request, * args, ** kwargs): @@ -110,14 +110,14 @@ def downloads(request): @permission('pyload.can_download') @check_server def download(request, path): + path = unquote(path) path = path.split("/") - + dir = join(settings.DL_ROOT, path[1].replace('..', '')) if isdir(dir) or isfile(dir): if isdir(dir): filepath = join(dir, path[2]) elif isfile(dir): filepath = dir - print filepath if isfile(filepath): try: type, encoding = mimetypes.guess_type(filepath) diff --git a/module/web/settings.py b/module/web/settings.py index 11224faf4..0e67e3674 100644 --- a/module/web/settings.py +++ b/module/web/settings.py @@ -90,7 +90,7 @@ LOGIN_REDIRECT_URL = "/" # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
-ADMIN_MEDIA_PREFIX = '/media/admin/'
+ADMIN_MEDIA_PREFIX = '/admin/media/'
# Make this unique, and don't share it with anybody.
SECRET_KEY = '+u%%1t&c7!e$0$*gu%w2$@to)h0!&x-r*9e+-=wa4*zxat%x^t'
@@ -129,9 +129,9 @@ INSTALLED_APPS = ( 'django.contrib.admin',
'pyload',
'ajax',
- 'cnl'
+ 'cnl',
)
AUTH_PROFILE_MODULE = 'pyload.UserProfile'
-LOGIN_URL = '/login' +LOGIN_URL = '/login/'
diff --git a/module/web/templates/default/downloads.html b/module/web/templates/default/downloads.html index b9cffa955..9ab5a2ea4 100644 --- a/module/web/templates/default/downloads.html +++ b/module/web/templates/default/downloads.html @@ -38,14 +38,14 @@ {{ folder.name }} <ul> {% for file in folder.files %} - <li><a href='{% url download 'get/' %}{{ folder.name }}/{{ file }}'>{{ file }}</a></li> + <li><a href='{% url download 'get/' %}{{ folder.path|urlencode }}/{{ file|urlencode }}'>{{file}}</a></li> {% endfor %} </ul> </li> {% endfor %} {% for file in files.files %} - <li> <a href={% url download 'get/' %}{{ file }}>{{ file }}</a></li> + <li> <a href={% url download 'get/' %}{{ file|urlencode }}>{{ file }}</a></li> {% endfor %} </ul> diff --git a/pyLoadCli.py b/pyLoadCli.py index 03a44cc02..e4238b28d 100755 --- a/pyLoadCli.py +++ b/pyLoadCli.py @@ -431,7 +431,16 @@ if __name__ == "__main__": config = xmlconfig.getConfig() translation = gettext.translation("pyLoadCli", join(abspath(dirname(__file__)), "locale"), languages=[config['general']['language']]) - translation.install(unicode=(False if sys.stdout.encoding == "ascii" else True)) + + try: + translation.ugettext("äöü") + unicode = True + except: + unicode = False + + #@TODO cleaner method, if possible + + translation.install(unicode) if len(sys.argv) > 1: diff --git a/pyLoadCore.py b/pyLoadCore.py index 483750152..5ea4b43c5 100755 --- a/pyLoadCore.py +++ b/pyLoadCore.py @@ -108,8 +108,16 @@ class Core(object): self.do_kill = False
self.do_restart = False
translation = gettext.translation("pyLoad", join(self.path, "locale"), languages=[self.config['general']['language']])
- translation.install(unicode=(False if sys.stdout.encoding == "ascii" else True))
+ try:
+ translation.ugettext("äöü")
+ unicode = True
+ except:
+ unicode = False
+ #@TODO cleaner method, if possible
+
+ translation.install(unicode)
+
self.check_install("Crypto", _("pycrypto to decode container files"))
self.check_install("Image", _("Python Image Libary (PIL) for captha reading"))
self.check_install("pycurl", _("pycurl for lower memory footprint while downloading"))
diff --git a/pyLoadGui.py b/pyLoadGui.py index c0fc98c5b..b4a518036 100755 --- a/pyLoadGui.py +++ b/pyLoadGui.py @@ -57,8 +57,19 @@ class main(QObject): if not lang: parser = XMLParser("module/config/gui_default.xml") lang = parser.xml.elementsByTagName("language").item(0).toElement().text() - translation = gettext.translation("pyLoadGui", join(dirname(__file__), "locale"), languages=[str(lang)])
- translation.install(unicode=False if sys.getdefaultencoding() == "ascii" else True) + + translation = gettext.translation("pyLoadGui", join(dirname(__file__), "locale"), languages=[str(lang)]) + + try: + translation.ugettext("äöü") + unicode = True + except: + unicode = False + + #@TODO cleaner method, if possible + + translation.install(unicode) + self.mainWindow = MainWindow() self.pwWindow = PWInputWindow() self.connWindow = ConnectionManager() diff --git a/systemCheck.py b/systemCheck.py index 8a1b452dc..79d8600a2 100644 --- a/systemCheck.py +++ b/systemCheck.py @@ -68,7 +68,7 @@ def main(): import pycurl except: core_err.append("Please install py-curl to use pyLoad.") - +#@TODO version > 7.19 try: import Image except: @@ -136,6 +136,18 @@ def main(): web_err.append("You dont have created database yet.") web_err.append("Please run: python %s syncdb" % join(dirname(__file__), "module", "web", "manage.py")) + try: + p = subprocess.call(["lighttpd", "-v"], stdout=pipe, stderr=pipe) + except: + web_err.append("Install lighttpd if you want an highperformance webserver.") + + try: + import flup + except: + web_err.append("Install Flup to use FastCGI and lighttpd.") + + + if web_err: print "The system check has detected some errors:" print "" |