Fix recovery layout and interactive assets
This commit is contained in:
@@ -6,6 +6,7 @@ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||
from importlib import resources
|
||||
from pathlib import Path
|
||||
from typing import Iterable, Optional
|
||||
from urllib.parse import urlsplit
|
||||
|
||||
from serato_doctor.crate_parser import load_library_crates
|
||||
from serato_doctor.database_parser import parse_database
|
||||
@@ -31,6 +32,7 @@ STATIC_FILES = {
|
||||
"/": ("index.html", "text/html; charset=utf-8"),
|
||||
"/app.css": ("app.css", "text/css; charset=utf-8"),
|
||||
"/recovery.css": ("recovery.css", "text/css; charset=utf-8"),
|
||||
"/layout-fixes.css": ("layout-fixes.css", "text/css; charset=utf-8"),
|
||||
"/app.js": ("app.js", "text/javascript; charset=utf-8"),
|
||||
}
|
||||
|
||||
@@ -296,7 +298,7 @@ def backup_history(serato: Path) -> dict:
|
||||
|
||||
class SeratoDoctorHandler(BaseHTTPRequestHandler):
|
||||
def do_GET(self) -> None:
|
||||
asset = STATIC_FILES.get(self.path)
|
||||
asset = STATIC_FILES.get(urlsplit(self.path).path)
|
||||
if asset is None:
|
||||
self._json_response(404, {"error": "Not found"})
|
||||
return
|
||||
@@ -308,6 +310,7 @@ class SeratoDoctorHandler(BaseHTTPRequestHandler):
|
||||
)
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", content_type)
|
||||
self.send_header("Cache-Control", "no-store")
|
||||
self.send_header("Content-Length", str(len(content)))
|
||||
self.end_headers()
|
||||
self.wfile.write(content)
|
||||
|
||||
Reference in New Issue
Block a user