summaryrefslogtreecommitdiffstats
path: root/module/web/ajax
diff options
context:
space:
mode:
Diffstat (limited to 'module/web/ajax')
-rw-r--r--module/web/ajax/urls.py1
-rw-r--r--module/web/ajax/views.py8
2 files changed, 8 insertions, 1 deletions
diff --git a/module/web/ajax/urls.py b/module/web/ajax/urls.py
index 4decc27b1..7d63ef5a6 100644
--- a/module/web/ajax/urls.py
+++ b/module/web/ajax/urls.py
@@ -18,6 +18,7 @@ urlpatterns = patterns('ajax',
(r'^queue$', 'views.queue'),
(r'^pause$', 'views.pause'),
(r'^unpause$', 'views.unpause'),
+ (r'^cancel$', 'views.cancel'),
(r'^packages$', 'views.packages'),
(r'^package/(\d+)$', 'views.package'),
(r'^link/(\d+)$', 'views.link'),
diff --git a/module/web/ajax/views.py b/module/web/ajax/views.py
index ea092745f..4f136cef9 100644
--- a/module/web/ajax/views.py
+++ b/module/web/ajax/views.py
@@ -30,7 +30,7 @@ class JsonResponse(HttpResponse):
object, indent=2, cls=json.DjangoJSONEncoder,
ensure_ascii=False)
super(JsonResponse, self).__init__(
- content, content_type='application/json') #@TODO uncomment
+ content)#, content_type='application/json') #@TODO uncomment
self['Cache-Control'] = 'no-cache, must-revalidate'
@@ -117,6 +117,12 @@ def unpause(request):
return HttpResponseServerError()
+@permission('pyload.can_change_status')
+def cancel(request):
+ try:
+ return JsonResponse(settings.PYLOAD.stop_downloads())
+ except:
+ return HttpResponseServerError()
@permission('pyload.can_see_dl')
def packages(request):