Skip to content

A self-hosted dashboard that puts all your feeds in one place

Add withAllowInsecure func

Svilen Markov96f70f8ea4ba
diff --git a/internal/glance/widget-custom-api.go b/internal/glance/widget-custom-api.go
index 3c2ca75..c70d5c2 100644
--- a/internal/glance/widget-custom-api.go
+++ b/internal/glance/widget-custom-api.go
@@ -659,6 +659,20 @@ var customAPITemplateFuncs = func() template.FuncMap {
req.BodyType = "string"
return req
},
+ "withAllowInsecure": func(val any, req *CustomAPIRequest) *CustomAPIRequest {
+ switch v := val.(type) {
+ case bool:
+ req.AllowInsecure = v
+ case string:
+ if strings.ToLower(v) == "true" {
+ req.AllowInsecure = true
+ }
+ default:
+ slog.Warn("withAllowInsecure called with non-boolean value, must be string or bool", "value", v)
+ }
+
+ return req
+ },
"getResponse": func(req *CustomAPIRequest) *customAPIResponseData {
err := req.initialize()
if err != nil {