forked from 0x2620/pandora
send no-store for temp poster
This commit is contained in:
parent
e13ef4aa1e
commit
046c49cd3b
1 changed files with 11 additions and 4 deletions
|
@ -858,6 +858,15 @@ def siteposter(request, id, size=None):
|
||||||
poster = path
|
poster = path
|
||||||
return HttpFileResponse(poster, content_type='image/jpeg')
|
return HttpFileResponse(poster, content_type='image/jpeg')
|
||||||
|
|
||||||
|
|
||||||
|
def temp_poster():
|
||||||
|
poster_path = os.path.join(settings.STATIC_ROOT, 'jpg/poster.jpg')
|
||||||
|
with open(poster_path, 'rb') as fd:
|
||||||
|
response = HttpResponse(fd.read(), content_type='image/jpeg')
|
||||||
|
response['Cache-Control'] = 'no-store'
|
||||||
|
response['Expires'] = datetime.strftime(datetime.utcnow() + timedelta(seconds=10), "%a, %d-%b-%Y %H:%M:%S GMT")
|
||||||
|
return response
|
||||||
|
|
||||||
def poster(request, id, size=None):
|
def poster(request, id, size=None):
|
||||||
item = get_object_or_404(models.Item, public_id=id)
|
item = get_object_or_404(models.Item, public_id=id)
|
||||||
if not item.access(request.user):
|
if not item.access(request.user):
|
||||||
|
@ -878,8 +887,7 @@ def poster(request, id, size=None):
|
||||||
if item.poster and os.path.exists(item.poster.path):
|
if item.poster and os.path.exists(item.poster.path):
|
||||||
return image_to_response(item.poster, size)
|
return image_to_response(item.poster, size)
|
||||||
else:
|
else:
|
||||||
poster_url = os.path.join(settings.STATIC_URL, 'jpg/poster.jpg')
|
return temp_poster()
|
||||||
return redirect(poster_url)
|
|
||||||
|
|
||||||
def icon(request, id, size=None):
|
def icon(request, id, size=None):
|
||||||
item = get_object_or_404(models.Item, public_id=id)
|
item = get_object_or_404(models.Item, public_id=id)
|
||||||
|
@ -888,8 +896,7 @@ def icon(request, id, size=None):
|
||||||
if item.icon and os.path.exists(item.icon.path):
|
if item.icon and os.path.exists(item.icon.path):
|
||||||
return image_to_response(item.icon, size)
|
return image_to_response(item.icon, size)
|
||||||
else:
|
else:
|
||||||
poster_url = os.path.join(settings.STATIC_URL, 'jpg/poster.jpg')
|
return temp_poster()
|
||||||
return redirect(poster_url)
|
|
||||||
|
|
||||||
def timeline(request, id, size, position=-1, format='jpg', mode=None):
|
def timeline(request, id, size, position=-1, format='jpg', mode=None):
|
||||||
item = get_object_or_404(models.Item, public_id=id)
|
item = get_object_or_404(models.Item, public_id=id)
|
||||||
|
|
Loading…
Reference in a new issue