summaryrefslogtreecommitdiffstats
path: root/pyload/remote/ClickNLoadBackend.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyload/remote/ClickNLoadBackend.py')
-rw-r--r--pyload/remote/ClickNLoadBackend.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/pyload/remote/ClickNLoadBackend.py b/pyload/remote/ClickNLoadBackend.py
index fbacb3244..31678ab8b 100644
--- a/pyload/remote/ClickNLoadBackend.py
+++ b/pyload/remote/ClickNLoadBackend.py
@@ -19,12 +19,14 @@ core = None
js = None
class ClickNLoadBackend(BackendBase):
+
def setup(self, host, port):
self.httpd = HTTPServer((host, port), CNLHandler)
global core, js
core = self.m.core
js = core.js
+
def serve(self):
while self.enabled:
self.httpd.handle_request()
@@ -36,12 +38,14 @@ class CNLHandler(BaseHTTPRequestHandler):
print "urls", urls
print "queue", queue
+
def get_post(self, name, default=""):
if name in self.post:
return self.post[name]
else:
return default
+
def start_response(self, string):
self.send_response(200)
@@ -53,6 +57,7 @@ class CNLHandler(BaseHTTPRequestHandler):
self.send_header("Content-type", "text/html")
self.end_headers()
+
def do_GET(self):
path = self.path.strip("/").lower()
#self.wfile.write(path+"\n")
@@ -84,6 +89,7 @@ class CNLHandler(BaseHTTPRequestHandler):
else:
self.send_error(404, "Not Found")
+
def do_POST(self):
form = FieldStorage(
fp=self.rfile,
@@ -98,21 +104,25 @@ class CNLHandler(BaseHTTPRequestHandler):
return self.do_GET()
+
def flash(self):
return "JDownloader"
+
def add(self):
package = self.get_post('referer', 'ClickNLoad Package')
urls = filter(lambda x: x != "", self.get_post('urls').split("\n"))
self.add_package(package, urls, 0)
+
def addcrypted(self):
package = self.get_post('referer', 'ClickNLoad Package')
dlc = self.get_post('crypted').replace(" ", "+")
core.upload_container(package, dlc)
+
def addcrypted2(self):
package = self.get_post("source", "ClickNLoad Package")
crypted = self.get_post("crypted")
@@ -139,6 +149,7 @@ class CNLHandler(BaseHTTPRequestHandler):
self.add_package(package, urls, autostart)
+
def crossdomain(self):
rep = "<?xml version=\"1.0\"?>\n"
rep += "<!DOCTYPE cross-domain-policy SYSTEM \"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd\">\n"
@@ -147,9 +158,11 @@ class CNLHandler(BaseHTTPRequestHandler):
rep += "</cross-domain-policy>"
return rep
+
def checksupport(self):
pass
+
def jdcheck(self):
rep = "jdownloader=true;\n"
rep += "var version='10629';\n"