feat: add task pin #89

This commit is contained in:
duorameng
2026-04-29 18:02:43 +08:00
parent b4709ef873
commit 685d79b54e
10 changed files with 186 additions and 65 deletions
+4 -3
View File
@@ -49,9 +49,10 @@ func CheckWSOrigin(r *http.Request) bool {
}
}
// 3. 兜底策略:如果是开发环境常见的 localhost/127.0.0.1,且端口不一致的情况,
// 如果用户没有配置允许列表,我们在非 Release 模式下可以考虑放行,
// 但为了安全,默认应严格限制。建议开发时通过 BH_ALLOWED_ORIGINS=localhost:5173 显式开启。
// 3. 允许来自 localhost127.0.0.1 的请求 (方便本地开发和同机部署)
if strings.HasPrefix(u.Host, "localhost") || strings.HasPrefix(u.Host, "127.0.0.1") {
return true
}
return false
}