feat(admin): themes installer + switcher + child theme override - #482
Merged
Conversation
Adds ResolveTemplate(name, SearchPath) and ResolveWithChild(req, SearchPath) to packages/go/theme/templates. SearchPath is an ordered list of ThemeFiles walked child-first; the first hit wins, matching the WordPress child-theme contract. Pure functions, no I/O, safe for concurrent use. Tests cover parent-only, child-only, child-overrides-parent, nil/empty search paths, precedence walk across both stores, and the ErrNoIndex / ErrUnknownRequestType propagation. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: Tayeb Mokni <tayeb.mokni@gmail.com>
API (apps/api/internal/admin/themes): - POST /api/v1/admin/themes/install — accepts .gntheme ZIP (raw or multipart), parses + validates theme.json, extracts atomically into themeDir/<slug>/ via a staging-dir rename. Rejects path traversal, symlinks, oversize entries, and zip bombs. - GET /api/v1/admin/themes — lists every directory under themeDir whose theme.json parses, plus the active slug from core.active_theme. - POST /api/v1/admin/themes/activate — switches the active theme after verifying the slug is installed on disk. Three sibling capabilities (install_themes / manage_themes / switch_themes) gate the routes. Admin UI: - /appearance/themes (#65) — umbrella page combining the gallery switcher and the drag-drop installer. Optimistic activate, live re-fetch after install. Empty-state encourages dropping a .gntheme. - /appearance/install (#13) — deep-link installer that redirects to the umbrella page on success. - Sidebar "Appearance" entry now points at /appearance/themes. Tests cover nested + flat archive layouts, missing/invalid manifests, existing-theme conflicts, path traversal, oversized uploads, and the inventory walk (skip broken / hidden directories). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: Tayeb Mokni <tayeb.mokni@gmail.com>
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 #13, #18, #65, #46.
Themes admin:
(Menus model + builder + Navigation block resolution from #54 is left for a follow-up — partial commit only.)
🤖 Generated with Claude Code