dsh-unlag 1.9.48 → 1.9.49

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 +8 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1672,9 +1672,13 @@ function serveButton(ctx, controller, config) {
1672
1672
  const handlers = [
1673
1673
  [
1674
1674
  `${BASE_PATH}/state`,
1675
- (_req, res) => {
1675
+ (req, res) => {
1676
1676
  // A disposed context answers with a status instead of a throw the server has to guess at.
1677
1677
  try {
1678
+ // These two are reads. Any other method is told so, the way the app's own bundle route
1679
+ // answers a method it does not serve.
1680
+ const method = String(req?.method ?? 'GET').toUpperCase()
1681
+ if (method !== 'GET' && method !== 'HEAD') return sendJson(res, 405, { status: 'method' })
1678
1682
  sendJson(res, 200, { version: VERSION, code: CODE_STAMP, plugins: settings.reloadPlugins, page: settings.reloadInterface, shim: bundleShimStatus(ctx) })
1679
1683
  } catch (error) {
1680
1684
  log(`cannot describe this copy of the plugin: ${error?.message ?? error}`)
@@ -1684,10 +1688,12 @@ function serveButton(ctx, controller, config) {
1684
1688
  ],
1685
1689
  [
1686
1690
  `${BASE_PATH}/graph`,
1687
- (_req, res) => {
1691
+ (req, res) => {
1688
1692
  // The page reads this before a rebuild; an answer that throws would leave the press with
1689
1693
  // no verdict at all, so the whole body is bounded and answers either way.
1690
1694
  try {
1695
+ const method = String(req?.method ?? 'GET').toUpperCase()
1696
+ if (method !== 'GET' && method !== 'HEAD') return sendJson(res, 405, { status: 'method' })
1691
1697
  ensureBundleShim(ctx)
1692
1698
  sendJson(res, 200, { graph: liveBootGraph(ctx) })
1693
1699
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-unlag",
3
- "version": "1.9.48",
3
+ "version": "1.9.49",
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",