store

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2026 License: MIT Imports: 14 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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

func NewStore(root string, activeName func() string, themeDirOverride func() string) *Store

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

func (s *Store) Delete(_ context.Context, name string) error

Delete removes an installed theme. The active theme and the live THEME_DIR target cannot be deleted; deactivate or unset first.

func (*Store) Get

func (s *Store) Get(_ context.Context, name string) (themegendomain.Theme, error)

Get reads one installed theme back into a Theme value.

func (*Store) Install

func (s *Store) Install(_ context.Context, theme themegendomain.Theme) error

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

List returns every installed theme: generated (manifest) plus manually dropped dirs (no manifest → source manual, best-effort edition).

func (*Store) Zip

func (s *Store) Zip(_ context.Context, name string) ([]byte, error)

Zip builds the download archive: the theme dir at the archive root plus a generated README with the THEME_DIR install steps.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL