dsh-unlag 1.9.63 → 1.9.65

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.
Files changed (2) hide show
  1. package/client.js +33 -9
  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: '读不到启动信息', slow: '启动信息读得太慢', row: '启动信息不完整', src: '启动脚本没有地址', graph: '已装插件清单读不到', plugin: '有插件已不在运行', script: '启动脚本读不到', empty: '启动脚本是空的', covers: '启动脚本缺插件', parse: '启动脚本内容不完整', size: '启动脚本太大', 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', size: 'a startup script is too large', verify: 'the plugin is not answering' };
18
+ ? { list: '读不到启动信息', slow: '启动信息读得太慢', row: '启动信息不完整', src: '启动脚本没有地址', graph: '已装插件清单读不到', plugin: '有插件已不在运行', script: '启动脚本读不到', empty: '启动脚本是空的', covers: '启动脚本缺插件', parse: '启动脚本内容不完整', size: '启动脚本太大', verify: '插件后端没有应答', screen: '页面状态读不到' }
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', size: 'a startup script is too large', verify: 'the plugin is not answering', screen: 'the page state cannot be read' };
20
20
 
21
21
  /** The last reason a readiness check refused for, or null after a check that passed. */
22
22
  let holdReason = null;
@@ -564,9 +564,22 @@ window.__ModuleLoader__.load({
564
564
  function reloadFreshPage() {
565
565
  const graph = window.__DSH_BOOT__;
566
566
  const stamp = typeof graph?.rev === 'string' && graph.rev !== '' ? graph.rev : String(Date.now());
567
- const target = new URL(location.href);
568
- target.searchParams.set('interface', stamp);
569
- window.location.replace(target.toString());
567
+ // The address is the page's own; a document whose address cannot be parsed still has to come
568
+ // back as a fresh one, because the code behind it has already been replaced.
569
+ let target = null;
570
+ try {
571
+ const parsed = new URL(location.href);
572
+ parsed.searchParams.set('interface', stamp);
573
+ target = parsed.toString();
574
+ } catch {
575
+ target = null;
576
+ }
577
+ try {
578
+ if (target !== null) window.location.replace(target);
579
+ else window.location.reload?.();
580
+ } catch {
581
+ // The page is going away either way; the press has already reported what it replaced.
582
+ }
570
583
  }
571
584
 
572
585
  /** A window the user still has open would go away with the rebuild. */
@@ -598,10 +611,21 @@ window.__ModuleLoader__.load({
598
611
  */
599
612
  async function prepareInterface() {
600
613
  if (!(await startupLooksServable())) return 'blocked';
601
- if (screenHasOpenWindow()) return 'dialog';
602
- await commitFocusedField();
603
- const ready = await otherPluginsAreReady();
604
- if (!ready || stillHeldBack()) return 'unsaved';
614
+ /**
615
+ * Everything below reads the page itself: the document, the events it answers, the fields it
616
+ * holds. A page that cannot be read is not a page that can be left running behind a fresh
617
+ * document, and a throw here would end the press as a failure with no reason on screen, so
618
+ * an unreadable page holds the rebuild and says so.
619
+ */
620
+ try {
621
+ if (screenHasOpenWindow()) return 'dialog';
622
+ await commitFocusedField();
623
+ const ready = await otherPluginsAreReady();
624
+ if (!ready || stillHeldBack()) return 'unsaved';
625
+ } catch {
626
+ held('screen');
627
+ return 'blocked';
628
+ }
605
629
  return null;
606
630
  }
607
631
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.63",
3
+ "version": "1.9.65",
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",