kempo 4.9.3 → 4.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -58,7 +58,7 @@ import e from"/kempo-ui/components/ShadowComponent.js";import{html as t,nothing
|
|
|
58
58
|
`}renderLast(e){const a=e.lastUpdate;return!a||a.ok?s:t`
|
|
59
59
|
<div class="b r p mb" role="alert">
|
|
60
60
|
<h2 class="h5 mb tc-danger">The last update did not work</h2>
|
|
61
|
-
<p>The update
|
|
61
|
+
<p>The update${a.packages?.length?` of ${a.packages.join(", ")}`:""} on ${d(a.at)} did not stay running (${a.reason}), so the site went back to how it was.${a.breaking?" Your data was restored from the backup taken before it.":""}</p>
|
|
62
62
|
</div>
|
|
63
63
|
`}renderGoBack(e){const a=e.goBack;return a?e.switching?t`<p class="tc-muted mb">The last switch is still being checked, which takes about a minute. Going back is available after that.</p>`:a.available?t`<p class="mb"><button @click=${()=>this.openConfirm("back")}>Go back</button> <span class="tc-muted">Puts the site back on what it ran before the last update${a.packages.length?` (${a.packages.join(", ")})`:""}.${a.restoresData?" That update changed your data, so this also restores the database from before it.":""}</span></p>`:s:s}renderDatabase(e){const{applied:a=[],failed:n=[]}=e.database??{},{upgraded:i=[],failed:r=[]}=e.extensionsRun??{};return t`
|
|
64
64
|
${n.length?t`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"src\\admin\\components\\Updates.js","names":["ShadowComponent","html","nothing","Toast","getUpdateStatus","checkForUpdate","prepareUpdate","applyUpdate","rollbackUpdate","discardUpdate","AFTER_RELOAD_KEY","when","value","Date","toLocaleString","sleep","ms","Promise","resolve","setTimeout","count","n","one","many","older","a","b","split","map","Number","reduce","result","part","index","Updates","static","status","state","error","checking","phase","stalled","action","chosen","constructor","super","this","connectedCallback","load","async","msg","selectNew","reportOutcome","switching","recheck","updatable","updateAvailable","key","name","from","runningVersion","to","latestVersion","major","extensionUpdates","updates","update","installedVersion","needs","kempoRequired","seen","Set","has","add","blocked","item","Boolean","chosenItems","filter","toggle","next","delete","expected","JSON","parse","sessionStorage","getItem","removeItem","lastUpdate","ok","at","success","message","check","problem","checkError","length","staged","selection","items","version","some","extensions","prepare","discard","openConfirm","renderRoot","querySelector","open","confirmed","bootId","mode","goBack","data","restoresData","confirm","forced","plan","files","breaking","packages","join","waitForServer","setItem","stringify","now","toISOString","window","location","reload","started","wasDown","res","fetch","credentials","cache","json","oldBootId","renderBusy","title","note","preparing","installing","restarting","renderStalled","renderRestartNote","restart","renderPlan","edited","breakingUpgrades","upgrades","upgrade","breakingExtensions","extension","noChanges","labels","permissions","settings","groups","widgets","jobs","adds","Object","entries","what","description","renderStaged","renderRow","renderAvailable","selected","majors","canUpdate","reason","renderCurrent","renderLast","last","renderGoBack","back","available","renderDatabase","applied","failed","database","upgraded","extensionFailed","extensionsRun","change","renderDialog","render","checkedAt","customElements","define"],"sources":["0"],"sourcesContent":["import ShadowComponent from '/kempo-ui/components/ShadowComponent.js';\nimport { html, nothing } from '/kempo-ui/lit-all.min.js';\nimport '/kempo-ui/components/Spinner.js';\nimport '/kempo-ui/components/Dialog.js';\nimport '/kempo-ui/components/Icon.js';\nimport Toast from '/kempo-ui/components/Toast.js';\nimport { getUpdateStatus, checkForUpdate, prepareUpdate, applyUpdate, rollbackUpdate, discardUpdate } from '/kempo/sdk.js';\n\n/*\n The update screen, served at /admin/components/Updates.js:\n\n <k-admin-updates></k-admin-updates>\n\n Lists what is newer on npm than what the site runs: Kempo itself and each installed extension, which the server looks up\n every 12 hours (and when \"Check now\" is pressed). Each has a box; what is ticked is updated together.\n\n A site that runs from a Docker volume updates in two steps. \"Get ready\" downloads the new versions next to the running site,\n which keeps working, and shows what switching to them would change: starter files that will update, files you edited that\n stay, files that must be replaced anyway, what each extension adds, and any change to your data. \"Switch\" asks for your word\n where that is needed, then the server restarts on the new versions. A version that does not work puts the old ones back by\n itself, and \"Go back\" does it by hand. Any other site installs the update in place and restarts.\n\n While the server is gone this screen asks it, every couple of seconds, whether it is back, then reloads the page and says how\n it went. A server that does not come back in ten minutes is reported rather than waited on forever.\n*/\nconst POLL_MS = 2000;\nconst GIVE_UP_MS = 10 * 60 * 1000;\nconst AFTER_RELOAD_KEY = 'kempo-after-update';\n\nconst when = value => (value ? new Date(value).toLocaleString() : 'never');\n\nconst sleep = ms => new Promise(resolve => setTimeout(resolve, ms));\n\nconst count = (n, one, many) => `${n} ${n === 1 ? one : many}`;\n\nconst older = (a, b) => a.split('.').map(Number).reduce((result, part, index) => result || (part - Number(b.split('.')[index])), 0) < 0;\n\nexport default class Updates extends ShadowComponent {\n static properties = {\n status: { state: true },\n error: { state: true },\n checking: { state: true },\n phase: { state: true },\n stalled: { state: true },\n action: { state: true },\n chosen: { state: true },\n };\n\n constructor(){\n super();\n this.status = null;\n this.error = '';\n this.checking = false;\n this.phase = 'idle';\n this.stalled = false;\n this.action = 'update';\n this.chosen = null;\n }\n\n /*\n Lifecycle\n */\n connectedCallback(){\n super.connectedCallback();\n this.load();\n }\n\n /*\n Loading\n */\n load = async () => {\n const [error, status] = await getUpdateStatus();\n if(error){\n this.error = error.msg || 'The update status could not be loaded';\n return;\n }\n this.error = '';\n this.status = status;\n this.selectNew(status);\n this.reportOutcome();\n /* A switch that is still being checked blocks the buttons below for about a minute: look again until it is done. */\n if(status.switching && !this.recheck){\n this.recheck = setTimeout(() => {\n this.recheck = null;\n this.load();\n }, 5000);\n }\n };\n\n /* Everything that can be updated, as { key, name, from, to, major, needs }: Kempo first, then the extensions. */\n updatable = status => [\n ...(status.updateAvailable ? [{ key: 'kempo', name: 'Kempo', from: status.runningVersion, to: status.latestVersion, major: status.major }] : []),\n ...(status.extensionUpdates?.updates ?? []).map(update => ({ key: update.name, name: update.name, from: update.installedVersion, to: update.latestVersion, major: update.major, needs: update.kempoRequired })),\n ];\n\n /* Everything that has just become available is ticked, once; what the person unticks stays unticked. */\n selectNew = status => {\n this.seen ??= new Set();\n const chosen = new Set(this.chosen ?? []);\n for(const { key } of this.updatable(status)){\n if(!this.seen.has(key)){\n this.seen.add(key);\n chosen.add(key);\n }\n }\n this.chosen = chosen;\n };\n\n /* An extension that needs a newer Kempo than the one running can only be chosen together with the Kempo update that provides it. */\n blocked = (item, status) => Boolean(item.needs) && older(status.runningVersion, item.needs) && !(this.chosen.has('kempo') && status.updateAvailable && !older(status.latestVersion, item.needs));\n\n chosenItems = () => this.updatable(this.status).filter(item => this.chosen.has(item.key) && !this.blocked(item, this.status));\n\n toggle = key => {\n const next = new Set(this.chosen);\n if(next.has(key)) next.delete(key);\n else next.add(key);\n this.chosen = next;\n };\n\n /* After the page reloads from an update: say whether the version that was asked for is the one now running. */\n reportOutcome = () => {\n try {\n const expected = JSON.parse(sessionStorage.getItem(AFTER_RELOAD_KEY) || 'null');\n if(!expected) return;\n sessionStorage.removeItem(AFTER_RELOAD_KEY);\n const failed = this.status.lastUpdate && !this.status.lastUpdate.ok && this.status.lastUpdate.at > expected.at;\n if(failed) Toast.error(`The update did not work, so the site went back to how it was`);\n else Toast.success(expected.message);\n } catch {\n /* storage can be blocked; the page has still reloaded */\n }\n };\n\n check = async () => {\n this.checking = true;\n const [error, status] = await checkForUpdate();\n this.checking = false;\n if(error){\n Toast.error(error.msg);\n return;\n }\n this.status = status;\n this.selectNew(status);\n const problem = status.checkError || status.extensionUpdates?.checkError;\n if(problem) Toast.error(problem);\n else if(!this.updatable(status).length && !status.staged) Toast.success('Everything is up to date');\n };\n\n /*\n Getting an update ready (Docker volume sites), or throwing it away\n */\n selection = () => {\n const items = this.chosenItems();\n return { version: items.some(item => item.key === 'kempo') ? this.status.latestVersion : null, extensions: items.filter(item => item.key !== 'kempo').map(item => item.key) };\n };\n\n prepare = async () => {\n this.phase = 'preparing';\n const [error] = await prepareUpdate(this.selection());\n this.phase = 'idle';\n if(error){\n Toast.error(error.msg);\n return;\n }\n await this.load();\n };\n\n discard = async () => {\n const [error] = await discardUpdate();\n if(error){\n Toast.error(error.msg);\n return;\n }\n await this.load();\n };\n\n /*\n Switching, updating in place and going back\n */\n openConfirm = action => {\n this.action = action;\n this.renderRoot.querySelector('#confirmDialog').open();\n };\n\n confirmed = async () => {\n const { staged, bootId, mode, goBack } = this.status;\n this.stalled = false;\n let error;\n let result;\n let message;\n\n if(this.action === 'back'){\n this.phase = 'going-back';\n [error, result] = await rollbackUpdate({ data: Boolean(goBack?.restoresData) });\n message = 'The site is back on what it ran before the last update';\n } else if(mode === 'release'){\n this.phase = 'switching';\n [error, result] = await applyUpdate({ confirm: { forced: staged.plan.files.forced.length > 0, breaking: staged.plan.breaking } });\n message = `Updated: ${staged.packages.join(', ')}`;\n } else {\n this.phase = 'installing';\n const { version, extensions } = this.selection();\n [error, result] = await applyUpdate({ version, extensions });\n message = `Updated: ${this.chosenItems().map(item => `${item.name} ${item.to}`).join(', ')}`;\n }\n\n if(error){\n this.phase = 'idle';\n Toast.error(error.msg);\n return;\n }\n this.phase = 'restarting';\n if(await this.waitForServer(bootId)){\n try {\n sessionStorage.setItem(AFTER_RELOAD_KEY, JSON.stringify({ message, at: new Date(Date.now() - 5000).toISOString(), to: result.to }));\n } catch {\n /* the reload still shows what is running */\n }\n window.location.reload();\n return;\n }\n this.stalled = true;\n };\n\n /*\n True once a server that is not the one asked about answers. The old one may still answer for a moment after\n the request that restarts it, so a reply only counts if it carries a different boot id, or if the server\n has been seen gone first (any reply short of a server error then comes from the new one, even a sign-in\n redirect that has no boot id).\n */\n waitForServer = async oldBootId => {\n const started = Date.now();\n let wasDown = false;\n while(Date.now() - started < GIVE_UP_MS){\n await sleep(POLL_MS);\n try {\n const res = await fetch('/kempo/api/updates?offline=true', { credentials: 'same-origin', cache: 'no-store' });\n if(res.ok){\n if((await res.json()).bootId !== oldBootId) return true;\n } else if(res.status >= 500){\n wasDown = true;\n } else if(wasDown){\n return true;\n }\n } catch {\n wasDown = true;\n }\n }\n return false;\n };\n\n /*\n Rendering\n */\n renderBusy(){\n const [title, note] = {\n preparing: ['Downloading the updates…', 'Your site keeps working while this happens. It can take a few minutes.'],\n installing: ['Installing the updates…', 'This can take a minute.'],\n switching: ['Switching to the updates…', 'This can take a minute.'],\n 'going-back': ['Going back…', 'This can take a minute.'],\n restarting: ['Restarting the server…', 'This page reloads by itself when the site is back, and updated extensions are brought up to date first.'],\n }[this.phase];\n return html`\n <div class=\"b r p mb\" role=\"status\">\n <p class=\"d-f mb\"><k-spinner class=\"mr\"></k-spinner><strong>${title}</strong></p>\n <p class=\"tc-muted\">${note} Please keep this page open.</p>\n </div>\n `;\n }\n\n renderStalled(){\n return html`\n <div class=\"b r p mb\" role=\"alert\">\n <p class=\"tc-danger mb\"><strong>The server did not come back within ten minutes.</strong></p>\n <p class=\"mb\">Check that the server process is running; if it is managed by pm2, systemd or Docker, check that it restarts when it exits.</p>\n <button class=\"primary\" @click=${() => window.location.reload()}>Reload this page</button>\n </div>\n `;\n }\n\n renderRestartNote(status){\n return status.restart === 'respawn'\n ? html`The site is unavailable for a few seconds while the server restarts.`\n : html`The server restarts, which takes a few seconds, and the site is unavailable until it is back.`;\n }\n\n /* What switching to the prepared versions would change. */\n renderPlan(plan){\n const { update, add, edited, forced } = plan.files;\n const breakingUpgrades = plan.upgrades.filter(upgrade => upgrade.breaking);\n const breakingExtensions = plan.extensions.filter(extension => extension.breaking);\n const noChanges = !update.length && !add.length && !edited.length && !forced.length && !plan.upgrades.length && !plan.extensions.length;\n const labels = { permissions: ['permission', 'permissions'], settings: ['setting', 'settings'], groups: ['group', 'groups'], widgets: ['dashboard widget', 'dashboard widgets'], jobs: ['scheduled job', 'scheduled jobs'] };\n const adds = extension => Object.entries(extension.adds).filter(([, n]) => n).map(([what, n]) => count(n, ...labels[what])).join(', ');\n return html`\n <ul class=\"mb\">\n ${noChanges ? html`<li>Nothing changes except the code.</li>` : nothing}\n ${plan.extensions.map(extension => html`<li>${extension.name} ${extension.from} <k-icon name=\"arrow\" direction=\"right\"></k-icon> ${extension.to}${adds(extension) ? html` <span class=\"tc-muted\">adds ${adds(extension)}</span>` : nothing}</li>`)}\n ${update.length ? html`<li>${count(update.length, 'starter file', 'starter files')} you have not edited will be updated.</li>` : nothing}\n ${add.length ? html`<li>${count(add.length, 'new file', 'new files')} will be added.</li>` : nothing}\n ${edited.length ? html`<li>${count(edited.length, 'file', 'files')} you have edited will stay as you made ${edited.length === 1 ? 'it' : 'them'}, even though Kempo has a newer version: <span class=\"tc-muted\">${edited.join(', ')}</span></li>` : nothing}\n ${forced.length ? html`<li class=\"tc-warning\"><k-icon name=\"warning\"></k-icon> ${count(forced.length, 'file', 'files')} you have edited must be replaced for security reasons. Your version is saved first: <span class=\"tc-muted\">${forced.join(', ')}</span></li>` : nothing}\n ${breakingUpgrades.length ? html`<li class=\"tc-warning\"><k-icon name=\"warning\"></k-icon> Kempo changes your data${breakingUpgrades.some(upgrade => upgrade.description) ? html` (${breakingUpgrades.map(upgrade => upgrade.description).filter(Boolean).join('; ')})` : nothing}.</li>` : nothing}\n ${breakingExtensions.length ? html`<li class=\"tc-warning\"><k-icon name=\"warning\"></k-icon> ${breakingExtensions.map(extension => extension.name).join(', ')} ${breakingExtensions.length === 1 ? 'is a breaking update that' : 'are breaking updates that'} may change your data.</li>` : nothing}\n ${plan.breaking ? html`<li class=\"tc-warning\"><k-icon name=\"warning\"></k-icon> A backup of the database is taken first. Going back later restores it, which loses anything entered after the update.</li>` : nothing}\n </ul>\n `;\n }\n\n renderStaged(status){\n const { staged } = status;\n return html`\n <div class=\"b r p mb\">\n <h2 class=\"h4 mb\">${count(staged.packages.length, 'update is', 'updates are')} ready</h2>\n <p class=\"tc-muted mb\">${staged.packages.join(', ')}. ${staged.packages.length === 1 ? 'It is' : 'They are'} downloaded next to your running site, which has not changed. Switching will:</p>\n ${this.renderPlan(staged.plan)}\n <p class=\"tc-muted mb\">${this.renderRestartNote(status)}</p>\n ${status.switching ? html`<p class=\"tc-muted mb\">The last switch is still being checked, which takes about a minute after the restart. You can switch when that is done.</p>` : nothing}\n <button class=\"primary mr\" ?disabled=${Boolean(status.switching)} @click=${() => this.openConfirm('update')}>Switch now</button>\n <button @click=${this.discard}>Not now</button>\n </div>\n `;\n }\n\n renderRow(item, status){\n const blocked = this.blocked(item, status);\n return html`\n <label class=\"d-f mb\">\n <input type=\"checkbox\" class=\"mr\" ?checked=${this.chosen.has(item.key) && !blocked} ?disabled=${blocked || this.phase !== 'idle'} @change=${() => this.toggle(item.key)}>\n <span><strong>${item.name}</strong> ${item.from} <k-icon name=\"arrow\" direction=\"right\"></k-icon> ${item.to}${item.major ? html` <span class=\"tc-warning\">breaking release</span>` : nothing}\n ${blocked ? html`<small class=\"d-b tc-muted\">Needs Kempo ${item.needs} or newer: tick Kempo as well.</small>` : nothing}</span>\n </label>\n `;\n }\n\n renderAvailable(status){\n const items = this.updatable(status);\n const selected = this.chosenItems();\n const majors = selected.filter(item => item.major);\n return html`\n <div class=\"b r p mb\">\n <h2 class=\"h4 mb\">${count(items.length, 'update is', 'updates are')} available</h2>\n <div class=\"mb\">${items.map(item => this.renderRow(item, status))}</div>\n ${majors.length ? html`<p class=\"tc-warning mb\" role=\"alert\"><k-icon name=\"warning\"></k-icon> ${majors.map(item => item.name).join(', ')} ${majors.length === 1 ? 'is a breaking release' : 'are breaking releases'} and may change how things work. Read ${majors.length === 1 ? 'its' : 'their'} release notes before updating.</p>` : nothing}\n ${status.canUpdate ? (status.mode === 'release' ? html`\n <p class=\"tc-muted mb\">Getting them ready downloads them without touching your site. You choose when to switch.</p>\n <button class=\"primary\" ?disabled=${!selected.length} @click=${this.prepare}>Get ${count(selected.length, 'update', 'updates')} ready</button>\n ` : html`\n <p class=\"tc-muted mb\">${this.renderRestartNote(status)}</p>\n <button class=\"primary\" ?disabled=${!selected.length} @click=${() => this.openConfirm('update')}>Update ${count(selected.length, 'item', 'items')}</button>\n `) : html`<p class=\"mb\">${status.reason} Update where it is installed, then restart the server.</p>`}\n </div>\n `;\n }\n\n renderCurrent(){\n return html`\n <div class=\"b r p mb\">\n <h2 class=\"h4 mb\"><k-icon name=\"check\" class=\"tc-success\"></k-icon> Everything is up to date</h2>\n <p class=\"tc-muted\">This site runs Kempo ${this.status.runningVersion}${this.status.latestVersion ? ', the newest version' : ''}, and its extensions are on their newest versions.</p>\n </div>\n `;\n }\n\n renderLast(status){\n const last = status.lastUpdate;\n if(!last || last.ok) return nothing;\n return html`\n <div class=\"b r p mb\" role=\"alert\">\n <h2 class=\"h5 mb tc-danger\">The last update did not work</h2>\n <p>The update of ${last.packages?.length ? last.packages.join(', ') : 'Kempo'} on ${when(last.at)} did not stay running (${last.reason}), so the site went back to how it was.${last.breaking ? ' Your data was restored from the backup taken before it.' : ''}</p>\n </div>\n `;\n }\n\n renderGoBack(status){\n const back = status.goBack;\n if(!back) return nothing;\n if(status.switching) return html`<p class=\"tc-muted mb\">The last switch is still being checked, which takes about a minute. Going back is available after that.</p>`;\n if(!back.available) return nothing;\n return html`<p class=\"mb\"><button @click=${() => this.openConfirm('back')}>Go back</button> <span class=\"tc-muted\">Puts the site back on what it ran before the last update${back.packages.length ? ` (${back.packages.join(', ')})` : ''}.${back.restoresData ? ' That update changed your data, so this also restores the database from before it.' : ''}</span></p>`;\n }\n\n renderDatabase(status){\n const { applied = [], failed = [] } = status.database ?? {};\n const { upgraded = [], failed: extensionFailed = [] } = status.extensionsRun ?? {};\n return html`\n ${failed.length ? html`\n <div class=\"b r p mb\" role=\"alert\">\n <h2 class=\"h5 mb tc-danger\">The database needs attention</h2>\n <p class=\"mb\">Kempo started, but these changes to its tables were not applied. Anything that depends on them may not work until they are.</p>\n <ul class=\"mb\">\n ${failed.map(({ change, reason }) => html`<li>${change}: <span class=\"tc-danger\">${reason}</span></li>`)}\n </ul>\n <p class=\"tc-muted\">Kempo only ever adds to its tables on its own. It never drops or changes anything that holds data, so these need someone who can look at the database.</p>\n </div>\n ` : nothing}\n ${extensionFailed.length ? html`\n <div class=\"b r p mb\" role=\"alert\">\n <h2 class=\"h5 mb tc-danger\">An extension could not be brought up to date</h2>\n <ul class=\"mb\">${extensionFailed.map(({ name, from, to, reason }) => html`<li>${name} ${from} <k-icon name=\"arrow\" direction=\"right\"></k-icon> ${to}: <span class=\"tc-danger\">${reason}</span></li>`)}</ul>\n <p class=\"tc-muted\">It is tried again the next time the server starts.</p>\n </div>\n ` : nothing}\n ${applied.length || upgraded.length ? html`\n <div class=\"b r p mb\">\n <h2 class=\"h5 mb\">Brought up to date when the server last started</h2>\n <ul>\n ${upgraded.map(({ name, from, to }) => html`<li>${name} ${from} <k-icon name=\"arrow\" direction=\"right\"></k-icon> ${to}</li>`)}\n ${applied.map(change => html`<li>${change}</li>`)}\n </ul>\n </div>\n ` : nothing}\n `;\n }\n\n renderDialog(status){\n const back = this.action === 'back';\n const forced = status.staged?.plan.files.forced ?? [];\n const breaking = !back && (status.staged?.plan.breaking ?? false);\n const items = status.mode === 'release' ? (status.staged?.packages ?? []) : this.chosen ? this.chosenItems().map(item => `${item.name} ${item.to}`) : [];\n return html`\n <k-dialog id=\"confirmDialog\" confirm-text=${back ? 'Go back and restart' : 'Update and restart'} confirm-classes=\"primary ml\" cancel-text=\"Cancel\" .confirmAction=${this.confirmed}>\n <h2 slot=\"title\" class=\"h5 pyh px m0\">${back ? 'Go back' : 'Update'}</h2>\n <div class=\"p\">\n <p class=\"mb\">${back ? 'This puts the site back on what it ran before the last update.' : `This updates ${items.join(', ')}.`} ${this.renderRestartNote(status)}</p>\n ${forced.length ? html`<p class=\"tc-warning mb\"><k-icon name=\"warning\"></k-icon> Your edits to ${forced.join(', ')} will be replaced. Your version is saved first.</p>` : nothing}\n ${breaking ? html`<p class=\"tc-warning mb\"><k-icon name=\"warning\"></k-icon> This update changes your data. A backup is taken first, and going back later restores it, which loses anything entered after the update.</p>` : nothing}\n ${back && status.goBack?.restoresData ? html`<p class=\"tc-warning mb\"><k-icon name=\"warning\"></k-icon> The update changed your data, so going back restores the database from before it. Anything entered since is lost.</p>` : nothing}\n <p class=\"tc-muted\">Anyone using the site meanwhile will not be able to reach it. This page reloads when the server is back.</p>\n </div>\n </k-dialog>\n `;\n }\n\n render(){\n const status = this.status;\n if(this.error) return html`<p class=\"tc-danger\" role=\"alert\">${this.error}</p>`;\n if(!status) return html`<k-spinner></k-spinner>`;\n const items = this.updatable(status);\n return html`\n ${this.phase !== 'idle' ? this.renderBusy() : nothing}\n ${this.stalled ? this.renderStalled() : nothing}\n ${this.phase === 'idle' ? html`\n ${this.renderLast(status)}\n ${this.renderDatabase(status)}\n ${status.staged ? this.renderStaged(status) : (items.length ? this.renderAvailable(status) : this.renderCurrent())}\n ${status.checkError || status.extensionUpdates?.checkError ? html`<p class=\"tc-danger mb\" role=\"alert\">The last check failed: ${status.checkError || status.extensionUpdates.checkError}</p>` : nothing}\n <p class=\"d-f mb\">\n <button ?disabled=${this.checking} @click=${this.check}>${this.checking ? 'Checking…' : 'Check now'}</button>\n <span class=\"tc-muted ph\">Last checked ${when(status.checkedAt)}</span>\n </p>\n ${this.renderGoBack(status)}\n <p class=\"tc-muted\">Automatic checks can be turned off with <strong>update_check_enabled</strong> on the System tab of <a href=\"/admin/settings\">Settings</a>. Installing or removing an extension is done from <a href=\"/admin/extensions\">Extensions</a>.</p>\n ` : nothing}\n ${this.renderDialog(status)}\n `;\n }\n}\n\ncustomElements.define('k-admin-updates', Updates);\n"],"mappings":"OAAOA,MAAqB,yDACnBC,aAAMC,MAAe,iCACvB,wCACA,uCACA,sCACAC,MAAW,0DACTC,oBAAiBC,mBAAgBC,iBAAeC,oBAAaC,mBAAgBC,MAAqB,gBAmB3G,MAEMC,EAAmB,qBAEnBC,EAAOC,GAAUA,EAAQ,IAAIC,KAAKD,GAAOE,iBAAmB,QAE5DC,EAAQC,GAAM,IAAIC,QAAQC,GAAWC,WAAWD,EAASF,IAEzDI,EAAQ,CAACC,EAAGC,EAAKC,IAAS,GAAGF,KAAW,IAANA,EAAUC,EAAMC,IAElDC,EAAQ,CAACC,EAAGC,IAAMD,EAAEE,MAAM,KAAKC,IAAIC,QAAQC,OAAO,CAACC,EAAQC,EAAMC,IAAU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/F,CAAI,2EAA2EmH,EAAOK,KAAK,2DAA6DvH;YACxKqH,EAAWtH,CAAI,yMAA2MC;YAC1N+K,GAAQ7I,EAAO4E,QAAQE,aAAejH,CAAI,kLAAoLC;;;;KAKxO,CAEA,MAAA0L,GACE,MAAMxJ,EAASU,KAAKV,OACpB,GAAGU,KAAKR,MAAO,OAAOrC,CAAI,qCAAqC6C,KAAKR,YACpE,IAAIF,EAAQ,OAAOnC,CAAI,0BACvB,MAAMkG,EAAQrD,KAAKS,UAAUnB,GAC7B,OAAOnC,CAAI;QACQ,SAAf6C,KAAKN,MAAmBM,KAAK4F,aAAexI;QAC5C4C,KAAKL,QAAUK,KAAKkG,gBAAkB9I;QACvB,SAAf4C,KAAKN,MAAmBvC,CAAI;UAC1B6C,KAAKgI,WAAW1I;UAChBU,KAAKqI,eAAe/I;UACpBA,EAAO6D,OAASnD,KAAKwH,aAAalI,GAAW+D,EAAMH,OAASlD,KAAK0H,gBAAgBpI,GAAUU,KAAK+H;UAChGzI,EAAO2D,YAAc3D,EAAO4B,kBAAkB+B,WAAa9F,CAAI,+DAA+DmC,EAAO2D,YAAc3D,EAAO4B,iBAAiB+B,iBAAmB7F;;8BAE1K4C,KAAKP,mBAAmBO,KAAK+C,SAAS/C,KAAKP,SAAW,YAAc;mDAC/C5B,EAAKyB,EAAOyJ;;UAErD/I,KAAKkI,aAAa5I;;QAElBlC;QACF4C,KAAK6I,aAAavJ;KAExB,EAGF0J,eAAeC,OAAO,kBAAmB7J","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"src\\admin\\components\\Updates.js","names":["ShadowComponent","html","nothing","Toast","getUpdateStatus","checkForUpdate","prepareUpdate","applyUpdate","rollbackUpdate","discardUpdate","AFTER_RELOAD_KEY","when","value","Date","toLocaleString","sleep","ms","Promise","resolve","setTimeout","count","n","one","many","older","a","b","split","map","Number","reduce","result","part","index","Updates","static","status","state","error","checking","phase","stalled","action","chosen","constructor","super","this","connectedCallback","load","async","msg","selectNew","reportOutcome","switching","recheck","updatable","updateAvailable","key","name","from","runningVersion","to","latestVersion","major","extensionUpdates","updates","update","installedVersion","needs","kempoRequired","seen","Set","has","add","blocked","item","Boolean","chosenItems","filter","toggle","next","delete","expected","JSON","parse","sessionStorage","getItem","removeItem","lastUpdate","ok","at","success","message","check","problem","checkError","length","staged","selection","items","version","some","extensions","prepare","discard","openConfirm","renderRoot","querySelector","open","confirmed","bootId","mode","goBack","data","restoresData","confirm","forced","plan","files","breaking","packages","join","waitForServer","setItem","stringify","now","toISOString","window","location","reload","started","wasDown","res","fetch","credentials","cache","json","oldBootId","renderBusy","title","note","preparing","installing","restarting","renderStalled","renderRestartNote","restart","renderPlan","edited","breakingUpgrades","upgrades","upgrade","breakingExtensions","extension","noChanges","labels","permissions","settings","groups","widgets","jobs","adds","Object","entries","what","description","renderStaged","renderRow","renderAvailable","selected","majors","canUpdate","reason","renderCurrent","renderLast","last","renderGoBack","back","available","renderDatabase","applied","failed","database","upgraded","extensionFailed","extensionsRun","change","renderDialog","render","checkedAt","customElements","define"],"sources":["0"],"sourcesContent":["import ShadowComponent from '/kempo-ui/components/ShadowComponent.js';\nimport { html, nothing } from '/kempo-ui/lit-all.min.js';\nimport '/kempo-ui/components/Spinner.js';\nimport '/kempo-ui/components/Dialog.js';\nimport '/kempo-ui/components/Icon.js';\nimport Toast from '/kempo-ui/components/Toast.js';\nimport { getUpdateStatus, checkForUpdate, prepareUpdate, applyUpdate, rollbackUpdate, discardUpdate } from '/kempo/sdk.js';\n\n/*\n The update screen, served at /admin/components/Updates.js:\n\n <k-admin-updates></k-admin-updates>\n\n Lists what is newer on npm than what the site runs: Kempo itself and each installed extension, which the server looks up\n every 12 hours (and when \"Check now\" is pressed). Each has a box; what is ticked is updated together.\n\n A site that runs from a Docker volume updates in two steps. \"Get ready\" downloads the new versions next to the running site,\n which keeps working, and shows what switching to them would change: starter files that will update, files you edited that\n stay, files that must be replaced anyway, what each extension adds, and any change to your data. \"Switch\" asks for your word\n where that is needed, then the server restarts on the new versions. A version that does not work puts the old ones back by\n itself, and \"Go back\" does it by hand. Any other site installs the update in place and restarts.\n\n While the server is gone this screen asks it, every couple of seconds, whether it is back, then reloads the page and says how\n it went. A server that does not come back in ten minutes is reported rather than waited on forever.\n*/\nconst POLL_MS = 2000;\nconst GIVE_UP_MS = 10 * 60 * 1000;\nconst AFTER_RELOAD_KEY = 'kempo-after-update';\n\nconst when = value => (value ? new Date(value).toLocaleString() : 'never');\n\nconst sleep = ms => new Promise(resolve => setTimeout(resolve, ms));\n\nconst count = (n, one, many) => `${n} ${n === 1 ? one : many}`;\n\nconst older = (a, b) => a.split('.').map(Number).reduce((result, part, index) => result || (part - Number(b.split('.')[index])), 0) < 0;\n\nexport default class Updates extends ShadowComponent {\n static properties = {\n status: { state: true },\n error: { state: true },\n checking: { state: true },\n phase: { state: true },\n stalled: { state: true },\n action: { state: true },\n chosen: { state: true },\n };\n\n constructor(){\n super();\n this.status = null;\n this.error = '';\n this.checking = false;\n this.phase = 'idle';\n this.stalled = false;\n this.action = 'update';\n this.chosen = null;\n }\n\n /*\n Lifecycle\n */\n connectedCallback(){\n super.connectedCallback();\n this.load();\n }\n\n /*\n Loading\n */\n load = async () => {\n const [error, status] = await getUpdateStatus();\n if(error){\n this.error = error.msg || 'The update status could not be loaded';\n return;\n }\n this.error = '';\n this.status = status;\n this.selectNew(status);\n this.reportOutcome();\n /* A switch that is still being checked blocks the buttons below for about a minute: look again until it is done. */\n if(status.switching && !this.recheck){\n this.recheck = setTimeout(() => {\n this.recheck = null;\n this.load();\n }, 5000);\n }\n };\n\n /* Everything that can be updated, as { key, name, from, to, major, needs }: Kempo first, then the extensions. */\n updatable = status => [\n ...(status.updateAvailable ? [{ key: 'kempo', name: 'Kempo', from: status.runningVersion, to: status.latestVersion, major: status.major }] : []),\n ...(status.extensionUpdates?.updates ?? []).map(update => ({ key: update.name, name: update.name, from: update.installedVersion, to: update.latestVersion, major: update.major, needs: update.kempoRequired })),\n ];\n\n /* Everything that has just become available is ticked, once; what the person unticks stays unticked. */\n selectNew = status => {\n this.seen ??= new Set();\n const chosen = new Set(this.chosen ?? []);\n for(const { key } of this.updatable(status)){\n if(!this.seen.has(key)){\n this.seen.add(key);\n chosen.add(key);\n }\n }\n this.chosen = chosen;\n };\n\n /* An extension that needs a newer Kempo than the one running can only be chosen together with the Kempo update that provides it. */\n blocked = (item, status) => Boolean(item.needs) && older(status.runningVersion, item.needs) && !(this.chosen.has('kempo') && status.updateAvailable && !older(status.latestVersion, item.needs));\n\n chosenItems = () => this.updatable(this.status).filter(item => this.chosen.has(item.key) && !this.blocked(item, this.status));\n\n toggle = key => {\n const next = new Set(this.chosen);\n if(next.has(key)) next.delete(key);\n else next.add(key);\n this.chosen = next;\n };\n\n /* After the page reloads from an update: say whether the version that was asked for is the one now running. */\n reportOutcome = () => {\n try {\n const expected = JSON.parse(sessionStorage.getItem(AFTER_RELOAD_KEY) || 'null');\n if(!expected) return;\n sessionStorage.removeItem(AFTER_RELOAD_KEY);\n const failed = this.status.lastUpdate && !this.status.lastUpdate.ok && this.status.lastUpdate.at > expected.at;\n if(failed) Toast.error(`The update did not work, so the site went back to how it was`);\n else Toast.success(expected.message);\n } catch {\n /* storage can be blocked; the page has still reloaded */\n }\n };\n\n check = async () => {\n this.checking = true;\n const [error, status] = await checkForUpdate();\n this.checking = false;\n if(error){\n Toast.error(error.msg);\n return;\n }\n this.status = status;\n this.selectNew(status);\n const problem = status.checkError || status.extensionUpdates?.checkError;\n if(problem) Toast.error(problem);\n else if(!this.updatable(status).length && !status.staged) Toast.success('Everything is up to date');\n };\n\n /*\n Getting an update ready (Docker volume sites), or throwing it away\n */\n selection = () => {\n const items = this.chosenItems();\n return { version: items.some(item => item.key === 'kempo') ? this.status.latestVersion : null, extensions: items.filter(item => item.key !== 'kempo').map(item => item.key) };\n };\n\n prepare = async () => {\n this.phase = 'preparing';\n const [error] = await prepareUpdate(this.selection());\n this.phase = 'idle';\n if(error){\n Toast.error(error.msg);\n return;\n }\n await this.load();\n };\n\n discard = async () => {\n const [error] = await discardUpdate();\n if(error){\n Toast.error(error.msg);\n return;\n }\n await this.load();\n };\n\n /*\n Switching, updating in place and going back\n */\n openConfirm = action => {\n this.action = action;\n this.renderRoot.querySelector('#confirmDialog').open();\n };\n\n confirmed = async () => {\n const { staged, bootId, mode, goBack } = this.status;\n this.stalled = false;\n let error;\n let result;\n let message;\n\n if(this.action === 'back'){\n this.phase = 'going-back';\n [error, result] = await rollbackUpdate({ data: Boolean(goBack?.restoresData) });\n message = 'The site is back on what it ran before the last update';\n } else if(mode === 'release'){\n this.phase = 'switching';\n [error, result] = await applyUpdate({ confirm: { forced: staged.plan.files.forced.length > 0, breaking: staged.plan.breaking } });\n message = `Updated: ${staged.packages.join(', ')}`;\n } else {\n this.phase = 'installing';\n const { version, extensions } = this.selection();\n [error, result] = await applyUpdate({ version, extensions });\n message = `Updated: ${this.chosenItems().map(item => `${item.name} ${item.to}`).join(', ')}`;\n }\n\n if(error){\n this.phase = 'idle';\n Toast.error(error.msg);\n return;\n }\n this.phase = 'restarting';\n if(await this.waitForServer(bootId)){\n try {\n sessionStorage.setItem(AFTER_RELOAD_KEY, JSON.stringify({ message, at: new Date(Date.now() - 5000).toISOString(), to: result.to }));\n } catch {\n /* the reload still shows what is running */\n }\n window.location.reload();\n return;\n }\n this.stalled = true;\n };\n\n /*\n True once a server that is not the one asked about answers. The old one may still answer for a moment after\n the request that restarts it, so a reply only counts if it carries a different boot id, or if the server\n has been seen gone first (any reply short of a server error then comes from the new one, even a sign-in\n redirect that has no boot id).\n */\n waitForServer = async oldBootId => {\n const started = Date.now();\n let wasDown = false;\n while(Date.now() - started < GIVE_UP_MS){\n await sleep(POLL_MS);\n try {\n const res = await fetch('/kempo/api/updates?offline=true', { credentials: 'same-origin', cache: 'no-store' });\n if(res.ok){\n if((await res.json()).bootId !== oldBootId) return true;\n } else if(res.status >= 500){\n wasDown = true;\n } else if(wasDown){\n return true;\n }\n } catch {\n wasDown = true;\n }\n }\n return false;\n };\n\n /*\n Rendering\n */\n renderBusy(){\n const [title, note] = {\n preparing: ['Downloading the updates…', 'Your site keeps working while this happens. It can take a few minutes.'],\n installing: ['Installing the updates…', 'This can take a minute.'],\n switching: ['Switching to the updates…', 'This can take a minute.'],\n 'going-back': ['Going back…', 'This can take a minute.'],\n restarting: ['Restarting the server…', 'This page reloads by itself when the site is back, and updated extensions are brought up to date first.'],\n }[this.phase];\n return html`\n <div class=\"b r p mb\" role=\"status\">\n <p class=\"d-f mb\"><k-spinner class=\"mr\"></k-spinner><strong>${title}</strong></p>\n <p class=\"tc-muted\">${note} Please keep this page open.</p>\n </div>\n `;\n }\n\n renderStalled(){\n return html`\n <div class=\"b r p mb\" role=\"alert\">\n <p class=\"tc-danger mb\"><strong>The server did not come back within ten minutes.</strong></p>\n <p class=\"mb\">Check that the server process is running; if it is managed by pm2, systemd or Docker, check that it restarts when it exits.</p>\n <button class=\"primary\" @click=${() => window.location.reload()}>Reload this page</button>\n </div>\n `;\n }\n\n renderRestartNote(status){\n return status.restart === 'respawn'\n ? html`The site is unavailable for a few seconds while the server restarts.`\n : html`The server restarts, which takes a few seconds, and the site is unavailable until it is back.`;\n }\n\n /* What switching to the prepared versions would change. */\n renderPlan(plan){\n const { update, add, edited, forced } = plan.files;\n const breakingUpgrades = plan.upgrades.filter(upgrade => upgrade.breaking);\n const breakingExtensions = plan.extensions.filter(extension => extension.breaking);\n const noChanges = !update.length && !add.length && !edited.length && !forced.length && !plan.upgrades.length && !plan.extensions.length;\n const labels = { permissions: ['permission', 'permissions'], settings: ['setting', 'settings'], groups: ['group', 'groups'], widgets: ['dashboard widget', 'dashboard widgets'], jobs: ['scheduled job', 'scheduled jobs'] };\n const adds = extension => Object.entries(extension.adds).filter(([, n]) => n).map(([what, n]) => count(n, ...labels[what])).join(', ');\n return html`\n <ul class=\"mb\">\n ${noChanges ? html`<li>Nothing changes except the code.</li>` : nothing}\n ${plan.extensions.map(extension => html`<li>${extension.name} ${extension.from} <k-icon name=\"arrow\" direction=\"right\"></k-icon> ${extension.to}${adds(extension) ? html` <span class=\"tc-muted\">adds ${adds(extension)}</span>` : nothing}</li>`)}\n ${update.length ? html`<li>${count(update.length, 'starter file', 'starter files')} you have not edited will be updated.</li>` : nothing}\n ${add.length ? html`<li>${count(add.length, 'new file', 'new files')} will be added.</li>` : nothing}\n ${edited.length ? html`<li>${count(edited.length, 'file', 'files')} you have edited will stay as you made ${edited.length === 1 ? 'it' : 'them'}, even though Kempo has a newer version: <span class=\"tc-muted\">${edited.join(', ')}</span></li>` : nothing}\n ${forced.length ? html`<li class=\"tc-warning\"><k-icon name=\"warning\"></k-icon> ${count(forced.length, 'file', 'files')} you have edited must be replaced for security reasons. Your version is saved first: <span class=\"tc-muted\">${forced.join(', ')}</span></li>` : nothing}\n ${breakingUpgrades.length ? html`<li class=\"tc-warning\"><k-icon name=\"warning\"></k-icon> Kempo changes your data${breakingUpgrades.some(upgrade => upgrade.description) ? html` (${breakingUpgrades.map(upgrade => upgrade.description).filter(Boolean).join('; ')})` : nothing}.</li>` : nothing}\n ${breakingExtensions.length ? html`<li class=\"tc-warning\"><k-icon name=\"warning\"></k-icon> ${breakingExtensions.map(extension => extension.name).join(', ')} ${breakingExtensions.length === 1 ? 'is a breaking update that' : 'are breaking updates that'} may change your data.</li>` : nothing}\n ${plan.breaking ? html`<li class=\"tc-warning\"><k-icon name=\"warning\"></k-icon> A backup of the database is taken first. Going back later restores it, which loses anything entered after the update.</li>` : nothing}\n </ul>\n `;\n }\n\n renderStaged(status){\n const { staged } = status;\n return html`\n <div class=\"b r p mb\">\n <h2 class=\"h4 mb\">${count(staged.packages.length, 'update is', 'updates are')} ready</h2>\n <p class=\"tc-muted mb\">${staged.packages.join(', ')}. ${staged.packages.length === 1 ? 'It is' : 'They are'} downloaded next to your running site, which has not changed. Switching will:</p>\n ${this.renderPlan(staged.plan)}\n <p class=\"tc-muted mb\">${this.renderRestartNote(status)}</p>\n ${status.switching ? html`<p class=\"tc-muted mb\">The last switch is still being checked, which takes about a minute after the restart. You can switch when that is done.</p>` : nothing}\n <button class=\"primary mr\" ?disabled=${Boolean(status.switching)} @click=${() => this.openConfirm('update')}>Switch now</button>\n <button @click=${this.discard}>Not now</button>\n </div>\n `;\n }\n\n renderRow(item, status){\n const blocked = this.blocked(item, status);\n return html`\n <label class=\"d-f mb\">\n <input type=\"checkbox\" class=\"mr\" ?checked=${this.chosen.has(item.key) && !blocked} ?disabled=${blocked || this.phase !== 'idle'} @change=${() => this.toggle(item.key)}>\n <span><strong>${item.name}</strong> ${item.from} <k-icon name=\"arrow\" direction=\"right\"></k-icon> ${item.to}${item.major ? html` <span class=\"tc-warning\">breaking release</span>` : nothing}\n ${blocked ? html`<small class=\"d-b tc-muted\">Needs Kempo ${item.needs} or newer: tick Kempo as well.</small>` : nothing}</span>\n </label>\n `;\n }\n\n renderAvailable(status){\n const items = this.updatable(status);\n const selected = this.chosenItems();\n const majors = selected.filter(item => item.major);\n return html`\n <div class=\"b r p mb\">\n <h2 class=\"h4 mb\">${count(items.length, 'update is', 'updates are')} available</h2>\n <div class=\"mb\">${items.map(item => this.renderRow(item, status))}</div>\n ${majors.length ? html`<p class=\"tc-warning mb\" role=\"alert\"><k-icon name=\"warning\"></k-icon> ${majors.map(item => item.name).join(', ')} ${majors.length === 1 ? 'is a breaking release' : 'are breaking releases'} and may change how things work. Read ${majors.length === 1 ? 'its' : 'their'} release notes before updating.</p>` : nothing}\n ${status.canUpdate ? (status.mode === 'release' ? html`\n <p class=\"tc-muted mb\">Getting them ready downloads them without touching your site. You choose when to switch.</p>\n <button class=\"primary\" ?disabled=${!selected.length} @click=${this.prepare}>Get ${count(selected.length, 'update', 'updates')} ready</button>\n ` : html`\n <p class=\"tc-muted mb\">${this.renderRestartNote(status)}</p>\n <button class=\"primary\" ?disabled=${!selected.length} @click=${() => this.openConfirm('update')}>Update ${count(selected.length, 'item', 'items')}</button>\n `) : html`<p class=\"mb\">${status.reason} Update where it is installed, then restart the server.</p>`}\n </div>\n `;\n }\n\n renderCurrent(){\n return html`\n <div class=\"b r p mb\">\n <h2 class=\"h4 mb\"><k-icon name=\"check\" class=\"tc-success\"></k-icon> Everything is up to date</h2>\n <p class=\"tc-muted\">This site runs Kempo ${this.status.runningVersion}${this.status.latestVersion ? ', the newest version' : ''}, and its extensions are on their newest versions.</p>\n </div>\n `;\n }\n\n renderLast(status){\n const last = status.lastUpdate;\n if(!last || last.ok) return nothing;\n return html`\n <div class=\"b r p mb\" role=\"alert\">\n <h2 class=\"h5 mb tc-danger\">The last update did not work</h2>\n <p>The update${last.packages?.length ? ` of ${last.packages.join(', ')}` : ''} on ${when(last.at)} did not stay running (${last.reason}), so the site went back to how it was.${last.breaking ? ' Your data was restored from the backup taken before it.' : ''}</p>\n </div>\n `;\n }\n\n renderGoBack(status){\n const back = status.goBack;\n if(!back) return nothing;\n if(status.switching) return html`<p class=\"tc-muted mb\">The last switch is still being checked, which takes about a minute. Going back is available after that.</p>`;\n if(!back.available) return nothing;\n return html`<p class=\"mb\"><button @click=${() => this.openConfirm('back')}>Go back</button> <span class=\"tc-muted\">Puts the site back on what it ran before the last update${back.packages.length ? ` (${back.packages.join(', ')})` : ''}.${back.restoresData ? ' That update changed your data, so this also restores the database from before it.' : ''}</span></p>`;\n }\n\n renderDatabase(status){\n const { applied = [], failed = [] } = status.database ?? {};\n const { upgraded = [], failed: extensionFailed = [] } = status.extensionsRun ?? {};\n return html`\n ${failed.length ? html`\n <div class=\"b r p mb\" role=\"alert\">\n <h2 class=\"h5 mb tc-danger\">The database needs attention</h2>\n <p class=\"mb\">Kempo started, but these changes to its tables were not applied. Anything that depends on them may not work until they are.</p>\n <ul class=\"mb\">\n ${failed.map(({ change, reason }) => html`<li>${change}: <span class=\"tc-danger\">${reason}</span></li>`)}\n </ul>\n <p class=\"tc-muted\">Kempo only ever adds to its tables on its own. It never drops or changes anything that holds data, so these need someone who can look at the database.</p>\n </div>\n ` : nothing}\n ${extensionFailed.length ? html`\n <div class=\"b r p mb\" role=\"alert\">\n <h2 class=\"h5 mb tc-danger\">An extension could not be brought up to date</h2>\n <ul class=\"mb\">${extensionFailed.map(({ name, from, to, reason }) => html`<li>${name} ${from} <k-icon name=\"arrow\" direction=\"right\"></k-icon> ${to}: <span class=\"tc-danger\">${reason}</span></li>`)}</ul>\n <p class=\"tc-muted\">It is tried again the next time the server starts.</p>\n </div>\n ` : nothing}\n ${applied.length || upgraded.length ? html`\n <div class=\"b r p mb\">\n <h2 class=\"h5 mb\">Brought up to date when the server last started</h2>\n <ul>\n ${upgraded.map(({ name, from, to }) => html`<li>${name} ${from} <k-icon name=\"arrow\" direction=\"right\"></k-icon> ${to}</li>`)}\n ${applied.map(change => html`<li>${change}</li>`)}\n </ul>\n </div>\n ` : nothing}\n `;\n }\n\n renderDialog(status){\n const back = this.action === 'back';\n const forced = status.staged?.plan.files.forced ?? [];\n const breaking = !back && (status.staged?.plan.breaking ?? false);\n const items = status.mode === 'release' ? (status.staged?.packages ?? []) : this.chosen ? this.chosenItems().map(item => `${item.name} ${item.to}`) : [];\n return html`\n <k-dialog id=\"confirmDialog\" confirm-text=${back ? 'Go back and restart' : 'Update and restart'} confirm-classes=\"primary ml\" cancel-text=\"Cancel\" .confirmAction=${this.confirmed}>\n <h2 slot=\"title\" class=\"h5 pyh px m0\">${back ? 'Go back' : 'Update'}</h2>\n <div class=\"p\">\n <p class=\"mb\">${back ? 'This puts the site back on what it ran before the last update.' : `This updates ${items.join(', ')}.`} ${this.renderRestartNote(status)}</p>\n ${forced.length ? html`<p class=\"tc-warning mb\"><k-icon name=\"warning\"></k-icon> Your edits to ${forced.join(', ')} will be replaced. Your version is saved first.</p>` : nothing}\n ${breaking ? html`<p class=\"tc-warning mb\"><k-icon name=\"warning\"></k-icon> This update changes your data. A backup is taken first, and going back later restores it, which loses anything entered after the update.</p>` : nothing}\n ${back && status.goBack?.restoresData ? html`<p class=\"tc-warning mb\"><k-icon name=\"warning\"></k-icon> The update changed your data, so going back restores the database from before it. Anything entered since is lost.</p>` : nothing}\n <p class=\"tc-muted\">Anyone using the site meanwhile will not be able to reach it. This page reloads when the server is back.</p>\n </div>\n </k-dialog>\n `;\n }\n\n render(){\n const status = this.status;\n if(this.error) return html`<p class=\"tc-danger\" role=\"alert\">${this.error}</p>`;\n if(!status) return html`<k-spinner></k-spinner>`;\n const items = this.updatable(status);\n return html`\n ${this.phase !== 'idle' ? this.renderBusy() : nothing}\n ${this.stalled ? this.renderStalled() : nothing}\n ${this.phase === 'idle' ? html`\n ${this.renderLast(status)}\n ${this.renderDatabase(status)}\n ${status.staged ? this.renderStaged(status) : (items.length ? this.renderAvailable(status) : this.renderCurrent())}\n ${status.checkError || status.extensionUpdates?.checkError ? html`<p class=\"tc-danger mb\" role=\"alert\">The last check failed: ${status.checkError || status.extensionUpdates.checkError}</p>` : nothing}\n <p class=\"d-f mb\">\n <button ?disabled=${this.checking} @click=${this.check}>${this.checking ? 'Checking…' : 'Check now'}</button>\n <span class=\"tc-muted ph\">Last checked ${when(status.checkedAt)}</span>\n </p>\n ${this.renderGoBack(status)}\n <p class=\"tc-muted\">Automatic checks can be turned off with <strong>update_check_enabled</strong> on the System tab of <a href=\"/admin/settings\">Settings</a>. Installing or removing an extension is done from <a href=\"/admin/extensions\">Extensions</a>.</p>\n ` : nothing}\n ${this.renderDialog(status)}\n `;\n }\n}\n\ncustomElements.define('k-admin-updates', Updates);\n"],"mappings":"OAAOA,MAAqB,yDACnBC,aAAMC,MAAe,iCACvB,wCACA,uCACA,sCACAC,MAAW,0DACTC,oBAAiBC,mBAAgBC,iBAAeC,oBAAaC,mBAAgBC,MAAqB,gBAmB3G,MAEMC,EAAmB,qBAEnBC,EAAOC,GAAUA,EAAQ,IAAIC,KAAKD,GAAOE,iBAAmB,QAE5DC,EAAQC,GAAM,IAAIC,QAAQC,GAAWC,WAAWD,EAASF,IAEzDI,EAAQ,CAACC,EAAGC,EAAKC,IAAS,GAAGF,KAAW,IAANA,EAAUC,EAAMC,IAElDC,EAAQ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EzCA,EAAO,iEAAmE,gBAAgB9E,EAAMsB,KAAK,YAAY3E,KAAKmG,kBAAkB7G;YACtJgF,EAAOpB,OAAS/F,CAAI,2EAA2EmH,EAAOK,KAAK,2DAA6DvH;YACxKqH,EAAWtH,CAAI,yMAA2MC;YAC1N+K,GAAQ7I,EAAO4E,QAAQE,aAAejH,CAAI,kLAAoLC;;;;KAKxO,CAEA,MAAA0L,GACE,MAAMxJ,EAASU,KAAKV,OACpB,GAAGU,KAAKR,MAAO,OAAOrC,CAAI,qCAAqC6C,KAAKR,YACpE,IAAIF,EAAQ,OAAOnC,CAAI,0BACvB,MAAMkG,EAAQrD,KAAKS,UAAUnB,GAC7B,OAAOnC,CAAI;QACQ,SAAf6C,KAAKN,MAAmBM,KAAK4F,aAAexI;QAC5C4C,KAAKL,QAAUK,KAAKkG,gBAAkB9I;QACvB,SAAf4C,KAAKN,MAAmBvC,CAAI;UAC1B6C,KAAKgI,WAAW1I;UAChBU,KAAKqI,eAAe/I;UACpBA,EAAO6D,OAASnD,KAAKwH,aAAalI,GAAW+D,EAAMH,OAASlD,KAAK0H,gBAAgBpI,GAAUU,KAAK+H;UAChGzI,EAAO2D,YAAc3D,EAAO4B,kBAAkB+B,WAAa9F,CAAI,+DAA+DmC,EAAO2D,YAAc3D,EAAO4B,iBAAiB+B,iBAAmB7F;;8BAE1K4C,KAAKP,mBAAmBO,KAAK+C,SAAS/C,KAAKP,SAAW,YAAc;mDAC/C5B,EAAKyB,EAAOyJ;;UAErD/I,KAAKkI,aAAa5I;;QAElBlC;QACF4C,KAAK6I,aAAavJ;KAExB,EAGF0J,eAAeC,OAAO,kBAAmB7J","ignoreList":[]}
|
package/docker/entrypoint.mjs
CHANGED
|
@@ -50,6 +50,7 @@ const goBack = async reason => {
|
|
|
50
50
|
try {
|
|
51
51
|
say('Restoring the database from the backup taken before the update.');
|
|
52
52
|
await restoreDatabase(result.dbBackup);
|
|
53
|
+
say('The database was restored.');
|
|
53
54
|
} catch(error) {
|
|
54
55
|
say(`The database could not be restored (${error.message}). The backup is at ${result.dbBackup}.`);
|
|
55
56
|
}
|
|
@@ -67,6 +68,7 @@ if(switched){
|
|
|
67
68
|
try {
|
|
68
69
|
say('Restoring the database from the backup taken before the update.');
|
|
69
70
|
await restoreDatabase(switched.dbBackup);
|
|
71
|
+
say('The database was restored.');
|
|
70
72
|
} catch(error) {
|
|
71
73
|
say(`The database could not be restored (${error.message}). The backup is at ${switched.dbBackup}.`);
|
|
72
74
|
}
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import { getCurrent, paths, readState } from './siteLayout.js';
|
|
|
5
5
|
/*
|
|
6
6
|
What "Go back" would do right now, worked out in one place so that what the Updates screen says and what the server does
|
|
7
7
|
cannot differ. It is not offered while a switch is still proving itself (the site is a minute old and its record of what
|
|
8
|
-
it came from is not final), or when there is no earlier version, or straight after a rollback (the earlier version is then
|
|
8
|
+
it came from is not final), or when there is no earlier version, or straight after a rollback, whether by hand or because the new version failed (the earlier version is then
|
|
9
9
|
the one that was just left, and "going back" would be a confusing way to say "update again"). It restores the database
|
|
10
10
|
only when the update being undone changed data and its backup is still there.
|
|
11
11
|
*/
|
|
@@ -23,7 +23,7 @@ export default siteRoot => {
|
|
|
23
23
|
plan.reason = 'There is no earlier version to go back to';
|
|
24
24
|
return plan;
|
|
25
25
|
}
|
|
26
|
-
if(last?.kind === 'rollback'){
|
|
26
|
+
if(last?.kind === 'rollback' || last?.ok === false){
|
|
27
27
|
plan.reason = 'The site has just gone back, so there is nothing newer to go back from. To move forward again, update it.';
|
|
28
28
|
return plan;
|
|
29
29
|
}
|
|
@@ -176,7 +176,7 @@ export const rollBack = ({ siteRoot, reason }) => {
|
|
|
176
176
|
|
|
177
177
|
swapIn({ siteRoot, sw: { id: previous.id, version: previous.version, source, from: { id: current.id, version: current.version } } });
|
|
178
178
|
restoreFiles({ siteRoot, backup: sw?.filesBackup });
|
|
179
|
-
writeState(siteRoot, 'last', { ok: false, from: current.version, to: previous.version, reason, at: new Date().toISOString(), dbBackup: sw?.dbBackup ?? null });
|
|
179
|
+
writeState(siteRoot, 'last', { ok: false, kind: 'rollback', from: current.version, to: previous.version, packages: sw?.packages ?? [], breaking: Boolean(sw?.breaking), reason, at: new Date().toISOString(), dbBackup: sw?.dbBackup ?? null });
|
|
180
180
|
clearState(siteRoot, 'switch');
|
|
181
181
|
return { ok: true, from: current.version, to: previous.version, dbBackup: sw?.dbBackup ?? null };
|
|
182
182
|
};
|