Skip to content

fix(plugins): /widgets/ serves only installed plugins (mrramam/HomeGlow#60) - #326

Merged
jherforth merged 1 commit into
mainfrom
fix/widgets-disk-fallback
Oct 25, 2026
Merged

jherforth merged 1 commit into
mainfrom
fix/widgets-disk-fallback

Conversation

@jherforth

Copy link
Copy Markdown
Owner

The last open part of mrramam#60. #319 already fixed the increment cap.

Problem

Two paths served files from server/widgets/ that aren't installed plugins:

  • The disk fallback in /widgets/:filename: a file with no row in the plugins table was read from disk. It skipped the manifest, so it got no plugin identity.
  • @fastify/static on server/widgets/ under /widgets/: this answered anything the route above doesn't match, such as /widgets/sub/page.html. It skipped the token and the frame scripts as well.

Migration 18 imported every pre-table file into the plugins table, so neither path serves anything on a real install. Both were reachable only by a file someone placed on disk.

Changes

  • /widgets/:filename serves only rows in the plugins table. Anything else answers 404, so every served page gets its token and frame scripts.
  • The static registration on server/widgets/ is removed.
  • Delete no longer unlinks a file on disk, since nothing serves one.
  • server/widgets/ stays. Migration 18 still reads it, and the Dockerfile creates it.
  • Docs: the widget-serving row in docs/architecture/plugin-platform.md.

Testing

  • New test in pluginStore.test.js: a file in server/widgets/ that isn't installed, a file in a subfolder, and the folder's README.md all answer 404, with none of their content. It fails on main with 200.
  • The legacy-import tests still pass: a pre-table file is imported by the migration and served from the database, including after the folder is wiped.
  • Server npm test: 627 pass.

🤖 Generated with Claude Code

The disk fallback in /widgets/:filename and the @fastify/static
registration on server/widgets/ served files that aren't in the plugins
table. The fallback skipped the manifest, and the static route skipped
the token and frame scripts as well. Migration 18 already imported every
pre-table file, so both were dead code for real installs, and reachable
only by a file placed on disk.

Delete no longer unlinks a file on disk either, since nothing serves one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jherforth jherforth self-assigned this Oct 25, 2026
@jherforth jherforth added the bug Something isn't working label Oct 25, 2026
@jherforth jherforth added this to the 1.11 milestone Oct 25, 2026
@jherforth
jherforth merged commit bdc2c0d into main Oct 25, 2026
6 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in HomeGlow Kanban Oct 25, 2026
adamecker pushed a commit to adamecker/HomeGlow that referenced this pull request Oct 25, 2026
@jherforth
jherforth deleted the fix/widgets-disk-fallback branch October 28, 2026 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant