diff --git a/README-CN.md b/README-CN.md index 02cf45d..bfae649 100644 --- a/README-CN.md +++ b/README-CN.md @@ -81,6 +81,8 @@ synctv server synctv server --data-dir ./ ``` +每次启动会检测是否有root权限的用户,如果没有则会初始化一个`root`用户,密码为`root`,请及时修改用户名密码。 + # 文档 https://synctv.wiki diff --git a/README.md b/README.md index ce36ae4..6e91ace 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,8 @@ synctv server synctv server --data-dir ./ ``` +Every time it starts, it will check for users with root permissions. If none are found, it will initialize a `root` user with the password `root`. Please change the username and password promptly. + # Documentation https://synctv.wiki diff --git a/internal/db/db.go b/internal/db/db.go index 0d7f4d7..5d40a47 100644 --- a/internal/db/db.go +++ b/internal/db/db.go @@ -49,7 +49,8 @@ func initRootUser() error { if err == nil || !errors.Is(err, gorm.ErrRecordNotFound) { return err } - _, err = CreateUser("root", "root", WithRole(model.RoleRoot)) + u, err := CreateUser("root", "root", WithRole(model.RoleRoot)) + log.Infof("init root user:\nid: %s\nusername: %s\npassword: %s", u.ID, u.Username, "root") return err }