fix: 修复代码格式、乱码和CORS校验问题

1. 修复tts.go中多余的缩进错误
2. 修复main.go和auth.go中的中文乱码问题,修正日志文本
3. 修复CORS校验逻辑,将origin转为小写后再判断协议前缀
4. 修正auth.go中API密钥未配置时的提示逻辑
This commit is contained in:
sun
2026-06-23 10:23:44 +08:00
parent 977e9ccadb
commit 3d50b6c69d
4 changed files with 11 additions and 10 deletions
+3 -2
View File
@@ -1,4 +1,4 @@
package middleware
package middleware
import (
"log"
@@ -53,7 +53,8 @@ func isValidOrigin(origin string) bool {
if origin == "" || origin == "null" || origin == "nil" {
return false
}
if !strings.HasPrefix(origin, "http://") && !strings.HasPrefix(origin, "https://") {
lowerOrigin := strings.ToLower(origin)
if !strings.HasPrefix(lowerOrigin, "http://") && !strings.HasPrefix(lowerOrigin, "https://") {
return false
}
return true