Fix linting
This commit is contained in:
@@ -484,11 +484,17 @@ def create_app(args):
|
|||||||
response = await super().get_response(path, scope)
|
response = await super().get_response(path, scope)
|
||||||
|
|
||||||
if path.endswith(".html"):
|
if path.endswith(".html"):
|
||||||
response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
|
response.headers["Cache-Control"] = (
|
||||||
|
"no-cache, no-store, must-revalidate"
|
||||||
|
)
|
||||||
response.headers["Pragma"] = "no-cache"
|
response.headers["Pragma"] = "no-cache"
|
||||||
response.headers["Expires"] = "0"
|
response.headers["Expires"] = "0"
|
||||||
elif "/assets/" in path: # Assets (JS, CSS, images, fonts) generated by Vite with hash in filename
|
elif (
|
||||||
response.headers["Cache-Control"] = "public, max-age=31536000, immutable"
|
"/assets/" in path
|
||||||
|
): # Assets (JS, CSS, images, fonts) generated by Vite with hash in filename
|
||||||
|
response.headers["Cache-Control"] = (
|
||||||
|
"public, max-age=31536000, immutable"
|
||||||
|
)
|
||||||
# Add other rules here if needed for non-HTML, non-asset files
|
# Add other rules here if needed for non-HTML, non-asset files
|
||||||
|
|
||||||
# Ensure correct Content-Type
|
# Ensure correct Content-Type
|
||||||
@@ -504,7 +510,9 @@ def create_app(args):
|
|||||||
static_dir.mkdir(exist_ok=True)
|
static_dir.mkdir(exist_ok=True)
|
||||||
app.mount(
|
app.mount(
|
||||||
"/webui",
|
"/webui",
|
||||||
SmartStaticFiles(directory=static_dir, html=True, check_dir=True), # Use SmartStaticFiles
|
SmartStaticFiles(
|
||||||
|
directory=static_dir, html=True, check_dir=True
|
||||||
|
), # Use SmartStaticFiles
|
||||||
name="webui",
|
name="webui",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user