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
+17 -3
View File
@@ -1,14 +1,25 @@
import { Hono } from 'hono';
import { serveStatic } from 'hono/bun';
import { join } from 'path';
import { initializeTokenService, startBackgroundRefresh } from './token-service';
import { tokenService } from './token-service';
import { createAuthRoutes } from './auth-routes';
import { createJobsRoutes } from './jobs-routes';
// temporary: dev-only SSL bypass for upstream PocketBase cert issues
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
// PERMANENT: Load environment variables
// Check if POCKETBASE_URL is set, use default if not
if (!process.env.POCKETBASE_URL) {
process.env.POCKETBASE_URL = 'https://pocketbase.ccllc.pro';
console.log('[Mode2Test] Using default POCKETBASE_URL:', process.env.POCKETBASE_URL);
}
// PERMANENT: Initialize token service and start background refresh
// Loads existing tokens from file if available
// Starts 5-minute background refresh cycle
initializeTokenService();
startBackgroundRefresh();
tokenService.initialize();
tokenService.startBackgroundRefresh();
// Create Hono app
const app = new Hono();
@@ -16,6 +27,9 @@ const app = new Hono();
// Mount auth routes
app.route('/api/auth', createAuthRoutes());
// Mount jobs routes
app.route('/api/jobs', createJobsRoutes());
// Health check endpoint
app.get('/health', (c) => {
return c.text('OK');