From eacfd7296e039701febf445444a72e9214737645 Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 30 Mar 2024 21:59:05 +0800 Subject: [PATCH] :bug: Fix websocket cannot pass auth --- pkg/server/auth.go | 3 +++ settings.toml | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/server/auth.go b/pkg/server/auth.go index bad3a14..19d80af 100644 --- a/pkg/server/auth.go +++ b/pkg/server/auth.go @@ -17,6 +17,9 @@ func authMiddleware(c *fiber.Ctx) error { tk := strings.Replace(header, "Bearer", "", 1) token = strings.TrimSpace(tk) } + if query := c.Query("tk"); len(query) > 0 { + token = strings.TrimSpace(query) + } c.Locals("token", token) diff --git a/settings.toml b/settings.toml index 7e63461..f844c33 100644 --- a/settings.toml +++ b/settings.toml @@ -10,14 +10,14 @@ secret = "LtTjzAGFLshwXhN4ZD4nG5KlMv1MWcsvfv03TSZYnT1VhiAnLIZFTnHUwR0XhGgi" content = "uploads" [debug] -database = true +database = false print_routes = false [identity] client_id = "solarecho" client_secret = "Z9k9AFTj^p" -endpoint = "http://localhost:8444" -grpc_endpoint = "127.0.0.1:7444" +endpoint = "https://id.solsynth.dev" +grpc_endpoint = "id.solsynth.dev:7444" [mailer] name = "Alphabot "