From ef6b5e70711a83733870419c0f423965176850c6 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 2 Feb 2014 19:46:27 +0000 Subject: [PATCH] add CORS header to timeline and frame --- pandora/item/views.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pandora/item/views.py b/pandora/item/views.py index 2b90026e8..6371966a8 100644 --- a/pandora/item/views.py +++ b/pandora/item/views.py @@ -725,7 +725,9 @@ def frame(request, id, size, position=None): if not frame: frame = os.path.join(settings.STATIC_ROOT, 'jpg/list256.jpg') #raise Http404 - return HttpFileResponse(frame, content_type='image/jpeg') + response = HttpFileResponse(frame, content_type='image/jpeg') + response['Access-Control-Allow-Origin'] = '*' + return response def poster_frame(request, id, position): item = get_object_or_404(models.Item, itemId=id) @@ -829,7 +831,9 @@ def timeline(request, id, size, position=-1, format='jpg', mode=None): while modes and not os.path.exists(path): mode = modes.pop(0) path = timeline() - return HttpFileResponse(path, content_type='image/jpeg') + response = HttpFileResponse(path, content_type='image/jpeg') + response['Access-Control-Allow-Origin'] = '*' + return response def download(request, id, index=1): item = get_object_or_404(models.Item, itemId=id)