Merge PR #1505: serve static assets correctly under /session/* routes
This commit is contained in:
commit
a60273b852
2 files changed
+6
-1
No files matched your search
+1
-1
@@ -217,7 +217,7 @@ def check_auth(handler, parsed) -> bool:
|
||||
if not is_auth_enabled():
|
||||
return True
|
||||
# Public paths don't require auth
|
||||
if parsed.path in PUBLIC_PATHS or parsed.path.startswith('/static/'):
|
||||
if parsed.path in PUBLIC_PATHS or parsed.path.startswith('/static/') or parsed.path.startswith('/session/static/'):
|
||||
return True
|
||||
# Check session cookie
|
||||
cookie_val = parse_cookie(handler)
|
||||
|
||||
@@ -1111,6 +1111,11 @@ def _handle_insights(handler, parsed) -> bool:
|
||||
def handle_get(handler, parsed) -> bool:
|
||||
"""Handle all GET routes. Returns True if handled, False for 404."""
|
||||
|
||||
if parsed.path.startswith("/session/static/"):
|
||||
from urllib.parse import urlparse as _up
|
||||
stripped = parsed._replace(path=parsed.path[len("/session"):])
|
||||
return _serve_static(handler, stripped)
|
||||
|
||||
if parsed.path in ("/", "/index.html") or parsed.path.startswith("/session/"):
|
||||
from urllib.parse import quote
|
||||
from api.updates import WEBUI_VERSION
|
||||
|
||||
Reference in new issue
Block a user