feat: add force refresh button to source/collection cards

- Backend: preview handlers accept forceRefresh in request body
- Frontend: Sources & Collections cards get a refresh button that
  bypasses cache and re-fetches from remote
This commit is contained in:
2026-07-28 21:42:12 +08:00
parent feafb19714
commit 55ab656606
8 changed files with 95 additions and 40 deletions
+7
View File
@@ -620,6 +620,13 @@ func getMapValue(v any) map[string]any {
return map[string]any{}
}
func getBoolValue(v any) bool {
if b, ok := v.(bool); ok {
return b
}
return false
}
func getStringArray(v any) []string {
if arr, ok := v.([]any); ok {
result := make([]string, 0, len(arr))
+2
View File
@@ -183,6 +183,7 @@ func (d *Deps) HandlePreviewSource(c fiber.Ctx) error {
Target: "json",
Settings: settings,
RequestUserAgent: c.Get("User-Agent"),
ForceRefresh: getBoolValue(input["forceRefresh"]),
CacheRepo: d.CacheRepo,
ProxyURL: d.Cfg.Fetcher.ProxyURL,
})
@@ -212,6 +213,7 @@ func (d *Deps) HandlePreviewCollection(c fiber.Ctx) error {
TemplateConfig: d.getTemplateConfig(rec.TemplateId),
Settings: settings,
RequestUserAgent: c.Get("User-Agent"),
ForceRefresh: getBoolValue(input["forceRefresh"]),
CacheRepo: d.CacheRepo,
ProxyURL: d.Cfg.Fetcher.ProxyURL,
})