A self-hosted dashboard that puts all your feeds in one place
Go aggregatordashboarddockerfeed-readergohomelabhomepagemonitoringredditrssrss-readerself-hostedstartpageyoutube
Simplify implementation of func
Svilen Markovbcef9fbd6183
diff --git a/internal/glance/widget-custom-api.go b/internal/glance/widget-custom-api.goindex d95d885..1d8bf2f 100644--- a/internal/glance/widget-custom-api.go+++ b/internal/glance/widget-custom-api.go@@ -414,14 +414,6 @@ func customAPIDoMathOp[T int | float64](a, b T, op string) T {return 0}return a / b- case "mod":- ai, bi := any(a), any(b)- aint, aok := ai.(int)- bint, bok := bi.(int)- if aok && bok && bint != 0 {- return T(aint % bint)- }- return 0}return 0}@@ -487,8 +479,11 @@ var customAPITemplateFuncs = func() template.FuncMap {"div": func(a, b any) any {return doMathOpWithAny(a, b, "div")},- "mod": func(a, b int) any {- return doMathOpWithAny(a, b, "mod")+ "mod": func(a, b int) int {+ if b == 0 {+ return 0+ }+ return a % b},"now": func() time.Time {return time.Now()