rebuild: split core into separate repo; move wg-go integration to internal/ctr/corebind
- go.mod: require git.zkcoi.com/zkcoi/meshray/core, replace => ../Meshray - internal/ctr/corebind: EnhancedBind + registry + adapter (wg-go integration isolated) - cmd/mr-wg migrated from old core/cmd/meshray-core - core/ removed; CHANGELOG updated; fix checkdb vet warning
This commit is contained in:
@@ -61,6 +61,17 @@ func NewServer(cfg *config.Config, logger *zap.Logger, dbStore *sqlite.Store) (*
|
||||
store: dbStore,
|
||||
}
|
||||
|
||||
// 首次启动初始化管理员账户(已存在则跳过,仅新建时返回随机密码)
|
||||
userService := service.NewUserService(dbStore)
|
||||
if uname, pwd, ierr := userService.InitializeAdmin(); ierr == nil {
|
||||
if pwd != "" {
|
||||
server.logger.Warn("已创建默认管理员账户,请尽快登录并修改密码",
|
||||
zap.String("username", uname), zap.String("password", pwd))
|
||||
}
|
||||
} else {
|
||||
server.logger.Error("初始化管理员账户失败", zap.Error(ierr))
|
||||
}
|
||||
|
||||
// 注册中间件
|
||||
server.registerMiddleware()
|
||||
|
||||
@@ -142,7 +153,9 @@ func (s *Server) registerRoutes() error {
|
||||
}
|
||||
|
||||
// 尝试直接提供文件
|
||||
// staticFS 已通过 fs.Sub 剥离 "static" 前缀,需先去掉路径中的 "static/"
|
||||
filePath := strings.TrimPrefix(path, "/")
|
||||
filePath = strings.TrimPrefix(filePath, "static/")
|
||||
if filePath == "" {
|
||||
filePath = "index.html"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user