Browse Source

fix: 系统操作日志调整为从 swagger.json 读取

pull/103/head
ssongliu 2 years ago committed by ssongliu
parent
commit
5a20546fc6
  1. 37
      backend/app/api/v1/app.go
  2. 110
      backend/app/api/v1/app_install.go
  3. 6
      backend/app/api/v1/auth.go
  4. 14
      backend/app/api/v1/backup.go
  5. 11
      backend/app/api/v1/command.go
  6. 11
      backend/app/api/v1/compose_template.go
  7. 27
      backend/app/api/v1/container.go
  8. 24
      backend/app/api/v1/cronjob.go
  9. 2
      backend/app/api/v1/dashboard.go
  10. 25
      backend/app/api/v1/database_mysql.go
  11. 12
      backend/app/api/v1/database_redis.go
  12. 5
      backend/app/api/v1/docker.go
  13. 21
      backend/app/api/v1/file.go
  14. 9
      backend/app/api/v1/group.go
  15. 23
      backend/app/api/v1/host.go
  16. 13
      backend/app/api/v1/image.go
  17. 9
      backend/app/api/v1/image_repo.go
  18. 7
      backend/app/api/v1/logs.go
  19. 11
      backend/app/api/v1/nginx.go
  20. 8
      backend/app/api/v1/setting.go
  21. 41
      backend/app/api/v1/website.go
  22. 5
      backend/app/api/v1/website_acme_account.go
  23. 6
      backend/app/api/v1/website_dns_account.go
  24. 6
      backend/app/api/v1/website_group.go
  25. 9
      backend/app/api/v1/website_ssl.go
  26. 52
      backend/middleware/operation.go
  27. 6
      backend/router/ro_website.go
  28. 10650
      cmd/server/docs/docs.go
  29. 6
      cmd/server/docs/swagger.go
  30. 10650
      cmd/server/docs/swagger.json
  31. 6344
      cmd/server/docs/swagger.yaml
  32. 2
      cmd/server/main.go
  33. 6
      cmd/server/operation/operation.go
  34. 130
      cmd/server/operation/operation.json
  35. 1
      frontend/src/lang/modules/en.ts
  36. 1
      frontend/src/lang/modules/zh.ts

37
backend/app/api/v1/app.go

@ -7,9 +7,8 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// List app
// @Tags App // @Tags App
// @Summary Search app list // @Summary List apps
// @Description 获取应用列表 // @Description 获取应用列表
// @Accept json // @Accept json
// @Param request body request.AppSearch true "request" // @Param request body request.AppSearch true "request"
@ -30,6 +29,13 @@ func (b *BaseApi) SearchApp(c *gin.Context) {
helper.SuccessWithData(c, list) helper.SuccessWithData(c, list)
} }
// @Tags App
// @Summary Sync app list
// @Description 同步应用列表
// @Success 200
// @Security ApiKeyAuth
// @Router /apps/sync [post]
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFuntions":[],"formatZH":"应用商店同步","formatEN":"App store synchronization"}
func (b *BaseApi) SyncApp(c *gin.Context) { func (b *BaseApi) SyncApp(c *gin.Context) {
if err := appService.SyncAppList(); err != nil { if err := appService.SyncAppList(); err != nil {
helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err) helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
@ -38,6 +44,14 @@ func (b *BaseApi) SyncApp(c *gin.Context) {
helper.SuccessWithData(c, "") helper.SuccessWithData(c, "")
} }
// @Tags App
// @Summary Search app by id
// @Description 通过 id 获取应用信息
// @Accept json
// @Param id path integer true "app id"
// @Success 200 {object} response.AppDTO
// @Security ApiKeyAuth
// @Router /apps/:id [get]
func (b *BaseApi) GetApp(c *gin.Context) { func (b *BaseApi) GetApp(c *gin.Context) {
id, err := helper.GetParamID(c) id, err := helper.GetParamID(c)
if err != nil { if err != nil {
@ -51,6 +65,16 @@ func (b *BaseApi) GetApp(c *gin.Context) {
} }
helper.SuccessWithData(c, appDTO) helper.SuccessWithData(c, appDTO)
} }
// @Tags App
// @Summary Search app detail by id
// @Description 通过 id 获取应用详情
// @Accept json
// @Param appId path integer true "app id"
// @Param version path string true "app 版本"
// @Success 200 {object} response.AppDetailDTO
// @Security ApiKeyAuth
// @Router /apps/detail/:appId/:version [get]
func (b *BaseApi) GetAppDetail(c *gin.Context) { func (b *BaseApi) GetAppDetail(c *gin.Context) {
appId, err := helper.GetIntParamByKey(c, "appId") appId, err := helper.GetIntParamByKey(c, "appId")
if err != nil { if err != nil {
@ -66,6 +90,15 @@ func (b *BaseApi) GetAppDetail(c *gin.Context) {
helper.SuccessWithData(c, appDetailDTO) helper.SuccessWithData(c, appDetailDTO)
} }
// @Tags App
// @Summary Install app
// @Description 安装应用
// @Accept json
// @Param request body request.AppInstallCreate true "request"
// @Success 200 {object} model.AppInstall
// @Security ApiKeyAuth
// @Router /apps/install [post]
// @x-panel-log {"bodyKeys":["name"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"name","input_value":"name","isList":false,"db":"app_installs","output_colume":"app_id","output_value":"appId"},{"info":"appId","isList":false,"db":"apps","output_colume":"key","output_value":"appKey"}],"formatZH":"安装应用 [appKey]-[name]","formatEN":"Install app [appKey]-[name]"}
func (b *BaseApi) InstallApp(c *gin.Context) { func (b *BaseApi) InstallApp(c *gin.Context) {
var req request.AppInstallCreate var req request.AppInstallCreate
if err := c.ShouldBindJSON(&req); err != nil { if err := c.ShouldBindJSON(&req); err != nil {

110
backend/app/api/v1/app_install.go

@ -13,9 +13,8 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// List app installed
// @Tags App // @Tags App
// @Summary Search app list installed // @Summary List app installed
// @Description 获取已安装应用列表 // @Description 获取已安装应用列表
// @Accept json // @Accept json
// @Param request body request.AppInstalledSearch true "request" // @Param request body request.AppInstalledSearch true "request"
@ -48,6 +47,14 @@ func (b *BaseApi) SearchAppInstalled(c *gin.Context) {
} }
} }
// @Tags App
// @Summary Check app installed
// @Description 检查应用安装情况
// @Accept json
// @Param key path string true "request"
// @Success 200 {object} response.AppInstalledCheck
// @Security ApiKeyAuth
// @Router /apps/installed/check/:key [get]
func (b *BaseApi) CheckAppInstalled(c *gin.Context) { func (b *BaseApi) CheckAppInstalled(c *gin.Context) {
key, ok := c.Params.Get("key") key, ok := c.Params.Get("key")
if !ok { if !ok {
@ -62,6 +69,14 @@ func (b *BaseApi) CheckAppInstalled(c *gin.Context) {
helper.SuccessWithData(c, checkData) helper.SuccessWithData(c, checkData)
} }
// @Tags App
// @Summary Search app port by key
// @Description 获取应用端口
// @Accept json
// @Param key path string true "request"
// @Success 200 {integer} port
// @Security ApiKeyAuth
// @Router /apps/installed/loadport/:key [get]
func (b *BaseApi) LoadPort(c *gin.Context) { func (b *BaseApi) LoadPort(c *gin.Context) {
key, ok := c.Params.Get("key") key, ok := c.Params.Get("key")
if !ok { if !ok {
@ -76,6 +91,14 @@ func (b *BaseApi) LoadPort(c *gin.Context) {
helper.SuccessWithData(c, port) helper.SuccessWithData(c, port)
} }
// @Tags App
// @Summary Search app password by key
// @Description 获取应用密码
// @Accept json
// @Param key path string true "request"
// @Success 200 {string} password
// @Security ApiKeyAuth
// @Router /apps/installed/loadpassword/:key [get]
func (b *BaseApi) LoadPassword(c *gin.Context) { func (b *BaseApi) LoadPassword(c *gin.Context) {
key, ok := c.Params.Get("key") key, ok := c.Params.Get("key")
if !ok { if !ok {
@ -90,6 +113,14 @@ func (b *BaseApi) LoadPassword(c *gin.Context) {
helper.SuccessWithData(c, password) helper.SuccessWithData(c, password)
} }
// @Tags App
// @Summary Check before delete
// @Description 删除前检查
// @Accept json
// @Param appInstallId path integer true "App install id"
// @Success 200 {anrry} dto.AppResource
// @Security ApiKeyAuth
// @Router /apps/installed/delete/check/:appInstallId [get]
func (b *BaseApi) DeleteCheck(c *gin.Context) { func (b *BaseApi) DeleteCheck(c *gin.Context) {
appInstallId, err := helper.GetIntParamByKey(c, "appInstallId") appInstallId, err := helper.GetIntParamByKey(c, "appInstallId")
if err != nil { if err != nil {
@ -104,6 +135,14 @@ func (b *BaseApi) DeleteCheck(c *gin.Context) {
helper.SuccessWithData(c, checkData) helper.SuccessWithData(c, checkData)
} }
// Sync app installed
// @Tags App
// @Summary Sync app installed
// @Description 同步已安装应用列表
// @Success 200
// @Security ApiKeyAuth
// @Router /apps/installed/sync [post]
// @x-panel-log {"bodyKeys":[],"paramKeys":[],"BeforeFuntions":[],"formatZH":"同步已安装应用列表","formatEN":"Sync the list of installed apps"}
func (b *BaseApi) SyncInstalled(c *gin.Context) { func (b *BaseApi) SyncInstalled(c *gin.Context) {
if err := appInstallService.SyncAll(); err != nil { if err := appInstallService.SyncAll(); err != nil {
helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err) helper.ErrorWithDetail(c, constant.CodeErrInternalServer, constant.ErrTypeInternalServer, err)
@ -112,6 +151,14 @@ func (b *BaseApi) SyncInstalled(c *gin.Context) {
helper.SuccessWithData(c, "") helper.SuccessWithData(c, "")
} }
// @Tags App
// @Summary Page installed backups
// @Description 查询已安装备份列表分页
// @Accept json
// @Param request body request.AppBackupSearch true "request"
// @Success 200 {object} dto.PageResult
// @Security ApiKeyAuth
// @Router /apps/installed/backups [post]
func (b *BaseApi) SearchInstalledBackup(c *gin.Context) { func (b *BaseApi) SearchInstalledBackup(c *gin.Context) {
var req request.AppBackupSearch var req request.AppBackupSearch
if err := c.ShouldBindJSON(&req); err != nil { if err := c.ShouldBindJSON(&req); err != nil {
@ -129,6 +176,15 @@ func (b *BaseApi) SearchInstalledBackup(c *gin.Context) {
}) })
} }
// @Tags App
// @Summary Operate installed app
// @Description 操作已安装应用
// @Accept json
// @Param request body request.AppInstalledOperate true "request"
// @Success 200
// @Security ApiKeyAuth
// @Router /apps/installed/op [post]
// @x-panel-log {"bodyKeys":["installId","operate"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"installId","isList":false,"db":"app_installs","output_colume":"app_id","output_value":"appId"},{"input_colume":"id","input_value":"installId","isList":false,"db":"app_installs","output_colume":"name","output_value":"appName"},{"input_colume":"id","input_value":"appId","isList":false,"db":"apps","output_colume":"key","output_value":"appKey"}],"formatZH":"[appKey] 应用 [appName] [operate]","formatEN":"[appKey] App [appName] [operate]"}
func (b *BaseApi) OperateInstalled(c *gin.Context) { func (b *BaseApi) OperateInstalled(c *gin.Context) {
var req request.AppInstalledOperate var req request.AppInstalledOperate
if err := c.ShouldBindJSON(&req); err != nil { if err := c.ShouldBindJSON(&req); err != nil {
@ -142,6 +198,15 @@ func (b *BaseApi) OperateInstalled(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// @Tags App
// @Summary Delete app backup record
// @Description 删除应用备份记录
// @Accept json
// @Param request body request.AppBackupDelete true "request"
// @Success 200
// @Security ApiKeyAuth
// @Router /apps/installed/backups/del [post]
// @x-panel-log {"bodyKeys":["ids"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"ids","isList":true,"db":"app_install_backups","output_colume":"name","output_value":"names"}],"formatZH":"删除应用备份 [names]","formatEN":"Deleting an Application Backup [names]"}
func (b *BaseApi) DeleteAppBackup(c *gin.Context) { func (b *BaseApi) DeleteAppBackup(c *gin.Context) {
var req request.AppBackupDelete var req request.AppBackupDelete
if err := c.ShouldBindJSON(&req); err != nil { if err := c.ShouldBindJSON(&req); err != nil {
@ -155,6 +220,14 @@ func (b *BaseApi) DeleteAppBackup(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// @Tags App
// @Summary Search app service by key
// @Description 通过 key 获取应用 service
// @Accept json
// @Param key path string true "request"
// @Success 200 {anrry} response.AppService
// @Security ApiKeyAuth
// @Router /apps/services/:key [get]
func (b *BaseApi) GetServices(c *gin.Context) { func (b *BaseApi) GetServices(c *gin.Context) {
key := c.Param("key") key := c.Param("key")
services, err := appInstallService.GetServices(key) services, err := appInstallService.GetServices(key)
@ -165,6 +238,14 @@ func (b *BaseApi) GetServices(c *gin.Context) {
helper.SuccessWithData(c, services) helper.SuccessWithData(c, services)
} }
// @Tags App
// @Summary Search app update version by install id
// @Description 通过 install id 获取应用更新版本
// @Accept json
// @Param appInstallId path integer true "request"
// @Success 200 {anrry} dto.AppVersion
// @Security ApiKeyAuth
// @Router /apps/installed/:appInstallId/versions [get]
func (b *BaseApi) GetUpdateVersions(c *gin.Context) { func (b *BaseApi) GetUpdateVersions(c *gin.Context) {
appInstallId, err := helper.GetIntParamByKey(c, "appInstallId") appInstallId, err := helper.GetIntParamByKey(c, "appInstallId")
if err != nil { if err != nil {
@ -179,6 +260,15 @@ func (b *BaseApi) GetUpdateVersions(c *gin.Context) {
helper.SuccessWithData(c, versions) helper.SuccessWithData(c, versions)
} }
// @Tags App
// @Summary Change app port
// @Description 修改应用端口
// @Accept json
// @Param request body request.PortUpdate true "request"
// @Success 200
// @Security ApiKeyAuth
// @Router /apps/installed/port/change [post]
// @x-panel-log {"bodyKeys":["key","name","port"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"应用端口修改 [key]-[name] => [port]","formatEN":"Application port update [key]-[name] => [port]"}
func (b *BaseApi) ChangeAppPort(c *gin.Context) { func (b *BaseApi) ChangeAppPort(c *gin.Context) {
var req request.PortUpdate var req request.PortUpdate
if err := c.ShouldBindJSON(&req); err != nil { if err := c.ShouldBindJSON(&req); err != nil {
@ -196,6 +286,14 @@ func (b *BaseApi) ChangeAppPort(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// @Tags App
// @Summary Search default config by key
// @Description 通过 key 获取应用默认配置
// @Accept json
// @Param key path string true "request"
// @Success 200 {string} content
// @Security ApiKeyAuth
// @Router /apps/installed/conf/:key [get]
func (b *BaseApi) GetDefaultConfig(c *gin.Context) { func (b *BaseApi) GetDefaultConfig(c *gin.Context) {
key := c.Param("key") key := c.Param("key")
if key == "" { if key == "" {
@ -211,6 +309,14 @@ func (b *BaseApi) GetDefaultConfig(c *gin.Context) {
helper.SuccessWithData(c, content) helper.SuccessWithData(c, content)
} }
// @Tags App
// @Summary Search params by appInstallId
// @Description 通过 install id 获取应用参数
// @Accept json
// @Param appInstallId path string true "request"
// @Success 200 {object} response.AppParam
// @Security ApiKeyAuth
// @Router /apps/installed/params/:appInstallId [get]
func (b *BaseApi) GetParams(c *gin.Context) { func (b *BaseApi) GetParams(c *gin.Context) {
appInstallId, err := helper.GetIntParamByKey(c, "appInstallId") appInstallId, err := helper.GetIntParamByKey(c, "appInstallId")
if err != nil { if err != nil {

6
backend/app/api/v1/auth.go

@ -15,7 +15,6 @@ import (
type BaseApi struct{} type BaseApi struct{}
// User login
// @Tags Auth // @Tags Auth
// @Summary User login // @Summary User login
// @Description 用户登录 // @Description 用户登录
@ -47,7 +46,6 @@ func (b *BaseApi) Login(c *gin.Context) {
helper.SuccessWithData(c, user) helper.SuccessWithData(c, user)
} }
// User login with mfa
// @Tags Auth // @Tags Auth
// @Summary User login with mfa // @Summary User login with mfa
// @Description 用户 mfa 登录 // @Description 用户 mfa 登录
@ -74,7 +72,6 @@ func (b *BaseApi) MFALogin(c *gin.Context) {
helper.SuccessWithData(c, user) helper.SuccessWithData(c, user)
} }
// User logout
// @Tags Auth // @Tags Auth
// @Summary User logout // @Summary User logout
// @Description 用户登出 // @Description 用户登出
@ -89,7 +86,6 @@ func (b *BaseApi) LogOut(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Load captcha
// @Tags Auth // @Tags Auth
// @Summary Load captcha // @Summary Load captcha
// @Description 加载验证码 // @Description 加载验证码
@ -104,7 +100,6 @@ func (b *BaseApi) Captcha(c *gin.Context) {
helper.SuccessWithData(c, captcha) helper.SuccessWithData(c, captcha)
} }
// Load safety status
// @Tags Auth // @Tags Auth
// @Summary Load safety status // @Summary Load safety status
// @Description 获取系统安全登录状态 // @Description 获取系统安全登录状态
@ -146,7 +141,6 @@ func (b *BaseApi) CheckIsFirstLogin(c *gin.Context) {
helper.SuccessWithData(c, authService.CheckIsFirst()) helper.SuccessWithData(c, authService.CheckIsFirst())
} }
// Init user
// @Tags Auth // @Tags Auth
// @Summary Init user // @Summary Init user
// @Description 初始化用户 // @Description 初始化用户

14
backend/app/api/v1/backup.go

@ -8,7 +8,6 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// Create backup account
// @Tags Backup Account // @Tags Backup Account
// @Summary Create backup account // @Summary Create backup account
// @Description 创建备份账号 // @Description 创建备份账号
@ -35,9 +34,8 @@ func (b *BaseApi) CreateBackup(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// List bucket
// @Tags Backup Account // @Tags Backup Account
// @Summary List bucket // @Summary List buckets
// @Description 获取 bucket 列表 // @Description 获取 bucket 列表
// @Accept json // @Accept json
// @Param request body dto.ForBuckets true "request" // @Param request body dto.ForBuckets true "request"
@ -62,7 +60,6 @@ func (b *BaseApi) ListBuckets(c *gin.Context) {
helper.SuccessWithData(c, buckets) helper.SuccessWithData(c, buckets)
} }
// Delete backup account
// @Tags Backup Account // @Tags Backup Account
// @Summary Delete backup account // @Summary Delete backup account
// @Description 删除备份账号 // @Description 删除备份账号
@ -90,9 +87,8 @@ func (b *BaseApi) DeleteBackup(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Page backup records
// @Tags Backup Account // @Tags Backup Account
// @Summary Search backup records with page // @Summary Page backup records
// @Description 获取备份记录列表分页 // @Description 获取备份记录列表分页
// @Accept json // @Accept json
// @Param request body dto.RecordSearch true "request" // @Param request body dto.RecordSearch true "request"
@ -118,7 +114,6 @@ func (b *BaseApi) SearchBackupRecords(c *gin.Context) {
}) })
} }
// Download backup record
// @Tags Backup Account // @Tags Backup Account
// @Summary Download backup record // @Summary Download backup record
// @Description 下载备份记录 // @Description 下载备份记录
@ -147,7 +142,6 @@ func (b *BaseApi) DownloadRecord(c *gin.Context) {
c.File(filePath) c.File(filePath)
} }
// Delete backup record
// @Tags Backup Account // @Tags Backup Account
// @Summary Delete backup record // @Summary Delete backup record
// @Description 删除备份记录 // @Description 删除备份记录
@ -175,7 +169,6 @@ func (b *BaseApi) DeleteBackupRecord(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Update backup account
// @Tags Backup Account // @Tags Backup Account
// @Summary Update backup account // @Summary Update backup account
// @Description 更新备份账号信息 // @Description 更新备份账号信息
@ -207,9 +200,8 @@ func (b *BaseApi) UpdateBackup(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// List backup account
// @Tags Backup Account // @Tags Backup Account
// @Summary Search backup account // @Summary List backup accounts
// @Description 获取备份账号列表 // @Description 获取备份账号列表
// @Success 200 {anrry} dto.BackupInfo // @Success 200 {anrry} dto.BackupInfo
// @Security ApiKeyAuth // @Security ApiKeyAuth

11
backend/app/api/v1/command.go

@ -8,7 +8,6 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// Create command
// @Tags Command // @Tags Command
// @Summary Create command // @Summary Create command
// @Description 创建快速命令 // @Description 创建快速命令
@ -35,15 +34,14 @@ func (b *BaseApi) CreateCommand(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Page command
// @Tags Command // @Tags Command
// @Summary Search command with page // @Summary Page commands
// @Description 获取快速命令列表分页 // @Description 获取快速命令列表分页
// @Accept json // @Accept json
// @Param request body dto.SearchWithPage true "request" // @Param request body dto.SearchWithPage true "request"
// @Success 200 {object} dto.PageResult // @Success 200 {object} dto.PageResult
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /commands [post] // @Router /commands/search [post]
func (b *BaseApi) SearchCommand(c *gin.Context) { func (b *BaseApi) SearchCommand(c *gin.Context) {
var req dto.SearchWithPage var req dto.SearchWithPage
if err := c.ShouldBindJSON(&req); err != nil { if err := c.ShouldBindJSON(&req); err != nil {
@ -63,9 +61,8 @@ func (b *BaseApi) SearchCommand(c *gin.Context) {
}) })
} }
// List command
// @Tags Command // @Tags Command
// @Summary Search command // @Summary List commands
// @Description 获取快速命令列表 // @Description 获取快速命令列表
// @Success 200 {object} dto.CommandInfo // @Success 200 {object} dto.CommandInfo
// @Security ApiKeyAuth // @Security ApiKeyAuth
@ -80,7 +77,6 @@ func (b *BaseApi) ListCommand(c *gin.Context) {
helper.SuccessWithData(c, list) helper.SuccessWithData(c, list)
} }
// Delete command
// @Tags Command // @Tags Command
// @Summary Delete command // @Summary Delete command
// @Description 删除快速命令 // @Description 删除快速命令
@ -108,7 +104,6 @@ func (b *BaseApi) DeleteCommand(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Update command
// @Tags Command // @Tags Command
// @Summary Update command // @Summary Update command
// @Description 更新快速命令 // @Description 更新快速命令

11
backend/app/api/v1/compose_template.go

@ -8,9 +8,8 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// Create Compose template
// @Tags Container Compose-template // @Tags Container Compose-template
// @Summary Create Compose template // @Summary Create compose template
// @Description 创建容器编排模版 // @Description 创建容器编排模版
// @Accept json // @Accept json
// @Param request body dto.ComposeTemplateCreate true "request" // @Param request body dto.ComposeTemplateCreate true "request"
@ -35,9 +34,8 @@ func (b *BaseApi) CreateComposeTemplate(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Page compose template
// @Tags Container Compose-template // @Tags Container Compose-template
// @Summary Search compose template list with page // @Summary Page compose templates
// @Description 获取容器编排模版列表分页 // @Description 获取容器编排模版列表分页
// @Accept json // @Accept json
// @Param request body dto.PageInfo true "request" // @Param request body dto.PageInfo true "request"
@ -64,9 +62,8 @@ func (b *BaseApi) SearchComposeTemplate(c *gin.Context) {
}) })
} }
// List compose template
// @Tags Container Compose-template // @Tags Container Compose-template
// @Summary Search compose template list // @Summary List compose templates
// @Description 获取容器编排模版列表 // @Description 获取容器编排模版列表
// @Produce json // @Produce json
// @Success 200 {anrry} dto.ComposeTemplateInfo // @Success 200 {anrry} dto.ComposeTemplateInfo
@ -82,7 +79,6 @@ func (b *BaseApi) ListComposeTemplate(c *gin.Context) {
helper.SuccessWithData(c, list) helper.SuccessWithData(c, list)
} }
// Delete compose template
// @Tags Container Compose-template // @Tags Container Compose-template
// @Summary Delete compose template // @Summary Delete compose template
// @Description 删除容器编排模版 // @Description 删除容器编排模版
@ -110,7 +106,6 @@ func (b *BaseApi) DeleteComposeTemplate(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Update compose template
// @Tags Container Compose-template // @Tags Container Compose-template
// @Summary Update compose template // @Summary Update compose template
// @Description 更新容器编排模版 // @Description 更新容器编排模版

27
backend/app/api/v1/container.go

@ -15,9 +15,8 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
) )
// Page container
// @Tags Container // @Tags Container
// @Summary Search container list with page // @Summary Page containers
// @Description 获取容器列表分页 // @Description 获取容器列表分页
// @Accept json // @Accept json
// @Param request body dto.PageContainer true "request" // @Param request body dto.PageContainer true "request"
@ -47,9 +46,8 @@ func (b *BaseApi) SearchContainer(c *gin.Context) {
}) })
} }
// Page compose
// @Tags Container Compose // @Tags Container Compose
// @Summary Search compose list with page // @Summary Page composes
// @Description 获取编排列表分页 // @Description 获取编排列表分页
// @Accept json // @Accept json
// @Param request body dto.PageInfo true "request" // @Param request body dto.PageInfo true "request"
@ -78,7 +76,6 @@ func (b *BaseApi) SearchCompose(c *gin.Context) {
}) })
} }
// Create compose
// @Tags Container Compose // @Tags Container Compose
// @Summary Create compose // @Summary Create compose
// @Description 创建容器编排 // @Description 创建容器编排
@ -106,7 +103,6 @@ func (b *BaseApi) CreateCompose(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Operate compose
// @Tags Container Compose // @Tags Container Compose
// @Summary Operate compose // @Summary Operate compose
// @Description 容器编排操作 // @Description 容器编排操作
@ -134,7 +130,6 @@ func (b *BaseApi) OperatorCompose(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Create container
// @Tags Container // @Tags Container
// @Summary Create container // @Summary Create container
// @Description 创建容器 // @Description 创建容器
@ -161,7 +156,6 @@ func (b *BaseApi) ContainerCreate(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Operate Container
// @Tags Container // @Tags Container
// @Summary Operate Container // @Summary Operate Container
// @Description 容器操作 // @Description 容器操作
@ -188,7 +182,6 @@ func (b *BaseApi) ContainerOperation(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Container stats
// @Tags Container // @Tags Container
// @Summary Container stats // @Summary Container stats
// @Description 容器监控信息 // @Description 容器监控信息
@ -211,7 +204,6 @@ func (b *BaseApi) ContainerStats(c *gin.Context) {
helper.SuccessWithData(c, result) helper.SuccessWithData(c, result)
} }
// Container inspect
// @Tags Container // @Tags Container
// @Summary Container inspect // @Summary Container inspect
// @Description 容器详情 // @Description 容器详情
@ -296,7 +288,6 @@ func (b *BaseApi) ContainerExec(c *gin.Context) {
} }
} }
// Container logs
// @Tags Container // @Tags Container
// @Summary Container logs // @Summary Container logs
// @Description 容器日志 // @Description 容器日志
@ -323,9 +314,8 @@ func (b *BaseApi) ContainerLogs(c *gin.Context) {
helper.SuccessWithData(c, logs) helper.SuccessWithData(c, logs)
} }
// Page network
// @Tags Container Network // @Tags Container Network
// @Summary Search network list with page // @Summary Page networks
// @Description 获取容器网络列表分页 // @Description 获取容器网络列表分页
// @Accept json // @Accept json
// @Param request body dto.PageInfo true "request" // @Param request body dto.PageInfo true "request"
@ -355,7 +345,6 @@ func (b *BaseApi) SearchNetwork(c *gin.Context) {
}) })
} }
// Delete network
// @Tags Container Network // @Tags Container Network
// @Summary Delete network // @Summary Delete network
// @Description 删除容器网络 // @Description 删除容器网络
@ -383,7 +372,6 @@ func (b *BaseApi) DeleteNetwork(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Create network
// @Tags Container Network // @Tags Container Network
// @Summary Create network // @Summary Create network
// @Description 创建容器网络 // @Description 创建容器网络
@ -411,9 +399,8 @@ func (b *BaseApi) CreateNetwork(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Page volume
// @Tags Container Volume // @Tags Container Volume
// @Summary Search volume list with page // @Summary Page volumes
// @Description 获取容器存储卷分页 // @Description 获取容器存储卷分页
// @Accept json // @Accept json
// @Param request body dto.PageInfo true "request" // @Param request body dto.PageInfo true "request"
@ -443,9 +430,8 @@ func (b *BaseApi) SearchVolume(c *gin.Context) {
}) })
} }
// List volume
// @Tags Container Volume // @Tags Container Volume
// @Summary Search volume list // @Summary List volumes
// @Description 获取容器存储卷列表 // @Description 获取容器存储卷列表
// @Accept json // @Accept json
// @Param request body dto.PageInfo true "request" // @Param request body dto.PageInfo true "request"
@ -462,7 +448,6 @@ func (b *BaseApi) ListVolume(c *gin.Context) {
helper.SuccessWithData(c, list) helper.SuccessWithData(c, list)
} }
// Delete volume
// @Tags Container Volume // @Tags Container Volume
// @Summary Delete volume // @Summary Delete volume
// @Description 删除容器存储卷 // @Description 删除容器存储卷
@ -490,7 +475,6 @@ func (b *BaseApi) DeleteVolume(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Create volume
// @Tags Container Volume // @Tags Container Volume
// @Summary Create volume // @Summary Create volume
// @Description 创建容器存储卷 // @Description 创建容器存储卷
@ -518,7 +502,6 @@ func (b *BaseApi) CreateVolume(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Update compose
// @Tags Container Compose // @Tags Container Compose
// @Summary Update compose // @Summary Update compose
// @Description 更新容器编排 // @Description 更新容器编排

24
backend/app/api/v1/cronjob.go

@ -10,7 +10,6 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// Create cronjob
// @Tags Cronjob // @Tags Cronjob
// @Summary Create cronjob // @Summary Create cronjob
// @Description 创建计划任务 // @Description 创建计划任务
@ -37,9 +36,8 @@ func (b *BaseApi) CreateCronjob(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Page cronjob
// @Tags Cronjob // @Tags Cronjob
// @Summary Search cronjob list with page // @Summary Page cronjobs
// @Description 获取计划任务分页 // @Description 获取计划任务分页
// @Accept json // @Accept json
// @Param request body dto.SearchWithPage true "request" // @Param request body dto.SearchWithPage true "request"
@ -65,9 +63,8 @@ func (b *BaseApi) SearchCronjob(c *gin.Context) {
}) })
} }
// Search job records
// @Tags Cronjob // @Tags Cronjob
// @Summary Search job records // @Summary Page job records
// @Description 获取计划任务记录 // @Description 获取计划任务记录
// @Accept json // @Accept json
// @Param request body dto.SearchRecord true "request" // @Param request body dto.SearchRecord true "request"
@ -97,7 +94,6 @@ func (b *BaseApi) SearchJobRecords(c *gin.Context) {
}) })
} }
// Delete cronjob
// @Tags Cronjob // @Tags Cronjob
// @Summary Delete cronjob // @Summary Delete cronjob
// @Description 删除计划任务 // @Description 删除计划任务
@ -105,7 +101,7 @@ func (b *BaseApi) SearchJobRecords(c *gin.Context) {
// @Param request body dto.BatchDeleteReq true "request" // @Param request body dto.BatchDeleteReq true "request"
// @Success 200 // @Success 200
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /cronjob/del [post] // @Router /cronjobs/del [post]
// @x-panel-log {"bodyKeys":["ids"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"ids","isList":true,"db":"cronjobs","output_colume":"name","output_value":"names"}],"formatZH":"删除计划任务 [names]","formatEN":"delete cronjob [names]"} // @x-panel-log {"bodyKeys":["ids"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"ids","isList":true,"db":"cronjobs","output_colume":"name","output_value":"names"}],"formatZH":"删除计划任务 [names]","formatEN":"delete cronjob [names]"}
func (b *BaseApi) DeleteCronjob(c *gin.Context) { func (b *BaseApi) DeleteCronjob(c *gin.Context) {
var req dto.BatchDeleteReq var req dto.BatchDeleteReq
@ -125,7 +121,6 @@ func (b *BaseApi) DeleteCronjob(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Update cronjob
// @Tags Cronjob // @Tags Cronjob
// @Summary Update cronjob // @Summary Update cronjob
// @Description 更新计划任务 // @Description 更新计划任务
@ -133,7 +128,7 @@ func (b *BaseApi) DeleteCronjob(c *gin.Context) {
// @Param request body dto.CronjobUpdate true "request" // @Param request body dto.CronjobUpdate true "request"
// @Success 200 // @Success 200
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /cronjob/update [post] // @Router /cronjobs/update [post]
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"id","isList":false,"db":"cronjobs","output_colume":"name","output_value":"name"}],"formatZH":"更新计划任务 [name]","formatEN":"update cronjob [name]"} // @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"id","isList":false,"db":"cronjobs","output_colume":"name","output_value":"name"}],"formatZH":"更新计划任务 [name]","formatEN":"update cronjob [name]"}
func (b *BaseApi) UpdateCronjob(c *gin.Context) { func (b *BaseApi) UpdateCronjob(c *gin.Context) {
var req dto.CronjobUpdate var req dto.CronjobUpdate
@ -153,7 +148,6 @@ func (b *BaseApi) UpdateCronjob(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Update cronjob status
// @Tags Cronjob // @Tags Cronjob
// @Summary Update cronjob status // @Summary Update cronjob status
// @Description 更新计划任务状态 // @Description 更新计划任务状态
@ -161,7 +155,7 @@ func (b *BaseApi) UpdateCronjob(c *gin.Context) {
// @Param request body dto.CronjobUpdateStatus true "request" // @Param request body dto.CronjobUpdateStatus true "request"
// @Success 200 // @Success 200
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /cronjob/status [post] // @Router /cronjobs/status [post]
// @x-panel-log {"bodyKeys":["id","status"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"id","isList":false,"db":"cronjobs","output_colume":"name","output_value":"name"}],"formatZH":"修改计划任务 [name] 状态为 [status]","formatEN":"change the status of cronjob [name] to [status]."} // @x-panel-log {"bodyKeys":["id","status"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"id","isList":false,"db":"cronjobs","output_colume":"name","output_value":"name"}],"formatZH":"修改计划任务 [name] 状态为 [status]","formatEN":"change the status of cronjob [name] to [status]."}
func (b *BaseApi) UpdateCronjobStatus(c *gin.Context) { func (b *BaseApi) UpdateCronjobStatus(c *gin.Context) {
var req dto.CronjobUpdateStatus var req dto.CronjobUpdateStatus
@ -181,15 +175,14 @@ func (b *BaseApi) UpdateCronjobStatus(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Download Cronjob records
// @Tags Cronjob // @Tags Cronjob
// @Summary Download Cronjob records // @Summary Download cronjob records
// @Description 下载计划任务记录 // @Description 下载计划任务记录
// @Accept json // @Accept json
// @Param request body dto.CronjobDownload true "request" // @Param request body dto.CronjobDownload true "request"
// @Success 200 // @Success 200
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /cronjob/download [post] // @Router /cronjobs/download [post]
// @x-panel-log {"bodyKeys":["recordID"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"recordID","isList":false,"db":"job_records","output_colume":"file","output_value":"file"}],"formatZH":"下载计划任务记录 [file]","formatEN":"download the cronjob record [file]"} // @x-panel-log {"bodyKeys":["recordID"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"recordID","isList":false,"db":"job_records","output_colume":"file","output_value":"file"}],"formatZH":"下载计划任务记录 [file]","formatEN":"download the cronjob record [file]"}
func (b *BaseApi) TargetDownload(c *gin.Context) { func (b *BaseApi) TargetDownload(c *gin.Context) {
var req dto.CronjobDownload var req dto.CronjobDownload
@ -210,7 +203,6 @@ func (b *BaseApi) TargetDownload(c *gin.Context) {
c.File(filePath) c.File(filePath)
} }
// Handle cronjob once
// @Tags Cronjob // @Tags Cronjob
// @Summary Handle cronjob once // @Summary Handle cronjob once
// @Description 手动执行计划任务 // @Description 手动执行计划任务
@ -218,7 +210,7 @@ func (b *BaseApi) TargetDownload(c *gin.Context) {
// @Param request body dto.OperateByID true "request" // @Param request body dto.OperateByID true "request"
// @Success 200 // @Success 200
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /cronjob/handle [post] // @Router /cronjobs/handle [post]
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"id","isList":false,"db":"cronjobs","output_colume":"name","output_value":"name"}],"formatZH":"手动执行计划任务 [name]","formatEN":"manually execute the cronjob [name]"} // @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"id","isList":false,"db":"cronjobs","output_colume":"name","output_value":"name"}],"formatZH":"手动执行计划任务 [name]","formatEN":"manually execute the cronjob [name]"}
func (b *BaseApi) HandleOnce(c *gin.Context) { func (b *BaseApi) HandleOnce(c *gin.Context) {
var req dto.OperateByID var req dto.OperateByID

2
backend/app/api/v1/dashboard.go

@ -8,7 +8,6 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// Load dashboard base info
// @Tags Dashboard // @Tags Dashboard
// @Summary Load dashboard base info // @Summary Load dashboard base info
// @Description 获取首页基础数据 // @Description 获取首页基础数据
@ -37,7 +36,6 @@ func (b *BaseApi) LoadDashboardBaseInfo(c *gin.Context) {
helper.SuccessWithData(c, data) helper.SuccessWithData(c, data)
} }
// Load dashboard current info
// @Tags Dashboard // @Tags Dashboard
// @Summary Load dashboard current info // @Summary Load dashboard current info
// @Description 获取首页实时数据 // @Description 获取首页实时数据

25
backend/app/api/v1/database_mysql.go

@ -10,7 +10,6 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// Create mysql database
// @Tags Database Mysql // @Tags Database Mysql
// @Summary Create mysql database // @Summary Create mysql database
// @Description 创建 mysql 数据库 // @Description 创建 mysql 数据库
@ -37,7 +36,6 @@ func (b *BaseApi) CreateMysql(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Update mysql database description
// @Tags Database Mysql // @Tags Database Mysql
// @Summary Update mysql database description // @Summary Update mysql database description
// @Description 更新 mysql 数据库库描述信息 // @Description 更新 mysql 数据库库描述信息
@ -64,7 +62,6 @@ func (b *BaseApi) UpdateMysqlDescription(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Change mysql password
// @Tags Database Mysql // @Tags Database Mysql
// @Summary Change mysql password // @Summary Change mysql password
// @Description 修改 mysql 密码 // @Description 修改 mysql 密码
@ -91,7 +88,6 @@ func (b *BaseApi) ChangeMysqlPassword(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Change mysql access
// @Tags Database Mysql // @Tags Database Mysql
// @Summary Change mysql access // @Summary Change mysql access
// @Description 修改 mysql 访问权限 // @Description 修改 mysql 访问权限
@ -118,7 +114,6 @@ func (b *BaseApi) ChangeMysqlAccess(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Update mysql variables
// @Tags Database Mysql // @Tags Database Mysql
// @Summary Update mysql variables // @Summary Update mysql variables
// @Description mysql 性能调优 // @Description mysql 性能调优
@ -142,7 +137,6 @@ func (b *BaseApi) UpdateMysqlVariables(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Update mysql conf by upload file
// @Tags Database Mysql // @Tags Database Mysql
// @Summary Update mysql conf by upload file // @Summary Update mysql conf by upload file
// @Description 上传替换 mysql 配置文件 // @Description 上传替换 mysql 配置文件
@ -171,9 +165,8 @@ func (b *BaseApi) UpdateMysqlConfByFile(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Page mysql database // @Tags Database Mysql
// @Tags Cronjob // @Summary Page mysql databases
// @Summary Search mysql database list with page
// @Description 获取 mysql 数据库列表分页 // @Description 获取 mysql 数据库列表分页
// @Accept json // @Accept json
// @Param request body dto.PageInfo true "request" // @Param request body dto.PageInfo true "request"
@ -199,9 +192,8 @@ func (b *BaseApi) SearchMysql(c *gin.Context) {
}) })
} }
// List mysql database // @Tags Database Mysql
// @Tags Cronjob // @Summary List mysql database names
// @Summary Search mysql database list
// @Description 获取 mysql 数据库列表 // @Description 获取 mysql 数据库列表
// @Accept json // @Accept json
// @Param request body dto.PageInfo true "request" // @Param request body dto.PageInfo true "request"
@ -218,7 +210,6 @@ func (b *BaseApi) ListDBName(c *gin.Context) {
helper.SuccessWithData(c, list) helper.SuccessWithData(c, list)
} }
// Backup mysql database
// @Tags Database Mysql // @Tags Database Mysql
// @Summary Backup mysql database // @Summary Backup mysql database
// @Description 备份 mysql 数据库 // @Description 备份 mysql 数据库
@ -247,7 +238,6 @@ func (b *BaseApi) BackupMysql(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Recover mysql database by upload file
// @Tags Database Mysql // @Tags Database Mysql
// @Summary Recover mysql database by upload file // @Summary Recover mysql database by upload file
// @Description Mysql 数据库从上传文件恢复 // @Description Mysql 数据库从上传文件恢复
@ -276,7 +266,6 @@ func (b *BaseApi) RecoverMysqlByUpload(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Recover mysql database
// @Tags Database Mysql // @Tags Database Mysql
// @Summary Recover mysql database // @Summary Recover mysql database
// @Description Mysql 数据库恢复 // @Description Mysql 数据库恢复
@ -305,7 +294,6 @@ func (b *BaseApi) RecoverMysql(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Check before delete mysql database
// @Tags Database Mysql // @Tags Database Mysql
// @Summary Check before delete mysql database // @Summary Check before delete mysql database
// @Description Mysql 数据库删除前检查 // @Description Mysql 数据库删除前检查
@ -333,7 +321,6 @@ func (b *BaseApi) DeleteCheckMysql(c *gin.Context) {
helper.SuccessWithData(c, apps) helper.SuccessWithData(c, apps)
} }
// Delete mysql database
// @Tags Database Mysql // @Tags Database Mysql
// @Summary Delete mysql database // @Summary Delete mysql database
// @Description 删除 mysql 数据库 // @Description 删除 mysql 数据库
@ -364,7 +351,6 @@ func (b *BaseApi) DeleteMysql(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Load mysql base info
// @Tags Database Mysql // @Tags Database Mysql
// @Summary Load mysql base info // @Summary Load mysql base info
// @Description 获取 mysql 基础信息 // @Description 获取 mysql 基础信息
@ -381,7 +367,6 @@ func (b *BaseApi) LoadBaseinfo(c *gin.Context) {
helper.SuccessWithData(c, data) helper.SuccessWithData(c, data)
} }
// Load mysql remote access
// @Tags Database Mysql // @Tags Database Mysql
// @Summary Load mysql remote access // @Summary Load mysql remote access
// @Description 获取 mysql 远程访问权限 // @Description 获取 mysql 远程访问权限
@ -398,7 +383,6 @@ func (b *BaseApi) LoadRemoteAccess(c *gin.Context) {
helper.SuccessWithData(c, isRemote) helper.SuccessWithData(c, isRemote)
} }
// Load mysql status info
// @Tags Database Mysql // @Tags Database Mysql
// @Summary Load mysql status info // @Summary Load mysql status info
// @Description 获取 mysql 状态信息 // @Description 获取 mysql 状态信息
@ -415,7 +399,6 @@ func (b *BaseApi) LoadStatus(c *gin.Context) {
helper.SuccessWithData(c, data) helper.SuccessWithData(c, data)
} }
// Load mysql variables info
// @Tags Database Mysql // @Tags Database Mysql
// @Summary Load mysql variables info // @Summary Load mysql variables info
// @Description 获取 mysql 性能参数信息 // @Description 获取 mysql 性能参数信息

12
backend/app/api/v1/database_redis.go

@ -19,7 +19,6 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
) )
// Load redis status info
// @Tags Database Redis // @Tags Database Redis
// @Summary Load redis status info // @Summary Load redis status info
// @Description 获取 redis 状态信息 // @Description 获取 redis 状态信息
@ -36,7 +35,6 @@ func (b *BaseApi) LoadRedisStatus(c *gin.Context) {
helper.SuccessWithData(c, data) helper.SuccessWithData(c, data)
} }
// Load redis conf
// @Tags Database Redis // @Tags Database Redis
// @Summary Load redis conf // @Summary Load redis conf
// @Description 获取 redis 配置信息 // @Description 获取 redis 配置信息
@ -53,7 +51,6 @@ func (b *BaseApi) LoadRedisConf(c *gin.Context) {
helper.SuccessWithData(c, data) helper.SuccessWithData(c, data)
} }
// Load redis persistence conf
// @Tags Database Redis // @Tags Database Redis
// @Summary Load redis persistence conf // @Summary Load redis persistence conf
// @Description 获取 redis 持久化配置 // @Description 获取 redis 持久化配置
@ -70,7 +67,6 @@ func (b *BaseApi) LoadPersistenceConf(c *gin.Context) {
helper.SuccessWithData(c, data) helper.SuccessWithData(c, data)
} }
// Update redis conf
// @Tags Database Redis // @Tags Database Redis
// @Summary Update redis conf // @Summary Update redis conf
// @Description 更新 redis 配置信息 // @Description 更新 redis 配置信息
@ -97,7 +93,6 @@ func (b *BaseApi) UpdateRedisConf(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Change redis password
// @Tags Database Redis // @Tags Database Redis
// @Summary Change redis password // @Summary Change redis password
// @Description 更新 redis 密码 // @Description 更新 redis 密码
@ -124,7 +119,6 @@ func (b *BaseApi) ChangeRedisPassword(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Update redis persistence conf
// @Tags Database Redis // @Tags Database Redis
// @Summary Update redis persistence conf // @Summary Update redis persistence conf
// @Description 更新 redis 持久化配置 // @Description 更新 redis 持久化配置
@ -151,7 +145,6 @@ func (b *BaseApi) UpdateRedisPersistenceConf(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Backup redis
// @Tags Database Redis // @Tags Database Redis
// @Summary Backup redis // @Summary Backup redis
// @Description 备份 redis 数据库 // @Description 备份 redis 数据库
@ -167,7 +160,6 @@ func (b *BaseApi) RedisBackup(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Recover redis
// @Tags Database Redis // @Tags Database Redis
// @Summary Recover redis // @Summary Recover redis
// @Description 恢复 redis 数据库 // @Description 恢复 redis 数据库
@ -193,9 +185,8 @@ func (b *BaseApi) RedisRecover(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Search redis backup list
// @Tags Database Redis // @Tags Database Redis
// @Summary Search redis backup list // @Summary Page redis backups
// @Description 获取 redis 备份记录分页 // @Description 获取 redis 备份记录分页
// @Accept json // @Accept json
// @Param request body dto.PageInfo true "request" // @Param request body dto.PageInfo true "request"
@ -221,7 +212,6 @@ func (b *BaseApi) RedisBackupList(c *gin.Context) {
}) })
} }
// Update redis conf by file
// @Tags Database Redis // @Tags Database Redis
// @Summary Update redis conf by file // @Summary Update redis conf by file
// @Description 上传更新 redis 配置信息 // @Description 上传更新 redis 配置信息

5
backend/app/api/v1/docker.go

@ -8,7 +8,6 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// Load status
// @Tags Container Docker // @Tags Container Docker
// @Summary Load docker status // @Summary Load docker status
// @Description 获取 docker 服务状态 // @Description 获取 docker 服务状态
@ -21,7 +20,6 @@ func (b *BaseApi) LoadDockerStatus(c *gin.Context) {
helper.SuccessWithData(c, status) helper.SuccessWithData(c, status)
} }
// Load daemon.json
// @Tags Container Docker // @Tags Container Docker
// @Summary Load docker daemon.json // @Summary Load docker daemon.json
// @Description 获取 docker 配置信息 // @Description 获取 docker 配置信息
@ -34,7 +32,6 @@ func (b *BaseApi) LoadDaemonJson(c *gin.Context) {
helper.SuccessWithData(c, conf) helper.SuccessWithData(c, conf)
} }
// Update daemon.json
// @Tags Container Docker // @Tags Container Docker
// @Summary Update docker daemon.json // @Summary Update docker daemon.json
// @Description 修改 docker 配置信息 // @Description 修改 docker 配置信息
@ -59,7 +56,6 @@ func (b *BaseApi) UpdateDaemonJson(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Update daemon.json by upload file
// @Tags Container Docker // @Tags Container Docker
// @Summary Update docker daemon.json by upload file // @Summary Update docker daemon.json by upload file
// @Description 上传替换 docker 配置文件 // @Description 上传替换 docker 配置文件
@ -88,7 +84,6 @@ func (b *BaseApi) UpdateDaemonJsonByFile(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Operate docker
// @Tags Container Docker // @Tags Container Docker
// @Summary Operate docker // @Summary Operate docker
// @Description Docker 操作 // @Description Docker 操作

21
backend/app/api/v1/file.go

@ -22,9 +22,8 @@ import (
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
) )
// List files
// @Tags File // @Tags File
// @Summary Search file list // @Summary List files
// @Description 获取文件列表 // @Description 获取文件列表
// @Accept json // @Accept json
// @Param request body request.FileOption true "request" // @Param request body request.FileOption true "request"
@ -45,7 +44,6 @@ func (b *BaseApi) ListFiles(c *gin.Context) {
helper.SuccessWithData(c, files) helper.SuccessWithData(c, files)
} }
// Load files tree
// @Tags File // @Tags File
// @Summary Load files tree // @Summary Load files tree
// @Description 加载文件树 // @Description 加载文件树
@ -68,7 +66,6 @@ func (b *BaseApi) GetFileTree(c *gin.Context) {
helper.SuccessWithData(c, tree) helper.SuccessWithData(c, tree)
} }
// Create file
// @Tags File // @Tags File
// @Summary Create file // @Summary Create file
// @Description 创建文件/文件夹 // @Description 创建文件/文件夹
@ -92,7 +89,6 @@ func (b *BaseApi) CreateFile(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Delete file
// @Tags File // @Tags File
// @Summary Delete file // @Summary Delete file
// @Description 删除文件/文件夹 // @Description 删除文件/文件夹
@ -116,7 +112,6 @@ func (b *BaseApi) DeleteFile(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Batch delete file
// @Tags File // @Tags File
// @Summary Batch delete file // @Summary Batch delete file
// @Description 批量删除文件/文件夹 // @Description 批量删除文件/文件夹
@ -140,7 +135,6 @@ func (b *BaseApi) BatchDeleteFile(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Change file mode
// @Tags File // @Tags File
// @Summary Change file mode // @Summary Change file mode
// @Description 修改文件权限 // @Description 修改文件权限
@ -164,7 +158,6 @@ func (b *BaseApi) ChangeFileMode(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Compress file
// @Tags File // @Tags File
// @Summary Compress file // @Summary Compress file
// @Description 压缩文件 // @Description 压缩文件
@ -188,7 +181,6 @@ func (b *BaseApi) CompressFile(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Decompress file
// @Tags File // @Tags File
// @Summary Decompress file // @Summary Decompress file
// @Description 解压文件 // @Description 解压文件
@ -212,7 +204,6 @@ func (b *BaseApi) DeCompressFile(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Load file content
// @Tags File // @Tags File
// @Summary Load file content // @Summary Load file content
// @Description 获取文件内容 // @Description 获取文件内容
@ -236,7 +227,6 @@ func (b *BaseApi) GetContent(c *gin.Context) {
helper.SuccessWithData(c, info) helper.SuccessWithData(c, info)
} }
// Update file content
// @Tags File // @Tags File
// @Summary Update file content // @Summary Update file content
// @Description 更新文件内容 // @Description 更新文件内容
@ -259,7 +249,6 @@ func (b *BaseApi) SaveContent(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Upload file
// @Tags File // @Tags File
// @Summary Upload file // @Summary Upload file
// @Description 上传文件 // @Description 上传文件
@ -307,7 +296,6 @@ func (b *BaseApi) UploadFiles(c *gin.Context) {
} }
} }
// Change file name
// @Tags File // @Tags File
// @Summary Change file name // @Summary Change file name
// @Description 修改文件名称 // @Description 修改文件名称
@ -330,7 +318,6 @@ func (b *BaseApi) ChangeFileName(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Wget file
// @Tags File // @Tags File
// @Summary Wget file // @Summary Wget file
// @Description 下载远端文件 // @Description 下载远端文件
@ -356,7 +343,6 @@ func (b *BaseApi) WgetFile(c *gin.Context) {
}) })
} }
// Move file
// @Tags File // @Tags File
// @Summary Move file // @Summary Move file
// @Description 移动文件 // @Description 移动文件
@ -379,7 +365,6 @@ func (b *BaseApi) MoveFile(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Download file
// @Tags File // @Tags File
// @Summary Download file // @Summary Download file
// @Description 下载文件 // @Description 下载文件
@ -403,7 +388,6 @@ func (b *BaseApi) Download(c *gin.Context) {
c.File(filePath) c.File(filePath)
} }
// Load file size
// @Tags File // @Tags File
// @Summary Load file size // @Summary Load file size
// @Description 获取文件夹大小 // @Description 获取文件夹大小
@ -427,13 +411,12 @@ func (b *BaseApi) Size(c *gin.Context) {
helper.SuccessWithData(c, res) helper.SuccessWithData(c, res)
} }
// Read file
// @Tags File // @Tags File
// @Summary Read file // @Summary Read file
// @Description 读取文件 // @Description 读取文件
// @Accept json // @Accept json
// @Param request body dto.FilePath true "request" // @Param request body dto.FilePath true "request"
// @Success 200 <anrry> byte // @Success 200 {string} content
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /files/loadfile [post] // @Router /files/loadfile [post]
// @x-panel-log {"bodyKeys":["path"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"读取文件 [path]","formatEN":"Read file [path]"} // @x-panel-log {"bodyKeys":["path"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"读取文件 [path]","formatEN":"Read file [path]"}

9
backend/app/api/v1/group.go

@ -8,7 +8,6 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// Create group
// @Tags System Group // @Tags System Group
// @Summary Create group // @Summary Create group
// @Description 创建系统组 // @Description 创建系统组
@ -35,7 +34,6 @@ func (b *BaseApi) CreateGroup(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Delete group
// @Tags System Group // @Tags System Group
// @Summary Delete group // @Summary Delete group
// @Description 删除系统组 // @Description 删除系统组
@ -63,7 +61,6 @@ func (b *BaseApi) DeleteGroup(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Update group
// @Tags System Group // @Tags System Group
// @Summary Update group // @Summary Update group
// @Description 更新系统组 // @Description 更新系统组
@ -91,9 +88,8 @@ func (b *BaseApi) UpdateGroup(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Search group info
// @Tags System Group // @Tags System Group
// @Summary Search group info // @Summary Search group info by id
// @Description 查询系统组 // @Description 查询系统组
// @Accept json // @Accept json
// @Param id path integer true "request" // @Param id path integer true "request"
@ -114,9 +110,8 @@ func (b *BaseApi) GetGroupInfo(c *gin.Context) {
helper.SuccessWithData(c, group) helper.SuccessWithData(c, group)
} }
// List group
// @Tags System Group // @Tags System Group
// @Summary Search group list // @Summary List groups
// @Description 查询系统组 // @Description 查询系统组
// @Accept json // @Accept json
// @Param request body dto.GroupSearch true "request" // @Param request body dto.GroupSearch true "request"

23
backend/app/api/v1/host.go

@ -10,7 +10,6 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// Create host
// @Tags Host // @Tags Host
// @Summary Create host // @Summary Create host
// @Description 创建主机 // @Description 创建主机
@ -18,7 +17,7 @@ import (
// @Param request body dto.HostOperate true "request" // @Param request body dto.HostOperate true "request"
// @Success 200 // @Success 200
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /host [post] // @Router /hosts [post]
// @x-panel-log {"bodyKeys":["name","addr"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"创建主机 [name][addr]","formatEN":"create host [name][addr]"} // @x-panel-log {"bodyKeys":["name","addr"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"创建主机 [name][addr]","formatEN":"create host [name][addr]"}
func (b *BaseApi) CreateHost(c *gin.Context) { func (b *BaseApi) CreateHost(c *gin.Context) {
var req dto.HostOperate var req dto.HostOperate
@ -38,7 +37,6 @@ func (b *BaseApi) CreateHost(c *gin.Context) {
helper.SuccessWithData(c, host) helper.SuccessWithData(c, host)
} }
// Test host conn by info
// @Tags Host // @Tags Host
// @Summary Test host conn by info // @Summary Test host conn by info
// @Description 测试主机连接 // @Description 测试主机连接
@ -46,7 +44,7 @@ func (b *BaseApi) CreateHost(c *gin.Context) {
// @Param request body dto.HostConnTest true "request" // @Param request body dto.HostConnTest true "request"
// @Success 200 // @Success 200
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /host/test/byinfo [post] // @Router /hosts/test/byinfo [post]
func (b *BaseApi) TestByInfo(c *gin.Context) { func (b *BaseApi) TestByInfo(c *gin.Context) {
var req dto.HostConnTest var req dto.HostConnTest
if err := c.ShouldBindJSON(&req); err != nil { if err := c.ShouldBindJSON(&req); err != nil {
@ -71,15 +69,14 @@ func (b *BaseApi) TestByInfo(c *gin.Context) {
helper.SuccessWithData(c, true) helper.SuccessWithData(c, true)
} }
// Test host conn by host id
// @Tags Host // @Tags Host
// @Summary Test host conn by host id // @Summary Test host conn by host id
// @Description 测试主机连接 // @Description 测试主机连接
// @Accept json // @Accept json
// @Param id path integer true "request" // @Param id path integer true "request"
// @Success 200 {boolean} // @Success 200 {boolean} connStatus
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /host/test/byid/:id [post] // @Router /hosts/test/byid/:id [post]
func (b *BaseApi) TestByID(c *gin.Context) { func (b *BaseApi) TestByID(c *gin.Context) {
id, err := helper.GetParamID(c) id, err := helper.GetParamID(c)
if err != nil { if err != nil {
@ -91,7 +88,6 @@ func (b *BaseApi) TestByID(c *gin.Context) {
helper.SuccessWithData(c, connStatus) helper.SuccessWithData(c, connStatus)
} }
// Load host tree
// @Tags Host // @Tags Host
// @Summary Load host tree // @Summary Load host tree
// @Description 加载主机树 // @Description 加载主机树
@ -99,7 +95,7 @@ func (b *BaseApi) TestByID(c *gin.Context) {
// @Param request body dto.SearchForTree true "request" // @Param request body dto.SearchForTree true "request"
// @Success 200 {anrry} dto.HostTree // @Success 200 {anrry} dto.HostTree
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /host/search [post] // @Router /hosts/search [post]
func (b *BaseApi) HostTree(c *gin.Context) { func (b *BaseApi) HostTree(c *gin.Context) {
var req dto.SearchForTree var req dto.SearchForTree
if err := c.ShouldBindJSON(&req); err != nil { if err := c.ShouldBindJSON(&req); err != nil {
@ -116,7 +112,6 @@ func (b *BaseApi) HostTree(c *gin.Context) {
helper.SuccessWithData(c, data) helper.SuccessWithData(c, data)
} }
// Load host info
// @Tags Host // @Tags Host
// @Summary Load host info // @Summary Load host info
// @Description 加载主机信息 // @Description 加载主机信息
@ -124,7 +119,7 @@ func (b *BaseApi) HostTree(c *gin.Context) {
// @Param id path integer true "request" // @Param id path integer true "request"
// @Success 200 {object} dto.HostInfo // @Success 200 {object} dto.HostInfo
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /host/:id [get] // @Router /hosts/:id [get]
func (b *BaseApi) GetHostInfo(c *gin.Context) { func (b *BaseApi) GetHostInfo(c *gin.Context) {
id, err := helper.GetParamID(c) id, err := helper.GetParamID(c)
if err != nil { if err != nil {
@ -144,7 +139,6 @@ func (b *BaseApi) GetHostInfo(c *gin.Context) {
helper.SuccessWithData(c, hostDto) helper.SuccessWithData(c, hostDto)
} }
// Delete host
// @Tags Host // @Tags Host
// @Summary Delete host // @Summary Delete host
// @Description 删除主机 // @Description 删除主机
@ -152,7 +146,7 @@ func (b *BaseApi) GetHostInfo(c *gin.Context) {
// @Param request body dto.OperateByID true "request" // @Param request body dto.OperateByID true "request"
// @Success 200 // @Success 200
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /host/del [post] // @Router /hosts/del [post]
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"id","isList":false,"db":"hosts","output_colume":"addr","output_value":"addr"}],"formatZH":"删除主机 [addr]","formatEN":"delete host [addr]"} // @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"id","isList":false,"db":"hosts","output_colume":"addr","output_value":"addr"}],"formatZH":"删除主机 [addr]","formatEN":"delete host [addr]"}
func (b *BaseApi) DeleteHost(c *gin.Context) { func (b *BaseApi) DeleteHost(c *gin.Context) {
var req dto.OperateByID var req dto.OperateByID
@ -172,7 +166,6 @@ func (b *BaseApi) DeleteHost(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Update host
// @Tags Host // @Tags Host
// @Summary Update host // @Summary Update host
// @Description 更新主机 // @Description 更新主机
@ -180,7 +173,7 @@ func (b *BaseApi) DeleteHost(c *gin.Context) {
// @Param request body dto.HostOperate true "request" // @Param request body dto.HostOperate true "request"
// @Success 200 // @Success 200
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /host/update [post] // @Router /hosts/update [post]
// @x-panel-log {"bodyKeys":["name","addr"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"更新主机信息 [name][addr]","formatEN":"update host [name][addr]"} // @x-panel-log {"bodyKeys":["name","addr"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"更新主机信息 [name][addr]","formatEN":"update host [name][addr]"}
func (b *BaseApi) UpdateHost(c *gin.Context) { func (b *BaseApi) UpdateHost(c *gin.Context) {
var req dto.HostOperate var req dto.HostOperate

13
backend/app/api/v1/image.go

@ -8,9 +8,8 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// Page image
// @Tags Container Image // @Tags Container Image
// @Summary Search image list with page // @Summary Page images
// @Description 获取镜像列表分页 // @Description 获取镜像列表分页
// @Accept json // @Accept json
// @Param request body dto.PageInfo true "request" // @Param request body dto.PageInfo true "request"
@ -41,9 +40,8 @@ func (b *BaseApi) SearchImage(c *gin.Context) {
}) })
} }
// List image
// @Tags Container Image // @Tags Container Image
// @Summary Search image list // @Summary List images
// @Description 获取镜像列表 // @Description 获取镜像列表
// @Produce json // @Produce json
// @Success 200 {anrry} dto.Options // @Success 200 {anrry} dto.Options
@ -58,7 +56,6 @@ func (b *BaseApi) ListImage(c *gin.Context) {
helper.SuccessWithData(c, list) helper.SuccessWithData(c, list)
} }
// Build image
// @Tags Container Image // @Tags Container Image
// @Summary Build image // @Summary Build image
// @Description 构建镜像 // @Description 构建镜像
@ -88,7 +85,6 @@ func (b *BaseApi) ImageBuild(c *gin.Context) {
helper.SuccessWithData(c, log) helper.SuccessWithData(c, log)
} }
// Pull image
// @Tags Container Image // @Tags Container Image
// @Summary Pull image // @Summary Pull image
// @Description 拉取镜像 // @Description 拉取镜像
@ -118,7 +114,6 @@ func (b *BaseApi) ImagePull(c *gin.Context) {
helper.SuccessWithData(c, logPath) helper.SuccessWithData(c, logPath)
} }
// Push image
// @Tags Container Image // @Tags Container Image
// @Summary Push image // @Summary Push image
// @Description 推送镜像 // @Description 推送镜像
@ -148,7 +143,6 @@ func (b *BaseApi) ImagePush(c *gin.Context) {
helper.SuccessWithData(c, logPath) helper.SuccessWithData(c, logPath)
} }
// Delete image
// @Tags Container Image // @Tags Container Image
// @Summary Delete image // @Summary Delete image
// @Description 删除镜像 // @Description 删除镜像
@ -177,7 +171,6 @@ func (b *BaseApi) ImageRemove(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Save image
// @Tags Container Image // @Tags Container Image
// @Summary Save image // @Summary Save image
// @Description 导出镜像 // @Description 导出镜像
@ -206,7 +199,6 @@ func (b *BaseApi) ImageSave(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Tag image
// @Tags Container Image // @Tags Container Image
// @Summary Tag image // @Summary Tag image
// @Description Tag 镜像 // @Description Tag 镜像
@ -235,7 +227,6 @@ func (b *BaseApi) ImageTag(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Load image
// @Tags Container Image // @Tags Container Image
// @Summary Load image // @Summary Load image
// @Description 导入镜像 // @Description 导入镜像

9
backend/app/api/v1/image_repo.go

@ -8,9 +8,8 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// Page image repo
// @Tags Container Image-repo // @Tags Container Image-repo
// @Summary Search image repo list with page // @Summary Page image repos
// @Description 获取镜像仓库列表分页 // @Description 获取镜像仓库列表分页
// @Accept json // @Accept json
// @Param request body dto.PageInfo true "request" // @Param request body dto.PageInfo true "request"
@ -41,9 +40,8 @@ func (b *BaseApi) SearchRepo(c *gin.Context) {
}) })
} }
// List image repo
// @Tags Container Image-repo // @Tags Container Image-repo
// @Summary Search image repo list // @Summary List image repos
// @Description 获取镜像仓库列表 // @Description 获取镜像仓库列表
// @Produce json // @Produce json
// @Success 200 {anrry} dto.ImageRepoOption // @Success 200 {anrry} dto.ImageRepoOption
@ -59,7 +57,6 @@ func (b *BaseApi) ListRepo(c *gin.Context) {
helper.SuccessWithData(c, list) helper.SuccessWithData(c, list)
} }
// Create image repo
// @Tags Container Image-repo // @Tags Container Image-repo
// @Summary Create image repo // @Summary Create image repo
// @Description 创建镜像仓库 // @Description 创建镜像仓库
@ -87,7 +84,6 @@ func (b *BaseApi) CreateRepo(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Delete image repo
// @Tags Container Image-repo // @Tags Container Image-repo
// @Summary Delete image repo // @Summary Delete image repo
// @Description 删除镜像仓库 // @Description 删除镜像仓库
@ -116,7 +112,6 @@ func (b *BaseApi) DeleteRepo(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Update image repo
// @Tags Container Image-repo // @Tags Container Image-repo
// @Summary Update image repo // @Summary Update image repo
// @Description 更新镜像仓库 // @Description 更新镜像仓库

7
backend/app/api/v1/logs.go

@ -8,12 +8,11 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// Page login logs
// @Tags Logs // @Tags Logs
// @Summary Page login logs // @Summary Page login logs
// @Description 获取系统登录日志列表分页 // @Description 获取系统登录日志列表分页
// @Accept json // @Accept json
// @Param request body request.PageInfo true "request" // @Param request body dto.PageInfo true "request"
// @Success 200 {object} dto.PageResult // @Success 200 {object} dto.PageResult
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /logs/login [post] // @Router /logs/login [post]
@ -36,12 +35,11 @@ func (b *BaseApi) GetLoginLogs(c *gin.Context) {
}) })
} }
// Page operation logs
// @Tags Logs // @Tags Logs
// @Summary Page operation logs // @Summary Page operation logs
// @Description 获取系统操作日志列表分页 // @Description 获取系统操作日志列表分页
// @Accept json // @Accept json
// @Param request body request.PageInfo true "request" // @Param request body dto.PageInfo true "request"
// @Success 200 {object} dto.PageResult // @Success 200 {object} dto.PageResult
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /logs/operation [post] // @Router /logs/operation [post]
@ -64,7 +62,6 @@ func (b *BaseApi) GetOperationLogs(c *gin.Context) {
}) })
} }
// Clean operation logs
// @Tags Logs // @Tags Logs
// @Summary Clean operation logs // @Summary Clean operation logs
// @Description 清空操作日志 // @Description 清空操作日志

11
backend/app/api/v1/nginx.go

@ -7,7 +7,6 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// Load nginx conf
// @Tags Nginx // @Tags Nginx
// @Summary Load nginx conf // @Summary Load nginx conf
// @Description 获取 nginx 配置信息 // @Description 获取 nginx 配置信息
@ -23,12 +22,11 @@ func (b *BaseApi) GetNginx(c *gin.Context) {
helper.SuccessWithData(c, fileInfo) helper.SuccessWithData(c, fileInfo)
} }
// Load partial nginx conf
// @Tags Nginx // @Tags Nginx
// @Summary Load partial nginx conf // @Summary Load partial nginx conf
// @Description 获取部分 nginx 配置信息 // @Description 获取部分 nginx 配置信息
// @Accept json // @Accept json
// @Param request body dto.NginxScopeReq true "request" // @Param request body request.NginxScopeReq true "request"
// @Success 200 {anrry} response.NginxParam // @Success 200 {anrry} response.NginxParam
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /nginx/scope [post] // @Router /nginx/scope [post]
@ -47,12 +45,11 @@ func (b *BaseApi) GetNginxConfigByScope(c *gin.Context) {
helper.SuccessWithData(c, params) helper.SuccessWithData(c, params)
} }
// Update nginx conf
// @Tags Nginx // @Tags Nginx
// @Summary Update nginx conf // @Summary Update nginx conf
// @Description 更新 nginx 配置信息 // @Description 更新 nginx 配置信息
// @Accept json // @Accept json
// @Param request body dto.NginxConfigUpdate true "request" // @Param request body request.NginxConfigUpdate true "request"
// @Success 200 // @Success 200
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /nginx/update [post] // @Router /nginx/update [post]
@ -70,7 +67,6 @@ func (b *BaseApi) UpdateNginxConfigByScope(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Load nginx status info
// @Tags Nginx // @Tags Nginx
// @Summary Load nginx status info // @Summary Load nginx status info
// @Description 获取 nginx 状态信息 // @Description 获取 nginx 状态信息
@ -86,12 +82,11 @@ func (b *BaseApi) GetNginxStatus(c *gin.Context) {
helper.SuccessWithData(c, res) helper.SuccessWithData(c, res)
} }
// Update nginx conf by upload file
// @Tags Nginx // @Tags Nginx
// @Summary Update nginx conf by upload file // @Summary Update nginx conf by upload file
// @Description 上传更新 nginx 配置文件 // @Description 上传更新 nginx 配置文件
// @Accept json // @Accept json
// @Param request body dto.NginxConfigFileUpdate true "request" // @Param request body request.NginxConfigFileUpdate true "request"
// @Success 200 // @Success 200
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /nginx/file [post] // @Router /nginx/file [post]

8
backend/app/api/v1/setting.go

@ -13,7 +13,6 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// Load system setting info
// @Tags System Setting // @Tags System Setting
// @Summary Load system setting info // @Summary Load system setting info
// @Description 加载系统配置信息 // @Description 加载系统配置信息
@ -45,7 +44,6 @@ func (b *BaseApi) GetDaemonjson(c *gin.Context) {
helper.SuccessWithData(c, value) helper.SuccessWithData(c, value)
} }
// Update system setting
// @Tags System Setting // @Tags System Setting
// @Summary Update system setting // @Summary Update system setting
// @Description 更新系统配置 // @Description 更新系统配置
@ -73,7 +71,6 @@ func (b *BaseApi) UpdateSetting(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Update system password
// @Tags System Setting // @Tags System Setting
// @Summary Update system password // @Summary Update system password
// @Description 更新系统登录密码 // @Description 更新系统登录密码
@ -101,7 +98,6 @@ func (b *BaseApi) UpdatePassword(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Reset system password expired
// @Tags System Setting // @Tags System Setting
// @Summary Reset system password expired // @Summary Reset system password expired
// @Description 重置过期系统登录密码 // @Description 重置过期系统登录密码
@ -129,7 +125,6 @@ func (b *BaseApi) HandlePasswordExpired(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Sync system time
// @Tags System Setting // @Tags System Setting
// @Summary Sync system time // @Summary Sync system time
// @Description 系统时间同步 // @Description 系统时间同步
@ -153,7 +148,6 @@ func (b *BaseApi) SyncTime(c *gin.Context) {
helper.SuccessWithData(c, ntime.Format("2006-01-02 15:04:05 MST -0700")) helper.SuccessWithData(c, ntime.Format("2006-01-02 15:04:05 MST -0700"))
} }
// Clean monitor datas
// @Tags System Setting // @Tags System Setting
// @Summary Clean monitor datas // @Summary Clean monitor datas
// @Description 清空监控数据 // @Description 清空监控数据
@ -178,7 +172,6 @@ func (b *BaseApi) CleanMonitor(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Load mfa info
// @Tags System Setting // @Tags System Setting
// @Summary Load mfa info // @Summary Load mfa info
// @Description 获取 mfa 信息 // @Description 获取 mfa 信息
@ -195,7 +188,6 @@ func (b *BaseApi) GetMFA(c *gin.Context) {
helper.SuccessWithData(c, otp) helper.SuccessWithData(c, otp)
} }
// Bind mfa
// @Tags System Setting // @Tags System Setting
// @Summary Bind mfa // @Summary Bind mfa
// @Description Mfa 绑定 // @Description Mfa 绑定

41
backend/app/api/v1/website.go

@ -9,9 +9,8 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// Page website
// @Tags Website // @Tags Website
// @Summary Search website with page // @Summary Page websites
// @Description 获取网站列表分页 // @Description 获取网站列表分页
// @Accept json // @Accept json
// @Param request body request.WebsiteSearch true "request" // @Param request body request.WebsiteSearch true "request"
@ -35,9 +34,8 @@ func (b *BaseApi) PageWebsite(c *gin.Context) {
}) })
} }
// List website
// @Tags Website // @Tags Website
// @Summary Search website // @Summary List websites
// @Description 获取网站列表 // @Description 获取网站列表
// @Success 200 {anrry} response.WebsiteDTO // @Success 200 {anrry} response.WebsiteDTO
// @Security ApiKeyAuth // @Security ApiKeyAuth
@ -51,9 +49,8 @@ func (b *BaseApi) GetWebsites(c *gin.Context) {
helper.SuccessWithData(c, websites) helper.SuccessWithData(c, websites)
} }
// List website name
// @Tags Website // @Tags Website
// @Summary Search website names // @Summary List website names
// @Description 获取网站列表 // @Description 获取网站列表
// @Success 200 {anrry} string // @Success 200 {anrry} string
// @Security ApiKeyAuth // @Security ApiKeyAuth
@ -67,7 +64,6 @@ func (b *BaseApi) GetWebsiteOptions(c *gin.Context) {
helper.SuccessWithData(c, websites) helper.SuccessWithData(c, websites)
} }
// Create website
// @Tags Website // @Tags Website
// @Summary Create website // @Summary Create website
// @Description 创建网站 // @Description 创建网站
@ -91,7 +87,6 @@ func (b *BaseApi) CreateWebsite(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Operate website
// @Tags Website // @Tags Website
// @Summary Operate website // @Summary Operate website
// @Description 操作网站 // @Description 操作网站
@ -115,7 +110,6 @@ func (b *BaseApi) OpWebsite(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Backup website
// @Tags Website // @Tags Website
// @Summary Backup website // @Summary Backup website
// @Description 备份网站 // @Description 备份网站
@ -138,7 +132,6 @@ func (b *BaseApi) BackupWebsite(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Recover website by upload
// @Tags Website // @Tags Website
// @Summary Recover website by upload // @Summary Recover website by upload
// @Description 从上传恢复网站 // @Description 从上传恢复网站
@ -166,7 +159,6 @@ func (b *BaseApi) RecoverWebsiteByUpload(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Recover website
// @Tags Website // @Tags Website
// @Summary Recover website // @Summary Recover website
// @Description 从备份恢复网站 // @Description 从备份恢复网站
@ -194,7 +186,6 @@ func (b *BaseApi) RecoverWebsite(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Delete website
// @Tags Website // @Tags Website
// @Summary Delete website // @Summary Delete website
// @Description 删除网站 // @Description 删除网站
@ -202,7 +193,7 @@ func (b *BaseApi) RecoverWebsite(c *gin.Context) {
// @Param request body request.WebsiteDelete true "request" // @Param request body request.WebsiteDelete true "request"
// @Success 200 // @Success 200
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /websites/recover [post] // @Router /websites/del [post]
// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"id","isList":false,"db":"websites","output_colume":"primary_domain","output_value":"domain"}],"formatZH":"删除网站 [domain]","formatEN":"Delete website [domain]"} // @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"id","isList":false,"db":"websites","output_colume":"primary_domain","output_value":"domain"}],"formatZH":"删除网站 [domain]","formatEN":"Delete website [domain]"}
func (b *BaseApi) DeleteWebsite(c *gin.Context) { func (b *BaseApi) DeleteWebsite(c *gin.Context) {
var req request.WebsiteDelete var req request.WebsiteDelete
@ -218,7 +209,6 @@ func (b *BaseApi) DeleteWebsite(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Update website
// @Tags Website // @Tags Website
// @Summary Update website // @Summary Update website
// @Description 更新网站 // @Description 更新网站
@ -241,7 +231,6 @@ func (b *BaseApi) UpdateWebsite(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Search website by id
// @Tags Website // @Tags Website
// @Summary Search website by id // @Summary Search website by id
// @Description 通过 id 查询网站 // @Description 通过 id 查询网站
@ -264,7 +253,6 @@ func (b *BaseApi) GetWebsite(c *gin.Context) {
helper.SuccessWithData(c, website) helper.SuccessWithData(c, website)
} }
// Search website nginx by id
// @Tags Website Nginx // @Tags Website Nginx
// @Summary Search website nginx by id // @Summary Search website nginx by id
// @Description 通过 id 查询网站 nginx // @Description 通过 id 查询网站 nginx
@ -287,7 +275,6 @@ func (b *BaseApi) GetWebsiteNginx(c *gin.Context) {
helper.SuccessWithData(c, fileInfo) helper.SuccessWithData(c, fileInfo)
} }
// Search website domains by websiteId
// @Tags Website Domain // @Tags Website Domain
// @Summary Search website domains by websiteId // @Summary Search website domains by websiteId
// @Description 通过网站 id 查询域名 // @Description 通过网站 id 查询域名
@ -310,7 +297,6 @@ func (b *BaseApi) GetWebDomains(c *gin.Context) {
helper.SuccessWithData(c, list) helper.SuccessWithData(c, list)
} }
// Delete website domain
// @Tags Website Domain // @Tags Website Domain
// @Summary Delete website domain // @Summary Delete website domain
// @Description 删除网站域名 // @Description 删除网站域名
@ -334,7 +320,6 @@ func (b *BaseApi) DeleteWebDomain(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Create website domain
// @Tags Website Domain // @Tags Website Domain
// @Summary Create website domain // @Summary Create website domain
// @Description 创建网站域名 // @Description 创建网站域名
@ -358,7 +343,6 @@ func (b *BaseApi) CreateWebDomain(c *gin.Context) {
helper.SuccessWithData(c, domain) helper.SuccessWithData(c, domain)
} }
// Load nginx conf
// @Tags Website Nginx // @Tags Website Nginx
// @Summary Load nginx conf // @Summary Load nginx conf
// @Description 获取 nginx 配置 // @Description 获取 nginx 配置
@ -366,7 +350,7 @@ func (b *BaseApi) CreateWebDomain(c *gin.Context) {
// @Param request body request.NginxScopeReq true "request" // @Param request body request.NginxScopeReq true "request"
// @Success 200 {object} response.WebsiteNginxConfig // @Success 200 {object} response.WebsiteNginxConfig
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /websites/config [get] // @Router /websites/config [post]
func (b *BaseApi) GetNginxConfig(c *gin.Context) { func (b *BaseApi) GetNginxConfig(c *gin.Context) {
var req request.NginxScopeReq var req request.NginxScopeReq
if err := c.ShouldBindJSON(&req); err != nil { if err := c.ShouldBindJSON(&req); err != nil {
@ -381,7 +365,6 @@ func (b *BaseApi) GetNginxConfig(c *gin.Context) {
helper.SuccessWithData(c, config) helper.SuccessWithData(c, config)
} }
// Update nginx conf
// @Tags Website Nginx // @Tags Website Nginx
// @Summary Update nginx conf // @Summary Update nginx conf
// @Description 更新 nginx 配置 // @Description 更新 nginx 配置
@ -404,7 +387,6 @@ func (b *BaseApi) UpdateNginxConfig(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Load https conf
// @Tags Website HTTPS // @Tags Website HTTPS
// @Summary Load https conf // @Summary Load https conf
// @Description 获取 https 配置 // @Description 获取 https 配置
@ -412,7 +394,7 @@ func (b *BaseApi) UpdateNginxConfig(c *gin.Context) {
// @Param id path integer true "request" // @Param id path integer true "request"
// @Success 200 {object} response.WebsiteHTTPS // @Success 200 {object} response.WebsiteHTTPS
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /websites/:id/https [post] // @Router /websites/:id/https [get]
func (b *BaseApi) GetHTTPSConfig(c *gin.Context) { func (b *BaseApi) GetHTTPSConfig(c *gin.Context) {
id, err := helper.GetParamID(c) id, err := helper.GetParamID(c)
if err != nil { if err != nil {
@ -427,13 +409,12 @@ func (b *BaseApi) GetHTTPSConfig(c *gin.Context) {
helper.SuccessWithData(c, res) helper.SuccessWithData(c, res)
} }
// Update https conf
// @Tags Website HTTPS // @Tags Website HTTPS
// @Summary Update https conf // @Summary Update https conf
// @Description 更新 https 配置 // @Description 更新 https 配置
// @Accept json // @Accept json
// @Param request body request.WebsiteHTTPSOp true "request" // @Param request body request.WebsiteHTTPSOp true "request"
// @Success 200 {object} request.WebsiteHTTPS // @Success 200 {object} response.WebsiteHTTPS
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /websites/:id/https [post] // @Router /websites/:id/https [post]
// @x-panel-log {"bodyKeys":["websiteId"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"websiteId","isList":false,"db":"websites","output_colume":"primary_domain","output_value":"domain"}],"formatZH":"更新网站 [domain] https 配置","formatEN":"Update website https [domain] conf"} // @x-panel-log {"bodyKeys":["websiteId"],"paramKeys":[],"BeforeFuntions":[{"input_colume":"id","input_value":"websiteId","isList":false,"db":"websites","output_colume":"primary_domain","output_value":"domain"}],"formatZH":"更新网站 [domain] https 配置","formatEN":"Update website https [domain] conf"}
@ -454,7 +435,6 @@ func (b *BaseApi) UpdateHTTPSConfig(c *gin.Context) {
helper.SuccessWithData(c, res) helper.SuccessWithData(c, res)
} }
// Check before create website
// @Tags Website // @Tags Website
// @Summary Check before create website // @Summary Check before create website
// @Description 网站创建前检查 // @Description 网站创建前检查
@ -477,13 +457,12 @@ func (b *BaseApi) CreateWebsiteCheck(c *gin.Context) {
helper.SuccessWithData(c, data) helper.SuccessWithData(c, data)
} }
// Load websit waf conf
// @Tags Website WAF // @Tags Website WAF
// @Summary Load websit waf conf // @Summary Load websit waf conf
// @Description 获取网站 waf 配置 // @Description 获取网站 waf 配置
// @Accept json // @Accept json
// @Param request body request.WebsiteWafReq true "request" // @Param request body request.WebsiteWafReq true "request"
// @Success 200 {object} request.WebsiteWafConfig // @Success 200 {object} response.WebsiteWafConfig
// @Security ApiKeyAuth // @Security ApiKeyAuth
// @Router /websites/waf/config [post] // @Router /websites/waf/config [post]
func (b *BaseApi) GetWebsiteWafConfig(c *gin.Context) { func (b *BaseApi) GetWebsiteWafConfig(c *gin.Context) {
@ -500,7 +479,6 @@ func (b *BaseApi) GetWebsiteWafConfig(c *gin.Context) {
helper.SuccessWithData(c, data) helper.SuccessWithData(c, data)
} }
// Update website waf conf
// @Tags Website WAF // @Tags Website WAF
// @Summary Update website waf conf // @Summary Update website waf conf
// @Description 更新 网站 waf 配置 // @Description 更新 网站 waf 配置
@ -523,7 +501,6 @@ func (b *BaseApi) UpdateWebsiteWafConfig(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Update website nginx conf
// @Tags Website Nginx // @Tags Website Nginx
// @Summary Update website nginx conf // @Summary Update website nginx conf
// @Description 更新 网站 nginx 配置 // @Description 更新 网站 nginx 配置
@ -546,7 +523,6 @@ func (b *BaseApi) UpdateWebsiteNginxConfig(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Operate website log
// @Tags Website // @Tags Website
// @Summary Operate website log // @Summary Operate website log
// @Description 操作网站日志 // @Description 操作网站日志
@ -570,7 +546,6 @@ func (b *BaseApi) OpWebsiteLog(c *gin.Context) {
helper.SuccessWithData(c, res) helper.SuccessWithData(c, res)
} }
// Change default server
// @Tags Website // @Tags Website
// @Summary Change default server // @Summary Change default server
// @Description 操作网站日志 // @Description 操作网站日志

5
backend/app/api/v1/website_acme_account.go

@ -8,9 +8,8 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// Page website acme account
// @Tags Website Acme // @Tags Website Acme
// @Summary Search website acme account with page // @Summary Page website acme accounts
// @Description 获取网站 acme 列表分页 // @Description 获取网站 acme 列表分页
// @Accept json // @Accept json
// @Param request body dto.PageInfo true "request" // @Param request body dto.PageInfo true "request"
@ -34,7 +33,6 @@ func (b *BaseApi) PageWebsiteAcmeAccount(c *gin.Context) {
}) })
} }
// Create website acme account
// @Tags Website Acme // @Tags Website Acme
// @Summary Create website acme account // @Summary Create website acme account
// @Description 创建网站 acme // @Description 创建网站 acme
@ -58,7 +56,6 @@ func (b *BaseApi) CreateWebsiteAcmeAccount(c *gin.Context) {
helper.SuccessWithData(c, res) helper.SuccessWithData(c, res)
} }
// Delete website acme account
// @Tags Website Acme // @Tags Website Acme
// @Summary Delete website acme account // @Summary Delete website acme account
// @Description 删除网站 acme // @Description 删除网站 acme

6
backend/app/api/v1/website_dns_account.go

@ -8,9 +8,8 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// Page website dns account
// @Tags Website DNS // @Tags Website DNS
// @Summary Search website dns account with page // @Summary Page website dns accounts
// @Description 获取网站 dns 列表分页 // @Description 获取网站 dns 列表分页
// @Accept json // @Accept json
// @Param request body dto.PageInfo true "request" // @Param request body dto.PageInfo true "request"
@ -34,7 +33,6 @@ func (b *BaseApi) PageWebsiteDnsAccount(c *gin.Context) {
}) })
} }
// Create website dns account
// @Tags Website DNS // @Tags Website DNS
// @Summary Create website dns account // @Summary Create website dns account
// @Description 创建网站 dns // @Description 创建网站 dns
@ -57,7 +55,6 @@ func (b *BaseApi) CreateWebsiteDnsAccount(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Update website dns account
// @Tags Website DNS // @Tags Website DNS
// @Summary Update website dns account // @Summary Update website dns account
// @Description 更新网站 dns // @Description 更新网站 dns
@ -80,7 +77,6 @@ func (b *BaseApi) UpdateWebsiteDnsAccount(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Delete website dns account
// @Tags Website DNS // @Tags Website DNS
// @Summary Delete website dns account // @Summary Delete website dns account
// @Description 删除网站 dns // @Description 删除网站 dns

6
backend/app/api/v1/website_group.go

@ -7,9 +7,8 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// List website group
// @Tags Website Group // @Tags Website Group
// @Summary List website group // @Summary List website groups
// @Description 获取网站组 // @Description 获取网站组
// @Success 200 {anrry} model.WebsiteGroup // @Success 200 {anrry} model.WebsiteGroup
// @Security ApiKeyAuth // @Security ApiKeyAuth
@ -23,7 +22,6 @@ func (b *BaseApi) GetWebGroups(c *gin.Context) {
helper.SuccessWithData(c, list) helper.SuccessWithData(c, list)
} }
// Create website group
// @Tags Website Group // @Tags Website Group
// @Summary Create website group // @Summary Create website group
// @Description 创建网站组 // @Description 创建网站组
@ -46,7 +44,6 @@ func (b *BaseApi) CreateWebGroup(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Update website group
// @Tags Website Group // @Tags Website Group
// @Summary Update website group // @Summary Update website group
// @Description 更新网站组 // @Description 更新网站组
@ -69,7 +66,6 @@ func (b *BaseApi) UpdateWebGroup(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Delete website group
// @Tags Website Group // @Tags Website Group
// @Summary Delete website group // @Summary Delete website group
// @Description 删除网站组 // @Description 删除网站组

9
backend/app/api/v1/website_ssl.go

@ -10,9 +10,8 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// Page website ssl
// @Tags Website SSL // @Tags Website SSL
// @Summary Search website ssl with page // @Summary Page website ssl
// @Description 获取网站 ssl 列表分页 // @Description 获取网站 ssl 列表分页
// @Accept json // @Accept json
// @Param request body request.WebsiteSSLSearch true "request" // @Param request body request.WebsiteSSLSearch true "request"
@ -45,7 +44,6 @@ func (b *BaseApi) PageWebsiteSSL(c *gin.Context) {
} }
} }
// Create website ssl
// @Tags Website SSL // @Tags Website SSL
// @Summary Create website ssl // @Summary Create website ssl
// @Description 创建网站 ssl // @Description 创建网站 ssl
@ -69,7 +67,6 @@ func (b *BaseApi) CreateWebsiteSSL(c *gin.Context) {
helper.SuccessWithData(c, res) helper.SuccessWithData(c, res)
} }
// Reset website ssl
// @Tags Website SSL // @Tags Website SSL
// @Summary Reset website ssl // @Summary Reset website ssl
// @Description 重置网站 ssl // @Description 重置网站 ssl
@ -92,7 +89,6 @@ func (b *BaseApi) RenewWebsiteSSL(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Resolve website ssl
// @Tags Website SSL // @Tags Website SSL
// @Summary Resolve website ssl // @Summary Resolve website ssl
// @Description 解析网站 ssl // @Description 解析网站 ssl
@ -115,7 +111,6 @@ func (b *BaseApi) GetDNSResolve(c *gin.Context) {
helper.SuccessWithData(c, res) helper.SuccessWithData(c, res)
} }
// Delete website ssl
// @Tags Website SSL // @Tags Website SSL
// @Summary Delete website ssl // @Summary Delete website ssl
// @Description 删除网站 ssl // @Description 删除网站 ssl
@ -138,7 +133,6 @@ func (b *BaseApi) DeleteWebsiteSSL(c *gin.Context) {
helper.SuccessWithData(c, nil) helper.SuccessWithData(c, nil)
} }
// Search website ssl by website id
// @Tags Website SSL // @Tags Website SSL
// @Summary Search website ssl by website id // @Summary Search website ssl by website id
// @Description 通过网站 id 查询 ssl // @Description 通过网站 id 查询 ssl
@ -161,7 +155,6 @@ func (b *BaseApi) GetWebsiteSSLByWebsiteId(c *gin.Context) {
helper.SuccessWithData(c, websiteSSL) helper.SuccessWithData(c, websiteSSL)
} }
// Search website ssl by id
// @Tags Website SSL // @Tags Website SSL
// @Summary Search website ssl by id // @Summary Search website ssl by id
// @Description 通过 id 查询 ssl // @Description 通过 id 查询 ssl

52
backend/middleware/operation.go

@ -13,7 +13,8 @@ import (
"github.com/1Panel-dev/1Panel/backend/app/service" "github.com/1Panel-dev/1Panel/backend/app/service"
"github.com/1Panel-dev/1Panel/backend/constant" "github.com/1Panel-dev/1Panel/backend/constant"
"github.com/1Panel-dev/1Panel/backend/global" "github.com/1Panel-dev/1Panel/backend/global"
"github.com/1Panel-dev/1Panel/cmd/server/operation" "github.com/1Panel-dev/1Panel/backend/utils/copier"
"github.com/1Panel-dev/1Panel/cmd/server/docs"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
@ -28,25 +29,48 @@ func OperationLog() gin.HandlerFunc {
record := model.OperationLog{ record := model.OperationLog{
Group: group, Group: group,
IP: c.ClientIP(), IP: c.ClientIP(),
Method: c.Request.Method, Method: strings.ToLower(c.Request.Method),
Path: c.Request.URL.Path, Path: strings.ReplaceAll(c.Request.URL.Path, "/api/v1", ""),
UserAgent: c.Request.UserAgent(), UserAgent: c.Request.UserAgent(),
} }
var ( var (
operationDics []operationJson swagger swaggerJson
operationDic operationJson operationDic operationJson
) )
if err := json.Unmarshal(operation.OperationJosn, &operationDics); err != nil { if err := json.Unmarshal(docs.SwaggerJson, &swagger); err != nil {
c.Next() c.Next()
return return
} }
for _, dic := range operationDics { path, hasPath := swagger.Paths[record.Path]
if dic.API == record.Path && dic.Method == record.Method { if !hasPath {
operationDic = dic c.Next()
break return
} }
methodMap, isMethodMap := path.(map[string]interface{})
if !isMethodMap {
c.Next()
return
}
dataMap, hasPost := methodMap["post"]
if !hasPost {
c.Next()
return
}
data, isDataMap := dataMap.(map[string]interface{})
if !isDataMap {
c.Next()
return
}
xlog, hasXlog := data["x-panel-log"]
if !hasXlog {
c.Next()
return
} }
if len(operationDic.API) == 0 { if err := copier.Copy(&operationDic, xlog); err != nil {
c.Next()
return
}
if len(operationDic.FormatZH) == 0 {
c.Next() c.Next()
return return
} }
@ -124,6 +148,10 @@ func OperationLog() gin.HandlerFunc {
} }
} }
type swaggerJson struct {
Paths map[string]interface{} `json:"paths"`
}
type operationJson struct { type operationJson struct {
API string `json:"api"` API string `json:"api"`
Method string `json:"method"` Method string `json:"method"`

6
backend/router/ro_website.go

@ -28,6 +28,7 @@ func (a *WebsiteRouter) InitWebsiteRouter(Router *gin.RouterGroup) {
groupRouter.POST("/backup", baseApi.BackupWebsite) groupRouter.POST("/backup", baseApi.BackupWebsite)
groupRouter.POST("/recover", baseApi.RecoverWebsite) groupRouter.POST("/recover", baseApi.RecoverWebsite)
groupRouter.POST("/recover/byupload", baseApi.RecoverWebsiteByUpload) groupRouter.POST("/recover/byupload", baseApi.RecoverWebsiteByUpload)
groupRouter.POST("/default/server", baseApi.ChangeDefaultServer)
groupRouter.GET("/domains/:websiteId", baseApi.GetWebDomains) groupRouter.GET("/domains/:websiteId", baseApi.GetWebDomains)
groupRouter.POST("/domains/del", baseApi.DeleteWebDomain) groupRouter.POST("/domains/del", baseApi.DeleteWebDomain)
@ -36,11 +37,12 @@ func (a *WebsiteRouter) InitWebsiteRouter(Router *gin.RouterGroup) {
groupRouter.GET("/:id/nginx", baseApi.GetWebsiteNginx) groupRouter.GET("/:id/nginx", baseApi.GetWebsiteNginx)
groupRouter.POST("/config", baseApi.GetNginxConfig) groupRouter.POST("/config", baseApi.GetNginxConfig)
groupRouter.POST("/config/update", baseApi.UpdateNginxConfig) groupRouter.POST("/config/update", baseApi.UpdateNginxConfig)
groupRouter.POST("/nginx/update", baseApi.UpdateWebsiteNginxConfig)
groupRouter.GET("/:id/https", baseApi.GetHTTPSConfig) groupRouter.GET("/:id/https", baseApi.GetHTTPSConfig)
groupRouter.POST("/:id/https", baseApi.UpdateHTTPSConfig) groupRouter.POST("/:id/https", baseApi.UpdateHTTPSConfig)
groupRouter.POST("/waf/config", baseApi.GetWebsiteWafConfig) groupRouter.POST("/waf/config", baseApi.GetWebsiteWafConfig)
groupRouter.POST("/waf/update", baseApi.UpdateWebsiteWafConfig) groupRouter.POST("/waf/update", baseApi.UpdateWebsiteWafConfig)
groupRouter.POST("/nginx/update", baseApi.UpdateWebsiteNginxConfig)
groupRouter.POST("/default/server", baseApi.ChangeDefaultServer)
} }
} }

10650
cmd/server/docs/docs.go

File diff suppressed because it is too large Load Diff

6
cmd/server/docs/swagger.go

@ -0,0 +1,6 @@
package docs
import _ "embed"
//go:embed swagger.json
var SwaggerJson []byte

10650
cmd/server/docs/swagger.json

File diff suppressed because it is too large Load Diff

6344
cmd/server/docs/swagger.yaml

File diff suppressed because it is too large Load Diff

2
cmd/server/main.go

@ -17,7 +17,7 @@ import (
// @host localhost // @host localhost
// @BasePath /api/v1 // @BasePath /api/v1
//go:generate swag init -o ./docs -g main.go -d ../../backend/app -g ../../cmd/server/main.go //go:generate swag init -o ./docs -g main.go -d ../../backend -g ../cmd/server/main.go
func main() { func main() {
if err := cmd.RootCmd.Execute(); err != nil { if err := cmd.RootCmd.Execute(); err != nil {
fmt.Fprintln(os.Stderr, err) fmt.Fprintln(os.Stderr, err)

6
cmd/server/operation/operation.go

@ -1,6 +0,0 @@
package operation
import _ "embed"
//go:embed operation.json
var OperationJosn []byte

130
cmd/server/operation/operation.json

@ -1,130 +0,0 @@
[
{
"api": "/api/v1/apps/sync",
"method": "POST",
"bodyKeys": [],
"paramKeys": [],
"BeforeFuntions": [],
"formatZH": "应用商店同步",
"formatEN": "App store synchronization"
},
{
"api": "/api/v1/apps/install",
"method": "POST",
"bodyKeys": [
"name"
],
"paramKeys": [],
"BeforeFuntions": [
{
"input_colume": "name",
"input_value": "name",
"isList": false,
"db": "app_installs",
"output_colume": "app_id",
"output_value": "appId"
},
{
"info": "appId",
"isList": false,
"db": "apps",
"output_colume": "key",
"output_value": "appKey"
}
],
"formatZH": "安装应用 [appKey]-[name]",
"formatEN": "Install app [appKey]-[name]"
},
{
"api": "/api/v1/apps/installed/op",
"method": "POST",
"bodyKeys": [
"installId",
"operate"
],
"paramKeys": [],
"BeforeFuntions": [
{
"input_colume": "id",
"input_value": "installId",
"isList": false,
"db": "app_installs",
"output_colume": "app_id",
"output_value": "appId"
},
{
"input_colume": "id",
"input_value": "installId",
"isList": false,
"db": "app_installs",
"output_colume": "name",
"output_value": "appName"
},
{
"input_colume": "id",
"input_value": "appId",
"isList": false,
"db": "apps",
"output_colume": "key",
"output_value": "appKey"
}
],
"formatZH": "[appKey] 应用 [appName] [operate]",
"formatEN": "[appKey] App [appName] [operate]"
},
{
"api": "/api/v1/apps/installed/sync",
"method": "POST",
"bodyKeys": [],
"paramKeys": [],
"BeforeFuntions": [],
"formatZH": "已安装应用同步",
"formatEN": "App installed synchronization"
},
{
"api": "/api/v1/apps/installed/backups/del",
"method": "POST",
"bodyKeys": [
"ids"
],
"paramKeys": [],
"BeforeFuntions": [
{
"input_colume": "id",
"input_value": "ids",
"isList": true,
"db": "app_install_backups",
"output_colume": "name",
"output_value": "names"
}
],
"formatZH": "删除应用备份 [names]",
"formatEN": "Deleting an Application Backup [names]"
},
{
"api": "/api/v1/apps/installed/port/change",
"method": "POST",
"bodyKeys": [
"key",
"name",
"port"
],
"paramKeys": [],
"BeforeFuntions": [],
"formatZH": "应用端口修改 [key]-[name] => [port]",
"formatEN": "Application port update [key]-[name] => [port]"
},
{
"api": "/api/v1/apps/installed/port/change",
"method": "POST",
"bodyKeys": [
"key",
"name",
"port"
],
"paramKeys": [],
"BeforeFuntions": [],
"formatZH": "应用端口修改 [key]-[name] => [port]",
"formatEN": "Application port update [key]-[name] => [port]"
}
]

1
frontend/src/lang/modules/en.ts

@ -603,6 +603,7 @@ export default {
commands: 'Command', commands: 'Command',
groups: 'System Group', groups: 'System Group',
backups: 'Backup Account', backups: 'Backup Account',
logs: 'Panel Logs',
settings: 'Panel Setting', settings: 'Panel Setting',
cronjobs: 'Cronjob', cronjobs: 'Cronjob',
databases: 'Database', databases: 'Database',

1
frontend/src/lang/modules/zh.ts

@ -617,6 +617,7 @@ export default {
groups: '系统组', groups: '系统组',
commands: '快捷命令', commands: '快捷命令',
backups: '备份账号', backups: '备份账号',
logs: '面板日志',
settings: '面板设置', settings: '面板设置',
cronjobs: '计划任务', cronjobs: '计划任务',
databases: '数据库', databases: '数据库',

Loading…
Cancel
Save