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:
@@ -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))
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user