this is web code
Ted Unangst tedu@tedunangst.com
Thu, 31 Aug 2023 02:48:07 -0400
M
util.go
→
util.go
@@ -36,10 +36,8 @@ import (
"bufio" "crypto/rand" "crypto/rsa" - "crypto/sha512" "database/sql" "fmt" - "io/ioutil" "net" "os" "os/signal"@@ -52,23 +50,7 @@ "humungus.tedunangst.com/r/webs/httpsig"
"humungus.tedunangst.com/r/webs/login" ) -var savedassetparams = make(map[string]string) - var re_plainname = regexp.MustCompile("^[[:alnum:]_-]+$") - -func getassetparam(file string) string { - if p, ok := savedassetparams[file]; ok { - return p - } - data, err := ioutil.ReadFile(file) - if err != nil { - return "" - } - hasher := sha512.New() - hasher.Write(data) - - return fmt.Sprintf("?v=%.8x", hasher.Sum(nil)) -} var dbtimeformat = "2006-01-02 15:04:05"
M
web.go
→
web.go
@@ -17,6 +17,7 @@ package main
import ( "bytes" + "crypto/sha512" "database/sql" "fmt" "html/template"@@ -2690,6 +2691,22 @@ }
sort.Slice(allemus, func(i, j int) bool { return allemus[i].Name < allemus[j].Name }) +} + +var savedassetparams = make(map[string]string) + +func getassetparam(file string) string { + if p, ok := savedassetparams[file]; ok { + return p + } + data, err := os.ReadFile(file) + if err != nil { + return "" + } + hasher := sha512.New() + hasher.Write(data) + + return fmt.Sprintf("?v=%.8x", hasher.Sum(nil)) } func serve() {