update pb collection and versioning setting is now in don in package.json
This commit is contained in:
@@ -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' }));
|
||||
|
||||
|
||||
+15
-2
@@ -54,7 +54,7 @@
|
||||
</div>
|
||||
|
||||
<div id="results" aria-live="polite" class="flex flex-col gap-3 flex-1 overflow-auto p-0"></div>
|
||||
<div class="text-right text-xs text-gray-500 mt-5 pt-3 border-t border-gray-200"><v1 class="0 0-beta3"></v1></div>
|
||||
<div class="text-right text-xs text-gray-500 mt-5 pt-3 border-t border-gray-200"><span id="versionLabel">v1.0.0-beta2</span></div>
|
||||
</div>
|
||||
|
||||
<!-- Detail Modal -->
|
||||
@@ -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%';
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"name": "job-info-pb",
|
||||
"version": "1.0.0-beta2",
|
||||
"type": "module",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user