From 4560a8042c10e2a4a3ec94d134a2112913208503 Mon Sep 17 00:00:00 2001 From: Dionisio Date: Fri, 13 Feb 2026 22:44:20 +0100 Subject: [PATCH] fix(routes): serve pages with clean URLs (no .html extension) Add server-side routes for /profile, /admin, and /shared that serve their respective HTML pages directly (same pattern already used for /login). Updated all frontend references to use clean URLs instead of .html extensions. Fixes #99 --- src/interfaces/web/mod.rs | 20 +++++++++++++++++++- static/admin.html | 2 +- static/js/app.js | 12 ++++++------ static/js/auth.js | 6 +++--- static/js/shared.js | 2 +- static/profile.html | 2 +- static/shared.html | 6 +++--- 7 files changed, 34 insertions(+), 16 deletions(-) diff --git a/src/interfaces/web/mod.rs b/src/interfaces/web/mod.rs index 06ca0fa4..eed19218 100644 --- a/src/interfaces/web/mod.rs +++ b/src/interfaces/web/mod.rs @@ -14,8 +14,11 @@ pub fn create_web_routes() -> Router { let static_path = config.static_path.clone(); Router::new() - // Add specific route for login + // Add specific routes for clean URLs (without .html) .route("/login", get(serve_login_page)) + .route("/profile", get(serve_profile_page)) + .route("/admin", get(serve_admin_page)) + .route("/shared", get(serve_shared_page)) // Serve static files .fallback_service( ServeDir::new(static_path) @@ -25,4 +28,19 @@ pub fn create_web_routes() -> Router { /// Serve the login page async fn serve_login_page() -> Html<&'static str> { Html(include_str!("../../../static/login.html")) +} + +/// Serve the profile page +async fn serve_profile_page() -> Html<&'static str> { + Html(include_str!("../../../static/profile.html")) +} + +/// Serve the admin page +async fn serve_admin_page() -> Html<&'static str> { + Html(include_str!("../../../static/admin.html")) +} + +/// Serve the shared page +async fn serve_shared_page() -> Html<&'static str> { + Html(include_str!("../../../static/shared.html")) } \ No newline at end of file diff --git a/static/admin.html b/static/admin.html index 3dbb17b7..7732e747 100644 --- a/static/admin.html +++ b/static/admin.html @@ -219,7 +219,7 @@ details[open] summary{margin-bottom:14px;color:#ff5e3a}

Access Denied

Administrator privileges required to access this panel.

- Sign in + Sign in