chore: update dev host

This commit is contained in:
duorameng
2026-05-14 09:02:16 +08:00
parent c211a19dd8
commit d08a53f2b2
2 changed files with 9 additions and 6 deletions
+4 -4
View File
@@ -75,8 +75,8 @@ const (
// Notify Templates Keys
KeyNotifyTemplateUserLoginTitle = "notify_template_user_login_title"
KeyNotifyTemplateUserLoginText = "notify_template_user_login_text"
KeyNotifyTemplateBruteForceLoginTitle = "notify_template_brute_force_login_title"
KeyNotifyTemplateBruteForceLoginText = "notify_template_brute_force_login_text"
KeyNotifyTemplateBruteForceLoginTitle = "notify_template_brute_force_login_title"
KeyNotifyTemplateBruteForceLoginText = "notify_template_brute_force_login_text"
KeyNotifyTemplatePasswordChangedTitle = "notify_template_password_changed_title"
KeyNotifyTemplatePasswordChangedText = "notify_template_password_changed_text"
KeyNotifyTemplateTaskSuccessTitle = "notify_template_task_success_title"
@@ -228,8 +228,8 @@ var DefaultSettings = map[string]map[string]string{
// Login
KeyNotifyTemplateUserLoginTitle: "用户登录(成功/失败)",
KeyNotifyTemplateUserLoginText: "用户 {{username}} 在 IP {{ip}} 登录{{status_label}}\n{{message}}",
KeyNotifyTemplateBruteForceLoginTitle: "系统安全警告",
KeyNotifyTemplateBruteForceLoginText: "检测到 IP {{ip}} 正在尝试暴力破解用户 {{username}}",
KeyNotifyTemplateBruteForceLoginTitle: "系统安全警告",
KeyNotifyTemplateBruteForceLoginText: "检测到 IP {{ip}} 正在尝试暴力破解用户 {{username}}",
KeyNotifyTemplatePasswordChangedTitle: "账户安全通知",
KeyNotifyTemplatePasswordChangedText: "用户 {{username}} 刚刚修改了密码",
// Task
+5 -2
View File
@@ -49,8 +49,11 @@ func CheckWSOrigin(r *http.Request) bool {
}
}
// 3. 允许来自 localhost127.0.0.1 的请求 (方便本地开发和同机部署)
if strings.HasPrefix(u.Host, "localhost") || strings.HasPrefix(u.Host, "127.0.0.1") {
// 3. 允许来自 localhost127.0.0.1 以及局域网内网 IP 的请求 (方便本地开发、虚拟机调试和局域网部署)
hostname := u.Hostname()
if strings.HasPrefix(hostname, "localhost") || strings.HasPrefix(hostname, "127.0.0.1") ||
strings.HasPrefix(hostname, "192.168.") || strings.HasPrefix(hostname, "10.") ||
strings.HasPrefix(hostname, "172.") {
return true
}