From dfc6da8324ba7e57b561001d89de0642f308c365 Mon Sep 17 00:00:00 2001 From: Golwhit Date: Mon, 29 Dec 2025 21:55:40 -0600 Subject: [PATCH] Clean up: remove dead code and fix broken file references --- server.ts | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/server.ts b/server.ts index b9505a5..3838dde 100644 --- a/server.ts +++ b/server.ts @@ -3,26 +3,6 @@ import { serveStatic } from 'hono/bun'; import { cors } from 'hono/cors'; import PocketBase from 'pocketbase'; import { ConfidentialClientApplication } from '@azure/msal-node'; -import { readFileSync } from 'fs'; -import { join } from 'path'; - -// Load env from Estimator/.env -const envPath = join(import.meta.dir, 'Estimator', '.env'); -try { - const envContent = readFileSync(envPath, 'utf-8'); - envContent.split('\n').forEach(line => { - const trimmed = line.trim(); - if (trimmed && !trimmed.startsWith('#')) { - const [key, ...valueParts] = trimmed.split('='); - if (key && valueParts.length > 0) { - process.env[key.trim()] = valueParts.join('=').trim(); - } - } - }); - console.log('āœ“ Loaded env from Estimator/.env'); -} catch (e) { - console.warn('⚠ Could not load Estimator/.env:', (e as Error).message); -} const app = new Hono(); @@ -101,7 +81,7 @@ app.post('/api/submit', async (c) => { // Serve static files app.get('/', async (c) => { - const html = await Bun.file('index.html').text(); + const html = await Bun.file('estimatortable.html').text(); return c.html(html); }); @@ -110,11 +90,6 @@ app.get('/estimatortable.html', async (c) => { return c.html(html); }); -app.get('/admin.html', async (c) => { - const html = await Bun.file('admin.html').text(); - return c.html(html); -}); - app.get('/appsettings.html', async (c) => { const html = await Bun.file('appsettings.html').text(); return c.html(html); @@ -387,12 +362,6 @@ app.get('/api/records', async (c) => { } }); -// Serve admin.html -app.get('/admin', async (c) => { - const html = await Bun.file(new URL('./admin.html', import.meta.url)).text(); - return c.html(html); -}); - // Export collection schema and headers (requires superuser token) app.get('/api/export/schema', async (c) => { try { @@ -498,9 +467,8 @@ app.get('/api/export/schema', async (c) => { const PORT = Number(process.env.PORT || 6500); console.log(`\nšŸš€ Server running on port ${PORT}`); -console.log(`\nšŸ“Š Estimator Table: \x1b[36mhttp://localhost:${PORT}/estimatortable.html\x1b[0m`); -console.log(`šŸ“ Idea & Feedback Form: \x1b[36mhttp://localhost:${PORT}/index.html\x1b[0m`); -console.log(`šŸ‘¤ Admin Panel: \x1b[36mhttp://localhost:${PORT}/admin.html\x1b[0m\n`); +console.log(`šŸ“Š Estimator Table: \x1b[36mhttp://localhost:${PORT}/\x1b[0m`); +console.log(`āš™ļø Settings: \x1b[36mhttp://localhost:${PORT}/appsettings.html\x1b[0m\n`); export default { port: PORT,