Mode2Test/AuthAndToken: assume tokens always fresh with background refresh; fix jobs API to use correct collection; align Home UI to Mode1 (exact fields, styling, strict Active dot); add full-field IndexedDB cache w/ pagination; remove progress bar; dev TLS bypass; rebuild bundles

This commit is contained in:
2026-01-17 20:20:24 +00:00
parent eed8552282
commit d77fa4b817
21 changed files with 5964 additions and 205 deletions
+28 -43
View File
@@ -4,50 +4,35 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mode2Test</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/pocketbase@0.26.5/dist/pocketbase.umd.js"></script>
</head>
<body class="font-sans bg-gray-50 min-h-screen">
<header class="bg-white shadow">
<div class="max-w-7xl mx-auto px-4 py-4 flex justify-between items-center">
<div>
<h1 class="text-2xl font-bold text-gray-800">Mode2Test</h1>
<p class="text-sm text-gray-600">Authenticated Application</p>
</div>
<div class="flex items-center gap-4">
<div id="userDisplay" class="text-right">
<p id="userName" class="text-sm font-medium text-gray-800"></p>
<p id="userEmail" class="text-xs text-gray-600"></p>
</div>
<button onclick="handleLogout()" class="px-4 py-2 bg-red-600 text-white rounded-md hover:bg-red-700">
Logout
</button>
</div>
</div>
</header>
<main class="max-w-7xl mx-auto px-4 py-8">
<div class="bg-white p-8 rounded-lg shadow">
<h2 class="text-xl font-bold mb-4 text-gray-800">Welcome to Mode2Test</h2>
<p class="text-gray-600 mb-6">Authenticated and ready to work.</p>
<div class="bg-gray-50 p-4 rounded border border-gray-200">
<h3 class="font-medium mb-2 text-gray-800">Token Status</h3>
<div id="tokenStatus" class="text-sm text-gray-600 space-y-2">
<p>Loading...</p>
</div>
</div>
</div>
</main>
<script>
const pb = new PocketBase('https://pocketbase.ccllc.pro');
async function checkAuth() {
if (!pb.authStore.isValid) {
// Try to refresh
try {
await pb.collection('users').authRefresh();
// Redirect to appropriate page based on auth status
async function checkAuthAndRedirect() {
try {
const response = await fetch('/api/auth/status');
const data = await response.json();
if (data.authenticated) {
// Redirect to home
window.location.href = '/home.html';
} else {
// Redirect to signin
window.location.href = '/signin.html';
}
} catch (err) {
// On error, go to signin
window.location.href = '/signin.html';
}
}
checkAuthAndRedirect();
</script>
</head>
<body>
<div style="text-align: center; padding: 50px;">
<p>Redirecting...</p>
</div>
</body>
</html>
} catch {
window.location.href = '/signin.html';
return;