fix: support md5 url rewriting for proxied instances
depends on public_facing_url instead of perceived request url (which can, and will be different for proxied instances)
This commit is contained in:
5
views.py
5
views.py
@@ -99,10 +99,11 @@ def videoplaybackProxy():
|
|||||||
return Response(json.dumps({"error": "Videoplayback request not cached or expired."}), mimetype="application/json", status=404)
|
return Response(json.dumps({"error": "Videoplayback request not cached or expired."}), mimetype="application/json", status=404)
|
||||||
return redirect(ythdd_globals.general_cache["hashed_videoplayback"][params["md5"]]["original_url"])
|
return redirect(ythdd_globals.general_cache["hashed_videoplayback"][params["md5"]]["original_url"])
|
||||||
else:
|
else:
|
||||||
md5sum = hashlib.md5(request.url.encode("utf-8")).hexdigest()
|
public_url = request.url
|
||||||
|
public_url = ythdd_globals.config["general"]["public_facing_url"] + public_url[public_url.rfind("videoplayback"):]
|
||||||
|
md5sum = hashlib.md5(public_url.encode("utf-8")).hexdigest()
|
||||||
ythdd_globals.general_cache["hashed_videoplayback"][md5sum] = {"original_url": request.url}
|
ythdd_globals.general_cache["hashed_videoplayback"][md5sum] = {"original_url": request.url}
|
||||||
|
|
||||||
|
|
||||||
# reconstruct the url
|
# reconstruct the url
|
||||||
# first attempt: from host param
|
# first attempt: from host param
|
||||||
host = params.get('host')
|
host = params.get('host')
|
||||||
|
|||||||
Reference in New Issue
Block a user