dsh-unlag 1.9.23 → 1.9.24

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/index.js +11 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -85,6 +85,13 @@ const DEFAULT_ROOTS = [join(homedir(), '.dsh', 'plugins')]
85
85
  const MAX_DEFERRALS = 40
86
86
  const MAX_STARTUP_ROWS = 64
87
87
  const MAX_STARTUP_ROW_CHARS = 4096
88
+
89
+ /**
90
+ * The most plugin ids one bundle address may name. A real startup list is far below this; a made-up
91
+ * address far above it would otherwise have the plugin read one body per id, and answering a request
92
+ * is work the request itself must not be able to grow without bound.
93
+ */
94
+ const MAX_BUNDLE_IDS = 128
88
95
  const MIN_INTERVAL_MS = 1500
89
96
  /** The route the app publishes client bundles under; the same key the module table registers. */
90
97
  const BUNDLE_ROUTE = '/plugins'
@@ -848,8 +855,10 @@ function bundleRequest(rawUrl) {
848
855
  id = id.endsWith('/client.js') ? id.slice(0, -'/client.js'.length) : id
849
856
  if (id !== '') ids.push(id)
850
857
  }
851
- if (ids.length === 0) return null
852
- return { ids, sourceMap, rev: revAt < 0 ? '' : rest.slice(revAt + '&rev='.length) }
858
+ if (ids.length === 0 || ids.length > MAX_BUNDLE_IDS) return null
859
+ // The same plugin twice in one address is one plugin: read its body once.
860
+ const unique = [...new Set(ids)]
861
+ return { ids: unique, sourceMap, rev: revAt < 0 ? '' : rest.slice(revAt + '&rev='.length) }
853
862
  }
854
863
 
855
864
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.23",
3
+ "version": "1.9.24",
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",