|
@@ -9,7 +9,6 @@ from typing import Any, Awaitable, Callable, List, Optional, Union
|
|
|
|
|
|
from fastapi import FastAPI, HTTPException, Request, Response
|
|
from fastapi import FastAPI, HTTPException, Request, Response
|
|
from fastapi.responses import FileResponse
|
|
from fastapi.responses import FileResponse
|
|
-from fastapi.staticfiles import StaticFiles
|
|
|
|
|
|
|
|
from .. import background_tasks, helpers
|
|
from .. import background_tasks, helpers
|
|
from ..client import Client
|
|
from ..client import Client
|
|
@@ -17,6 +16,7 @@ from ..logging import log
|
|
from ..native import NativeConfig
|
|
from ..native import NativeConfig
|
|
from ..observables import ObservableSet
|
|
from ..observables import ObservableSet
|
|
from ..server import Server
|
|
from ..server import Server
|
|
|
|
+from ..staticfiles import CacheControlledStaticFiles
|
|
from ..storage import Storage
|
|
from ..storage import Storage
|
|
from .app_config import AppConfig
|
|
from .app_config import AppConfig
|
|
from .range_response import get_range_response
|
|
from .range_response import get_range_response
|
|
@@ -157,7 +157,7 @@ class App(FastAPI):
|
|
if url_path == '/':
|
|
if url_path == '/':
|
|
raise ValueError('''Path cannot be "/", because it would hide NiceGUI's internal "/_nicegui" route.''')
|
|
raise ValueError('''Path cannot be "/", because it would hide NiceGUI's internal "/_nicegui" route.''')
|
|
|
|
|
|
- handler = StaticFiles(directory=local_directory, follow_symlink=follow_symlink)
|
|
|
|
|
|
+ handler = CacheControlledStaticFiles(directory=local_directory, follow_symlink=follow_symlink)
|
|
|
|
|
|
@self.get(url_path + '/{path:path}')
|
|
@self.get(url_path + '/{path:path}')
|
|
async def static_file(request: Request, path: str = '') -> Response:
|
|
async def static_file(request: Request, path: str = '') -> Response:
|