feat: home page hash-based tab routing for shareable links

This commit is contained in:
2026-07-12 01:53:59 +08:00
parent 5bb2df7b52
commit 989a3ae4cf
2 changed files with 21 additions and 21 deletions

View File

@@ -55,7 +55,8 @@ const App = {
}
if (page === 'install') { this.showPublic('install'); return; }
if (page === 'home' || page === 'login' || page === 'register') { this.showPublic(page); return; }
if (page === 'home') { this.showPublic('home', param); return; }
if (page === 'login' || page === 'register') { this.showPublic(page); return; }
if (!Auth.logged()) { location.hash = '#/login'; return; }
this.showLayout();
@@ -83,13 +84,13 @@ const App = {
}
},
showPublic(page) {
showPublic(page, param) {
document.getElementById('top-auth').classList.remove('hidden');
document.getElementById('main-layout').classList.add('hidden');
const pub = document.getElementById('public-page');
pub.classList.remove('hidden');
const comp = page === 'login' ? LoginPage : page === 'register' ? RegisterPage : page === 'install' ? InstallPage : HomePage;
Promise.resolve(comp.render()).then(html => { pub.innerHTML = html; if (comp.mount) comp.mount(); });
Promise.resolve(comp.render(param)).then(html => { pub.innerHTML = html; if (comp.mount) comp.mount(param); });
},
showLayout() {