all repos — searchix @ c4dc9b20cce2b08e7cf0f0e0b6c21fb3938177d0

Search engine for NixOS, nix-darwin, home-manager and NUR users

fix: CSS not allowed by subresource integrity (disable for now)

Alan Pearce
commit

c4dc9b20cce2b08e7cf0f0e0b6c21fb3938177d0

parent

e2b72135312274360853f51e817b83d1ccf3e5a9

1 file changed, 7 insertions(+), 12 deletions(-)

changed files
M frontend/assets.gofrontend/assets.go
@@ -1,8 +1,6 @@
package frontend import ( - "crypto/sha256" - "encoding/base64" "fmt" "hash/fnv" "io"
@@ -13,10 +11,9 @@ "github.com/Southclaws/fault/fmsg"
) type Asset struct { - URL string - ETag string - Filename string - Base64SHA256 string + URL string + ETag string + Filename string } type AssetCollection struct {
@@ -47,17 +44,15 @@ return nil, fault.Wrap(err, fmsg.Withf("could not open file %s", filename))
} defer file.Close() - shasum := sha256.New() hash := fnv.New64a() - if _, err := io.Copy(io.MultiWriter(shasum, hash), file); err != nil { + if _, err := io.Copy(hash, file); err != nil { return nil, fault.Wrap(err, fmsg.Withf("could not hash file %s", filename)) } return &Asset{ - URL: "/" + filename, - ETag: fmt.Sprintf(`W/"%x"`, hash.Sum(nil)), - Filename: filename, - Base64SHA256: base64.StdEncoding.EncodeToString(shasum.Sum(nil)), + URL: "/" + filename, + ETag: fmt.Sprintf(`W/"%x"`, hash.Sum(nil)), + Filename: filename, }, nil }