实现登录功能

This commit is contained in:
Alex Yang
2025-11-30 11:44:26 +08:00
parent 4f0815a5f9
commit 72aa2846e5
7 changed files with 441 additions and 38 deletions

View File

@@ -19,6 +19,8 @@ type HTTPConfig struct {
Port int `json:"port"`
Host string `json:"host"`
EnableAPI bool `json:"enableAPI"`
Username string `json:"username"` // 登录用户名
Password string `json:"password"` // 登录密码
}
// BlacklistEntry 黑名单条目
@@ -92,6 +94,13 @@ func LoadConfig(path string) (*Config, error) {
if config.HTTP.Host == "" {
config.HTTP.Host = "0.0.0.0"
}
// 默认用户名和密码如果未配置则使用admin/admin
if config.HTTP.Username == "" {
config.HTTP.Username = "admin"
}
if config.HTTP.Password == "" {
config.HTTP.Password = "admin"
}
if config.Shield.UpdateInterval == 0 {
config.Shield.UpdateInterval = 3600
}