Skip to content

fix(server-root): skip landing-page seeding in --public mode (#578) - #579

Merged
melvincarvalho merged 2 commits into
gh-pagesfrom
issue-578-public-no-seed
Jul 2, 2026
Merged

fix(server-root): skip landing-page seeding in --public mode (#578)#579
melvincarvalho merged 2 commits into
gh-pagesfrom
issue-578-public-no-seed

Conversation

@melvincarvalho

Copy link
Copy Markdown
Contributor

Closes #578.

Problem

Since #433/#435, startup seeds /index.html, /.acl, and /index.html.acl into DATA_ROOT — including in --public mode, where WAC is bypassed (the seeded ACLs are never consulted) and the page's HEAD-adaptive Sign up / Sign in is meaningless without auth. For the serve-a-directory use case --public was created for (#107, the servejss foundation), this wrote three files into the user's project directory, regressing servejss's "like npx serve" behaviour.

Fix

Gate the seedServerRoot onReady hook on !options.public, alongside the existing read-only skip. Operators who want a landing page in public mode can still hand-create /index.html — skip-if-exists already honours it. Non-public modes are unchanged.

Tests

New suite in test/server-root.test.js:

  • public mode seeds none of /index.html, /.acl, /index.html.acl into the served tree
  • GET / serves the container listing and existing files remain readable

Verified end-to-end with jss start --root <dir> --public: served directory stays untouched, PUT still works. Full suite: 991 pass / 0 fail.

--public bypasses WAC, so the seeded /.acl and /index.html.acl are
never consulted, and the page's HEAD-adaptive Sign up/Sign in (#435)
is meaningless without auth. Seeding also wrote three files into the
served directory for the serve-a-directory use case --public was
created for (#107, servejss), regressing its 'like npx serve'
behaviour.

Skip seedServerRoot when options.public is set, alongside the
existing read-only skip. Operators can still hand-create /index.html
(skip-if-exists honours it).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request fixes --public mode behavior by preventing the server-root landing page seeding logic from writing index.html and ACL files into the served directory, aligning --public with its “serve a directory without mutating it” use case.

Changes:

  • Skip the seedServerRoot onReady hook when options.public is enabled (in addition to the existing readOnly skip).
  • Add regression tests ensuring public mode does not seed /index.html, /.acl, or /index.html.acl.
  • Add a public-mode test asserting GET / returns a container listing and existing files remain readable.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/server.js Gates server-root landing page seeding on !options.public to avoid mutating the served tree in public mode.
test/server-root.test.js Adds a dedicated suite verifying public mode skips seeding and still serves container listings and files.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@melvincarvalho
melvincarvalho merged commit ec8547b into gh-pages Jul 2, 2026
1 check passed
@melvincarvalho
melvincarvalho deleted the issue-578-public-no-seed branch July 2, 2026 00:30
melvincarvalho added a commit that referenced this pull request Jul 2, 2026
Changes since 0.0.210:
- fix(nostr): reconcile JWK key path to accept both Y-parities (#571) (#577)
- fix(server-root): skip landing-page seeding in --public mode — --public
  no longer writes /index.html, /.acl, /index.html.acl into the served
  directory, restoring serve-like behaviour for servejss (#578) (#579)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--public mode seeds the server-root landing page into the served directory (namespace pollution for servejss / serve use case)

2 participants