Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
37e4954
Merge remote-tracking branch 'origin/master' into feat/043-theme-web
claude Nov 27, 2026
39ff55c
feat(web): theme catalog, detail, sources and installed themes (spec …
claude Nov 27, 2026
ccfe452
Merge branch 'feat/043-gp-module-theme' into feat/043-theme-web
claude Nov 27, 2026
689c6b1
Merge branch 'feat/043-gp-module-theme' into feat/043-theme-web
claude Nov 27, 2026
ae1e262
Merge branch 'feat/043-gp-module-theme' into feat/043-theme-web
claude Nov 27, 2026
64fc4f1
Merge branch 'feat/043-gp-module-theme' into feat/043-theme-web
claude Nov 27, 2026
59d563c
Merge branch 'feat/043-gp-module-theme' into feat/043-theme-web
claude Nov 27, 2026
7a03e57
Merge branch 'feat/043-gp-module-theme' into feat/043-theme-web
claude Nov 27, 2026
04b09ac
Merge branch 'feat/043-gp-module-theme' into feat/043-theme-web
claude Nov 27, 2026
6f5a4f3
Merge branch 'feat/043-gp-module-theme' into feat/043-theme-web
claude Nov 27, 2026
74d5896
Merge branch 'feat/043-gp-module-theme' into feat/043-theme-web
claude Nov 27, 2026
9e25154
fix(api): theme sources name an admin-made credential Secret, like mo…
claude Nov 27, 2026
a8e3018
test(api): cover theme credential Secret reads, legacy field, duplica…
claude Nov 27, 2026
3e04f83
Merge remote-tracking branch 'origin/master' into feat/043-theme-web
claude Nov 27, 2026
5a2422a
Merge branch 'fix/043-theme-credential-secret' into feat/043-theme-web
claude Nov 27, 2026
8997348
feat(web): theme source dialog names a credential Secret, like module…
claude Nov 27, 2026
d80787f
docs(changelog): theme marketplace dashboard entry
claude Nov 27, 2026
c0fdfcc
fix(web): keep the theme preview on across pages, as in the design
claude Nov 27, 2026
5d275fa
fix(api): drop the unused sourceSpecOf helper
claude Nov 27, 2026
969cddc
Merge branch 'fix/043-theme-credential-secret' into feat/043-theme-web
claude Nov 27, 2026
f49ec0a
fix(web): translate theme page literals and read the clock outside re…
claude Nov 27, 2026
3ffd534
test(web): find the remove confirmation by its alertdialog role
claude Nov 27, 2026
02ad74c
fix(web): address review findings on the theme pages
claude Nov 27, 2026
cd651d0
fix(web): rely on the safe mode session flag instead of a module flag
claude Nov 27, 2026
8eacd58
refactor(web): use HeroUI Button, ToggleButton and Table on the theme…
claude Nov 27, 2026
d18fc5e
fix(web): style the selected catalog tag like the design
claude Nov 27, 2026
9b9c1dd
test(web): cover the theme preview banner, source dialog and sources …
claude Nov 27, 2026
d271d8e
fix(web): keep theme previews and installed picks consistent; documen…
claude Nov 27, 2026
0655c9b
docs: full theme marketplace sections in api and web specs (T057)
claude Nov 27, 2026
94a7cb9
fix(web): end a theme preview on the first edit, not on a dirty flip
claude Nov 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 37 additions & 33 deletions api/internal/handlers/theme_sources.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,67 +19,71 @@ import (

// themeSourceHandler serves the admin theme source routes (spec 043,
// contracts/themes-api.md, "Theme sources"). The RBAC table admits them only with
// themes:manage. Credentials are never returned: the list and write responses
// carry no credential field, and the stored reference is not part of the item.
// themes:manage. A source names an admin-made credential Secret by name
// (credentialSecret, like a ModuleSource secretRef); responses show that name
// and never the Secret's values.
type themeSourceHandler struct {
store *db.Store
svc *themes.Service
}

// themeSourceBody is the POST and PUT request. Unknown fields are refused. On PUT
// the name comes from the path and the body name is ignored. Credential is kept
// as raw JSON so an absent field (keep, or none on create) and a JSON null (clear,
// on PUT) can be told apart.
// the name comes from the path and the body name is ignored. CredentialSecret is
// kept as raw JSON so an absent field (keep, or none on create) and a JSON null
// (clear, on PUT) can be told apart.
type themeSourceBody struct {
Name string `json:"name"`
Type string `json:"type"`
Spec json.RawMessage `json:"spec"`
Credential json.RawMessage `json:"credential"`
Verify json.RawMessage `json:"verify"`
RefreshInterval *int `json:"refreshInterval"`
Enabled *bool `json:"enabled"`
Name string `json:"name"`
Type string `json:"type"`
Spec json.RawMessage `json:"spec"`
CredentialSecret json.RawMessage `json:"credentialSecret"`
Verify json.RawMessage `json:"verify"`
RefreshInterval *int `json:"refreshInterval"`
Enabled *bool `json:"enabled"`
}

// themeSourceItem is one source as the admin API shows it. Builtin marks the
// reserved official source, which can be disabled but not deleted.
type themeSourceItem struct {
Name string `json:"name"`
Type string `json:"type"`
Spec json.RawMessage `json:"spec"`
Verify json.RawMessage `json:"verify"`
RefreshInterval int `json:"refreshInterval"`
Enabled bool `json:"enabled"`
Builtin bool `json:"builtin"`
LastSyncAt *string `json:"lastSyncAt"`
LastError *string `json:"lastError"`
ThemeCount int `json:"themeCount"`
Name string `json:"name"`
Type string `json:"type"`
Spec json.RawMessage `json:"spec"`
Verify json.RawMessage `json:"verify"`
// CredentialSecret is the name of the credential Secret, or null for none.
CredentialSecret *string `json:"credentialSecret"`
RefreshInterval int `json:"refreshInterval"`
Enabled bool `json:"enabled"`
Builtin bool `json:"builtin"`
LastSyncAt *string `json:"lastSyncAt"`
LastError *string `json:"lastError"`
ThemeCount int `json:"themeCount"`
}

// settings converts the request body to the service input.
func (b themeSourceBody) settings() themes.SourceSettings {
return themes.SourceSettings{
Type: b.Type,
Spec: b.Spec,
Credential: b.Credential,
CredentialSecret: b.CredentialSecret,
Verify: b.Verify,
RefreshIntervalS: b.RefreshInterval,
Enabled: b.Enabled,
}
}

// sourceItemOf renders a stored source. The spec and policy are the canonical
// JSON the service wrote; no credential reference is included.
// JSON the service wrote; the credential Secret is shown by name only.
func sourceItemOf(src db.ThemeSource) themeSourceItem {
item := themeSourceItem{
Name: src.Name,
Type: src.Type,
Spec: json.RawMessage(src.Spec),
RefreshInterval: src.RefreshIntervalS,
Enabled: src.Enabled,
Builtin: src.Name == themes.OfficialSourceName,
LastSyncAt: src.LastSyncAt,
LastError: src.LastError,
ThemeCount: src.ThemeCount,
Name: src.Name,
Type: src.Type,
Spec: json.RawMessage(src.Spec),
CredentialSecret: src.CredentialRef,
RefreshInterval: src.RefreshIntervalS,
Enabled: src.Enabled,
Builtin: src.Name == themes.OfficialSourceName,
LastSyncAt: src.LastSyncAt,
LastError: src.LastError,
ThemeCount: src.ThemeCount,
}
if src.Verify != nil {
item.Verify = json.RawMessage(*src.Verify)
Expand Down
Loading
Loading