Changeset 0.22.6 (#148)
This commit is contained in:
@@ -173,10 +173,6 @@ async function startApp() {
|
||||
UI.restoreSidebar();
|
||||
await loadSettings();
|
||||
|
||||
// Initialize surface system (v0.21.3) — must happen before extensions
|
||||
// so that extensions can register surfaces during init().
|
||||
if (typeof Surfaces !== 'undefined') Surfaces.init();
|
||||
|
||||
// Load extensions BEFORE chats so block renderers (mermaid, katex, csv, diff)
|
||||
// are registered when messages are first rendered.
|
||||
try {
|
||||
@@ -211,25 +207,13 @@ async function startApp() {
|
||||
UI.renderChatList();
|
||||
UI.updateModelSelector();
|
||||
|
||||
// Check for workspaces on startup — register editor surface early (v0.21.6)
|
||||
// This ensures the Editor button + Files tab appear without needing to browse first.
|
||||
if (typeof EditorMode !== 'undefined') {
|
||||
try { await EditorMode.checkStartup(); } catch (_) {}
|
||||
}
|
||||
|
||||
// Initialize hash router (v0.21.6) — replaces sessionStorage chat restore.
|
||||
// Reads current URL hash and routes to the right surface/chat/workspace.
|
||||
if (typeof Router !== 'undefined') {
|
||||
Router.init();
|
||||
} else {
|
||||
// Fallback: restore last-active chat from sessionStorage
|
||||
try {
|
||||
const savedChat = sessionStorage.getItem('cs-active-chat');
|
||||
if (savedChat && App.chats.some(c => c.id === savedChat)) {
|
||||
selectChat(savedChat);
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
// Restore last-active chat from sessionStorage
|
||||
try {
|
||||
const savedChat = sessionStorage.getItem('cs-active-chat');
|
||||
if (savedChat && App.chats.some(c => c.id === savedChat)) {
|
||||
selectChat(savedChat);
|
||||
}
|
||||
} catch (_) {}
|
||||
|
||||
UI.updateUser();
|
||||
UI.showAdminButton(API.isAdmin);
|
||||
@@ -352,16 +336,17 @@ function updateTabArrows(tabs) {
|
||||
// ── Auth Flow ────────────────────────────────
|
||||
|
||||
function showSplash(health) {
|
||||
document.getElementById('splashGate').style.display = 'flex';
|
||||
document.getElementById('appContainer').style.display = 'none';
|
||||
if (health && health.registration_enabled === false) {
|
||||
document.getElementById('authTabRegister').style.display = 'none';
|
||||
}
|
||||
// v0.22.6: Server-rendered architecture uses /login page.
|
||||
// Redirect instead of showing the SPA splash gate.
|
||||
const base = window.__BASE__ || '';
|
||||
window.location.href = base + '/login';
|
||||
}
|
||||
|
||||
function hideSplash() {
|
||||
document.getElementById('splashGate').style.display = 'none';
|
||||
document.getElementById('appContainer').style.display = '';
|
||||
const splash = document.getElementById('splashGate');
|
||||
const app = document.getElementById('appContainer');
|
||||
if (splash) splash.style.display = 'none';
|
||||
if (app) app.style.display = '';
|
||||
}
|
||||
|
||||
async function handleLogin() {
|
||||
|
||||
Reference in New Issue
Block a user