fix(admin): Admin web title
This commit is contained in:
@@ -1 +1 @@
|
||||
### 👏👏👏 你好 ***{{username}}***, 欢迎使用 [RustDesk Api](https://github.com/lejianwen/rustdesk-api)
|
||||
### 👏👏👏 你好 ***{{username}}***, 欢迎使用 [RustDesk API](https://github.com/lejianwen/rustdesk-api)
|
||||
@@ -61,6 +61,12 @@ func (co *Config) AppConfig(c *gin.Context) {
|
||||
func (co *Config) AdminConfig(c *gin.Context) {
|
||||
|
||||
u := service.AllService.UserService.CurUser(c)
|
||||
if u == nil || u.Id == 0 {
|
||||
response.Success(c, &gin.H{
|
||||
"title": global.Config.Admin.Title,
|
||||
})
|
||||
return
|
||||
}
|
||||
hello := global.Config.Admin.Hello
|
||||
helloFile := global.Config.Admin.HelloFile
|
||||
if helloFile != "" {
|
||||
|
||||
@@ -22,6 +22,9 @@ func Init(g *gin.Engine) {
|
||||
adg := g.Group("/api/admin")
|
||||
LoginBind(adg)
|
||||
adg.POST("/user/register", (&admin.User{}).Register)
|
||||
|
||||
ConfigBind(adg)
|
||||
|
||||
adg.Use(middleware.AdminAuth())
|
||||
//FileBind(adg)
|
||||
UserBind(adg)
|
||||
@@ -35,7 +38,6 @@ func Init(g *gin.Engine) {
|
||||
AddressBookCollectionBind(adg)
|
||||
AddressBookCollectionRuleBind(adg)
|
||||
UserTokenBind(adg)
|
||||
ConfigBind(adg)
|
||||
|
||||
//deprecated by ConfigBind
|
||||
//rs := &admin.Rustdesk{}
|
||||
@@ -221,9 +223,13 @@ func UserTokenBind(rg *gin.RouterGroup) {
|
||||
func ConfigBind(rg *gin.RouterGroup) {
|
||||
aR := rg.Group("/config")
|
||||
rs := &admin.Config{}
|
||||
|
||||
aR.GET("/admin", rs.AdminConfig)
|
||||
|
||||
aR.Use(middleware.AdminAuth())
|
||||
aR.GET("/server", rs.ServerConfig)
|
||||
aR.GET("/app", rs.AppConfig)
|
||||
aR.GET("/admin", rs.AdminConfig)
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -280,7 +280,7 @@ func (us *UserService) UpdatePassword(u *model.User, password string) error {
|
||||
|
||||
// IsAdmin 是否管理员
|
||||
func (us *UserService) IsAdmin(u *model.User) bool {
|
||||
return *u.IsAdmin
|
||||
return u != nil && *u.IsAdmin
|
||||
}
|
||||
|
||||
// RouteNames
|
||||
|
||||
Reference in New Issue
Block a user