all repos — honk @ b322a36b59c720429cf77ebb0566fe59b37d547e

my fork of honk

this is web code
Ted Unangst tedu@tedunangst.com
Thu, 31 Aug 2023 02:48:07 -0400
commit

b322a36b59c720429cf77ebb0566fe59b37d547e

parent

9f1821544be462620e482ecf05701cc6ef80671c

2 files changed, 17 insertions(+), 18 deletions(-)

jump to
M util.goutil.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.goweb.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() {