mirror of https://gitlab.com/litecord/litecord.git
embed.sanitizer: fix double-slash on path
- run: add app.session
This commit is contained in:
parent
75a7c4d83a
commit
e2720a4084
|
|
@ -65,7 +65,7 @@ def proxify(url) -> str:
|
||||||
return (
|
return (
|
||||||
# base mediaproxy url
|
# base mediaproxy url
|
||||||
f'{proto}://{md_base_url}/img/'
|
f'{proto}://{md_base_url}/img/'
|
||||||
f'{parsed.scheme}/{parsed.netloc}/{parsed.path}'
|
f'{parsed.scheme}/{parsed.netloc}{parsed.path}'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -73,7 +73,7 @@ async def fetch_metadata(url) -> dict:
|
||||||
"""Fetch metadata for a url."""
|
"""Fetch metadata for a url."""
|
||||||
parsed = url.parsed
|
parsed = url.parsed
|
||||||
|
|
||||||
md_path = f'{parsed.scheme}/{parsed.netloc}/{parsed.path}'
|
md_path = f'{parsed.scheme}/{parsed.netloc}{parsed.path}'
|
||||||
|
|
||||||
md_base_url = app.config['MEDIA_PROXY']
|
md_base_url = app.config['MEDIA_PROXY']
|
||||||
proto = 'https' if app.config['IS_SSL'] else 'http'
|
proto = 'https' if app.config['IS_SSL'] else 'http'
|
||||||
|
|
|
||||||
3
run.py
3
run.py
|
|
@ -8,6 +8,7 @@ import websockets
|
||||||
from quart import Quart, g, jsonify, request
|
from quart import Quart, g, jsonify, request
|
||||||
from logbook import StreamHandler, Logger
|
from logbook import StreamHandler, Logger
|
||||||
from logbook.compat import redirect_logging
|
from logbook.compat import redirect_logging
|
||||||
|
from aiohttp import ClientSession
|
||||||
|
|
||||||
# import the config set by instance owner
|
# import the config set by instance owner
|
||||||
import config
|
import config
|
||||||
|
|
@ -281,6 +282,8 @@ async def app_before_serving():
|
||||||
g.app = app
|
g.app = app
|
||||||
g.loop = asyncio.get_event_loop()
|
g.loop = asyncio.get_event_loop()
|
||||||
|
|
||||||
|
app.session = ClientSession()
|
||||||
|
|
||||||
init_app_managers(app)
|
init_app_managers(app)
|
||||||
|
|
||||||
# start the websocket, etc
|
# start the websocket, etc
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue