chore: update dev host
This commit is contained in:
@@ -75,8 +75,8 @@ const (
|
|||||||
// Notify Templates Keys
|
// Notify Templates Keys
|
||||||
KeyNotifyTemplateUserLoginTitle = "notify_template_user_login_title"
|
KeyNotifyTemplateUserLoginTitle = "notify_template_user_login_title"
|
||||||
KeyNotifyTemplateUserLoginText = "notify_template_user_login_text"
|
KeyNotifyTemplateUserLoginText = "notify_template_user_login_text"
|
||||||
KeyNotifyTemplateBruteForceLoginTitle = "notify_template_brute_force_login_title"
|
KeyNotifyTemplateBruteForceLoginTitle = "notify_template_brute_force_login_title"
|
||||||
KeyNotifyTemplateBruteForceLoginText = "notify_template_brute_force_login_text"
|
KeyNotifyTemplateBruteForceLoginText = "notify_template_brute_force_login_text"
|
||||||
KeyNotifyTemplatePasswordChangedTitle = "notify_template_password_changed_title"
|
KeyNotifyTemplatePasswordChangedTitle = "notify_template_password_changed_title"
|
||||||
KeyNotifyTemplatePasswordChangedText = "notify_template_password_changed_text"
|
KeyNotifyTemplatePasswordChangedText = "notify_template_password_changed_text"
|
||||||
KeyNotifyTemplateTaskSuccessTitle = "notify_template_task_success_title"
|
KeyNotifyTemplateTaskSuccessTitle = "notify_template_task_success_title"
|
||||||
@@ -228,8 +228,8 @@ var DefaultSettings = map[string]map[string]string{
|
|||||||
// Login
|
// Login
|
||||||
KeyNotifyTemplateUserLoginTitle: "用户登录(成功/失败)",
|
KeyNotifyTemplateUserLoginTitle: "用户登录(成功/失败)",
|
||||||
KeyNotifyTemplateUserLoginText: "用户 {{username}} 在 IP {{ip}} 登录{{status_label}}\n{{message}}",
|
KeyNotifyTemplateUserLoginText: "用户 {{username}} 在 IP {{ip}} 登录{{status_label}}\n{{message}}",
|
||||||
KeyNotifyTemplateBruteForceLoginTitle: "系统安全警告",
|
KeyNotifyTemplateBruteForceLoginTitle: "系统安全警告",
|
||||||
KeyNotifyTemplateBruteForceLoginText: "检测到 IP {{ip}} 正在尝试暴力破解用户 {{username}}",
|
KeyNotifyTemplateBruteForceLoginText: "检测到 IP {{ip}} 正在尝试暴力破解用户 {{username}}",
|
||||||
KeyNotifyTemplatePasswordChangedTitle: "账户安全通知",
|
KeyNotifyTemplatePasswordChangedTitle: "账户安全通知",
|
||||||
KeyNotifyTemplatePasswordChangedText: "用户 {{username}} 刚刚修改了密码",
|
KeyNotifyTemplatePasswordChangedText: "用户 {{username}} 刚刚修改了密码",
|
||||||
// Task
|
// Task
|
||||||
|
|||||||
@@ -49,8 +49,11 @@ func CheckWSOrigin(r *http.Request) bool {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 允许来自 localhost 和 127.0.0.1 的请求 (方便本地开发和同机部署)
|
// 3. 允许来自 localhost、127.0.0.1 以及局域网内网 IP 的请求 (方便本地开发、虚拟机调试和局域网部署)
|
||||||
if strings.HasPrefix(u.Host, "localhost") || strings.HasPrefix(u.Host, "127.0.0.1") {
|
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
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user