diff --git a/README.md b/README.md index 0b108db..e0788c0 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,8 @@ automatically in the browser: by the build, checked when the tab comes back into view and every 30 minutes): «Neue Version verfügbar.» · «Neu laden». The code survives the reload; Python's session doesn't. -- ⋮ **Info** shows the version - the short commit and the build date, as in +- ⋮ **Info** shows the version - the short commit, the bundled glpython-editor's + tag (from `package.json`) and the build date, as in `version.json` - and **Nach Updates suchen** runs the same check: «Diese Version ist aktuell.», or the notice with «Neu laden». When a learner reports a problem, it tells whether their browser still runs an old version. diff --git a/scripts/check-ide-browser.mjs b/scripts/check-ide-browser.mjs index dcfc594..cb45e06 100644 --- a/scripts/check-ide-browser.mjs +++ b/scripts/check-ide-browser.mjs @@ -604,6 +604,8 @@ try { await page.getByRole('menuitem', { name: 'Info' }).click() const dialog = page.getByRole('dialog') assert.match(await dialog.innerText(), new RegExp(`Version\\s+${version.slice(0, 7)}`)) + const editorSpec = JSON.parse(readFileSync('package.json', 'utf8')).dependencies['glpython-editor'].split('#')[1] + assert.match(await dialog.innerText(), new RegExp(`Editor\\s+${/^[0-9a-f]{40}$/.test(editorSpec) ? editorSpec.slice(0, 7) : editorSpec.replace(/\./g, '\\.')}`), 'the editor\'s version') await dialog.getByRole('button', { name: 'Nach Updates suchen' }).click() await page.waitForFunction(() => document.querySelector('.ide-info-check [role=status]')?.textContent === 'Diese Version ist aktuell.', null, { timeout: 10000 }) // A newer deploy: the same check offers the reload. diff --git a/src/App.tsx b/src/App.tsx index 802b1bd..188b0c0 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -41,6 +41,9 @@ function timeAgo(time: number, locale: string, justNow: string): string { // deployed now (version.json, see vite.config.ts): a tab that stayed open - // on an iPad often for days - offers to load the new one; ⋮ «Info» shows it. declare const __GLPYTHON_IDE_VERSION__: string +// The glpython-editor version it bundles (its tag), for ⋮ «Info» too: most +// of what learners see (editor, Tests, visualizer, hints) comes from there. +declare const __GLPYTHON_EDITOR_VERSION__: string declare const __GLPYTHON_IDE_BUILT__: string const VERSION_CHECK_MS = 30 * 60 * 1000 async function checkForNewVersion(): Promise<'current' | 'available' | 'failed'> { @@ -521,6 +524,7 @@ function App() {
{__GLPYTHON_IDE_VERSION__.slice(0, 7)}{__GLPYTHON_EDITOR_VERSION__}