From d3d32a6b6bda0d8c1351b68335a1c7e8fc57a86e Mon Sep 17 00:00:00 2001 From: ryan Date: Sat, 25 Apr 2026 19:48:30 +0800 Subject: [PATCH] [fix] anubis --- .gitignore | 1 + openflare_server/service/config_version.go | 2 +- openflare_server/service/https_phase1_test.go | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 24b8ea5e..b2995169 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,4 @@ go.work.sum .codex-cache /.gomodcache/ /anubis-1.25.0/ +*.mmdb \ No newline at end of file diff --git a/openflare_server/service/config_version.go b/openflare_server/service/config_version.go index 4ba70265..de23e5cb 100644 --- a/openflare_server/service/config_version.go +++ b/openflare_server/service/config_version.go @@ -1103,7 +1103,7 @@ func renderPowStaticLocationBlock(powEnabled bool) string { if !powEnabled { 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/" diff --git a/openflare_server/service/https_phase1_test.go b/openflare_server/service/https_phase1_test.go index 837b7e68..20b79783 100644 --- a/openflare_server/service/https_phase1_test.go +++ b/openflare_server/service/https_phase1_test.go @@ -986,6 +986,9 @@ func TestPublishConfigVersionDetectsPoWChanges(t *testing.T) { 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") } + 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`) { t.Fatal("expected snapshot to persist PoW config") }