Fix token handling, remove orchestrator API call, improve mobile responsive footer layout

This commit is contained in:
2026-01-18 03:09:37 +00:00
parent d77fa4b817
commit 09fc949a06
50 changed files with 9991 additions and 4503 deletions
+39
View File
@@ -0,0 +1,39 @@
// PocketBase auth bootstrap shared by pages
(function (global) {
const pb = new PocketBase('https://pocketbase.ccllc.pro');
function authHeaders() {
if (pb.authStore.isValid && pb.authStore.token) {
return { Authorization: `Bearer ${pb.authStore.token}` };
}
return {};
}
function getDisplayName() {
const model = pb.authStore.model || {};
return (
model.display_name ||
model.name ||
model.email ||
model.username ||
'Unknown'
);
}
function getEmail() {
const model = pb.authStore.model || {};
// Prefer email, but fall back to username if email missing
return model.email || model.username || null;
}
async function ensureAuth() {
if (pb.authStore.isValid) return true;
const path = new URL(window.location.href).pathname;
if (!path.endsWith('signin.html')) {
window.location.href = 'signin.html';
}
return false;
}
global.Auth = { pb, authHeaders, ensureAuth, getDisplayName, getEmail };
})(window);