@@ -269,7 +269,9 @@ async def login_page(request: Request, error: str = None):
269269 async with aiofiles .open (login_path , 'r' , encoding = 'utf-8' ) as f :
270270 content = await f .read ()
271271
272- # No server-side manipulation needed - frontend handles error display via URL params
272+ # Inject app name throughout the login page
273+ app_name = config ['app' ]['name' ]
274+ content = content .replace ('NoteDiscovery' , app_name )
273275
274276 return content
275277
@@ -320,15 +322,6 @@ async def logout(request: Request):
320322# Application Routes (with auth via router dependencies)
321323# ============================================================================
322324
323- @pages_router .get ("/" , response_class = HTMLResponse )
324- async def root (request : Request ):
325- """Serve the main application page"""
326- index_path = static_path / "index.html"
327- async with aiofiles .open (index_path , 'r' , encoding = 'utf-8' ) as f :
328- content = await f .read ()
329- return content
330-
331-
332325@api_router .get ("" )
333326async def api_documentation ():
334327 """API Documentation - List all available endpoints"""
@@ -1252,20 +1245,22 @@ async def health_check():
12521245# Catch-all route for SPA (Single Page Application) routing
12531246# This allows URLs like /folder/note to work for direct navigation
12541247@pages_router .get ("/{full_path:path}" , response_class = HTMLResponse )
1248+ @limiter .limit ("120/minute" )
12551249async def catch_all (full_path : str , request : Request ):
12561250 """
1257- Serve index.html for all non-API routes.
1251+ Serve index.html for all non-API routes (including root /) .
12581252 This enables client-side routing (e.g., /folder/note)
12591253 """
12601254 # Skip if it's an API route or static file (shouldn't reach here, but just in case)
12611255 if full_path .startswith ('api/' ) or full_path .startswith ('static/' ):
12621256 raise HTTPException (status_code = 404 , detail = "Not found" )
12631257
1264- # Serve index.html for all other routes
1258+ # Serve index.html with app name injected
12651259 index_path = static_path / "index.html"
12661260 async with aiofiles .open (index_path , 'r' , encoding = 'utf-8' ) as f :
12671261 content = await f .read ()
1268- return content
1262+ app_name = config ['app' ]['name' ]
1263+ return content .replace ('<title>NoteDiscovery</title>' , f'<title>{ app_name } </title>' )
12691264
12701265
12711266# ============================================================================
0 commit comments