fix: Auth redirects and navigation for landing page routing

- login.html: Post-login redirect / -> /index.html; already-logged-in redirect / -> /index.html
- articles.html, topics.html: Auth failure redirect -> /login.html
- uni-nav.js: Dashboard link / -> /index.html; navigate function fix for prefix handling
- sw.js: Remove / pre-cache; HTML documents use Network First strategy for fresh content

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
Yuzhiran Dev
2026-06-16 08:28:06 +08:00
parent 24e46eced5
commit c069a140bb
5 changed files with 52 additions and 38 deletions
+3 -3
View File
@@ -121,14 +121,14 @@
function getCurrentPage() {
var path = window.location.pathname;
if (path === '/' || path === '/index.html') return 'dashboard';
if (path === '/index.html') return 'dashboard';
var m = path.match(/\/(\w+)\.html/);
return m ? m[1] : 'dashboard';
}
function navItems(isAdmin) {
var items = [
{ key: 'dashboard', label: '仪表盘', page: '/' },
{ key: 'dashboard', label: '仪表盘', page: 'index.html' },
{ key: 'topics', label: '选题', page: 'topics.html' },
{ key: 'metrics', label: '数据', page: 'metrics.html' },
{ key: 'calendar', label: '日历', page: 'calendar.html' },
@@ -194,7 +194,7 @@
navigate: function (page) {
this.dropdownOpen = false; this.profileOpen = false;
if (this.onNavigate) { this.onNavigate(page); return; }
window.location.href = page === '/' ? '/' : '/' + page;
window.location.href = page.startsWith('/') ? page : '/' + page;
},
logout: function () {
this.profileOpen = false;