dsh-unlag 1.9.20 → 1.9.22

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 +9 -1
  2. package/index.js +6 -0
  3. package/package.json +1 -1
package/client.js CHANGED
@@ -606,7 +606,15 @@ window.__ModuleLoader__.load({
606
606
  : BUTTON_STYLE;
607
607
 
608
608
  const onClick = async () => {
609
- if (pending || pressInFlight) return;
609
+ // A press already running is joined, and the press that joined says so instead of nothing.
610
+ if (pressInFlight) {
611
+ setNotice(COPY.applying);
612
+ return;
613
+ }
614
+ if (pending) {
615
+ setNotice(COPY.applying);
616
+ return;
617
+ }
610
618
  // A press the page already answered is not answered twice. Saying so beats a dead button.
611
619
  if (Date.now() - stampRead() < 3000) { // ui-copy-ignore
612
620
  setNotice(COPY.applying);
package/index.js CHANGED
@@ -1521,6 +1521,12 @@ function serveButton(ctx, controller, config) {
1521
1521
  try {
1522
1522
  const method = String(req?.method ?? 'GET').toUpperCase()
1523
1523
  if (method !== 'POST') return sendJson(res, 405, { status: 'method' })
1524
+ /**
1525
+ * A page on any site can post to a local address without asking first, and a log is
1526
+ * evidence: a made-up outcome must not get in. The header the page's own script sends
1527
+ * makes the request one a browser has to ask about first, and this app never agrees.
1528
+ */
1529
+ if (typeof req?.headers?.[BUTTON_HEADER] !== 'string') return sendJson(res, 403, { status: 'forbidden' })
1524
1530
  let query = ''
1525
1531
  try {
1526
1532
  query = new URL(String(req?.url ?? ''), 'http://x').searchParams.toString()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.20",
3
+ "version": "1.9.22",
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",