dsh-unlag 1.9.76 → 1.9.78

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 (3) hide show
  1. package/client.js +13 -4
  2. package/index.js +7 -0
  3. package/package.json +1 -1
package/client.js CHANGED
@@ -100,15 +100,23 @@ window.__ModuleLoader__.load({
100
100
  */
101
101
  const HOST_BASE = '/dsh-unlag'; // ui-copy-ignore
102
102
 
103
- async function readSettings() {
103
+ async function readSettings(attempt = 0) {
104
+ const again = async () => {
105
+ if (attempt >= 1) return null;
106
+ await new Promise((resolve) => setTimeout(resolve, 250)); // ui-copy-ignore
107
+ return readSettings(attempt + 1);
108
+ };
104
109
  try {
110
+ // The answer can be missing for a moment while the plugin set is recomposed, which reads
111
+ // exactly like a press with nothing switched on. One more ask costs a fraction of a second
112
+ // and turns that into the press the person meant; a second miss is still reported as such.
105
113
  const response = await withTimeout(fetch(`${HOST_BASE}/state`, { cache: 'no-store', credentials: 'same-origin' }));
106
- if (!response.ok) return null;
114
+ if (!response.ok) return again();
107
115
  const data = await withTimeout(response.json());
108
- if (data === null || typeof data !== 'object') return null;
116
+ if (data === null || typeof data !== 'object') return again();
109
117
  return { plugins: data.plugins !== false, page: data.page !== false };
110
118
  } catch {
111
- return null;
119
+ return again();
112
120
  }
113
121
  }
114
122
 
@@ -918,6 +926,7 @@ window.__ModuleLoader__.load({
918
926
  */
919
927
  const PROBE = {
920
928
  prepareInterface,
929
+ readSettings,
921
930
  startupLooksServable,
922
931
  startupHoldReason: () => holdReason,
923
932
  noticeFor,
package/index.js CHANGED
@@ -1616,6 +1616,13 @@ function parseAsScript(body, name) {
1616
1616
  * @param rows the startup script addresses, as the next document would request them.
1617
1617
  */
1618
1618
  export async function verifyStartupRows(graph, fetchBody, rows, budgetMs = MAX_VERIFY_MS) {
1619
+ // A startup list is checked against the plugin set, so a set that cannot be read at all leaves
1620
+ // nothing to check against: approving anyway would vouch for addresses nothing backs, and the
1621
+ // next document would die on the first one that answers 404. An empty set is still a readable
1622
+ // one — a row it no longer names is served from the retained bundle and reported as left out.
1623
+ if (graph === null || typeof graph !== 'object' || !Array.isArray(graph.entries)) {
1624
+ return { status: 'blocked', reason: 'list', detail: 'the plugin list cannot be read, so no startup row can be checked against it' }
1625
+ }
1619
1626
  const entries = new Map(
1620
1627
  (Array.isArray(graph?.entries) ? graph.entries : [])
1621
1628
  .filter((row) => typeof row?.id === 'string' && row.id !== '')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.76",
3
+ "version": "1.9.78",
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",