2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 10:17:17 +08:00

feat: 安全入口及应用安装检查中间件

This commit is contained in:
耗子
2024-10-12 03:40:20 +08:00
parent 119183971d
commit 09698f7cd3
13 changed files with 176 additions and 29 deletions

View File

@@ -358,18 +358,18 @@ func (s *CliService) Init(ctx context.Context, cmd *cli.Command) error {
settings := []biz.Setting{{Key: biz.SettingKeyName, Value: "耗子面板"}, {Key: biz.SettingKeyMonitor, Value: "1"}, {Key: biz.SettingKeyMonitorDays, Value: "30"}, {Key: biz.SettingKeyBackupPath, Value: filepath.Join(app.Root, "backup")}, {Key: biz.SettingKeyWebsitePath, Value: filepath.Join(app.Root, "wwwroot")}, {Key: biz.SettingKeyVersion, Value: app.Conf.String("app.version")}}
if err := app.Orm.Create(&settings).Error; err != nil {
return fmt.Errorf("初始化失败: %v", err)
return fmt.Errorf("初始化失败%v", err)
}
value, err := hash.NewArgon2id().Make(str.RandomString(32))
if err != nil {
return fmt.Errorf("初始化失败: %v", err)
return fmt.Errorf("初始化失败%v", err)
}
user := data.NewUserRepo()
_, err = user.Create("admin", value)
if err != nil {
return fmt.Errorf("初始化失败: %v", err)
return fmt.Errorf("初始化失败%v", err)
}
config := new(types.PanelConfig)