diff options
| author | 2014-11-22 20:04:29 +0100 | |
|---|---|---|
| committer | 2014-11-22 20:04:29 +0100 | |
| commit | 0de6e675bb0c5a4adb79d16df55ada3071825ad5 (patch) | |
| tree | 9ff782ba4c41873c8c7d06b239166d8a0806b335 /module/web | |
| parent | Revert plugins to stable (diff) | |
| download | pyload-0de6e675bb0c5a4adb79d16df55ada3071825ad5.tar.xz | |
Revert remaining modules
Diffstat (limited to 'module/web')
| -rw-r--r-- | module/web/cnl_app.py | 47 | ||||
| -rw-r--r-- | module/web/pyload_app.py | 2 | 
2 files changed, 23 insertions, 26 deletions
| diff --git a/module/web/cnl_app.py b/module/web/cnl_app.py index 718499dfb..d8f7c1180 100644 --- a/module/web/cnl_app.py +++ b/module/web/cnl_app.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python  # -*- coding: utf-8 -*-  from os.path import join  import re @@ -8,7 +9,6 @@ from binascii import unhexlify  from bottle import route, request, HTTPError  from webinterface import PYLOAD, DL_ROOT, JS -  try:      from Crypto.Cipher import AES  except: @@ -17,8 +17,8 @@ except:  def local_check(function):      def _view(*args, **kwargs): -        if request.environ.get("REMOTE_ADDR", "0") in ("127.0.0.1", "localhost") \ -                or request.environ.get("HTTP_HOST", "0") in ("127.0.0.1:9666", "localhost:9666"): +        if request.environ.get('REMOTE_ADDR', "0") in ('127.0.0.1', 'localhost') \ +        or request.environ.get('HTTP_HOST','0') == '127.0.0.1:9666':              return function(*args, **kwargs)          else:              return HTTPError(403, "Forbidden") @@ -26,15 +26,14 @@ def local_check(function):      return _view -@route('/flash') -@route('/flash/<id>') -@route('/flash', method='POST') +@route("/flash") +@route("/flash/:id") +@route("/flash", method="POST")  @local_check  def flash(id="0"):      return "JDownloader\r\n" - -@route('/flash/add', method='POST') +@route("/flash/add", method="POST")  @local_check  def add(request):      package = request.POST.get('referer', None) @@ -47,10 +46,10 @@ def add(request):      return "" - -@route('/flash/addcrypted', method='POST') +@route("/flash/addcrypted", method="POST")  @local_check  def addcrypted(): +      package = request.forms.get('referer', 'ClickAndLoad Package')      dlc = request.forms['crypted'].replace(" ", "+") @@ -66,10 +65,10 @@ def addcrypted():      else:          return "success\r\n" - -@route('/flash/addcrypted2', method='POST') +@route("/flash/addcrypted2", method="POST")  @local_check  def addcrypted2(): +      package = request.forms.get("source", None)      crypted = request.forms["crypted"]      jk = request.forms["jk"] @@ -83,7 +82,7 @@ def addcrypted2():          try:              jk = re.findall(r"return ('|\")(.+)('|\")", jk)[0][1]          except: -            ## Test for some known js functions to decode +        ## Test for some known js functions to decode              if jk.find("dec") > -1 and jk.find("org") > -1:                  org = re.findall(r"var org = ('|\")([^\"']+)", jk)[0][1]                  jk = list(org) @@ -101,7 +100,7 @@ def addcrypted2():      IV = Key      obj = AES.new(Key, AES.MODE_CBC, IV) -    result = obj.decrypt(crypted).replace("\x00", "").replace("\r", "").split("\n") +    result = obj.decrypt(crypted).replace("\x00", "").replace("\r","").split("\n")      result = filter(lambda x: x != "", result) @@ -115,14 +114,13 @@ def addcrypted2():      else:          return "success\r\n" - -@route('/flashgot_pyload') -@route('/flashgot_pyload', method='POST') -@route('/flashgot') -@route('/flashgot', method='POST') +@route("/flashgot_pyload") +@route("/flashgot_pyload", method="POST") +@route("/flashgot") +@route("/flashgot", method="POST")  @local_check  def flashgot(): -    if request.environ['HTTP_REFERER'] not in ("http://localhost:9666/flashgot", "http://127.0.0.1:9666/flashgot"): +    if request.environ['HTTP_REFERER'] != "http://localhost:9666/flashgot" and request.environ['HTTP_REFERER'] != "http://127.0.0.1:9666/flashgot":          return HTTPError()      autostart = int(request.forms.get('autostart', 0)) @@ -137,8 +135,7 @@ def flashgot():      return "" - -@route('/crossdomain.xml') +@route("/crossdomain.xml")  @local_check  def crossdomain():      rep = "<?xml version=\"1.0\"?>\n" @@ -149,17 +146,17 @@ def crossdomain():      return rep -@route('/flash/checkSupportForUrl') +@route("/flash/checkSupportForUrl")  @local_check  def checksupport(): +      url = request.GET.get("url")      res = PYLOAD.checkURLs([url])      supported = (not res[0][1] is None)      return str(supported).lower() - -@route('/jdcheck.js') +@route("/jdcheck.js")  @local_check  def jdcheck():      rep = "jdownloader=true;\n" diff --git a/module/web/pyload_app.py b/module/web/pyload_app.py index f3515f05f..df4a4b3d4 100644 --- a/module/web/pyload_app.py +++ b/module/web/pyload_app.py @@ -261,7 +261,7 @@ def config():          elif not data.trafficleft:              data.trafficleft = _("not available")          else: -            data.trafficleft = formatSize(data.trafficleft) +            data.trafficleft = formatSize(data.trafficleft * 1024)          if data.validuntil == -1:              data.validuntil  = _("unlimited") | 
