From 17904cff3afe16aedf4bb57a21a6bf9afa03848f Mon Sep 17 00:00:00 2001 From: aewing Date: Sat, 28 Mar 2026 19:22:11 +0000 Subject: [PATCH] Promote legacy notes UI to native notes.html route --- notes.html | 3407 ++++++++++++++++++++++++++++++++++++++++++++++++++++ server.ts | 71 +- 2 files changed, 3409 insertions(+), 69 deletions(-) create mode 100644 notes.html diff --git a/notes.html b/notes.html new file mode 100644 index 0000000..da12dc8 --- /dev/null +++ b/notes.html @@ -0,0 +1,3407 @@ + + + + + + Prism Notes Legacy Workspace + + + + + + + +
+ Testing Harness + Tasks + Legacy Notes Workspace +
+ + + + + + + +
+ v1.0.0-alpha3 +
+ + +
+
+

PB + Microsoft Graph

+

Sign in with Microsoft

+
+ +
+

Sign in with your Microsoft account

+ +
+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/server.ts b/server.ts index a1e4c82..96220b9 100644 --- a/server.ts +++ b/server.ts @@ -24,10 +24,6 @@ const ONENOTE_TARGET = { notebookName: 'Billing Notes', }; -const WORKSPACE_ROOT = new URL('./', import.meta.url).pathname; -const LEGACY_NOTES_COMMIT = '4c6058c'; -let legacyNotesHtmlCache: string | null = null; - // --------------------------------------------------------------------------- // App // --------------------------------------------------------------------------- @@ -62,42 +58,6 @@ function getBearerToken(header: string | undefined | null): string | null { return m?.[1] || null; } -function decorateLegacyNotesHtml(html: string): string { - const nav = ` -
- Testing Harness - Tasks - Legacy Notes UI ยท restored from ${LEGACY_NOTES_COMMIT} -
`; - - return html - .replace('Prism Notes', 'Prism Notes Legacy') - .replace(/]*)>/i, `${nav}`); -} - -async function loadLegacyNotesHtml(): Promise { - if (legacyNotesHtmlCache) return legacyNotesHtmlCache; - - const proc = Bun.spawn(['git', '--no-pager', 'show', `${LEGACY_NOTES_COMMIT}:index.html`], { - cwd: WORKSPACE_ROOT, - stdout: 'pipe', - stderr: 'pipe', - }); - - const [stdout, stderr, exitCode] = await Promise.all([ - new Response(proc.stdout).text(), - new Response(proc.stderr).text(), - proc.exited, - ]); - - if (exitCode !== 0) { - throw new Error(stderr || `git show failed for ${LEGACY_NOTES_COMMIT}:index.html`); - } - - legacyNotesHtmlCache = decorateLegacyNotesHtml(stdout); - return legacyNotesHtmlCache; -} - function escapeHtml(s: string): string { return s .replace(/&/g, '&') @@ -1126,35 +1086,8 @@ app.get('/', async (c) => { }); app.get('/notes', async (c) => { - try { - const html = await loadLegacyNotesHtml(); - return c.html(html); - } catch (error) { - console.error('Failed to load legacy notes UI', error); - return c.html(` - - - - - Prism Notes Legacy - - - -
-
-

Prism Notes

-

Legacy notes UI unavailable

-

The current server could not load the historical notes interface from git commit ${LEGACY_NOTES_COMMIT}.

-
${escapeHtml(String(error instanceof Error ? error.message : error || 'Unknown error'))}
- -
-
- -`, 500); - } + const html = await Bun.file(new URL('./notes.html', import.meta.url)).text(); + return c.html(html); }); app.get('/tasks', async (c) => {