You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
502 B
15 lines
502 B
# Morsel Media Proxy
|
|
# Prevents users from doxxing themselves. Ain't that nice?
|
|
from main import app
|
|
from flask import redirect
|
|
from flask import Response
|
|
import requests
|
|
|
|
@app.route("/proxy/<path:url>")
|
|
def mediaproxy(url):
|
|
if url.startswith("static/") or url.startswith("avatar/"):
|
|
return redirect("/"+url, 303)
|
|
else:
|
|
proxied_media = requests.get(url, headers={"X-Proxied-By":"MorselMediaProxy"})
|
|
return Response(proxied_media.content, mimetype=proxied_media.headers["Content-Type"])
|