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
This commit is contained in:
Dionisio
2026-02-13 22:44:20 +01:00
parent 6f3baabbb2
commit 4560a8042c
7 changed files with 34 additions and 16 deletions
+6 -6
View File
@@ -207,7 +207,7 @@ function setupUserMenu() {
if (adminBtn) {
adminBtn.addEventListener('click', () => {
wrapper.classList.remove('open');
window.location.href = '/admin.html';
window.location.href = '/admin';
});
}
@@ -215,7 +215,7 @@ function setupUserMenu() {
if (profileBtn) {
profileBtn.addEventListener('click', () => {
wrapper.classList.remove('open');
window.location.href = '/profile.html';
window.location.href = '/profile';
});
}
@@ -1627,7 +1627,7 @@ async function checkAuthentication() {
if (!exchangeResponse.ok) {
const errText = await exchangeResponse.text();
console.error('OIDC token exchange failed:', exchangeResponse.status, errText);
window.location.href = '/login.html?source=oidc_error';
window.location.href = '/login?source=oidc_error';
return;
}
@@ -1677,7 +1677,7 @@ async function checkAuthentication() {
}
} catch (err) {
console.error('OIDC exchange error:', err);
window.location.href = '/login.html?source=oidc_error';
window.location.href = '/login?source=oidc_error';
return;
}
}
@@ -1688,7 +1688,7 @@ async function checkAuthentication() {
if (!token) {
console.log('No token found, redirecting to login');
// Avoid potential loop by adding a parameter
const redirectUrl = '/login.html?source=app';
const redirectUrl = '/login?source=app';
window.location.href = redirectUrl;
return;
}
@@ -1931,7 +1931,7 @@ function logout() {
sessionStorage.removeItem('redirect_count');
// Redirect to login page with correct path
window.location.href = '/login.html';
window.location.href = '/login';
}
/**
+3 -3
View File
@@ -1189,14 +1189,14 @@ function redirectToMainApp() {
// Ultimate fallback - clear everything and go to a special error page
localStorage.clear();
sessionStorage.clear();
window.location.href = '/login.html?critical=redirect_error';
window.location.href = '/login?critical=redirect_error';
}
}, 50);
} catch (error) {
console.error('Fatal error in redirectToMainApp:', error);
// Emergency fallback
try {
window.location.href = '/login.html?error=redirect_fatal';
window.location.href = '/login?error=redirect_fatal';
} catch (e) {
// Nothing more we can do
alert('Critical redirect error. Please reload the page and try again.');
@@ -1215,5 +1215,5 @@ function logout() {
localStorage.removeItem(REFRESH_TOKEN_KEY);
localStorage.removeItem(TOKEN_EXPIRY_KEY);
localStorage.removeItem(USER_DATA_KEY);
window.location.href = '/login.html';
window.location.href = '/login';
}
+1 -1
View File
@@ -15,7 +15,7 @@ function checkAuthentication() {
if (!token || !tokenExpiry || new Date(tokenExpiry) < new Date()) {
// No token or expired token
window.location.href = '/login.html';
window.location.href = '/login';
return;
}