feat(custom): custom sidebar items

This commit is contained in:
Aaron Liu
2025-07-15 10:41:13 +08:00
parent 3cda4d1ef7
commit ca57ca1ba0
5 changed files with 28 additions and 9 deletions

View File

@@ -198,6 +198,8 @@ type (
LibRawThumbPath(ctx context.Context) string
// CustomProps returns the custom props settings.
CustomProps(ctx context.Context) []types.CustomProps
// CustomNavItems returns the custom nav items settings.
CustomNavItems(ctx context.Context) []CustomNavItem
}
UseFirstSiteUrlCtxKey = struct{}
)
@@ -225,6 +227,14 @@ type (
}
)
func (s *settingProvider) CustomNavItems(ctx context.Context) []CustomNavItem {
raw := s.getString(ctx, "custom_nav_items", "[]")
var items []CustomNavItem
if err := json.Unmarshal([]byte(raw), &items); err != nil {
return []CustomNavItem{}
}
return items
}
func (s *settingProvider) CustomProps(ctx context.Context) []types.CustomProps {
raw := s.getString(ctx, "custom_props", "[]")
var props []types.CustomProps