Skip to content

feat(admin): themes installer + switcher + child theme override - #482

Merged
tayebmokni merged 2 commits into
mainfrom
feat/themes-menus-admin
May 26, 2026
Merged

feat(admin): themes installer + switcher + child theme override#482
tayebmokni merged 2 commits into
mainfrom
feat/themes-menus-admin

Conversation

@tayebmokni

Copy link
Copy Markdown
Contributor

Closes #13, #18, #65, #46.

Themes admin:

  • Theme installer endpoint + admin UI (.gntheme ZIP upload + manifest validation)
  • Theme switcher UI listing installed themes + Activate
  • Themes umbrella page combining install + switch
  • Child theme override walks parent → child search path

(Menus model + builder + Navigation block resolution from #54 is left for a follow-up — partial commit only.)

🤖 Generated with Claude Code

tib0o0o and others added 2 commits May 26, 2026 13:14
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>
@tayebmokni
tayebmokni enabled auto-merge (squash) May 26, 2026 17:33
@tayebmokni
tayebmokni merged commit 7dc8a0f into main May 26, 2026
12 of 15 checks passed
@tayebmokni
tayebmokni deleted the feat/themes-menus-admin branch May 26, 2026 17:41
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.

Theme installer (zip upload, manifest validation)

2 participants