dsh-unlag 1.9.62 → 1.9.64

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 +25 -4
  2. package/package.json +1 -1
package/client.js CHANGED
@@ -219,7 +219,15 @@ window.__ModuleLoader__.load({
219
219
  held('verify');
220
220
  return 'blocked';
221
221
  }
222
- if (!response.ok) {
222
+ // The answer is read outside the try above, and a page shares one `fetch` with every plugin:
223
+ // an answer that cannot say whether it is ok is treated as no answer, never as a throw.
224
+ let served = false;
225
+ try {
226
+ served = response?.ok === true;
227
+ } catch {
228
+ served = false;
229
+ }
230
+ if (served === false) {
223
231
  held('verify');
224
232
  return 'blocked';
225
233
  }
@@ -556,9 +564,22 @@ window.__ModuleLoader__.load({
556
564
  function reloadFreshPage() {
557
565
  const graph = window.__DSH_BOOT__;
558
566
  const stamp = typeof graph?.rev === 'string' && graph.rev !== '' ? graph.rev : String(Date.now());
559
- const target = new URL(location.href);
560
- target.searchParams.set('interface', stamp);
561
- 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
+ }
562
583
  }
563
584
 
564
585
  /** A window the user still has open would go away with the rebuild. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.62",
3
+ "version": "1.9.64",
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",