diff --git a/backend/app/api/v1/setting.go b/backend/app/api/v1/setting.go index f16aaa200..a13feea98 100644 --- a/backend/app/api/v1/setting.go +++ b/backend/app/api/v1/setting.go @@ -65,33 +65,6 @@ func (b *BaseApi) UpdateSetting(c *gin.Context) { helper.SuccessWithData(c, nil) } -// @Tags System Setting -// @Summary Update system entrance -// @Description 更新系统安全入口 -// @Accept json -// @Param request body dto.SettingUpdate true "request" -// @Success 200 -// @Security ApiKeyAuth -// @Router /settings/entrance/enable [post] -// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFuntions":[],"formatZH":"修改系统配置 [SecurityEntranceStatus] => [打开]","formatEN":"update system setting [SecurityEntranceStatus] => [Enable]"} -func (b *BaseApi) UpdateEntrance(c *gin.Context) { - var req dto.SettingUpdate - if err := c.ShouldBindJSON(&req); err != nil { - helper.ErrorWithDetail(c, constant.CodeErrBadRequest, constant.ErrTypeInvalidParams, err) - return - } - if err := global.VALID.Struct(req); err != nil { - helper.ErrorWithDetail(c, constant.CodeErrBadRequest, constant.ErrTypeInvalidParams, err) - return - } - - if err := settingService.UpdateEntrance(req.Value); err != nil { - helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err) - return - } - helper.SuccessWithData(c, nil) -} - // @Tags System Setting // @Summary Update system password // @Description 更新系统登录密码 diff --git a/backend/app/dto/setting.go b/backend/app/dto/setting.go index c3483bf78..613b3d48c 100644 --- a/backend/app/dto/setting.go +++ b/backend/app/dto/setting.go @@ -16,7 +16,6 @@ type SettingInfo struct { Language string `json:"language"` ServerPort string `json:"serverPort"` - SecurityEntranceStatus string `json:"securityEntranceStatus"` SSL string `json:"ssl"` SSLType string `json:"sslType"` SecurityEntrance string `json:"securityEntrance"` diff --git a/backend/app/service/auth.go b/backend/app/service/auth.go index a653a041f..4976d41b4 100644 --- a/backend/app/service/auth.go +++ b/backend/app/service/auth.go @@ -148,18 +148,14 @@ func (u *AuthService) VerifyCode(code string) (bool, error) { } func (u *AuthService) CheckIsSafety(code string) bool { - status, err := settingRepo.Get(settingRepo.WithByKey("SecurityEntranceStatus")) + status, err := settingRepo.Get(settingRepo.WithByKey("SecurityEntrance")) if err != nil { return false } - if status.Value == "disable" { + if len(status.Value) == 0 { return true } - setting, err := settingRepo.Get(settingRepo.WithByKey("SecurityEntrance")) - if err != nil { - return false - } - return setting.Value == code + return status.Value == code } func (u *AuthService) CheckIsFirst() bool { diff --git a/backend/app/service/setting.go b/backend/app/service/setting.go index 27c4eeb4e..134b02ffe 100644 --- a/backend/app/service/setting.go +++ b/backend/app/service/setting.go @@ -28,7 +28,6 @@ type SettingService struct{} type ISettingService interface { GetSettingInfo() (*dto.SettingInfo, error) Update(key, value string) error - UpdateEntrance(value string) error UpdatePassword(c *gin.Context, old, new string) error UpdatePort(port uint) error UpdateSSL(c *gin.Context, req dto.SSLUpdate) error @@ -68,16 +67,6 @@ func (u *SettingService) Update(key, value string) error { return err } } - if key == "SecurityEntrance" { - if err := settingRepo.Update("SecurityEntranceStatus", "enable"); err != nil { - return err - } - } - if key == "SecurityEntranceStatus" { - if err := settingRepo.Update("SecurityEntrance", ""); err != nil { - return err - } - } if err := settingRepo.Update(key, value); err != nil { return err } @@ -87,16 +76,6 @@ func (u *SettingService) Update(key, value string) error { return nil } -func (u *SettingService) UpdateEntrance(value string) error { - if err := settingRepo.Update("SecurityEntranceStatus", "enable"); err != nil { - return err - } - if err := settingRepo.Update("SecurityEntrance", value); err != nil { - return err - } - return nil -} - func (u *SettingService) UpdatePort(port uint) error { if common.ScanPort(int(port)) { return buserr.WithDetail(constant.ErrPortInUsed, port, nil) diff --git a/backend/configs/system.go b/backend/configs/system.go index 02c73ef97..9e295ebff 100644 --- a/backend/configs/system.go +++ b/backend/configs/system.go @@ -15,5 +15,8 @@ type System struct { Mode string `mapstructure:"mode"` RepoUrl string `mapstructure:"repo_url"` Version string `mapstructure:"version"` + Username string `mapstructure:"username"` + Password string `mapstructure:"password"` + Entrance string `mapstructure:"entrance"` IsDemo bool `mapstructure:"is_demo"` } diff --git a/backend/init/migration/migrations/init.go b/backend/init/migration/migrations/init.go index f16517a26..70132e721 100644 --- a/backend/init/migration/migrations/init.go +++ b/backend/init/migration/migrations/init.go @@ -61,10 +61,10 @@ var AddTableSetting = &gormigrate.Migration{ if err := tx.AutoMigrate(&model.Setting{}); err != nil { return err } - if err := tx.Create(&model.Setting{Key: "UserName", Value: ""}).Error; err != nil { + if err := tx.Create(&model.Setting{Key: "UserName", Value: global.CONF.System.Username}).Error; err != nil { return err } - if err := tx.Create(&model.Setting{Key: "Password", Value: ""}).Error; err != nil { + if err := tx.Create(&model.Setting{Key: "Password", Value: global.CONF.System.Password}).Error; err != nil { return err } if err := tx.Create(&model.Setting{Key: "Email", Value: ""}).Error; err != nil { @@ -91,7 +91,7 @@ var AddTableSetting = &gormigrate.Migration{ if err := tx.Create(&model.Setting{Key: "ServerPort", Value: global.CONF.System.Port}).Error; err != nil { return err } - if err := tx.Create(&model.Setting{Key: "SecurityEntrance", Value: "onepanel"}).Error; err != nil { + if err := tx.Create(&model.Setting{Key: "SecurityEntrance", Value: global.CONF.System.Entrance}).Error; err != nil { return err } if err := tx.Create(&model.Setting{Key: "JWTSigningKey", Value: common.RandStr(16)}).Error; err != nil { @@ -291,10 +291,9 @@ var UpdateTableWebsite = &gormigrate.Migration{ var AddEntranceAndSSL = &gormigrate.Migration{ ID: "20230414-add-entrance-and-ssl", Migrate: func(tx *gorm.DB) error { - if err := tx.Create(&model.Setting{Key: "SecurityEntranceStatus", Value: "disable"}).Error; err != nil { - return err - } - if err := tx.Model(&model.Setting{}).Where("key = ?", "SecurityEntrance").Updates(map[string]interface{}{"value": ""}).Error; err != nil { + if err := tx.Model(&model.Setting{}). + Where("key = ? AND value = ?", "SecurityEntrance", "onepanel"). + Updates(map[string]interface{}{"value": ""}).Error; err != nil { return err } if err := tx.Create(&model.Setting{Key: "SSLType", Value: "self"}).Error; err != nil { diff --git a/backend/init/viper/viper.go b/backend/init/viper/viper.go index bc6b90300..3f91a22e7 100644 --- a/backend/init/viper/viper.go +++ b/backend/init/viper/viper.go @@ -21,6 +21,7 @@ func Init() { port := "9999" mode := "" version := "v1.0.0" + username, password, entrance := "", "", "" fileOp := files.NewFileOp() v := viper.NewWithOptions() v.SetConfigType("yaml") @@ -40,8 +41,11 @@ func Init() { } } else { baseDir = loadParams("BASE_DIR") - port = loadParams("PANEL_PORT") - version = loadParams("ORIGINAL_INSTALLED_VERSION") + port = loadParams("ORIGINAL_PORT") + version = loadParams("ORIGINAL_VERSION") + username = loadParams("ORIGINAL_USERNAME") + password = loadParams("ORIGINAL_PASSWORD") + entrance = loadParams("ORIGINAL_ENTRANCE") if strings.HasSuffix(baseDir, "/") { baseDir = baseDir[:strings.LastIndex(baseDir, "/")] @@ -60,14 +64,25 @@ func Init() { if err := v.Unmarshal(&serverConfig); err != nil { panic(err) } - if mode == "dev" && fileOp.Stat("/opt/1panel/conf/app.yaml") && serverConfig.System.BaseDir != "" { - baseDir = serverConfig.System.BaseDir - } - if mode == "dev" && fileOp.Stat("/opt/1panel/conf/app.yaml") && serverConfig.System.Port != "" { - port = serverConfig.System.Port - } - if mode == "dev" && fileOp.Stat("/opt/1panel/conf/app.yaml") && serverConfig.System.Version != "" { - version = serverConfig.System.Version + if mode == "dev" && fileOp.Stat("/opt/1panel/conf/app.yaml") { + if serverConfig.System.BaseDir != "" { + baseDir = serverConfig.System.BaseDir + } + if serverConfig.System.Port != "" { + port = serverConfig.System.Port + } + if serverConfig.System.Version != "" { + version = serverConfig.System.Version + } + if serverConfig.System.Username != "" { + version = serverConfig.System.Username + } + if serverConfig.System.Password != "" { + version = serverConfig.System.Password + } + if serverConfig.System.Entrance != "" { + version = serverConfig.System.Entrance + } } global.CONF = serverConfig @@ -81,6 +96,9 @@ func Init() { global.CONF.System.TmpDir = global.CONF.System.DataDir + "/tmp" global.CONF.System.Port = port global.CONF.System.Version = version + global.CONF.System.Username = username + global.CONF.System.Password = password + global.CONF.System.Entrance = entrance global.Viper = v } diff --git a/backend/router/ro_setting.go b/backend/router/ro_setting.go index 2ca54f689..95be7323b 100644 --- a/backend/router/ro_setting.go +++ b/backend/router/ro_setting.go @@ -22,7 +22,6 @@ func (s *SettingRouter) InitSettingRouter(Router *gin.RouterGroup) { router.POST("/expired/handle", baseApi.HandlePasswordExpired) settingRouter.GET("/search/available", baseApi.GetSystemAvailable) settingRouter.POST("/update", baseApi.UpdateSetting) - settingRouter.POST("/entrance/enable", baseApi.UpdateEntrance) settingRouter.POST("/port/update", baseApi.UpdatePort) settingRouter.POST("/ssl/update", baseApi.UpdateSSL) settingRouter.GET("/ssl/info", baseApi.LoadFromCert) diff --git a/cmd/server/cmd/reset.go b/cmd/server/cmd/reset.go index 566677b2e..f59315578 100644 --- a/cmd/server/cmd/reset.go +++ b/cmd/server/cmd/reset.go @@ -24,7 +24,7 @@ var resetMFACmd = &cobra.Command{ } var resetSSLCmd = &cobra.Command{ - Use: "reset-ssl", + Use: "reset-https", Short: "取消 1Panel https 方式登录", RunE: func(cmd *cobra.Command, args []string) error { db, err := loadDBConn() @@ -44,6 +44,6 @@ var resetEntranceCmd = &cobra.Command{ return err } - return setSettingByKey(db, "SecurityEntranceStatus", "disable") + return setSettingByKey(db, "SecurityEntrance", "") }, } diff --git a/cmd/server/docs/docs.go b/cmd/server/docs/docs.go index 5e85306c5..f85219ea5 100644 --- a/cmd/server/docs/docs.go +++ b/cmd/server/docs/docs.go @@ -1,10 +1,17 @@ -// Package docs GENERATED BY SWAG; DO NOT EDIT +// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // This file was generated by swaggo/swag package docs -import "github.com/swaggo/swag" +import ( + "bytes" + "encoding/json" + "strings" + "text/template" -const docTemplate = `{ + "github.com/swaggo/swag" +) + +var doc = `{ "schemes": {{ marshal .Schemes }}, "swagger": "2.0", "info": { @@ -69,7 +76,7 @@ const docTemplate = `{ "summary": "Get app list update", "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -449,7 +456,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -551,7 +558,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -593,7 +600,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -637,7 +644,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -656,7 +663,7 @@ const docTemplate = `{ "summary": "Sync app installed", "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -696,7 +703,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -749,7 +756,7 @@ const docTemplate = `{ "summary": "Sync app list", "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -787,7 +794,7 @@ const docTemplate = `{ "summary": "Check System isDemo", "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -815,7 +822,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -829,7 +836,7 @@ const docTemplate = `{ "summary": "Check is First login", "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -843,7 +850,7 @@ const docTemplate = `{ "summary": "Load safety status", "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -893,7 +900,7 @@ const docTemplate = `{ "summary": "User logout", "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -957,7 +964,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1000,7 +1007,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1042,7 +1049,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1121,7 +1128,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1163,7 +1170,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1255,7 +1262,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1295,7 +1302,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1335,7 +1342,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1472,7 +1479,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1625,7 +1632,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1667,7 +1674,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1750,7 +1757,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1838,7 +1845,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1880,7 +1887,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1961,7 +1968,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2031,7 +2038,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2076,7 +2083,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2169,7 +2176,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -2205,7 +2212,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2385,7 +2392,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2427,7 +2434,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2517,7 +2524,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2568,7 +2575,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2610,7 +2617,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2728,7 +2735,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2771,7 +2778,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2822,7 +2829,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2873,7 +2880,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2924,7 +2931,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3047,7 +3054,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3099,7 +3106,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3232,7 +3239,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3296,7 +3303,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3347,7 +3354,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3398,7 +3405,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3438,7 +3445,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3525,7 +3532,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3671,7 +3678,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3711,7 +3718,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3751,7 +3758,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3813,7 +3820,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3977,7 +3984,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4017,7 +4024,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4059,7 +4066,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4101,7 +4108,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4138,7 +4145,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -4171,7 +4178,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4258,7 +4265,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4300,7 +4307,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4342,7 +4349,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4384,7 +4391,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4471,7 +4478,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4514,7 +4521,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4557,7 +4564,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4601,7 +4608,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4644,7 +4651,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4722,7 +4729,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4795,7 +4802,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4873,7 +4880,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4917,7 +4924,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4960,7 +4967,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5055,7 +5062,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5098,7 +5105,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5195,7 +5202,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5238,7 +5245,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5325,7 +5332,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5367,7 +5374,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5440,7 +5447,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -5518,7 +5525,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5597,7 +5604,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -5630,7 +5637,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -5733,7 +5740,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -5802,7 +5809,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5845,7 +5852,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6036,7 +6043,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6134,7 +6141,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6185,7 +6192,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6225,7 +6232,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -6258,7 +6265,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6300,7 +6307,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -6333,7 +6340,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6375,7 +6382,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6417,7 +6424,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6461,7 +6468,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6512,7 +6519,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6563,7 +6570,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6606,7 +6613,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -6639,7 +6646,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6684,7 +6691,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6821,7 +6828,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6857,46 +6864,6 @@ const docTemplate = `{ } } }, - "/settings/entrance/enable": { - "post": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "description": "更新系统安全入口", - "consumes": [ - "application/json" - ], - "tags": [ - "System Setting" - ], - "summary": "Update system entrance", - "parameters": [ - { - "description": "request", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.SettingUpdate" - } - } - ], - "responses": { - "200": { - "description": "OK" - } - }, - "x-panel-log": { - "BeforeFuntions": [], - "bodyKeys": [], - "formatEN": "update system setting [SecurityEntranceStatus] =\u003e [Enable]", - "formatZH": "修改系统配置 [SecurityEntranceStatus] =\u003e [打开]", - "paramKeys": [] - } - } - }, "/settings/expired/handle": { "post": { "security": [ @@ -6925,7 +6892,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6987,7 +6954,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7013,7 +6980,7 @@ const docTemplate = `{ "summary": "Clean monitor datas", "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7053,7 +7020,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7093,7 +7060,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7143,7 +7110,7 @@ const docTemplate = `{ "summary": "Load system available status", "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -7176,7 +7143,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7219,7 +7186,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7270,7 +7237,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7322,7 +7289,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7365,7 +7332,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7416,7 +7383,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7525,7 +7492,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7596,7 +7563,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7639,7 +7606,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } }, @@ -7670,7 +7637,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7712,7 +7679,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7953,7 +7920,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8040,7 +8007,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -8073,7 +8040,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -8178,7 +8145,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8229,7 +8196,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8281,7 +8248,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8332,7 +8299,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8383,7 +8350,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8434,7 +8401,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8476,7 +8443,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8563,7 +8530,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8684,7 +8651,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8812,7 +8779,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8863,7 +8830,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8937,7 +8904,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -9022,7 +8989,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -9073,7 +9040,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -9106,7 +9073,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -9157,7 +9124,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -9208,7 +9175,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -9241,7 +9208,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -9371,7 +9338,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -9404,7 +9371,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -9455,7 +9422,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -9542,7 +9509,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -9575,7 +9542,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -9624,7 +9591,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -9657,7 +9624,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -9735,7 +9702,7 @@ const docTemplate = `{ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -10066,6 +10033,9 @@ const docTemplate = `{ }, "path": { "type": "string" + }, + "withFile": { + "type": "boolean" } } }, @@ -11454,25 +11424,6 @@ const docTemplate = `{ } } }, - "dto.NginxKey": { - "type": "string", - "enum": [ - "index", - "limit-conn", - "ssl", - "cache", - "http-per", - "proxy-cache" - ], - "x-enum-varnames": [ - "Index", - "LimitConn", - "SSL", - "CACHE", - "HttpPer", - "ProxyCache" - ] - }, "dto.OperateByID": { "type": "object", "required": [ @@ -11986,9 +11937,6 @@ const docTemplate = `{ "securityEntrance": { "type": "string" }, - "securityEntranceStatus": { - "type": "string" - }, "serverPort": { "type": "string" }, @@ -12792,6 +12740,9 @@ const docTemplate = `{ }, "path": { "type": "string" + }, + "sub": { + "type": "boolean" } } }, @@ -13070,7 +13021,7 @@ const docTemplate = `{ }, "params": {}, "scope": { - "$ref": "#/definitions/dto.NginxKey" + "type": "string" }, "websiteId": { "type": "integer" @@ -13137,7 +13088,7 @@ const docTemplate = `{ ], "properties": { "scope": { - "$ref": "#/definitions/dto.NginxKey" + "type": "string" }, "websiteId": { "type": "integer" @@ -14348,18 +14299,56 @@ const docTemplate = `{ } }` +type swaggerInfo struct { + Version string + Host string + BasePath string + Schemes []string + Title string + Description string +} + // SwaggerInfo holds exported Swagger Info so clients can modify it -var SwaggerInfo = &swag.Spec{ - Version: "1.0", - Host: "localhost", - BasePath: "/api/v1", - Schemes: []string{}, - Title: "1Panel", - Description: "开源Linux面板", - InfoInstanceName: "swagger", - SwaggerTemplate: docTemplate, +var SwaggerInfo = swaggerInfo{ + Version: "1.0", + Host: "localhost", + BasePath: "/api/v1", + Schemes: []string{}, + Title: "1Panel", + Description: "开源Linux面板", +} + +type s struct{} + +func (s *s) ReadDoc() string { + sInfo := SwaggerInfo + sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1) + + t, err := template.New("swagger_info").Funcs(template.FuncMap{ + "marshal": func(v interface{}) string { + a, _ := json.Marshal(v) + return string(a) + }, + "escape": func(v interface{}) string { + // escape tabs + str := strings.Replace(v.(string), "\t", "\\t", -1) + // replace " with \", and if that results in \\", replace that with \\\" + str = strings.Replace(str, "\"", "\\\"", -1) + return strings.Replace(str, "\\\\\"", "\\\\\\\"", -1) + }, + }).Parse(doc) + if err != nil { + return doc + } + + var tpl bytes.Buffer + if err := t.Execute(&tpl, sInfo); err != nil { + return doc + } + + return tpl.String() } func init() { - swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) + swag.Register("swagger", &s{}) } diff --git a/cmd/server/docs/swagger.json b/cmd/server/docs/swagger.json index e4ad62e63..2a55b3ad6 100644 --- a/cmd/server/docs/swagger.json +++ b/cmd/server/docs/swagger.json @@ -62,7 +62,7 @@ "summary": "Get app list update", "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -442,7 +442,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -544,7 +544,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -586,7 +586,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -630,7 +630,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -649,7 +649,7 @@ "summary": "Sync app installed", "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -689,7 +689,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -742,7 +742,7 @@ "summary": "Sync app list", "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -780,7 +780,7 @@ "summary": "Check System isDemo", "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -808,7 +808,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -822,7 +822,7 @@ "summary": "Check is First login", "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -836,7 +836,7 @@ "summary": "Load safety status", "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -886,7 +886,7 @@ "summary": "User logout", "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -950,7 +950,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -993,7 +993,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1035,7 +1035,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1114,7 +1114,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1156,7 +1156,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1248,7 +1248,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1288,7 +1288,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1328,7 +1328,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1465,7 +1465,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1618,7 +1618,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1660,7 +1660,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1743,7 +1743,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1831,7 +1831,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1873,7 +1873,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -1954,7 +1954,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2024,7 +2024,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2069,7 +2069,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2162,7 +2162,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -2198,7 +2198,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2378,7 +2378,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2420,7 +2420,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2510,7 +2510,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2561,7 +2561,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2603,7 +2603,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2721,7 +2721,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2764,7 +2764,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2815,7 +2815,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2866,7 +2866,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -2917,7 +2917,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3040,7 +3040,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3092,7 +3092,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3225,7 +3225,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3289,7 +3289,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3340,7 +3340,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3391,7 +3391,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3431,7 +3431,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3518,7 +3518,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3664,7 +3664,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3704,7 +3704,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3744,7 +3744,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3806,7 +3806,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -3970,7 +3970,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4010,7 +4010,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4052,7 +4052,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4094,7 +4094,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4131,7 +4131,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -4164,7 +4164,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4251,7 +4251,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4293,7 +4293,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4335,7 +4335,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4377,7 +4377,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4464,7 +4464,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4507,7 +4507,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4550,7 +4550,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4594,7 +4594,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4637,7 +4637,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4715,7 +4715,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4788,7 +4788,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4866,7 +4866,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4910,7 +4910,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -4953,7 +4953,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5048,7 +5048,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5091,7 +5091,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5188,7 +5188,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5231,7 +5231,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5318,7 +5318,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5360,7 +5360,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5433,7 +5433,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -5511,7 +5511,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5590,7 +5590,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -5623,7 +5623,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -5726,7 +5726,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -5795,7 +5795,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -5838,7 +5838,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6029,7 +6029,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6127,7 +6127,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6178,7 +6178,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6218,7 +6218,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -6251,7 +6251,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6293,7 +6293,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -6326,7 +6326,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6368,7 +6368,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6410,7 +6410,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6454,7 +6454,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6505,7 +6505,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6556,7 +6556,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6599,7 +6599,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -6632,7 +6632,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6677,7 +6677,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6814,7 +6814,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6850,46 +6850,6 @@ } } }, - "/settings/entrance/enable": { - "post": { - "security": [ - { - "ApiKeyAuth": [] - } - ], - "description": "更新系统安全入口", - "consumes": [ - "application/json" - ], - "tags": [ - "System Setting" - ], - "summary": "Update system entrance", - "parameters": [ - { - "description": "request", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.SettingUpdate" - } - } - ], - "responses": { - "200": { - "description": "OK" - } - }, - "x-panel-log": { - "BeforeFuntions": [], - "bodyKeys": [], - "formatEN": "update system setting [SecurityEntranceStatus] =\u003e [Enable]", - "formatZH": "修改系统配置 [SecurityEntranceStatus] =\u003e [打开]", - "paramKeys": [] - } - } - }, "/settings/expired/handle": { "post": { "security": [ @@ -6918,7 +6878,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -6980,7 +6940,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7006,7 +6966,7 @@ "summary": "Clean monitor datas", "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7046,7 +7006,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7086,7 +7046,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7136,7 +7096,7 @@ "summary": "Load system available status", "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -7169,7 +7129,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7212,7 +7172,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7263,7 +7223,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7315,7 +7275,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7358,7 +7318,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7409,7 +7369,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7518,7 +7478,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7589,7 +7549,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7632,7 +7592,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } }, @@ -7663,7 +7623,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7705,7 +7665,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -7946,7 +7906,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8033,7 +7993,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -8066,7 +8026,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -8171,7 +8131,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8222,7 +8182,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8274,7 +8234,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8325,7 +8285,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8376,7 +8336,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8427,7 +8387,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8469,7 +8429,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8556,7 +8516,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8677,7 +8637,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8805,7 +8765,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8856,7 +8816,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -8930,7 +8890,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -9015,7 +8975,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -9066,7 +9026,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -9099,7 +9059,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -9150,7 +9110,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -9201,7 +9161,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -9234,7 +9194,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -9364,7 +9324,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -9397,7 +9357,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -9448,7 +9408,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -9535,7 +9495,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -9568,7 +9528,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -9617,7 +9577,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } } } @@ -9650,7 +9610,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -9728,7 +9688,7 @@ ], "responses": { "200": { - "description": "OK" + "description": "" } }, "x-panel-log": { @@ -10059,6 +10019,9 @@ }, "path": { "type": "string" + }, + "withFile": { + "type": "boolean" } } }, @@ -11447,25 +11410,6 @@ } } }, - "dto.NginxKey": { - "type": "string", - "enum": [ - "index", - "limit-conn", - "ssl", - "cache", - "http-per", - "proxy-cache" - ], - "x-enum-varnames": [ - "Index", - "LimitConn", - "SSL", - "CACHE", - "HttpPer", - "ProxyCache" - ] - }, "dto.OperateByID": { "type": "object", "required": [ @@ -11979,9 +11923,6 @@ "securityEntrance": { "type": "string" }, - "securityEntranceStatus": { - "type": "string" - }, "serverPort": { "type": "string" }, @@ -12785,6 +12726,9 @@ }, "path": { "type": "string" + }, + "sub": { + "type": "boolean" } } }, @@ -13063,7 +13007,7 @@ }, "params": {}, "scope": { - "$ref": "#/definitions/dto.NginxKey" + "type": "string" }, "websiteId": { "type": "integer" @@ -13130,7 +13074,7 @@ ], "properties": { "scope": { - "$ref": "#/definitions/dto.NginxKey" + "type": "string" }, "websiteId": { "type": "integer" diff --git a/cmd/server/docs/swagger.yaml b/cmd/server/docs/swagger.yaml index 9412b55dd..cd1665f65 100644 --- a/cmd/server/docs/swagger.yaml +++ b/cmd/server/docs/swagger.yaml @@ -202,6 +202,8 @@ definitions: type: string path: type: string + withFile: + type: boolean required: - name - operation @@ -1135,22 +1137,6 @@ definitions: subnet: type: string type: object - dto.NginxKey: - enum: - - index - - limit-conn - - ssl - - cache - - http-per - - proxy-cache - type: string - x-enum-varnames: - - Index - - LimitConn - - SSL - - CACHE - - HttpPer - - ProxyCache dto.OperateByID: properties: id: @@ -1493,8 +1479,6 @@ definitions: type: string securityEntrance: type: string - securityEntranceStatus: - type: string serverPort: type: string sessionTimeout: @@ -2024,6 +2008,8 @@ definitions: type: integer path: type: string + sub: + type: boolean required: - mode - path @@ -2212,7 +2198,7 @@ definitions: type: string params: {} scope: - $ref: '#/definitions/dto.NginxKey' + type: string websiteId: type: integer required: @@ -2257,7 +2243,7 @@ definitions: request.NginxScopeReq: properties: scope: - $ref: '#/definitions/dto.NginxKey' + type: string websiteId: type: integer required: @@ -3103,7 +3089,7 @@ paths: description: 获取应用更新版本 responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Get app list update @@ -3341,7 +3327,7 @@ paths: $ref: '#/definitions/request.AppInstalledOperate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Operate installed app @@ -3408,7 +3394,7 @@ paths: $ref: '#/definitions/request.AppInstalledUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Change app params @@ -3435,7 +3421,7 @@ paths: $ref: '#/definitions/request.PortUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Change app port @@ -3464,7 +3450,7 @@ paths: $ref: '#/definitions/request.AppInstalledSearch' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: List app installed @@ -3475,7 +3461,7 @@ paths: description: 同步已安装应用列表 responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Sync app installed @@ -3501,7 +3487,7 @@ paths: $ref: '#/definitions/request.AppSearch' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: List apps @@ -3533,7 +3519,7 @@ paths: description: 同步应用列表 responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Sync app list @@ -3561,7 +3547,7 @@ paths: description: 判断是否为demo环境 responses: "200": - description: OK + description: "" summary: Check System isDemo tags: - Auth @@ -3579,7 +3565,7 @@ paths: $ref: '#/definitions/dto.InitUser' responses: "200": - description: OK + description: "" summary: Init user tags: - Auth @@ -3588,7 +3574,7 @@ paths: description: 判断是否为首次登录 responses: "200": - description: OK + description: "" summary: Check is First login tags: - Auth @@ -3597,7 +3583,7 @@ paths: description: 获取系统安全登录状态 responses: "200": - description: OK + description: "" summary: Load safety status tags: - Auth @@ -3626,7 +3612,7 @@ paths: description: 用户登出 responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: User logout @@ -3666,7 +3652,7 @@ paths: $ref: '#/definitions/dto.ContainerCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create container @@ -3694,7 +3680,7 @@ paths: $ref: '#/definitions/dto.ComposeCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create compose @@ -3721,7 +3707,7 @@ paths: $ref: '#/definitions/dto.ComposeOperation' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Operate compose @@ -3771,7 +3757,7 @@ paths: $ref: '#/definitions/dto.ComposeCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Test compose @@ -3798,7 +3784,7 @@ paths: $ref: '#/definitions/dto.ComposeUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update compose @@ -3855,7 +3841,7 @@ paths: $ref: '#/definitions/dto.DaemonJsonConf' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update docker daemon.json @@ -3881,7 +3867,7 @@ paths: $ref: '#/definitions/dto.DaemonJsonUpdateByFile' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update docker daemon.json by upload file @@ -3907,7 +3893,7 @@ paths: $ref: '#/definitions/dto.DockerOperation' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Operate docker @@ -3993,7 +3979,7 @@ paths: $ref: '#/definitions/dto.ImageLoad' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Load image @@ -4093,7 +4079,7 @@ paths: $ref: '#/definitions/dto.BatchDelete' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete image @@ -4120,7 +4106,7 @@ paths: $ref: '#/definitions/dto.ImageSave' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Save image @@ -4173,7 +4159,7 @@ paths: $ref: '#/definitions/dto.ImageTag' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Tag image @@ -4229,7 +4215,7 @@ paths: $ref: '#/definitions/dto.NetworkCreat' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create network @@ -4256,7 +4242,7 @@ paths: $ref: '#/definitions/dto.BatchDelete' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete network @@ -4307,7 +4293,7 @@ paths: $ref: '#/definitions/dto.ContainerOperation' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Operate Container @@ -4352,7 +4338,7 @@ paths: - application/json responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create image repo @@ -4381,7 +4367,7 @@ paths: - application/json responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete image repo @@ -4440,7 +4426,7 @@ paths: - application/json responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Load repo status @@ -4462,7 +4448,7 @@ paths: - application/json responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update image repo @@ -4574,7 +4560,7 @@ paths: $ref: '#/definitions/dto.ComposeTemplateCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create compose template @@ -4601,7 +4587,7 @@ paths: $ref: '#/definitions/dto.BatchDelete' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete compose template @@ -4658,7 +4644,7 @@ paths: $ref: '#/definitions/dto.ComposeTemplateUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update compose template @@ -4691,7 +4677,7 @@ paths: $ref: '#/definitions/dto.VolumeCreat' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create volume @@ -4718,7 +4704,7 @@ paths: $ref: '#/definitions/dto.BatchDelete' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete volume @@ -4792,7 +4778,7 @@ paths: $ref: '#/definitions/dto.CronjobCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create cronjob @@ -4820,7 +4806,7 @@ paths: $ref: '#/definitions/dto.CronjobBatchDelete' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete cronjob @@ -4853,7 +4839,7 @@ paths: $ref: '#/definitions/dto.CronjobDownload' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Download cronjob records @@ -4886,7 +4872,7 @@ paths: $ref: '#/definitions/dto.OperateByID' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Handle cronjob once @@ -4919,7 +4905,7 @@ paths: $ref: '#/definitions/dto.CronjobClean' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Clean job records @@ -4996,7 +4982,7 @@ paths: $ref: '#/definitions/dto.CronjobUpdateStatus' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update cronjob status @@ -5030,7 +5016,7 @@ paths: $ref: '#/definitions/dto.CronjobUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update cronjob @@ -5115,7 +5101,7 @@ paths: $ref: '#/definitions/dto.MysqlDBCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create mysql database @@ -5155,7 +5141,7 @@ paths: $ref: '#/definitions/dto.ChangeDBInfo' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Change mysql access @@ -5188,7 +5174,7 @@ paths: $ref: '#/definitions/dto.ChangeDBInfo' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Change mysql password @@ -5221,7 +5207,7 @@ paths: $ref: '#/definitions/dto.MysqlConfUpdateByFile' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update mysql conf by upload file @@ -5247,7 +5233,7 @@ paths: $ref: '#/definitions/dto.MysqlDBDelete' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete mysql database @@ -5302,7 +5288,7 @@ paths: $ref: '#/definitions/dto.UpdateDescription' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update mysql database description @@ -5393,7 +5379,7 @@ paths: $ref: '#/definitions/dto.RedisConfUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update redis conf @@ -5419,7 +5405,7 @@ paths: $ref: '#/definitions/dto.RedisConfUpdateByFile' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update redis conf by file @@ -5445,7 +5431,7 @@ paths: $ref: '#/definitions/dto.ChangeDBInfo' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Change redis password @@ -5484,7 +5470,7 @@ paths: $ref: '#/definitions/dto.RedisConfPersistenceUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update redis persistence conf @@ -5584,7 +5570,7 @@ paths: $ref: '#/definitions/dto.MysqlVariablesUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update mysql variables @@ -5610,7 +5596,7 @@ paths: $ref: '#/definitions/request.FileCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create file @@ -5637,7 +5623,7 @@ paths: $ref: '#/definitions/request.FileBatchDelete' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Batch delete file @@ -5664,7 +5650,7 @@ paths: $ref: '#/definitions/request.FilePathCheck' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Check file exist @@ -5688,7 +5674,7 @@ paths: type: file responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: ChunkUpload file @@ -5708,7 +5694,7 @@ paths: $ref: '#/definitions/request.FileCompress' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Compress file @@ -5764,7 +5750,7 @@ paths: $ref: '#/definitions/request.FileDeCompress' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Decompress file @@ -5791,7 +5777,7 @@ paths: $ref: '#/definitions/request.FileDelete' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete file @@ -5818,7 +5804,7 @@ paths: $ref: '#/definitions/request.FileDownload' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Download file @@ -5845,7 +5831,7 @@ paths: $ref: '#/definitions/dto.FilePath' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Download file with path @@ -5901,7 +5887,7 @@ paths: $ref: '#/definitions/request.FileCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Change file mode @@ -5929,7 +5915,7 @@ paths: $ref: '#/definitions/request.FileMove' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Move file @@ -5957,7 +5943,7 @@ paths: $ref: '#/definitions/request.FileRoleUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Change file owner @@ -5986,7 +5972,7 @@ paths: $ref: '#/definitions/request.FileRename' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Change file name @@ -6014,7 +6000,7 @@ paths: $ref: '#/definitions/request.FileEdit' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update file content @@ -6063,7 +6049,7 @@ paths: $ref: '#/definitions/request.DirSizeReq' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Load file size @@ -6109,7 +6095,7 @@ paths: type: file responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Upload file @@ -6158,7 +6144,7 @@ paths: $ref: '#/definitions/request.FileWget' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Wget file @@ -6187,7 +6173,7 @@ paths: $ref: '#/definitions/dto.GroupCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create group @@ -6215,7 +6201,7 @@ paths: $ref: '#/definitions/dto.OperateByID' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete group @@ -6276,7 +6262,7 @@ paths: $ref: '#/definitions/dto.GroupUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update group @@ -6304,7 +6290,7 @@ paths: $ref: '#/definitions/dto.HostOperate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create host @@ -6365,7 +6351,7 @@ paths: $ref: '#/definitions/dto.CommandOperate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create command @@ -6393,7 +6379,7 @@ paths: $ref: '#/definitions/dto.BatchDeleteReq' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete command @@ -6448,7 +6434,7 @@ paths: $ref: '#/definitions/dto.CommandOperate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update command @@ -6475,7 +6461,7 @@ paths: $ref: '#/definitions/dto.BatchDeleteReq' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete host @@ -6521,7 +6507,7 @@ paths: $ref: '#/definitions/dto.BatchRuleOperate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create group @@ -6570,7 +6556,7 @@ paths: $ref: '#/definitions/dto.PortRuleOperate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create group @@ -6620,7 +6606,7 @@ paths: $ref: '#/definitions/dto.AddrRuleUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create group @@ -6640,7 +6626,7 @@ paths: $ref: '#/definitions/dto.PortRuleUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create group @@ -6703,7 +6689,7 @@ paths: $ref: '#/definitions/dto.HostConnTest' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Test host conn by info @@ -6745,7 +6731,7 @@ paths: $ref: '#/definitions/dto.HostOperate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update host @@ -6773,7 +6759,7 @@ paths: $ref: '#/definitions/dto.ChangeHostGroup' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update host group @@ -6893,7 +6879,7 @@ paths: $ref: '#/definitions/request.NginxConfigFileUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update OpenResty conf by upload file @@ -6954,7 +6940,7 @@ paths: $ref: '#/definitions/request.NginxConfigUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update OpenResty conf @@ -6987,7 +6973,7 @@ paths: $ref: '#/definitions/request.RuntimeCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create runtime @@ -7013,7 +6999,7 @@ paths: type: string responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Get runtime @@ -7033,7 +7019,7 @@ paths: $ref: '#/definitions/request.RuntimeDelete' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete runtime @@ -7060,7 +7046,7 @@ paths: $ref: '#/definitions/request.RuntimeSearch' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: List runtimes @@ -7080,7 +7066,7 @@ paths: $ref: '#/definitions/request.RuntimeUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update runtime @@ -7107,7 +7093,7 @@ paths: $ref: '#/definitions/dto.BackupOperate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create backup account @@ -7134,7 +7120,7 @@ paths: $ref: '#/definitions/dto.CommonBackup' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Backup system data @@ -7163,7 +7149,7 @@ paths: $ref: '#/definitions/dto.BatchDeleteReq' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete backup account @@ -7196,7 +7182,7 @@ paths: $ref: '#/definitions/dto.BatchDeleteReq' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete backup record @@ -7229,7 +7215,7 @@ paths: $ref: '#/definitions/dto.DownloadRecord' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Download backup record @@ -7257,7 +7243,7 @@ paths: $ref: '#/definitions/dto.RecordSearch' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Page backup records @@ -7277,7 +7263,7 @@ paths: $ref: '#/definitions/dto.CommonRecover' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Recover system data @@ -7307,7 +7293,7 @@ paths: $ref: '#/definitions/dto.CommonRecover' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Recover system data by upload @@ -7393,7 +7379,7 @@ paths: $ref: '#/definitions/dto.BackupOperate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update backup account @@ -7419,32 +7405,6 @@ paths: summary: Load local backup dir tags: - System Setting - /settings/entrance/enable: - post: - consumes: - - application/json - description: 更新系统安全入口 - parameters: - - description: request - in: body - name: request - required: true - schema: - $ref: '#/definitions/dto.SettingUpdate' - responses: - "200": - description: OK - security: - - ApiKeyAuth: [] - summary: Update system entrance - tags: - - System Setting - x-panel-log: - BeforeFuntions: [] - bodyKeys: [] - formatEN: update system setting [SecurityEntranceStatus] => [Enable] - formatZH: 修改系统配置 [SecurityEntranceStatus] => [打开] - paramKeys: [] /settings/expired/handle: post: consumes: @@ -7459,7 +7419,7 @@ paths: $ref: '#/definitions/dto.PasswordUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Reset system password expired @@ -7498,7 +7458,7 @@ paths: $ref: '#/definitions/dto.MfaCredential' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Bind mfa @@ -7515,7 +7475,7 @@ paths: description: 清空监控数据 responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Clean monitor datas @@ -7541,7 +7501,7 @@ paths: $ref: '#/definitions/dto.PasswordUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update system password @@ -7567,7 +7527,7 @@ paths: $ref: '#/definitions/dto.PortUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update system port @@ -7598,7 +7558,7 @@ paths: description: 获取系统可用状态 responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Load system available status @@ -7618,7 +7578,7 @@ paths: $ref: '#/definitions/dto.SnapshotCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create system snapshot @@ -7646,7 +7606,7 @@ paths: $ref: '#/definitions/dto.BatchDeleteReq' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete system backup @@ -7679,7 +7639,7 @@ paths: $ref: '#/definitions/dto.UpdateDescription' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update snapshot description @@ -7713,7 +7673,7 @@ paths: $ref: '#/definitions/dto.SnapshotImport' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Import system snapshot @@ -7741,7 +7701,7 @@ paths: $ref: '#/definitions/dto.SnapshotRecover' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Recover system backup @@ -7774,7 +7734,7 @@ paths: $ref: '#/definitions/dto.SnapshotRecover' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Rollback system backup @@ -7842,7 +7802,7 @@ paths: $ref: '#/definitions/dto.SSLUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update system ssl @@ -7888,7 +7848,7 @@ paths: $ref: '#/definitions/dto.SettingUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update system setting @@ -7916,7 +7876,7 @@ paths: $ref: '#/definitions/dto.Upgrade' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Load release notes by version @@ -7935,7 +7895,7 @@ paths: $ref: '#/definitions/dto.Upgrade' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Upgrade @@ -7962,7 +7922,7 @@ paths: $ref: '#/definitions/request.WebsiteCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create website @@ -8115,7 +8075,7 @@ paths: $ref: '#/definitions/request.WebsiteResourceReq' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete website acme account @@ -8170,7 +8130,7 @@ paths: $ref: '#/definitions/request.NginxAuthReq' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Get AuthBasic conf @@ -8190,7 +8150,7 @@ paths: $ref: '#/definitions/request.NginxAuthUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Get AuthBasic conf @@ -8254,7 +8214,7 @@ paths: $ref: '#/definitions/request.NginxConfigUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update nginx conf @@ -8287,7 +8247,7 @@ paths: $ref: '#/definitions/request.WebsiteDefaultUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Change default server @@ -8321,7 +8281,7 @@ paths: $ref: '#/definitions/request.WebsiteDelete' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete website @@ -8354,7 +8314,7 @@ paths: $ref: '#/definitions/request.WebsiteUpdateDirPermission' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update Site Dir permission @@ -8387,7 +8347,7 @@ paths: $ref: '#/definitions/request.WebsiteUpdateDir' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update Site Dir @@ -8420,7 +8380,7 @@ paths: $ref: '#/definitions/request.WebsiteDnsAccountCreate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Create website dns account @@ -8447,7 +8407,7 @@ paths: $ref: '#/definitions/request.WebsiteResourceReq' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete website dns account @@ -8502,7 +8462,7 @@ paths: $ref: '#/definitions/request.WebsiteDnsAccountUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update website dns account @@ -8579,7 +8539,7 @@ paths: $ref: '#/definitions/request.WebsiteDomainDelete' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete website domain @@ -8661,7 +8621,7 @@ paths: $ref: '#/definitions/request.WebsiteNginxUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update website nginx conf @@ -8694,7 +8654,7 @@ paths: $ref: '#/definitions/request.WebsiteOp' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Operate website @@ -8741,7 +8701,7 @@ paths: $ref: '#/definitions/request.WebsitePHPConfigUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update website php conf @@ -8795,7 +8755,7 @@ paths: $ref: '#/definitions/request.WebsitePHPFileUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update php conf @@ -8828,7 +8788,7 @@ paths: $ref: '#/definitions/request.WebsiteProxyReq' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Get proxy conf @@ -8848,7 +8808,7 @@ paths: $ref: '#/definitions/request.WebsiteProxyConfig' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update proxy conf @@ -8881,7 +8841,7 @@ paths: $ref: '#/definitions/request.NginxProxyUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update proxy file @@ -8914,7 +8874,7 @@ paths: $ref: '#/definitions/request.NginxRewriteReq' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Get rewrite conf @@ -8934,7 +8894,7 @@ paths: $ref: '#/definitions/request.NginxRewriteUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update rewrite conf @@ -9017,7 +8977,7 @@ paths: type: integer responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Search website ssl by id @@ -9037,7 +8997,7 @@ paths: $ref: '#/definitions/request.WebsiteResourceReq' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Delete website ssl @@ -9070,7 +9030,7 @@ paths: $ref: '#/definitions/request.WebsiteSSLRenew' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Reset website ssl @@ -9125,7 +9085,7 @@ paths: $ref: '#/definitions/request.WebsiteSSLSearch' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Page website ssl @@ -9145,7 +9105,7 @@ paths: $ref: '#/definitions/request.WebsiteSSLUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update ssl @@ -9177,7 +9137,7 @@ paths: type: integer responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Search website ssl by website id @@ -9197,7 +9157,7 @@ paths: $ref: '#/definitions/request.WebsiteUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update website @@ -9246,7 +9206,7 @@ paths: $ref: '#/definitions/request.WebsiteWafUpdate' responses: "200": - description: OK + description: "" security: - ApiKeyAuth: [] summary: Update website waf conf diff --git a/frontend/src/api/interface/setting.ts b/frontend/src/api/interface/setting.ts index d243657fe..1ff84d4bc 100644 --- a/frontend/src/api/interface/setting.ts +++ b/frontend/src/api/interface/setting.ts @@ -15,7 +15,6 @@ export namespace Setting { language: string; serverPort: number; - securityEntranceStatus: string; ssl: string; sslType: string; securityEntrance: string; diff --git a/frontend/src/api/modules/setting.ts b/frontend/src/api/modules/setting.ts index 76e7c8df4..51ffabd62 100644 --- a/frontend/src/api/modules/setting.ts +++ b/frontend/src/api/modules/setting.ts @@ -16,10 +16,6 @@ export const updateSetting = (param: Setting.SettingUpdate) => { return http.post(`/settings/update`, param); }; -export const updateEntrance = (param: Setting.SettingUpdate) => { - return http.post(`/settings/entrance/enable`, param); -}; - export const updatePassword = (param: Setting.PasswordUpdate) => { return http.post(`/settings/password/update`, param); }; diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 8d068423a..4fa265eb6 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -869,10 +869,11 @@ const message = { path: 'Path', safe: 'Security', - safeEntrance: 'Security entrance', + entrance: 'Entrance', entranceHelper: 'Enabling secure entry will only allow logging in to the panel through specified secure entry.', entranceError: 'Please enter a secure login entry point of 6-10 characters, only numbers or letters are supported.', + entranceInputHelper: 'When the security entry is set to blank, the security entry is cancelled.', expirationTime: 'Expiration Time', unSetting: 'Not Set', noneSetting: diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index cfb77a439..42b798c19 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -830,9 +830,6 @@ const message = { portHelper: '建议端口范围8888 - 65535,注意:有安全组的服务器请提前在安全组放行新端口', portChange: '端口修改', portChangeHelper: '服务端口修改需要重启服务,是否继续?', - entrance: '安全入口', - entranceHelper: '开启安全入口后只能通过指定安全入口登录面板', - entranceError: '请输入 6-10 位安全登录入口,仅支持输入数字或字母', theme: '主题颜色', componentSize: '组件大小', dark: '暗色', @@ -924,8 +921,10 @@ const message = { hasNewVersion: '有新版本', safe: '安全', - safeEntrance: '安全入口', - safeEntranceHelper: '面板管理入口,设置后只能通过指定安全入口登录面板,如: onepanel', + entrance: '安全入口', + entranceHelper: '开启安全入口后只能通过指定安全入口登录面板', + entranceError: '请输入 6-10 位安全登录入口,仅支持输入数字或字母', + entranceInputHelper: '安全入口设置为空时,则取消安全入口', expirationTime: '密码过期时间', unSetting: '未设置', noneSetting: '为面板密码设置过期时间,过期后需要重新设置密码', diff --git a/frontend/src/views/home/index.vue b/frontend/src/views/home/index.vue index 2deee084d..428b4c8bb 100644 --- a/frontend/src/views/home/index.vue +++ b/frontend/src/views/home/index.vue @@ -502,7 +502,7 @@ const loadUpgradeStatus = async () => { const loadSafeStatus = async () => { const res = await getSettingInfo(); - isSafety.value = res.data.securityEntranceStatus === 'enable'; + isSafety.value = res.data.securityEntrance; }; onMounted(() => { diff --git a/frontend/src/views/log/operation/index.vue b/frontend/src/views/log/operation/index.vue index 932fc4e7b..e30956639 100644 --- a/frontend/src/views/log/operation/index.vue +++ b/frontend/src/views/log/operation/index.vue @@ -183,9 +183,6 @@ const loadDetail = (log: string) => { if (log.indexOf('[SessionTimeout]') !== -1) { return log.replace('[SessionTimeout]', '[' + i18n.global.t('setting.sessionTimeout') + ']'); } - if (log.indexOf('SecurityEntranceStatus') !== -1) { - return log.replace('[SecurityEntranceStatus]', '[' + i18n.global.t('setting.entrance') + ']'); - } if (log.indexOf('SecurityEntrance') !== -1) { return log.replace('[SecurityEntrance]', '[' + i18n.global.t('setting.entrance') + ']'); } diff --git a/frontend/src/views/setting/panel/index.vue b/frontend/src/views/setting/panel/index.vue index 6ddbffc65..adce87728 100644 --- a/frontend/src/views/setting/panel/index.vue +++ b/frontend/src/views/setting/panel/index.vue @@ -21,7 +21,7 @@ - + - - - - - - {{ $t('setting.expirationHelper') }} - - - - + + + @@ -170,7 +148,8 @@ import { ElForm, ElMessageBox } from 'element-plus'; import { Setting } from '@/api/interface/setting'; import LayoutContent from '@/layout/layout-content.vue'; import SSLSetting from '@/views/setting/safe/ssl/index.vue'; -import DrawerHeader from '@/components/drawer-header/index.vue'; +import TimeoutSetting from '@/views/setting/safe/timeout/index.vue'; +import EntranceSetting from '@/views/setting/safe/entrance/index.vue'; import { updateSetting, getMFA, @@ -178,21 +157,18 @@ import { getSettingInfo, updatePort, getSystemAvailable, - updateEntrance, updateSSL, } from '@/api/modules/setting'; import i18n from '@/lang'; -import { Rules, checkNumberRange } from '@/global/form-rules'; -import { dateFormatSimple } from '@/utils/util'; +import { Rules } from '@/global/form-rules'; import { MsgError, MsgSuccess } from '@/utils/message'; -import { GlobalStore } from '@/store'; -const globalStore = GlobalStore(); const loading = ref(false); +const entranceRef = ref(); +const timeoutref = ref(); const form = reactive({ serverPort: 9999, - securityEntranceStatus: 'disable', ssl: 'disable', sslType: 'self', securityEntrance: '', @@ -203,20 +179,15 @@ const form = reactive({ mfaSecret: 'disable', }); type FormInstance = InstanceType; -const timeoutFormRef = ref(); -const timeoutVisiable = ref(false); -const timeoutForm = reactive({ - days: 0, -}); const sslShow = ref(); const oldSSLStatus = ref(); +const unset = ref(i18n.global.t('setting.unSetting')); + const search = async () => { const res = await getSettingInfo(); form.serverPort = Number(res.data.serverPort); - form.securityEntranceStatus = res.data.securityEntranceStatus; - isEntranceShow.value = res.data.securityEntranceStatus === 'enable'; form.ssl = res.data.ssl; oldSSLStatus.value = res.data.ssl; form.sslType = res.data.sslType; @@ -231,9 +202,6 @@ const search = async () => { form.mfaSecret = res.data.mfaSecret; }; -const isEntranceShow = ref(false); -const codeError = ref(false); - const isMFAShow = ref(false); const otp = reactive({ secret: '', @@ -322,23 +290,8 @@ const handleMFA = async () => { } }; -const handleEntrance = async () => { - if (form.securityEntranceStatus === 'enable') { - isEntranceShow.value = true; - } else { - isEntranceShow.value = false; - loading.value = true; - await updateSetting({ key: 'SecurityEntranceStatus', value: 'disable' }) - .then(() => { - globalStore.entrance = ''; - loading.value = false; - search(); - MsgSuccess(i18n.global.t('commons.msg.operationSuccess')); - }) - .catch(() => { - loading.value = false; - }); - } +const onChangeEntrance = async () => { + entranceRef.value.acceptParams({ securityEntrance: form.securityEntrance }); }; const handleSSL = async () => { @@ -368,29 +321,6 @@ const handleSSL = async () => { }); }; -const onSaveEntrance = async () => { - const reg = /^[A-Za-z0-9]{6,10}$/; - if ((!reg.test(form.securityEntrance) && form.securityEntrance !== '') || form.securityEntrance === '') { - codeError.value = true; - return; - } - loading.value = true; - await updateEntrance({ key: 'SecurityEntrance', value: form.securityEntrance }) - .then(() => { - globalStore.entrance = form.securityEntrance; - loading.value = false; - MsgSuccess(i18n.global.t('commons.msg.operationSuccess')); - search(); - }) - .catch(() => { - loading.value = false; - }); -}; - -const handleClose = () => { - timeoutVisiable.value = false; -}; - const onBind = async () => { if (!mfaCode.value) { MsgError(i18n.global.t('commons.msg.comfimNoNull', ['code'])); @@ -415,28 +345,7 @@ const onCancelMfaBind = async () => { }; const onChangeExpirationTime = async () => { - timeoutForm.days = form.expirationDays; - timeoutVisiable.value = true; -}; - -const submitTimeout = async (formEl: FormInstance | undefined) => { - if (!formEl) return; - formEl.validate(async (valid) => { - if (!valid) return; - let time = new Date(new Date().getTime() + 3600 * 1000 * 24 * timeoutForm.days); - loading.value = true; - await updateSetting({ key: 'ExpirationDays', value: timeoutForm.days + '' }) - .then(() => { - loading.value = false; - search(); - loadTimeOut(); - form.expirationTime = dateFormatSimple(time); - timeoutVisiable.value = false; - }) - .catch(() => { - loading.value = false; - }); - }); + timeoutref.value.acceptParams({ expirationDays: form.expirationDays }); }; function loadTimeOut() { diff --git a/frontend/src/views/setting/safe/timeout/index.vue b/frontend/src/views/setting/safe/timeout/index.vue new file mode 100644 index 000000000..ea5625fbf --- /dev/null +++ b/frontend/src/views/setting/safe/timeout/index.vue @@ -0,0 +1,81 @@ + + + +