mirror of
https://codeberg.org/Freedium-cfd/web.git
synced 2026-03-11 09:04:37 +00:00
miro: make proxy image thought Caddy
This commit is contained in:
parent
3876fef698
commit
1151e9388f
5 changed files with 21 additions and 5 deletions
|
|
@ -162,6 +162,11 @@
|
|||
respond "Access denied" 403
|
||||
}
|
||||
|
||||
route @miro/* {
|
||||
uri replace @miro/ /
|
||||
reverse_proxy https://miro.medium.com
|
||||
}
|
||||
|
||||
route /* {
|
||||
reverse_proxy web:7080
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,11 @@
|
|||
|
||||
{{ template }}
|
||||
|
||||
route @miro/* {
|
||||
uri replace @miro/ /
|
||||
reverse_proxy https://miro.medium.com
|
||||
}
|
||||
|
||||
route /* {
|
||||
reverse_proxy web:7080
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,11 @@ freedium.cfd {
|
|||
|
||||
{{ template }}
|
||||
|
||||
route @miro/* {
|
||||
uri replace @miro/ /
|
||||
reverse_proxy https://miro.medium.com
|
||||
}
|
||||
|
||||
route /* {
|
||||
reverse_proxy web:7080
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,10 +39,10 @@ async def route_processing(path: str, request: Request):
|
|||
if key_data != config.ADMIN_SECRET_KEY:
|
||||
return JSONResponse({"message": f"Wrong secret key: {key_data}"}, status_code=403)
|
||||
|
||||
if path.startswith("@miro/"):
|
||||
miro_data = path.removeprefix("@miro/")
|
||||
return await miro_proxy(miro_data)
|
||||
elif path.startswith("render_iframe/"):
|
||||
# if path.startswith("@miro/"):
|
||||
# miro_data = path.removeprefix("@miro/")
|
||||
# return await miro_proxy(miro_data)
|
||||
if path.startswith("render_iframe/"):
|
||||
iframe_id = path.removeprefix("render_iframe/")
|
||||
return await iframe_proxy(iframe_id)
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,9 @@ from bs4 import BeautifulSoup, Comment
|
|||
|
||||
IFRAME_HEADERS = {"Access-Control-Allow-Origin": "*", "X-Frame-Options": "SAMEORIGIN"}
|
||||
|
||||
|
||||
@trace
|
||||
async def iframe_proxy(iframe_id):
|
||||
async def iframe_proxy(iframe_id: str):
|
||||
# How Medium embeds works: https://stackoverflow.com/questions/56594766/medium-embed-ly-notifyresize-does-not-work-on-safari
|
||||
async with aiohttp.ClientSession() as client:
|
||||
request = await client.get(
|
||||
|
|
|
|||
Loading…
Reference in a new issue