From cd2662b349bcece1f6b7d885426ad5d4c0d75ca8 Mon Sep 17 00:00:00 2001 From: Yuzhong Zhang <141388234+BetterAndBetterII@users.noreply.github.com> Date: Wed, 9 Jul 2025 13:44:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=BB=E6=9C=BA=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=E6=9B=BF=E6=8D=A2=E9=80=BB=E8=BE=91=EF=BC=8C=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E9=80=9A=E8=BF=87=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=90=8E=E7=AB=AF=E4=B8=BB=E6=9C=BA=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E5=8F=8D=E5=90=91=E4=BB=A3=E7=90=86=E5=92=8C?= =?UTF-8?q?=E8=B7=A8=E5=9F=9F=E6=94=AF=E6=8C=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 298b489..ace7ab3 100644 --- a/main.go +++ b/main.go @@ -87,7 +87,12 @@ func handleUI() http.HandlerFunc { return } - modifiedContent := strings.ReplaceAll(string(fileContent), "firestore.googleapis.com", "localhost:3002") + // 替换为请求的url对应的domain,使其在反向代理或不同域名下也能正常工作。 + backendHost := os.Getenv("EXCALIDRAW_BACKEND_HOST") + if backendHost == "" { + backendHost = r.Host + } + modifiedContent := strings.ReplaceAll(string(fileContent), "firestore.googleapis.com", backendHost) modifiedContent = strings.ReplaceAll(modifiedContent, "ssl=!0", "ssl=0") modifiedContent = strings.ReplaceAll(modifiedContent, "ssl:!0", "ssl:0")