aboutsummaryrefslogtreecommitdiff
path: root/util.go
diff options
context:
space:
mode:
authorTim Keller <tjk@tjkeller.xyz>2026-05-17 00:29:39 -0500
committerTim Keller <tjk@tjkeller.xyz>2026-05-17 00:29:39 -0500
commitd4f8fc15b7e6a2204e8dda92a083684d93a5fa59 (patch)
tree74196a63e31a244170c2e35863e655af8b06d008 /util.go
parent1316aa7ca5e1668bbb7967264540bff3c8dbef86 (diff)
downloadembedtube-d4f8fc15b7e6a2204e8dda92a083684d93a5fa59.tar.xz
embedtube-d4f8fc15b7e6a2204e8dda92a083684d93a5fa59.zip
refactor some and client side support for new api + cleanup client code and fix some server bugs
Diffstat (limited to 'util.go')
-rw-r--r--util.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/util.go b/util.go
index 6381bff..55077b8 100644
--- a/util.go
+++ b/util.go
@@ -5,6 +5,7 @@ import (
"html/template"
"log"
"net/http"
+ "strconv"
)
func reloadTemplate(t **template.Template, files ...string) error {
@@ -23,3 +24,12 @@ func templateError(err error, w http.ResponseWriter) {
http.Error(w, msg, http.StatusInternalServerError)
log.Println(msg)
}
+
+
+func AtoiOrZero(s string) int {
+ i, err := strconv.Atoi(s)
+ if err != nil {
+ return 0
+ }
+ return i
+}