dsh-unlag 1.9.26 → 1.9.28
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.
- package/client.js +4 -3
- package/index.js +18 -2
- package/package.json +1 -1
package/client.js
CHANGED
|
@@ -15,8 +15,8 @@ window.__ModuleLoader__.load({
|
|
|
15
15
|
* repeating one generic sentence.
|
|
16
16
|
*/
|
|
17
17
|
const REASONS = zh
|
|
18
|
-
? { list: '读不到启动信息', row: '启动信息不完整', src: '启动脚本没有地址', graph: '已装插件清单读不到', plugin: '有插件已不在运行', script: '启动脚本读不到', empty: '启动脚本是空的', covers: '启动脚本缺插件', parse: '启动脚本内容不完整', verify: '插件后端没有应答' }
|
|
19
|
-
: { list: 'startup info is unavailable', row: 'startup info is incomplete', src: 'a startup script has no address', graph: 'the plugin list cannot be read', plugin: 'a plugin is no longer running', script: 'a startup script cannot be read', empty: 'a startup script is empty', covers: 'a startup script misses a plugin', parse: 'a startup script is incomplete', verify: 'the plugin is not answering' };
|
|
18
|
+
? { list: '读不到启动信息', slow: '启动信息读得太慢', row: '启动信息不完整', src: '启动脚本没有地址', graph: '已装插件清单读不到', plugin: '有插件已不在运行', script: '启动脚本读不到', empty: '启动脚本是空的', covers: '启动脚本缺插件', parse: '启动脚本内容不完整', verify: '插件后端没有应答' }
|
|
19
|
+
: { list: 'startup info is unavailable', slow: 'the startup list answered too slowly', row: 'startup info is incomplete', src: 'a startup script has no address', graph: 'the plugin list cannot be read', plugin: 'a plugin is no longer running', script: 'a startup script cannot be read', empty: 'a startup script is empty', covers: 'a startup script misses a plugin', parse: 'a startup script is incomplete', verify: 'the plugin is not answering' };
|
|
20
20
|
|
|
21
21
|
/** The last reason a readiness check refused for, or null after a check that passed. */
|
|
22
22
|
let holdReason = null;
|
|
@@ -245,7 +245,7 @@ window.__ModuleLoader__.load({
|
|
|
245
245
|
network: 'script', // ui-copy-ignore
|
|
246
246
|
parse: 'parse', // ui-copy-ignore
|
|
247
247
|
register: 'plugin', // ui-copy-ignore
|
|
248
|
-
slow: '
|
|
248
|
+
slow: 'slow', // ui-copy-ignore
|
|
249
249
|
dependencies: 'covers',
|
|
250
250
|
list: 'list', // ui-copy-ignore
|
|
251
251
|
};
|
|
@@ -749,6 +749,7 @@ window.__ModuleLoader__.load({
|
|
|
749
749
|
prepareInterface,
|
|
750
750
|
startupLooksServable,
|
|
751
751
|
startupHoldReason: () => holdReason,
|
|
752
|
+
noticeFor,
|
|
752
753
|
frozenStartupLooksServable,
|
|
753
754
|
desktopStartupPayload,
|
|
754
755
|
desktopShellPresent,
|
package/index.js
CHANGED
|
@@ -31,6 +31,12 @@ export const inject = ['webServer']
|
|
|
31
31
|
|
|
32
32
|
/** A transaction that has not finished in this long is stuck; the press reports it instead of hanging. */
|
|
33
33
|
const RELOAD_TIMEOUT_MS = 20_000
|
|
34
|
+
/**
|
|
35
|
+
* How long a press waits for an answer before it is told the update is still applying. The page
|
|
36
|
+
* gives up on its own request sooner than the update may take, and a press that ends in "did not
|
|
37
|
+
* finish" while the plugin set is still being replaced is a lie the person cannot check.
|
|
38
|
+
*/
|
|
39
|
+
const RELOAD_ANSWER_MS = 10_000
|
|
34
40
|
|
|
35
41
|
|
|
36
42
|
const LOG_PATH = join(homedir(), '.dsh', 'unlag-reload.log')
|
|
@@ -1667,8 +1673,18 @@ function serveButton(ctx, controller, config) {
|
|
|
1667
1673
|
if (method !== 'POST') return sendJson(res, 405, { status: 'method' })
|
|
1668
1674
|
if (buttonAllowed(req) === false) return sendJson(res, 403, { status: 'forbidden' })
|
|
1669
1675
|
if (!settings.reloadPlugins) return sendJson(res, 200, { status: 'off' })
|
|
1670
|
-
const
|
|
1671
|
-
|
|
1676
|
+
const limit = Number(process.env.DSH_UNLAG_ANSWER_MS ?? '') || RELOAD_ANSWER_MS
|
|
1677
|
+
let timer = null
|
|
1678
|
+
const stillApplying = new Promise((resolve) => {
|
|
1679
|
+
timer = setTimeout(() => resolve({ status: 'applying', warnings: [], pending: [], restartReason: null, failedEntries: [] }), limit)
|
|
1680
|
+
})
|
|
1681
|
+
try {
|
|
1682
|
+
const outcome = await Promise.race([controller.reloadNow(), stillApplying])
|
|
1683
|
+
if (outcome?.status === 'applying') log('the update outlasted the answer the page waits for: the press is told it is still applying')
|
|
1684
|
+
sendJson(res, 200, outcome)
|
|
1685
|
+
} finally {
|
|
1686
|
+
if (timer !== null) clearTimeout(timer)
|
|
1687
|
+
}
|
|
1672
1688
|
} catch (error) {
|
|
1673
1689
|
log(`cannot apply a plugin reload: ${error?.message ?? error}`)
|
|
1674
1690
|
sendJson(res, 500, { status: 'failed', detail: String(error?.message ?? error) })
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-unlag",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.28",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A press applies plugin edits right away and brings a laggy interface back; automatic reloading stays off unless you turn it on, so the press is the only trigger, and nothing restarts.",
|
|
6
6
|
"license": "MIT",
|