Documentation
¶
Overview ¶
Package store persists generated themes on disk: one directory per theme under THEMES_DIR, a theme.json manifest, and stdlib zip archives for download and manual THEME_DIR installs.
Index ¶
- type Store
- func (s *Store) Delete(_ context.Context, name string) error
- func (s *Store) Get(_ context.Context, name string) (themegendomain.Theme, error)
- func (s *Store) Install(_ context.Context, theme themegendomain.Theme) error
- func (s *Store) List(_ context.Context) ([]themegendomain.InstalledTheme, error)
- func (s *Store) Zip(_ context.Context, name string) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store is the filesystem ThemeStore: root is THEMES_DIR, activeName resolves the [theme] active value for list markers and delete guards, and themeDirOverride resolves the raw THEME_DIR value so the live manual override target is listed active and cannot be deleted.
func NewStore ¶
NewStore builds the filesystem store rooted at root (THEMES_DIR). activeName resolves the [theme] active value; nil disables active markers. themeDirOverride resolves the raw THEME_DIR value; nil disables the manual override guard.
func (*Store) Delete ¶
Delete removes an installed theme. The active theme and the live THEME_DIR target cannot be deleted; deactivate or unset first.
func (*Store) Install ¶
Install persists a validated theme as inactive. It validates the name and files again (defense in depth), refuses collisions, minifies the CSS (a minify failure keeps the original for the validator to report), enforces zip-slip protection via the allowlist, and writes theme.json last.
func (*Store) List ¶
func (s *Store) List(_ context.Context) ([]themegendomain.InstalledTheme, error)
List returns every installed theme: generated (manifest) plus manually dropped dirs (no manifest → source manual, best-effort edition).