[fix] anubis

This commit is contained in:
ryan
2026-04-25 19:48:30 +08:00
parent 9c57ec2f5c
commit d3d32a6b6b
3 changed files with 5 additions and 1 deletions
+1
View File
@@ -49,3 +49,4 @@ go.work.sum
.codex-cache .codex-cache
/.gomodcache/ /.gomodcache/
/anubis-1.25.0/ /anubis-1.25.0/
*.mmdb
+1 -1
View File
@@ -1103,7 +1103,7 @@ func renderPowStaticLocationBlock(powEnabled bool) string {
if !powEnabled { if !powEnabled {
return "" return ""
} }
return fmt.Sprintf(" location %s {\n alias %s/;\n }\n\n", anubisStaticPrefix, nginxPowStaticDirPlaceholder) return fmt.Sprintf(" location %s {\n alias %s/;\n types {\n text/css css;\n application/javascript js mjs;\n application/json json;\n image/webp webp;\n font/woff2 woff2;\n }\n }\n\n", anubisStaticPrefix, nginxPowStaticDirPlaceholder)
} }
const anubisStaticPrefix = "/.within.website/x/cmd/anubis/static/" const anubisStaticPrefix = "/.within.website/x/cmd/anubis/static/"
@@ -986,6 +986,9 @@ func TestPublishConfigVersionDetectsPoWChanges(t *testing.T) {
if strings.Contains(secondRelease.Version.RenderedConfig, "location /.within.website/x/cmd/anubis/static/static/ {") { if strings.Contains(secondRelease.Version.RenderedConfig, "location /.within.website/x/cmd/anubis/static/static/ {") {
t.Fatal("expected rendered config to avoid duplicate static path segment") t.Fatal("expected rendered config to avoid duplicate static path segment")
} }
if !strings.Contains(secondRelease.Version.RenderedConfig, "application/javascript js mjs;") {
t.Fatal("expected rendered config to serve Anubis module scripts with a JavaScript MIME type")
}
if !strings.Contains(secondRelease.Version.SnapshotJSON, `"difficulty":5`) { if !strings.Contains(secondRelease.Version.SnapshotJSON, `"difficulty":5`) {
t.Fatal("expected snapshot to persist PoW config") t.Fatal("expected snapshot to persist PoW config")
} }