diff --git a/backend/server.ts b/backend/server.ts index 91e8f6e..16df9e4 100644 --- a/backend/server.ts +++ b/backend/server.ts @@ -17,6 +17,18 @@ const logLine = (path: string, line: string) => { } }; +// Version endpoint sourced from package.json +app.get('/version', (c) => { + try { + const pkgRaw = fs.readFileSync('./package.json', 'utf-8'); + const pkg = JSON.parse(pkgRaw); + return c.json({ version: pkg.version || '0.0.0' }); + } catch (err) { + logLine('logs/error.log', `version endpoint error: ${(err as Error)?.message || String(err)}`); + return c.json({ version: '0.0.0' }, 200); + } +}); + // Serve static files from the frontend directory app.use('/*', serveStatic({ root: './frontend' })); diff --git a/frontend/index.html b/frontend/index.html index a864910..eb46db9 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -54,7 +54,7 @@
-
+
v1.0.0-beta2
@@ -120,7 +120,7 @@ const headers = { ...(options.headers||{}), ...authHeaders() }; return fetch(url + `&_ts=${Date.now()}`, { ...options, headers }); }; - const PB_COLLECTION_URL = "https://pocketbase.ccllc.pro/api/collections/pbc_1431294567/records"; + const PB_COLLECTION_URL = "https://pocketbase.ccllc.pro/api/collections/pbc_1407612689/records"; const NOTES_COLLECTION_URL = "https://pocketbase.ccllc.pro/api/collections/notes/records"; const perPage = 50; @@ -137,12 +137,25 @@ const jobFolderBtn = document.getElementById('jobFolderBtn'); const jobNotes = document.getElementById('jobNotes'); const newNote = document.getElementById('newNote'); + const versionLabel = document.getElementById('versionLabel'); const toolbar = document.getElementById('toolbar'); const tbButtons = Array.from(toolbar.querySelectorAll('button')); const safeLower = v => (v||'').toString().trim().toLowerCase(); + // Load version from backend /version endpoint so UI matches package.json + async function loadVersion(){ + if(!versionLabel) return; + try{ + const res = await fetch('/version'); + if(!res.ok) return; + const data = await res.json().catch(()=>null); + if(data?.version) versionLabel.textContent = `v${data.version}`; + }catch(err){ /* silent */ } + } + loadVersion(); + let progTimer=null; function startProgress(){ progressBar.style.width='0%'; diff --git a/package.json b/package.json index a846067..8475b1b 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "name": "job-info-pb", + "version": "1.0.0-beta2", "type": "module", "private": true, "scripts": {