Changeset 0.28.0.10 (#182)

This commit is contained in:
2026-03-13 09:29:04 +00:00
parent 33d76e59ab
commit 9b9e2eb756
9 changed files with 1412 additions and 1128 deletions

View File

@@ -119,6 +119,17 @@
if (typeof Theme !== 'undefined') Theme.init();
// Appearance (zoom + font size) must restore on every surface.
if (typeof UI !== 'undefined' && UI.restoreAppearance) UI.restoreAppearance();
// v0.28.0: Universal logout — available on every surface.
// Chat/editor/notes load app.js which overrides this with a
// richer version (showConfirm, App.chats cleanup, etc.).
// Extension surfaces get this baseline version.
function handleLogout() {
if (!confirm('Sign out?')) return;
if (typeof Events !== 'undefined') { Events.disconnect(); Events.clear(); }
if (typeof API !== 'undefined' && API.logout) API.logout();
location.reload();
}
</script>
{{if eq .Surface "chat"}}{{template "scripts-chat" .}}{{end}}
@@ -131,6 +142,39 @@
<script nonce="{{.CSPNonce}}" src="{{.BasePath}}/surfaces/{{.Surface}}/js/main.js?v={{.Version}}"></script>
{{end}}
{{/* ── v0.28.0: Universal UserMenu hydration ──────────────────
Runs after all surface-specific scripts. Creates and binds the
UserMenu component if no surface script did it already.
Guard: chat surface excluded — it uses UI.toggleUserMenu() with
richer behavior (team admin refresh). Chat migration to UserMenu
component is tracked as tech debt (Pre-1.0 sweep).
*/}}
<script nonce="{{.CSPNonce}}">
(function () {
if (typeof UserMenu === 'undefined') return;
if (UserMenu.primary) return;
if ((window.__SURFACE__ || '') === 'chat') return;
var btn = document.getElementById('userMenuBtn');
if (!btn) return;
var menu = UserMenu.create({ id: '' });
UserMenu.primary = menu;
menu.setUser(window.__USER__ || {});
var user = window.__USER__ || {};
menu.showAdmin(user.role === 'admin');
menu.bind({
onSettings: function () { window.location.href = (window.__BASE__ || '') + '/settings'; },
onAdmin: function () { window.location.href = (window.__BASE__ || '') + '/admin'; },
onDebug: function () { if (typeof openDebugModal === 'function') openDebugModal(); },
onSignout: function () { handleLogout(); },
});
})();
</script>
{{/* ── Debug Log Modal (all surfaces) ───── */}}
<div id="debugModal" class="modal-overlay">
<div class="modal modal-wide">