🐛 Fix websocket cannot pass auth

This commit is contained in:
LittleSheep 2024-03-30 21:59:05 +08:00
parent 729409618b
commit eacfd7296e
2 changed files with 6 additions and 3 deletions

View File

@ -17,6 +17,9 @@ func authMiddleware(c *fiber.Ctx) error {
tk := strings.Replace(header, "Bearer", "", 1) tk := strings.Replace(header, "Bearer", "", 1)
token = strings.TrimSpace(tk) token = strings.TrimSpace(tk)
} }
if query := c.Query("tk"); len(query) > 0 {
token = strings.TrimSpace(query)
}
c.Locals("token", token) c.Locals("token", token)

View File

@ -10,14 +10,14 @@ secret = "LtTjzAGFLshwXhN4ZD4nG5KlMv1MWcsvfv03TSZYnT1VhiAnLIZFTnHUwR0XhGgi"
content = "uploads" content = "uploads"
[debug] [debug]
database = true database = false
print_routes = false print_routes = false
[identity] [identity]
client_id = "solarecho" client_id = "solarecho"
client_secret = "Z9k9AFTj^p" client_secret = "Z9k9AFTj^p"
endpoint = "http://localhost:8444" endpoint = "https://id.solsynth.dev"
grpc_endpoint = "127.0.0.1:7444" grpc_endpoint = "id.solsynth.dev:7444"
[mailer] [mailer]
name = "Alphabot <alphabot@smartsheep.studio>" name = "Alphabot <alphabot@smartsheep.studio>"