Repository navigation
feat(server): --recipes-only shows guests only the recipes - #621
Merged
Merged
Conversation
`cook server --recipes-only` (or COOK_RECIPES_ONLY=1) keeps visitors who are not signed in to reading recipes and menus: no shopping list, pantry, editor, API docs, stats or sync, and a preferences page cut down to the language picker. Signed-in users keep everything their role allows. Without a users file nobody can sign in, so every visitor gets the recipes only, which makes a read-only public cookbook. The auth middleware decides it from an allowlist (`browses_recipes`), so a route added later stays hidden from guests by default. Anything else asks them to sign in (401 for the API, a redirect for pages), or answers 404 when sign-in is off. Files under /api/static are limited to pictures, so the shopping list and pantry files in the recipe directory stay out of reach. The guest's Viewer can do nothing, which removes the editing and shopping controls through the existing `can_*` guards, and the shopping list and pantry links are turned off for the request without touching the visitor's own cookie. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Collaborator
Author
|
@dubadub |
LeMyst
marked this pull request as ready for review
October 3, 2026 20:02
This was referenced Oct 7, 2026
LeMyst
added a commit
that referenced
this pull request
Oct 8, 2026
) The Preferences page listed the full paths of the aisle file, the pantry file and the recipe directory to anyone who could open it, which with sign-in on includes guests. That told any visitor the server's directory layout and, usually, the account it runs as. It came with the new UI in e200582; since #621 (d682b15) only `--recipes-only` blanked them. Admins still get the full paths; with sign-in off that is everyone, so a local server looks as before. Everyone else sees where a file is inside the recipe directory (`config/aisle.conf`), "Global configuration" for one outside it, and no Recipe Directory card. "Not configured" is now translated through the existing `pref-not-configured` key. Closes #637 Co-authored-by: myst <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
This was referenced Oct 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #620.
cook server --recipes-only(orCOOK_RECIPES_ONLY=1) keeps visitors who are not signed in to reading recipes and menus. Signed-in users keep everything their role allows. Without a users file nobody can sign in, so every visitor gets the recipes only, which makes a read-only public cookbook.The screenshots were taken as a guest of
cook server ./seed --recipes-only. The recipe page has no Shopping/Pantry pills and no Edit or Add to shopping list buttons, and the preferences page shows only the language picker.What a guest gets
Allowed:
/,/directory,/random,/recipe(recipes and menus),/preferences, the feeds,/static,GET /api/recipes…,/api/search, pictures under/api/static, and sign-in/out.Everything else:
401and pages redirect to/login?next=…;404.This covers
/api/static/.shopping-listand other non-picture files in the recipe directory.How
auth::middleware::browses_recipesis an allowlist, so a route added later stays hidden from guests by default. It runs in the existing auth middleware, right after theVieweris worked out. All routes stay registered, because signed-in users still need them.Viewer::limited_to_recipesapplies to anyone not signed in. Such a viewer can do nothing, so the existingcan_edit_lists()/can_edit_recipes()guards already hide every editing and shopping control.viewer.recipes_only()hides the remaining preferences sections and theg s/g pshortcuts.FeatureFlagsare switched off, which hides the Shopping/Pantry links. The visitor's own cookie is left as it was for when they sign in.docs/server.mdgets the option, the env var and a "Showing guests only the recipes" section.Tests
/api/staticfiles;COOK_RECIPES_ONLYvalues.tests/server_auth_test.rs:404and the pages carry no shopping/edit links;/api/menusto/api/recipes, which a guest can reach in every mode.cargo fmt,cargo clippy --all-targetsandcargo testall pass.🤖 Generated with Claude Code