From 5187b202521800fc320e622add42a55f1a48ae19 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Tue, 31 Dec 2024 10:32:47 +0800 Subject: [PATCH] fix: correct Swagger API definitions (#7606) Signed-off-by: Ryan Wang --- backend/app/api/v1/app.go | 10 +- backend/app/api/v1/app_install.go | 10 +- backend/app/api/v1/clam.go | 2 + backend/app/api/v1/command.go | 4 +- backend/app/api/v1/container.go | 8 +- backend/app/api/v1/dashboard.go | 4 +- backend/app/api/v1/database.go | 9 +- backend/app/api/v1/database_mysql.go | 1 + backend/app/api/v1/database_postgresql.go | 4 +- backend/app/api/v1/device.go | 2 +- backend/app/api/v1/fail2ban.go | 4 +- backend/app/api/v1/file.go | 2 + backend/app/api/v1/ftp.go | 1 + backend/app/api/v1/host.go | 2 +- backend/app/api/v1/runtime.go | 2 +- backend/app/api/v1/ssh.go | 1 + backend/app/api/v1/website.go | 15 +- backend/app/api/v1/website_domain.go | 2 +- backend/app/api/v1/website_ssl.go | 4 +- backend/app/dto/fail2ban.go | 2 +- cmd/server/docs/docs.go | 1120 +++++++++++--------- cmd/server/docs/swagger.json | 1122 ++++++++++++--------- cmd/server/docs/swagger.yaml | 187 +++- cmd/server/main.go | 5 +- 24 files changed, 1456 insertions(+), 1067 deletions(-) diff --git a/backend/app/api/v1/app.go b/backend/app/api/v1/app.go index 45ae5e29e..3c431361d 100644 --- a/backend/app/api/v1/app.go +++ b/backend/app/api/v1/app.go @@ -68,7 +68,7 @@ func (b *BaseApi) SyncApp(c *gin.Context) { // @Success 200 {object} response.AppDTO // @Security ApiKeyAuth // @Security Timestamp -// @Router /apps/:key [get] +// @Router /apps/{key} [get] func (b *BaseApi) GetApp(c *gin.Context) { appKey, err := helper.GetStrParamByKey(c, "key") if err != nil { @@ -88,11 +88,11 @@ func (b *BaseApi) GetApp(c *gin.Context) { // @Accept json // @Param appId path integer true "app id" // @Param version path string true "app version" -// @Param version path string true "app type" +// @Param type path string true "app type" // @Success 200 {object} response.AppDetailDTO // @Security ApiKeyAuth // @Security Timestamp -// @Router /apps/detail/:appId/:version/:type [get] +// @Router /apps/detail/{appId}/{version}/{type} [get] func (b *BaseApi) GetAppDetail(c *gin.Context) { appID, err := helper.GetIntParamByKey(c, "appId") if err != nil { @@ -112,11 +112,11 @@ func (b *BaseApi) GetAppDetail(c *gin.Context) { // @Tags App // @Summary Get app detail by id // @Accept json -// @Param appId path integer true "id" +// @Param id path integer true "id" // @Success 200 {object} response.AppDetailDTO // @Security ApiKeyAuth // @Security Timestamp -// @Router /apps/details/:id [get] +// @Router /apps/details/{id} [get] func (b *BaseApi) GetAppDetailByID(c *gin.Context) { appDetailID, err := helper.GetIntParamByKey(c, "id") if err != nil { diff --git a/backend/app/api/v1/app_install.go b/backend/app/api/v1/app_install.go index 69f2ac1d3..ad6f88ccc 100644 --- a/backend/app/api/v1/app_install.go +++ b/backend/app/api/v1/app_install.go @@ -104,10 +104,11 @@ func (b *BaseApi) LoadPort(c *gin.Context) { // @Summary Search app password by key // @Accept json // @Param request body dto.OperationWithNameAndType true "request" +// @Param key path string true "key" // @Success 200 {string} response.DatabaseConn // @Security ApiKeyAuth // @Security Timestamp -// @Router /apps/installed/conninfo/:key [get] +// @Router /apps/installed/conninfo/{key} [get] func (b *BaseApi) LoadConnInfo(c *gin.Context) { var req dto.OperationWithNameAndType if err := helper.CheckBindAndValidate(&req, c); err != nil { @@ -128,7 +129,7 @@ func (b *BaseApi) LoadConnInfo(c *gin.Context) { // @Success 200 {array} dto.AppResource // @Security ApiKeyAuth // @Security Timestamp -// @Router /apps/installed/delete/check/:appInstallId [get] +// @Router /apps/installed/delete/check/{appInstallId} [get] func (b *BaseApi) DeleteCheck(c *gin.Context) { appInstallId, err := helper.GetIntParamByKey(c, "appInstallId") if err != nil { @@ -187,7 +188,7 @@ func (b *BaseApi) OperateInstalled(c *gin.Context) { // @Success 200 {array} response.AppService // @Security ApiKeyAuth // @Security Timestamp -// @Router /apps/services/:key [get] +// @Router /apps/services/{key} [get] func (b *BaseApi) GetServices(c *gin.Context) { key := c.Param("key") services, err := appInstallService.GetServices(key) @@ -201,7 +202,6 @@ func (b *BaseApi) GetServices(c *gin.Context) { // @Tags App // @Summary Search app update version by install id // @Accept json -// @Param appInstallId path integer true "request" // @Success 200 {array} dto.AppVersion // @Security ApiKeyAuth // @Security Timestamp @@ -269,7 +269,7 @@ func (b *BaseApi) GetDefaultConfig(c *gin.Context) { // @Success 200 {object} response.AppParam // @Security ApiKeyAuth // @Security Timestamp -// @Router /apps/installed/params/:appInstallId [get] +// @Router /apps/installed/params/{appInstallId} [get] func (b *BaseApi) GetParams(c *gin.Context) { appInstallId, err := helper.GetIntParamByKey(c, "appInstallId") if err != nil { diff --git a/backend/app/api/v1/clam.go b/backend/app/api/v1/clam.go index 62f398249..bc3b8788e 100644 --- a/backend/app/api/v1/clam.go +++ b/backend/app/api/v1/clam.go @@ -120,6 +120,7 @@ func (b *BaseApi) LoadClamBaseInfo(c *gin.Context) { // @Summary Operate Clam // @Accept json // @Param request body dto.Operate true "request" +// @Success 200 // @Security ApiKeyAuth // @Security Timestamp // @Router /toolbox/clam/operate [post] @@ -142,6 +143,7 @@ func (b *BaseApi) OperateClam(c *gin.Context) { // @Summary Clean clam record // @Accept json // @Param request body dto.OperateByID true "request" +// @Success 200 // @Security ApiKeyAuth // @Security Timestamp // @Router /toolbox/clam/record/clean [post] diff --git a/backend/app/api/v1/command.go b/backend/app/api/v1/command.go index 671abb4b5..463ac4523 100644 --- a/backend/app/api/v1/command.go +++ b/backend/app/api/v1/command.go @@ -106,7 +106,7 @@ func (b *BaseApi) SearchRedisCommand(c *gin.Context) { // @Tags Command // @Summary Tree commands // @Accept json -// @Success 200 {Array} dto.CommandTree +// @Success 200 {array} dto.CommandTree // @Security ApiKeyAuth // @Security Timestamp // @Router /hosts/command/tree [get] @@ -122,7 +122,7 @@ func (b *BaseApi) SearchCommandTree(c *gin.Context) { // @Tags Redis Command // @Summary List redis commands -// @Success 200 {Array} dto.RedisCommand +// @Success 200 {array} dto.RedisCommand // @Security ApiKeyAuth // @Security Timestamp // @Router /hosts/command/redis [get] diff --git a/backend/app/api/v1/container.go b/backend/app/api/v1/container.go index 23b37fd5e..822a914a7 100644 --- a/backend/app/api/v1/container.go +++ b/backend/app/api/v1/container.go @@ -1,13 +1,14 @@ package v1 import ( + "strconv" + "github.com/1Panel-dev/1Panel/backend/app/api/v1/helper" "github.com/1Panel-dev/1Panel/backend/app/dto" "github.com/1Panel-dev/1Panel/backend/constant" "github.com/1Panel-dev/1Panel/backend/global" "github.com/gin-gonic/gin" "github.com/pkg/errors" - "strconv" ) // @Tags Container @@ -394,7 +395,7 @@ func (b *BaseApi) ContainerOperation(c *gin.Context) { // @Success 200 {object} dto.ContainerStats // @Security ApiKeyAuth // @Security Timestamp -// @Router /containers/stats/:id [get] +// @Router /containers/stats/{id} [get] func (b *BaseApi) ContainerStats(c *gin.Context) { containerID, ok := c.Params.Get("id") if !ok { @@ -438,6 +439,7 @@ func (b *BaseApi) Inspect(c *gin.Context) { // @Param since query string false "since" // @Param follow query string false "follow" // @Param tail query string false "tail" +// @Success 200 // @Security ApiKeyAuth // @Security Timestamp // @Router /containers/search/log [post] @@ -464,6 +466,7 @@ func (b *BaseApi) ContainerLogs(c *gin.Context) { // @Summary Download Container logs // @Accept json // @Param request body dto.ContainerLog true "request" +// @Success 200 // @Security ApiKeyAuth // @Security Timestamp // @Router /containers/download/log [post] @@ -680,6 +683,7 @@ func (b *BaseApi) ComposeUpdate(c *gin.Context) { // @Param since query string false "date" // @Param follow query string false "follow" // @Param tail query string false "tail" +// @Success 200 // @Security ApiKeyAuth // @Security Timestamp // @Router /containers/compose/search/log [get] diff --git a/backend/app/api/v1/dashboard.go b/backend/app/api/v1/dashboard.go index b2cbc70fc..1331825b4 100644 --- a/backend/app/api/v1/dashboard.go +++ b/backend/app/api/v1/dashboard.go @@ -34,7 +34,7 @@ func (b *BaseApi) LoadDashboardOsInfo(c *gin.Context) { // @Success 200 {object} dto.DashboardBase // @Security ApiKeyAuth // @Security Timestamp -// @Router /dashboard/base/:ioOption/:netOption [get] +// @Router /dashboard/base/{ioOption}/{netOption} [get] func (b *BaseApi) LoadDashboardBaseInfo(c *gin.Context) { ioOption, ok := c.Params.Get("ioOption") if !ok { @@ -78,7 +78,7 @@ func (b *BaseApi) LoadDashboardCurrentInfo(c *gin.Context) { // @Success 200 // @Security ApiKeyAuth // @Security Timestamp -// @Router /dashboard/system/restart/:operation [post] +// @Router /dashboard/system/restart/{operation} [post] func (b *BaseApi) SystemRestart(c *gin.Context) { operation, ok := c.Params.Get("operation") if !ok { diff --git a/backend/app/api/v1/database.go b/backend/app/api/v1/database.go index cb9e4badf..51b932386 100644 --- a/backend/app/api/v1/database.go +++ b/backend/app/api/v1/database.go @@ -93,10 +93,11 @@ func (b *BaseApi) SearchDatabase(c *gin.Context) { // @Tags Database // @Summary List databases +// @Param type path string true "type" // @Success 200 {array} dto.DatabaseOption // @Security ApiKeyAuth // @Security Timestamp -// @Router /databases/db/list/:type [get] +// @Router /databases/db/list/{type} [get] func (b *BaseApi) ListDatabase(c *gin.Context) { dbType, err := helper.GetStrParamByKey(c, "type") if err != nil { @@ -114,10 +115,11 @@ func (b *BaseApi) ListDatabase(c *gin.Context) { // @Tags Database // @Summary Retrieve database list based on type +// @Param type path string true "type" // @Success 200 {array} dto.DatabaseItem // @Security ApiKeyAuth // @Security Timestamp -// @Router /databases/db/item/:type [get] +// @Router /databases/db/item/{type} [get] func (b *BaseApi) LoadDatabaseItems(c *gin.Context) { dbType, err := helper.GetStrParamByKey(c, "type") if err != nil { @@ -135,10 +137,11 @@ func (b *BaseApi) LoadDatabaseItems(c *gin.Context) { // @Tags Database // @Summary Get databases +// @Param name path string true "name" // @Success 200 {object} dto.DatabaseInfo // @Security ApiKeyAuth // @Security Timestamp -// @Router /databases/db/:name [get] +// @Router /databases/db/{name} [get] func (b *BaseApi) GetDatabase(c *gin.Context) { name, err := helper.GetStrParamByKey(c, "name") if err != nil { diff --git a/backend/app/api/v1/database_mysql.go b/backend/app/api/v1/database_mysql.go index 7d4e3a7a3..167bed640 100644 --- a/backend/app/api/v1/database_mysql.go +++ b/backend/app/api/v1/database_mysql.go @@ -217,6 +217,7 @@ func (b *BaseApi) ListDBName(c *gin.Context) { // @Summary Load mysql database from remote // @Accept json // @Param request body dto.MysqlLoadDB true "request" +// @Success 200 // @Security ApiKeyAuth // @Security Timestamp // @Router /databases/load [post] diff --git a/backend/app/api/v1/database_postgresql.go b/backend/app/api/v1/database_postgresql.go index ea41d2221..311e107d6 100644 --- a/backend/app/api/v1/database_postgresql.go +++ b/backend/app/api/v1/database_postgresql.go @@ -168,9 +168,11 @@ func (b *BaseApi) SearchPostgresql(c *gin.Context) { // @Summary Load postgresql database from remote // @Accept json // @Param request body dto.PostgresqlLoadDB true "request" +// @Param database path string true "database" +// @Success 200 // @Security ApiKeyAuth // @Security Timestamp -// @Router /databases/pg/:database/load [post] +// @Router /databases/pg/{database}/load [post] func (b *BaseApi) LoadPostgresqlDBFromRemote(c *gin.Context) { database, err := helper.GetStrParamByKey(c, "database") if err != nil { diff --git a/backend/app/api/v1/device.go b/backend/app/api/v1/device.go index 425e19d30..00b27cc58 100644 --- a/backend/app/api/v1/device.go +++ b/backend/app/api/v1/device.go @@ -28,7 +28,7 @@ func (b *BaseApi) LoadDeviceBaseInfo(c *gin.Context) { // @Tags Device // @Summary list time zone options // @Accept json -// @Success 200 {Array} string +// @Success 200 {array} string // @Security ApiKeyAuth // @Security Timestamp // @Router /toolbox/device/zone/options [get] diff --git a/backend/app/api/v1/fail2ban.go b/backend/app/api/v1/fail2ban.go index 5928160a9..768973b1c 100644 --- a/backend/app/api/v1/fail2ban.go +++ b/backend/app/api/v1/fail2ban.go @@ -29,7 +29,7 @@ func (b *BaseApi) LoadFail2BanBaseInfo(c *gin.Context) { // @Summary Page fail2ban ip list // @Accept json // @Param request body dto.Fail2BanSearch true "request" -// @Success 200 {Array} string +// @Success 200 {array} string // @Security ApiKeyAuth // @Security Timestamp // @Router /toolbox/fail2ban/search [post] @@ -52,6 +52,7 @@ func (b *BaseApi) SearchFail2Ban(c *gin.Context) { // @Summary Operate fail2ban // @Accept json // @Param request body dto.Operate true "request" +// @Success 200 // @Security ApiKeyAuth // @Security Timestamp // @Router /toolbox/fail2ban/operate [post] @@ -74,6 +75,7 @@ func (b *BaseApi) OperateFail2Ban(c *gin.Context) { // @Summary Operate sshd of fail2ban // @Accept json // @Param request body dto.Operate true "request" +// @Success 200 // @Security ApiKeyAuth // @Security Timestamp // @Router /toolbox/fail2ban/operate/sshd [post] diff --git a/backend/app/api/v1/file.go b/backend/app/api/v1/file.go index 43e39dd30..38dd384db 100644 --- a/backend/app/api/v1/file.go +++ b/backend/app/api/v1/file.go @@ -290,6 +290,7 @@ func (b *BaseApi) SaveContent(c *gin.Context) { // @Tags File // @Summary Upload file +// @Accept multipart/form-data // @Param file formData file true "request" // @Success 200 // @Security ApiKeyAuth @@ -662,6 +663,7 @@ func mergeChunks(fileName string, fileDir string, dstDir string, chunkCount int, // @Tags File // @Summary Chunk upload file +// @Accept multipart/form-data // @Param file formData file true "request" // @Success 200 // @Security ApiKeyAuth diff --git a/backend/app/api/v1/ftp.go b/backend/app/api/v1/ftp.go index 59a10ff85..00d675a96 100644 --- a/backend/app/api/v1/ftp.go +++ b/backend/app/api/v1/ftp.go @@ -55,6 +55,7 @@ func (b *BaseApi) LoadFtpLogInfo(c *gin.Context) { // @Summary Operate FTP // @Accept json // @Param request body dto.Operate true "request" +// @Success 200 // @Security ApiKeyAuth // @Security Timestamp // @Router /toolbox/ftp/operate [post] diff --git a/backend/app/api/v1/host.go b/backend/app/api/v1/host.go index 02685688e..a69a16cff 100644 --- a/backend/app/api/v1/host.go +++ b/backend/app/api/v1/host.go @@ -56,7 +56,7 @@ func (b *BaseApi) TestByInfo(c *gin.Context) { // @Success 200 {boolean} connStatus // @Security ApiKeyAuth // @Security Timestamp -// @Router /hosts/test/byid/:id [post] +// @Router /hosts/test/byid/{id} [post] func (b *BaseApi) TestByID(c *gin.Context) { id, err := helper.GetParamID(c) if err != nil { diff --git a/backend/app/api/v1/runtime.go b/backend/app/api/v1/runtime.go index fe68cdd9f..813ebdf03 100644 --- a/backend/app/api/v1/runtime.go +++ b/backend/app/api/v1/runtime.go @@ -118,7 +118,7 @@ func (b *BaseApi) UpdateRuntime(c *gin.Context) { // @Success 200 // @Security ApiKeyAuth // @Security Timestamp -// @Router /runtimes/:id [get] +// @Router /runtimes/{id} [get] func (b *BaseApi) GetRuntime(c *gin.Context) { id, err := helper.GetIntParamByKey(c, "id") if err != nil { diff --git a/backend/app/api/v1/ssh.go b/backend/app/api/v1/ssh.go index 079010b99..621ef5509 100644 --- a/backend/app/api/v1/ssh.go +++ b/backend/app/api/v1/ssh.go @@ -26,6 +26,7 @@ func (b *BaseApi) GetSSHInfo(c *gin.Context) { // @Summary Operate SSH // @Accept json // @Param request body dto.Operate true "request" +// @Success 200 // @Security ApiKeyAuth // @Security Timestamp // @Router /host/ssh/operate [post] diff --git a/backend/app/api/v1/website.go b/backend/app/api/v1/website.go index 59bdc6762..30670921d 100644 --- a/backend/app/api/v1/website.go +++ b/backend/app/api/v1/website.go @@ -166,7 +166,7 @@ func (b *BaseApi) UpdateWebsite(c *gin.Context) { // @Success 200 {object} response.WebsiteDTO // @Security ApiKeyAuth // @Security Timestamp -// @Router /websites/:id [get] +// @Router /websites/{id} [get] func (b *BaseApi) GetWebsite(c *gin.Context) { id, err := helper.GetParamID(c) if err != nil { @@ -185,10 +185,11 @@ func (b *BaseApi) GetWebsite(c *gin.Context) { // @Summary Search website nginx by id // @Accept json // @Param id path integer true "request" +// @Param type path string true "type" // @Success 200 {object} response.FileInfo // @Security ApiKeyAuth // @Security Timestamp -// @Router /websites/:id/config/:type [get] +// @Router /websites/{id}/config/{type} [get] func (b *BaseApi) GetWebsiteNginx(c *gin.Context) { id, err := helper.GetParamID(c) if err != nil { @@ -254,7 +255,7 @@ func (b *BaseApi) UpdateNginxConfig(c *gin.Context) { // @Success 200 {object} response.WebsiteHTTPS // @Security ApiKeyAuth // @Security Timestamp -// @Router /websites/:id/https [get] +// @Router /websites/{id}/https [get] func (b *BaseApi) GetHTTPSConfig(c *gin.Context) { id, err := helper.GetParamID(c) if err != nil { @@ -272,11 +273,12 @@ func (b *BaseApi) GetHTTPSConfig(c *gin.Context) { // @Tags Website HTTPS // @Summary Update https conf // @Accept json +// @Param id path integer true "request" // @Param request body request.WebsiteHTTPSOp true "request" // @Success 200 {object} response.WebsiteHTTPS // @Security ApiKeyAuth // @Security Timestamp -// @Router /websites/:id/https [post] +// @Router /websites/{id}/https [post] // @x-panel-log {"bodyKeys":["websiteId"],"paramKeys":[],"BeforeFunctions":[{"input_column":"id","input_value":"websiteId","isList":false,"db":"websites","output_column":"primary_domain","output_value":"domain"}],"formatZH":"更新网站 [domain] https 配置","formatEN":"Update website https [domain] conf"} func (b *BaseApi) UpdateHTTPSConfig(c *gin.Context) { var req request.WebsiteHTTPSOp @@ -386,7 +388,7 @@ func (b *BaseApi) ChangeDefaultServer(c *gin.Context) { // @Success 200 {object} response.PHPConfig // @Security ApiKeyAuth // @Security Timestamp -// @Router /websites/php/config/:id [get] +// @Router /websites/php/config/{id} [get] func (b *BaseApi) GetWebsitePHPConfig(c *gin.Context) { id, err := helper.GetParamID(c) if err != nil { @@ -782,10 +784,11 @@ func (b *BaseApi) GetDirConfig(c *gin.Context) { // @Tags Website // @Summary Get default html // @Accept json +// @Param type path string true "type" // @Success 200 {object} response.FileInfo // @Security ApiKeyAuth // @Security Timestamp -// @Router /websites/default/html/:type [get] +// @Router /websites/default/html/{type} [get] func (b *BaseApi) GetDefaultHtml(c *gin.Context) { resourceType, err := helper.GetStrParamByKey(c, "type") if err != nil { diff --git a/backend/app/api/v1/website_domain.go b/backend/app/api/v1/website_domain.go index 7b824c40f..8ba07e4f1 100644 --- a/backend/app/api/v1/website_domain.go +++ b/backend/app/api/v1/website_domain.go @@ -57,7 +57,7 @@ func (b *BaseApi) CreateWebDomain(c *gin.Context) { // @Success 200 {array} model.WebsiteDomain // @Security ApiKeyAuth // @Security Timestamp -// @Router /websites/domains/:websiteId [get] +// @Router /websites/domains/{websiteId} [get] func (b *BaseApi) GetWebDomains(c *gin.Context) { websiteId, err := helper.GetIntParamByKey(c, "websiteId") if err != nil { diff --git a/backend/app/api/v1/website_ssl.go b/backend/app/api/v1/website_ssl.go index 77d766ff3..d51eef52e 100644 --- a/backend/app/api/v1/website_ssl.go +++ b/backend/app/api/v1/website_ssl.go @@ -138,7 +138,7 @@ func (b *BaseApi) DeleteWebsiteSSL(c *gin.Context) { // @Success 200 // @Security ApiKeyAuth // @Security Timestamp -// @Router /websites/ssl/website/:websiteId [get] +// @Router /websites/ssl/website/{websiteId} [get] func (b *BaseApi) GetWebsiteSSLByWebsiteId(c *gin.Context) { websiteId, err := helper.GetIntParamByKey(c, "websiteId") if err != nil { @@ -160,7 +160,7 @@ func (b *BaseApi) GetWebsiteSSLByWebsiteId(c *gin.Context) { // @Success 200 // @Security ApiKeyAuth // @Security Timestamp -// @Router /websites/ssl/:id [get] +// @Router /websites/ssl/{id} [get] func (b *BaseApi) GetWebsiteSSLById(c *gin.Context) { id, err := helper.GetParamID(c) if err != nil { diff --git a/backend/app/dto/fail2ban.go b/backend/app/dto/fail2ban.go index 8c8351b82..51688e893 100644 --- a/backend/app/dto/fail2ban.go +++ b/backend/app/dto/fail2ban.go @@ -19,7 +19,7 @@ type Fail2BanSearch struct { } type Fail2BanUpdate struct { - Key string `json:"key" validate:"required,oneof=port bantime findtime maxretry banaction logpath port"` + Key string `json:"key" validate:"required,oneof=port bantime findtime maxretry banaction logpath"` Value string `json:"value"` } diff --git a/cmd/server/docs/docs.go b/cmd/server/docs/docs.go index 3b14ff1da..b33064b23 100644 --- a/cmd/server/docs/docs.go +++ b/cmd/server/docs/docs.go @@ -20,42 +20,6 @@ const docTemplate = `{ "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { - "/apps/:key": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "App" - ], - "summary": "Search app by key", - "parameters": [ - { - "type": "string", - "description": "app key", - "name": "key", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.AppDTO" - } - } - } - } - }, "/apps/checkupdate": { "get": { "security": [ @@ -77,7 +41,7 @@ const docTemplate = `{ } } }, - "/apps/detail/:appId/:version/:type": { + "/apps/detail/{appId}/{version}/{type}": { "get": { "security": [ { @@ -112,7 +76,7 @@ const docTemplate = `{ { "type": "string", "description": "app type", - "name": "version", + "name": "type", "in": "path", "required": true } @@ -127,7 +91,7 @@ const docTemplate = `{ } } }, - "/apps/details/:id": { + "/apps/details/{id}": { "get": { "security": [ { @@ -148,7 +112,7 @@ const docTemplate = `{ { "type": "integer", "description": "id", - "name": "appId", + "name": "id", "in": "path", "required": true } @@ -313,7 +277,7 @@ const docTemplate = `{ } } }, - "/apps/installed/conninfo/:key": { + "/apps/installed/conninfo/{key}": { "get": { "security": [ { @@ -339,6 +303,13 @@ const docTemplate = `{ "schema": { "$ref": "#/definitions/dto.OperationWithNameAndType" } + }, + { + "type": "string", + "description": "key", + "name": "key", + "in": "path", + "required": true } ], "responses": { @@ -351,7 +322,7 @@ const docTemplate = `{ } } }, - "/apps/installed/delete/check/:appInstallId": { + "/apps/installed/delete/check/{appInstallId}": { "get": { "security": [ { @@ -572,42 +543,6 @@ const docTemplate = `{ } } }, - "/apps/installed/params/:appInstallId": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "App" - ], - "summary": "Search params by appInstallId", - "parameters": [ - { - "type": "string", - "description": "request", - "name": "appInstallId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.AppParam" - } - } - } - } - }, "/apps/installed/params/update": { "post": { "security": [ @@ -652,6 +587,42 @@ const docTemplate = `{ } } }, + "/apps/installed/params/{appInstallId}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "App" + ], + "summary": "Search params by appInstallId", + "parameters": [ + { + "type": "string", + "description": "request", + "name": "appInstallId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.AppParam" + } + } + } + } + }, "/apps/installed/port/change": { "post": { "security": [ @@ -778,15 +749,6 @@ const docTemplate = `{ "App" ], "summary": "Search app update version by install id", - "parameters": [ - { - "type": "integer", - "description": "request", - "name": "appInstallId", - "in": "path", - "required": true - } - ], "responses": { "200": { "description": "OK", @@ -835,7 +797,7 @@ const docTemplate = `{ } } }, - "/apps/services/:key": { + "/apps/services/{key}": { "get": { "security": [ { @@ -902,6 +864,42 @@ const docTemplate = `{ } } }, + "/apps/{key}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "App" + ], + "summary": "Search app by key", + "parameters": [ + { + "type": "string", + "description": "app key", + "name": "key", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.AppDTO" + } + } + } + } + }, "/auth/captcha": { "get": { "tags": [ @@ -1333,7 +1331,11 @@ const docTemplate = `{ "in": "query" } ], - "responses": {} + "responses": { + "200": { + "description": "OK" + } + } } }, "/containers/compose/test": { @@ -1664,7 +1666,11 @@ const docTemplate = `{ } } ], - "responses": {} + "responses": { + "200": { + "description": "OK" + } + } } }, "/containers/image": { @@ -3029,10 +3035,14 @@ const docTemplate = `{ "in": "query" } ], - "responses": {} + "responses": { + "200": { + "description": "OK" + } + } } }, - "/containers/stats/:id": { + "/containers/stats/{id}": { "get": { "security": [ { @@ -4009,7 +4019,34 @@ const docTemplate = `{ } } }, - "/dashboard/base/:ioOption/:netOption": { + "/dashboard/base/os": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Dashboard" + ], + "summary": "Load os info", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/dto.OsInfo" + } + } + } + } + }, + "/dashboard/base/{ioOption}/{netOption}": { "get": { "security": [ { @@ -4052,33 +4089,6 @@ const docTemplate = `{ } } }, - "/dashboard/base/os": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "Dashboard" - ], - "summary": "Load os info", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/dto.OsInfo" - } - } - } - } - }, "/dashboard/current": { "post": { "security": [ @@ -4117,7 +4127,7 @@ const docTemplate = `{ } } }, - "/dashboard/system/restart/:operation": { + "/dashboard/system/restart/{operation}": { "post": { "security": [ { @@ -4508,30 +4518,6 @@ const docTemplate = `{ } } }, - "/databases/db/:name": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "tags": [ - "Database" - ], - "summary": "Get databases", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/dto.DatabaseInfo" - } - } - } - } - }, "/databases/db/check": { "post": { "security": [ @@ -4630,7 +4616,7 @@ const docTemplate = `{ } } }, - "/databases/db/item/:type": { + "/databases/db/item/{type}": { "get": { "security": [ { @@ -4644,6 +4630,15 @@ const docTemplate = `{ "Database" ], "summary": "Retrieve database list based on type", + "parameters": [ + { + "type": "string", + "description": "type", + "name": "type", + "in": "path", + "required": true + } + ], "responses": { "200": { "description": "OK", @@ -4657,7 +4652,7 @@ const docTemplate = `{ } } }, - "/databases/db/list/:type": { + "/databases/db/list/{type}": { "get": { "security": [ { @@ -4671,6 +4666,15 @@ const docTemplate = `{ "Database" ], "summary": "List databases", + "parameters": [ + { + "type": "string", + "description": "type", + "name": "type", + "in": "path", + "required": true + } + ], "responses": { "200": { "description": "OK", @@ -4766,6 +4770,39 @@ const docTemplate = `{ } } }, + "/databases/db/{name}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "tags": [ + "Database" + ], + "summary": "Get databases", + "parameters": [ + { + "type": "string", + "description": "name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/dto.DatabaseInfo" + } + } + } + } + }, "/databases/del": { "post": { "security": [ @@ -4942,7 +4979,11 @@ const docTemplate = `{ } } ], - "responses": {} + "responses": { + "200": { + "description": "OK" + } + } } }, "/databases/options": { @@ -5030,37 +5071,6 @@ const docTemplate = `{ } } }, - "/databases/pg/:database/load": { - "post": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "Database Postgresql" - ], - "summary": "Load postgresql database from remote", - "parameters": [ - { - "description": "request", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.PostgresqlLoadDB" - } - } - ], - "responses": {} - } - }, "/databases/pg/bind": { "post": { "security": [ @@ -5390,6 +5400,48 @@ const docTemplate = `{ } } }, + "/databases/pg/{database}/load": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Database Postgresql" + ], + "summary": "Load postgresql database from remote", + "parameters": [ + { + "description": "request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.PostgresqlLoadDB" + } + }, + { + "type": "string", + "description": "database", + "name": "database", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, "/databases/redis/conf": { "post": { "security": [ @@ -6110,6 +6162,9 @@ const docTemplate = `{ "Timestamp": [] } ], + "consumes": [ + "multipart/form-data" + ], "tags": [ "File" ], @@ -6989,6 +7044,9 @@ const docTemplate = `{ "Timestamp": [] } ], + "consumes": [ + "multipart/form-data" + ], "tags": [ "File" ], @@ -7468,7 +7526,11 @@ const docTemplate = `{ } } ], - "responses": {}, + "responses": { + "200": { + "description": "OK" + } + }, "x-panel-log": { "BeforeFunctions": [], "bodyKeys": [ @@ -8080,7 +8142,10 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "type": "Array" + "type": "array", + "items": { + "$ref": "#/definitions/dto.RedisCommand" + } } } } @@ -8279,7 +8344,10 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "type": "Array" + "type": "array", + "items": { + "$ref": "#/definitions/dto.CommandTree" + } } } } @@ -8866,7 +8934,7 @@ const docTemplate = `{ } } }, - "/hosts/test/byid/:id": { + "/hosts/test/byid/{id}": { "post": { "security": [ { @@ -9539,39 +9607,6 @@ const docTemplate = `{ } } }, - "/runtimes/:id": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "Runtime" - ], - "summary": "Get runtime", - "parameters": [ - { - "type": "string", - "description": "request", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, "/runtimes/del": { "post": { "security": [ @@ -10014,6 +10049,39 @@ const docTemplate = `{ } } }, + "/runtimes/{id}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Runtime" + ], + "summary": "Get runtime", + "parameters": [ + { + "type": "string", + "description": "request", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, "/settings/api/config/generate/key": { "post": { "security": [ @@ -12027,7 +12095,11 @@ const docTemplate = `{ } } ], - "responses": {}, + "responses": { + "200": { + "description": "OK" + } + }, "x-panel-log": { "BeforeFunctions": [], "bodyKeys": [ @@ -12067,7 +12139,11 @@ const docTemplate = `{ } } ], - "responses": {}, + "responses": { + "200": { + "description": "OK" + } + }, "x-panel-log": { "BeforeFunctions": [ { @@ -12649,7 +12725,10 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "type": "Array" + "type": "array", + "items": { + "type": "string" + } } } } @@ -12731,7 +12810,11 @@ const docTemplate = `{ } } ], - "responses": {}, + "responses": { + "200": { + "description": "OK" + } + }, "x-panel-log": { "BeforeFunctions": [], "bodyKeys": [ @@ -12771,7 +12854,11 @@ const docTemplate = `{ } } ], - "responses": {} + "responses": { + "200": { + "description": "OK" + } + } } }, "/toolbox/fail2ban/search": { @@ -12806,7 +12893,10 @@ const docTemplate = `{ "200": { "description": "OK", "schema": { - "type": "Array" + "type": "array", + "items": { + "type": "string" + } } } } @@ -13080,7 +13170,11 @@ const docTemplate = `{ } } ], - "responses": {}, + "responses": { + "200": { + "description": "OK" + } + }, "x-panel-log": { "BeforeFunctions": [], "bodyKeys": [ @@ -13289,168 +13383,6 @@ const docTemplate = `{ } } }, - "/websites/:id": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "Website" - ], - "summary": "Search website by id", - "parameters": [ - { - "type": "integer", - "description": "request", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.WebsiteDTO" - } - } - } - } - }, - "/websites/:id/config/:type": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "Website Nginx" - ], - "summary": "Search website nginx by id", - "parameters": [ - { - "type": "integer", - "description": "request", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.FileInfo" - } - } - } - } - }, - "/websites/:id/https": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "Website HTTPS" - ], - "summary": "Load https conf", - "parameters": [ - { - "type": "integer", - "description": "request", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.WebsiteHTTPS" - } - } - } - }, - "post": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "Website HTTPS" - ], - "summary": "Update https conf", - "parameters": [ - { - "description": "request", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.WebsiteHTTPSOp" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.WebsiteHTTPS" - } - } - }, - "x-panel-log": { - "BeforeFunctions": [ - { - "db": "websites", - "input_column": "id", - "input_value": "websiteId", - "isList": false, - "output_column": "primary_domain", - "output_value": "domain" - } - ], - "bodyKeys": [ - "websiteId" - ], - "formatEN": "Update website https [domain] conf", - "formatZH": "更新网站 [domain] https 配置", - "paramKeys": [] - } - } - }, "/websites/acme": { "post": { "security": [ @@ -14124,33 +14056,6 @@ const docTemplate = `{ } } }, - "/websites/default/html/:type": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "Website" - ], - "summary": "Get default html", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.FileInfo" - } - } - } - } - }, "/websites/default/html/update": { "post": { "security": [ @@ -14195,6 +14100,42 @@ const docTemplate = `{ } } }, + "/websites/default/html/{type}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Website" + ], + "summary": "Get default html", + "parameters": [ + { + "type": "string", + "description": "type", + "name": "type", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.FileInfo" + } + } + } + } + }, "/websites/default/server": { "post": { "security": [ @@ -14669,45 +14610,6 @@ const docTemplate = `{ } } }, - "/websites/domains/:websiteId": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "Website Domain" - ], - "summary": "Search website domains by websiteId", - "parameters": [ - { - "type": "integer", - "description": "request", - "name": "websiteId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/model.WebsiteDomain" - } - } - } - } - } - }, "/websites/domains/del": { "post": { "security": [ @@ -14761,6 +14663,45 @@ const docTemplate = `{ } } }, + "/websites/domains/{websiteId}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Website Domain" + ], + "summary": "Search website domains by websiteId", + "parameters": [ + { + "type": "integer", + "description": "request", + "name": "websiteId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/model.WebsiteDomain" + } + } + } + } + } + }, "/websites/leech": { "post": { "security": [ @@ -15102,7 +15043,7 @@ const docTemplate = `{ } } }, - "/websites/php/config/:id": { + "/websites/php/config/{id}": { "get": { "security": [ { @@ -15699,39 +15640,6 @@ const docTemplate = `{ } } }, - "/websites/ssl/:id": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "Website SSL" - ], - "summary": "Search website ssl by id", - "parameters": [ - { - "type": "integer", - "description": "request", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, "/websites/ssl/del": { "post": { "security": [ @@ -16064,7 +15972,7 @@ const docTemplate = `{ } } }, - "/websites/ssl/website/:websiteId": { + "/websites/ssl/website/{websiteId}": { "get": { "security": [ { @@ -16097,6 +16005,39 @@ const docTemplate = `{ } } }, + "/websites/ssl/{id}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Website SSL" + ], + "summary": "Search website ssl by id", + "parameters": [ + { + "type": "integer", + "description": "request", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, "/websites/update": { "post": { "security": [ @@ -16140,6 +16081,182 @@ const docTemplate = `{ "paramKeys": [] } } + }, + "/websites/{id}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Website" + ], + "summary": "Search website by id", + "parameters": [ + { + "type": "integer", + "description": "request", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.WebsiteDTO" + } + } + } + } + }, + "/websites/{id}/config/{type}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Website Nginx" + ], + "summary": "Search website nginx by id", + "parameters": [ + { + "type": "integer", + "description": "request", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "type", + "name": "type", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.FileInfo" + } + } + } + } + }, + "/websites/{id}/https": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Website HTTPS" + ], + "summary": "Load https conf", + "parameters": [ + { + "type": "integer", + "description": "request", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.WebsiteHTTPS" + } + } + } + }, + "post": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Website HTTPS" + ], + "summary": "Update https conf", + "parameters": [ + { + "type": "integer", + "description": "request", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.WebsiteHTTPSOp" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.WebsiteHTTPS" + } + } + }, + "x-panel-log": { + "BeforeFunctions": [ + { + "db": "websites", + "input_column": "id", + "input_value": "websiteId", + "isList": false, + "output_column": "primary_domain", + "output_value": "domain" + } + ], + "bodyKeys": [ + "websiteId" + ], + "formatEN": "Update website https [domain] conf", + "formatZH": "更新网站 [domain] https 配置", + "paramKeys": [] + } + } } }, "definitions": { @@ -16193,6 +16310,9 @@ const docTemplate = `{ "apiKey": { "type": "string" }, + "apiKeyValidityTime": { + "type": "string" + }, "ipWhiteList": { "type": "string" } @@ -16724,6 +16844,23 @@ const docTemplate = `{ } } }, + "dto.CommandTree": { + "type": "object", + "properties": { + "children": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.CommandInfo" + } + }, + "id": { + "type": "integer" + }, + "label": { + "type": "string" + } + } + }, "dto.CommonBackup": { "type": "object", "required": [ @@ -18170,8 +18307,7 @@ const docTemplate = `{ "findtime", "maxretry", "banaction", - "logpath", - "port" + "logpath" ] }, "value": { @@ -18856,7 +18992,8 @@ const docTemplate = `{ "enum": [ "zh", "en", - "tw" + "tw", + "ru" ] }, "name": { @@ -20543,6 +20680,9 @@ const docTemplate = `{ "apiKey": { "type": "string" }, + "apiKeyValidityTime": { + "type": "string" + }, "appStoreLastModified": { "type": "string" }, @@ -24558,7 +24698,7 @@ const docTemplate = `{ "description": "Custom Token Format, Format: md5('1panel' + API-Key + UnixTimestamp).\n` + "`" + `` + "`" + `` + "`" + `\neg:\ncurl -X GET \"http://localhost:4004/api/v1/resource\" \\\n-H \"1Panel-Token: \u003c1panel_token\u003e\" \\\n-H \"1Panel-Timestamp: \u003ccurrent_unix_timestamp\u003e\"\n` + "`" + `` + "`" + `` + "`" + `\n- ` + "`" + `1Panel-Token` + "`" + ` is the key for the panel API Key.", "type": "apiKey", "name": "1Panel-Token", - "in": "Header" + "in": "header" }, "Timestamp": { "description": "- ` + "`" + `1Panel-Timestamp` + "`" + ` is the Unix timestamp of the current time in seconds.", diff --git a/cmd/server/docs/swagger.json b/cmd/server/docs/swagger.json index 5a841ba89..9b4770c66 100644 --- a/cmd/server/docs/swagger.json +++ b/cmd/server/docs/swagger.json @@ -17,42 +17,6 @@ }, "basePath": "/api/v1", "paths": { - "/apps/:key": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "App" - ], - "summary": "Search app by key", - "parameters": [ - { - "type": "string", - "description": "app key", - "name": "key", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.AppDTO" - } - } - } - } - }, "/apps/checkupdate": { "get": { "security": [ @@ -74,7 +38,7 @@ } } }, - "/apps/detail/:appId/:version/:type": { + "/apps/detail/{appId}/{version}/{type}": { "get": { "security": [ { @@ -109,7 +73,7 @@ { "type": "string", "description": "app type", - "name": "version", + "name": "type", "in": "path", "required": true } @@ -124,7 +88,7 @@ } } }, - "/apps/details/:id": { + "/apps/details/{id}": { "get": { "security": [ { @@ -145,7 +109,7 @@ { "type": "integer", "description": "id", - "name": "appId", + "name": "id", "in": "path", "required": true } @@ -310,7 +274,7 @@ } } }, - "/apps/installed/conninfo/:key": { + "/apps/installed/conninfo/{key}": { "get": { "security": [ { @@ -336,6 +300,13 @@ "schema": { "$ref": "#/definitions/dto.OperationWithNameAndType" } + }, + { + "type": "string", + "description": "key", + "name": "key", + "in": "path", + "required": true } ], "responses": { @@ -348,7 +319,7 @@ } } }, - "/apps/installed/delete/check/:appInstallId": { + "/apps/installed/delete/check/{appInstallId}": { "get": { "security": [ { @@ -569,42 +540,6 @@ } } }, - "/apps/installed/params/:appInstallId": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "App" - ], - "summary": "Search params by appInstallId", - "parameters": [ - { - "type": "string", - "description": "request", - "name": "appInstallId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.AppParam" - } - } - } - } - }, "/apps/installed/params/update": { "post": { "security": [ @@ -649,6 +584,42 @@ } } }, + "/apps/installed/params/{appInstallId}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "App" + ], + "summary": "Search params by appInstallId", + "parameters": [ + { + "type": "string", + "description": "request", + "name": "appInstallId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.AppParam" + } + } + } + } + }, "/apps/installed/port/change": { "post": { "security": [ @@ -775,15 +746,6 @@ "App" ], "summary": "Search app update version by install id", - "parameters": [ - { - "type": "integer", - "description": "request", - "name": "appInstallId", - "in": "path", - "required": true - } - ], "responses": { "200": { "description": "OK", @@ -832,7 +794,7 @@ } } }, - "/apps/services/:key": { + "/apps/services/{key}": { "get": { "security": [ { @@ -899,6 +861,42 @@ } } }, + "/apps/{key}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "App" + ], + "summary": "Search app by key", + "parameters": [ + { + "type": "string", + "description": "app key", + "name": "key", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.AppDTO" + } + } + } + } + }, "/auth/captcha": { "get": { "tags": [ @@ -1330,7 +1328,11 @@ "in": "query" } ], - "responses": {} + "responses": { + "200": { + "description": "OK" + } + } } }, "/containers/compose/test": { @@ -1661,7 +1663,11 @@ } } ], - "responses": {} + "responses": { + "200": { + "description": "OK" + } + } } }, "/containers/image": { @@ -3026,10 +3032,14 @@ "in": "query" } ], - "responses": {} + "responses": { + "200": { + "description": "OK" + } + } } }, - "/containers/stats/:id": { + "/containers/stats/{id}": { "get": { "security": [ { @@ -4006,7 +4016,34 @@ } } }, - "/dashboard/base/:ioOption/:netOption": { + "/dashboard/base/os": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Dashboard" + ], + "summary": "Load os info", + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/dto.OsInfo" + } + } + } + } + }, + "/dashboard/base/{ioOption}/{netOption}": { "get": { "security": [ { @@ -4049,33 +4086,6 @@ } } }, - "/dashboard/base/os": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "Dashboard" - ], - "summary": "Load os info", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/dto.OsInfo" - } - } - } - } - }, "/dashboard/current": { "post": { "security": [ @@ -4114,7 +4124,7 @@ } } }, - "/dashboard/system/restart/:operation": { + "/dashboard/system/restart/{operation}": { "post": { "security": [ { @@ -4505,30 +4515,6 @@ } } }, - "/databases/db/:name": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "tags": [ - "Database" - ], - "summary": "Get databases", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/dto.DatabaseInfo" - } - } - } - } - }, "/databases/db/check": { "post": { "security": [ @@ -4627,7 +4613,7 @@ } } }, - "/databases/db/item/:type": { + "/databases/db/item/{type}": { "get": { "security": [ { @@ -4641,6 +4627,15 @@ "Database" ], "summary": "Retrieve database list based on type", + "parameters": [ + { + "type": "string", + "description": "type", + "name": "type", + "in": "path", + "required": true + } + ], "responses": { "200": { "description": "OK", @@ -4654,7 +4649,7 @@ } } }, - "/databases/db/list/:type": { + "/databases/db/list/{type}": { "get": { "security": [ { @@ -4668,6 +4663,15 @@ "Database" ], "summary": "List databases", + "parameters": [ + { + "type": "string", + "description": "type", + "name": "type", + "in": "path", + "required": true + } + ], "responses": { "200": { "description": "OK", @@ -4763,6 +4767,39 @@ } } }, + "/databases/db/{name}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "tags": [ + "Database" + ], + "summary": "Get databases", + "parameters": [ + { + "type": "string", + "description": "name", + "name": "name", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/dto.DatabaseInfo" + } + } + } + } + }, "/databases/del": { "post": { "security": [ @@ -4939,7 +4976,11 @@ } } ], - "responses": {} + "responses": { + "200": { + "description": "OK" + } + } } }, "/databases/options": { @@ -5027,37 +5068,6 @@ } } }, - "/databases/pg/:database/load": { - "post": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "Database Postgresql" - ], - "summary": "Load postgresql database from remote", - "parameters": [ - { - "description": "request", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/dto.PostgresqlLoadDB" - } - } - ], - "responses": {} - } - }, "/databases/pg/bind": { "post": { "security": [ @@ -5387,6 +5397,48 @@ } } }, + "/databases/pg/{database}/load": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Database Postgresql" + ], + "summary": "Load postgresql database from remote", + "parameters": [ + { + "description": "request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.PostgresqlLoadDB" + } + }, + { + "type": "string", + "description": "database", + "name": "database", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, "/databases/redis/conf": { "post": { "security": [ @@ -6107,6 +6159,9 @@ "Timestamp": [] } ], + "consumes": [ + "multipart/form-data" + ], "tags": [ "File" ], @@ -6986,6 +7041,9 @@ "Timestamp": [] } ], + "consumes": [ + "multipart/form-data" + ], "tags": [ "File" ], @@ -7465,7 +7523,11 @@ } } ], - "responses": {}, + "responses": { + "200": { + "description": "OK" + } + }, "x-panel-log": { "BeforeFunctions": [], "bodyKeys": [ @@ -8077,7 +8139,10 @@ "200": { "description": "OK", "schema": { - "type": "Array" + "type": "array", + "items": { + "$ref": "#/definitions/dto.RedisCommand" + } } } } @@ -8276,7 +8341,10 @@ "200": { "description": "OK", "schema": { - "type": "Array" + "type": "array", + "items": { + "$ref": "#/definitions/dto.CommandTree" + } } } } @@ -8673,7 +8741,7 @@ "tags": [ "Firewall" ], - "summary": "Uodate address group", + "summary": "Update address group", "parameters": [ { "description": "request", @@ -8863,7 +8931,7 @@ } } }, - "/hosts/test/byid/:id": { + "/hosts/test/byid/{id}": { "post": { "security": [ { @@ -9536,39 +9604,6 @@ } } }, - "/runtimes/:id": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "Runtime" - ], - "summary": "Get runtime", - "parameters": [ - { - "type": "string", - "description": "request", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, "/runtimes/del": { "post": { "security": [ @@ -10011,6 +10046,39 @@ } } }, + "/runtimes/{id}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Runtime" + ], + "summary": "Get runtime", + "parameters": [ + { + "type": "string", + "description": "request", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, "/settings/api/config/generate/key": { "post": { "security": [ @@ -12024,7 +12092,11 @@ } } ], - "responses": {}, + "responses": { + "200": { + "description": "OK" + } + }, "x-panel-log": { "BeforeFunctions": [], "bodyKeys": [ @@ -12064,7 +12136,11 @@ } } ], - "responses": {}, + "responses": { + "200": { + "description": "OK" + } + }, "x-panel-log": { "BeforeFunctions": [ { @@ -12646,7 +12722,10 @@ "200": { "description": "OK", "schema": { - "type": "Array" + "type": "array", + "items": { + "type": "string" + } } } } @@ -12728,7 +12807,11 @@ } } ], - "responses": {}, + "responses": { + "200": { + "description": "OK" + } + }, "x-panel-log": { "BeforeFunctions": [], "bodyKeys": [ @@ -12768,7 +12851,11 @@ } } ], - "responses": {} + "responses": { + "200": { + "description": "OK" + } + } } }, "/toolbox/fail2ban/search": { @@ -12803,7 +12890,10 @@ "200": { "description": "OK", "schema": { - "type": "Array" + "type": "array", + "items": { + "type": "string" + } } } } @@ -13077,7 +13167,11 @@ } } ], - "responses": {}, + "responses": { + "200": { + "description": "OK" + } + }, "x-panel-log": { "BeforeFunctions": [], "bodyKeys": [ @@ -13286,168 +13380,6 @@ } } }, - "/websites/:id": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "Website" - ], - "summary": "Search website by id", - "parameters": [ - { - "type": "integer", - "description": "request", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.WebsiteDTO" - } - } - } - } - }, - "/websites/:id/config/:type": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "Website Nginx" - ], - "summary": "Search website nginx by id", - "parameters": [ - { - "type": "integer", - "description": "request", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.FileInfo" - } - } - } - } - }, - "/websites/:id/https": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "Website HTTPS" - ], - "summary": "Load https conf", - "parameters": [ - { - "type": "integer", - "description": "request", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.WebsiteHTTPS" - } - } - } - }, - "post": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "Website HTTPS" - ], - "summary": "Update https conf", - "parameters": [ - { - "description": "request", - "name": "request", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/request.WebsiteHTTPSOp" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.WebsiteHTTPS" - } - } - }, - "x-panel-log": { - "BeforeFunctions": [ - { - "db": "websites", - "input_column": "id", - "input_value": "websiteId", - "isList": false, - "output_column": "primary_domain", - "output_value": "domain" - } - ], - "bodyKeys": [ - "websiteId" - ], - "formatEN": "Update website https [domain] conf", - "formatZH": "更新网站 [domain] https 配置", - "paramKeys": [] - } - } - }, "/websites/acme": { "post": { "security": [ @@ -14121,33 +14053,6 @@ } } }, - "/websites/default/html/:type": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "Website" - ], - "summary": "Get default html", - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/response.FileInfo" - } - } - } - } - }, "/websites/default/html/update": { "post": { "security": [ @@ -14192,6 +14097,42 @@ } } }, + "/websites/default/html/{type}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Website" + ], + "summary": "Get default html", + "parameters": [ + { + "type": "string", + "description": "type", + "name": "type", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.FileInfo" + } + } + } + } + }, "/websites/default/server": { "post": { "security": [ @@ -14666,45 +14607,6 @@ } } }, - "/websites/domains/:websiteId": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "Website Domain" - ], - "summary": "Search website domains by websiteId", - "parameters": [ - { - "type": "integer", - "description": "request", - "name": "websiteId", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/model.WebsiteDomain" - } - } - } - } - } - }, "/websites/domains/del": { "post": { "security": [ @@ -14758,6 +14660,45 @@ } } }, + "/websites/domains/{websiteId}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Website Domain" + ], + "summary": "Search website domains by websiteId", + "parameters": [ + { + "type": "integer", + "description": "request", + "name": "websiteId", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "array", + "items": { + "$ref": "#/definitions/model.WebsiteDomain" + } + } + } + } + } + }, "/websites/leech": { "post": { "security": [ @@ -15099,7 +15040,7 @@ } } }, - "/websites/php/config/:id": { + "/websites/php/config/{id}": { "get": { "security": [ { @@ -15696,39 +15637,6 @@ } } }, - "/websites/ssl/:id": { - "get": { - "security": [ - { - "ApiKeyAuth": [] - }, - { - "Timestamp": [] - } - ], - "consumes": [ - "application/json" - ], - "tags": [ - "Website SSL" - ], - "summary": "Search website ssl by id", - "parameters": [ - { - "type": "integer", - "description": "request", - "name": "id", - "in": "path", - "required": true - } - ], - "responses": { - "200": { - "description": "OK" - } - } - } - }, "/websites/ssl/del": { "post": { "security": [ @@ -16061,7 +15969,7 @@ } } }, - "/websites/ssl/website/:websiteId": { + "/websites/ssl/website/{websiteId}": { "get": { "security": [ { @@ -16094,6 +16002,39 @@ } } }, + "/websites/ssl/{id}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Website SSL" + ], + "summary": "Search website ssl by id", + "parameters": [ + { + "type": "integer", + "description": "request", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, "/websites/update": { "post": { "security": [ @@ -16137,6 +16078,182 @@ "paramKeys": [] } } + }, + "/websites/{id}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Website" + ], + "summary": "Search website by id", + "parameters": [ + { + "type": "integer", + "description": "request", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.WebsiteDTO" + } + } + } + } + }, + "/websites/{id}/config/{type}": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Website Nginx" + ], + "summary": "Search website nginx by id", + "parameters": [ + { + "type": "integer", + "description": "request", + "name": "id", + "in": "path", + "required": true + }, + { + "type": "string", + "description": "type", + "name": "type", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.FileInfo" + } + } + } + } + }, + "/websites/{id}/https": { + "get": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Website HTTPS" + ], + "summary": "Load https conf", + "parameters": [ + { + "type": "integer", + "description": "request", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.WebsiteHTTPS" + } + } + } + }, + "post": { + "security": [ + { + "ApiKeyAuth": [] + }, + { + "Timestamp": [] + } + ], + "consumes": [ + "application/json" + ], + "tags": [ + "Website HTTPS" + ], + "summary": "Update https conf", + "parameters": [ + { + "type": "integer", + "description": "request", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/request.WebsiteHTTPSOp" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.WebsiteHTTPS" + } + } + }, + "x-panel-log": { + "BeforeFunctions": [ + { + "db": "websites", + "input_column": "id", + "input_value": "websiteId", + "isList": false, + "output_column": "primary_domain", + "output_value": "domain" + } + ], + "bodyKeys": [ + "websiteId" + ], + "formatEN": "Update website https [domain] conf", + "formatZH": "更新网站 [domain] https 配置", + "paramKeys": [] + } + } } }, "definitions": { @@ -16190,6 +16307,9 @@ "apiKey": { "type": "string" }, + "apiKeyValidityTime": { + "type": "string" + }, "ipWhiteList": { "type": "string" } @@ -16721,6 +16841,23 @@ } } }, + "dto.CommandTree": { + "type": "object", + "properties": { + "children": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.CommandInfo" + } + }, + "id": { + "type": "integer" + }, + "label": { + "type": "string" + } + } + }, "dto.CommonBackup": { "type": "object", "required": [ @@ -18167,8 +18304,7 @@ "findtime", "maxretry", "banaction", - "logpath", - "port" + "logpath" ] }, "value": { @@ -18853,7 +18989,8 @@ "enum": [ "zh", "en", - "tw" + "tw", + "ru" ] }, "name": { @@ -20540,6 +20677,9 @@ "apiKey": { "type": "string" }, + "apiKeyValidityTime": { + "type": "string" + }, "appStoreLastModified": { "type": "string" }, @@ -24555,7 +24695,7 @@ "description": "Custom Token Format, Format: md5('1panel' + API-Key + UnixTimestamp).\n```\neg:\ncurl -X GET \"http://localhost:4004/api/v1/resource\" \\\n-H \"1Panel-Token: \u003c1panel_token\u003e\" \\\n-H \"1Panel-Timestamp: \u003ccurrent_unix_timestamp\u003e\"\n```\n- `1Panel-Token` is the key for the panel API Key.", "type": "apiKey", "name": "1Panel-Token", - "in": "Header" + "in": "header" }, "Timestamp": { "description": "- `1Panel-Timestamp` is the Unix timestamp of the current time in seconds.", diff --git a/cmd/server/docs/swagger.yaml b/cmd/server/docs/swagger.yaml index 1f7c90411..7016bda27 100644 --- a/cmd/server/docs/swagger.yaml +++ b/cmd/server/docs/swagger.yaml @@ -34,6 +34,8 @@ definitions: type: string apiKey: type: string + apiKeyValidityTime: + type: string ipWhiteList: type: string type: object @@ -384,6 +386,17 @@ definitions: - command - name type: object + dto.CommandTree: + properties: + children: + items: + $ref: '#/definitions/dto.CommandInfo' + type: array + id: + type: integer + label: + type: string + type: object dto.CommonBackup: properties: detailName: @@ -1362,7 +1375,6 @@ definitions: - maxretry - banaction - logpath - - port type: string value: type: string @@ -1822,6 +1834,7 @@ definitions: - zh - en - tw + - ru type: string name: type: string @@ -2977,6 +2990,8 @@ definitions: type: string apiKey: type: string + apiKeyValidityTime: + type: string appStoreLastModified: type: string appStoreSyncStatus: @@ -5662,7 +5677,7 @@ info: title: 1Panel version: "1.0" paths: - /apps/:key: + /apps/{key}: get: consumes: - application/json @@ -5694,7 +5709,7 @@ paths: summary: Get app list update tags: - App - /apps/detail/:appId/:version/:type: + /apps/detail/{appId}/{version}/{type}: get: consumes: - application/json @@ -5711,7 +5726,7 @@ paths: type: string - description: app type in: path - name: version + name: type required: true type: string responses: @@ -5725,14 +5740,14 @@ paths: summary: Search app detail by appid tags: - App - /apps/details/:id: + /apps/details/{id}: get: consumes: - application/json parameters: - description: id in: path - name: appId + name: id required: true type: integer responses: @@ -5834,7 +5849,7 @@ paths: summary: Search default config by key tags: - App - /apps/installed/conninfo/:key: + /apps/installed/conninfo/{key}: get: consumes: - application/json @@ -5845,6 +5860,11 @@ paths: required: true schema: $ref: '#/definitions/dto.OperationWithNameAndType' + - description: key + in: path + name: key + required: true + type: string responses: "200": description: OK @@ -5856,7 +5876,7 @@ paths: summary: Search app password by key tags: - App - /apps/installed/delete/check/:appInstallId: + /apps/installed/delete/check/{appInstallId}: get: consumes: - application/json @@ -5991,7 +6011,7 @@ paths: formatEN: '[operate] App [appKey][appName]' formatZH: '[operate] 应用 [appKey][appName]' paramKeys: [] - /apps/installed/params/:appInstallId: + /apps/installed/params/{appInstallId}: get: consumes: - application/json @@ -6109,12 +6129,6 @@ paths: post: consumes: - application/json - parameters: - - description: request - in: path - name: appInstallId - required: true - type: integer responses: "200": description: OK @@ -6148,7 +6162,7 @@ paths: summary: List apps tags: - App - /apps/services/:key: + /apps/services/{key}: get: consumes: - application/json @@ -6447,7 +6461,9 @@ paths: in: query name: tail type: string - responses: {} + responses: + "200": + description: OK security: - ApiKeyAuth: [] - Timestamp: [] @@ -6645,7 +6661,9 @@ paths: required: true schema: $ref: '#/definitions/dto.ContainerLog' - responses: {} + responses: + "200": + description: OK security: - ApiKeyAuth: [] - Timestamp: [] @@ -7469,14 +7487,16 @@ paths: in: query name: tail type: string - responses: {} + responses: + "200": + description: OK security: - ApiKeyAuth: [] - Timestamp: [] summary: Container logs tags: - Container - /containers/stats/:id: + /containers/stats/{id}: get: parameters: - description: container id @@ -8071,7 +8091,7 @@ paths: formatEN: update cronjob [name] formatZH: 更新计划任务 [name] paramKeys: [] - /dashboard/base/:ioOption/:netOption: + /dashboard/base/{ioOption}/{netOption}: get: consumes: - application/json @@ -8134,7 +8154,7 @@ paths: summary: Load dashboard current info tags: - Dashboard - /dashboard/system/restart/:operation: + /dashboard/system/restart/{operation}: post: consumes: - application/json @@ -8372,8 +8392,14 @@ paths: formatEN: create database [name][type] formatZH: 创建远程数据库 [name][type] paramKeys: [] - /databases/db/:name: + /databases/db/{name}: get: + parameters: + - description: name + in: path + name: name + required: true + type: string responses: "200": description: OK @@ -8446,8 +8472,14 @@ paths: formatEN: delete database [names] formatZH: 删除远程数据库 [names] paramKeys: [] - /databases/db/item/:type: + /databases/db/item/{type}: get: + parameters: + - description: type + in: path + name: type + required: true + type: string responses: "200": description: OK @@ -8461,8 +8493,14 @@ paths: summary: Retrieve database list based on type tags: - Database - /databases/db/list/:type: + /databases/db/list/{type}: get: + parameters: + - description: type + in: path + name: type + required: true + type: string responses: "200": description: OK @@ -8627,7 +8665,9 @@ paths: required: true schema: $ref: '#/definitions/dto.MysqlLoadDB' - responses: {} + responses: + "200": + description: OK security: - ApiKeyAuth: [] - Timestamp: [] @@ -8685,7 +8725,7 @@ paths: formatEN: create postgresql database [name] formatZH: 创建 postgresql 数据库 [name] paramKeys: [] - /databases/pg/:database/load: + /databases/pg/{database}/load: post: consumes: - application/json @@ -8696,7 +8736,14 @@ paths: required: true schema: $ref: '#/definitions/dto.PostgresqlLoadDB' - responses: {} + - description: database + in: path + name: database + required: true + type: string + responses: + "200": + description: OK security: - ApiKeyAuth: [] - Timestamp: [] @@ -9332,6 +9379,8 @@ paths: paramKeys: [] /files/chunkupload: post: + consumes: + - multipart/form-data parameters: - description: request in: formData @@ -9862,6 +9911,8 @@ paths: - File /files/upload: post: + consumes: + - multipart/form-data parameters: - description: request in: formData @@ -10152,7 +10203,9 @@ paths: required: true schema: $ref: '#/definitions/dto.Operate' - responses: {} + responses: + "200": + description: OK security: - ApiKeyAuth: [] - Timestamp: [] @@ -10522,7 +10575,9 @@ paths: "200": description: OK schema: - type: Array + items: + $ref: '#/definitions/dto.RedisCommand' + type: array security: - ApiKeyAuth: [] - Timestamp: [] @@ -10641,7 +10696,9 @@ paths: "200": description: OK schema: - type: Array + items: + $ref: '#/definitions/dto.CommandTree' + type: array security: - ApiKeyAuth: [] - Timestamp: [] @@ -10892,7 +10949,7 @@ paths: security: - ApiKeyAuth: [] - Timestamp: [] - summary: Uodate address group + summary: Update address group tags: - Firewall /hosts/firewall/update/description: @@ -10994,7 +11051,7 @@ paths: summary: Page host tags: - Host - /hosts/test/byid/:id: + /hosts/test/byid/{id}: post: consumes: - application/json @@ -11394,7 +11451,7 @@ paths: formatEN: Create runtime [name] formatZH: 创建运行环境 [name] paramKeys: [] - /runtimes/:id: + /runtimes/{id}: get: consumes: - application/json @@ -12879,7 +12936,9 @@ paths: required: true schema: $ref: '#/definitions/dto.Operate' - responses: {} + responses: + "200": + description: OK security: - ApiKeyAuth: [] - Timestamp: [] @@ -12904,7 +12963,9 @@ paths: required: true schema: $ref: '#/definitions/dto.OperateByID' - responses: {} + responses: + "200": + description: OK security: - ApiKeyAuth: [] - Timestamp: [] @@ -13254,7 +13315,9 @@ paths: "200": description: OK schema: - type: Array + items: + type: string + type: array security: - ApiKeyAuth: [] - Timestamp: [] @@ -13298,7 +13361,9 @@ paths: required: true schema: $ref: '#/definitions/dto.Operate' - responses: {} + responses: + "200": + description: OK security: - ApiKeyAuth: [] - Timestamp: [] @@ -13323,7 +13388,9 @@ paths: required: true schema: $ref: '#/definitions/dto.Operate' - responses: {} + responses: + "200": + description: OK security: - ApiKeyAuth: [] - Timestamp: [] @@ -13345,7 +13412,9 @@ paths: "200": description: OK schema: - type: Array + items: + type: string + type: array security: - ApiKeyAuth: [] - Timestamp: [] @@ -13507,7 +13576,9 @@ paths: required: true schema: $ref: '#/definitions/dto.Operate' - responses: {} + responses: + "200": + description: OK security: - ApiKeyAuth: [] - Timestamp: [] @@ -13641,7 +13712,7 @@ paths: formatEN: Create website [primaryDomain] formatZH: 创建网站 [primaryDomain] paramKeys: [] - /websites/:id: + /websites/{id}: get: consumes: - application/json @@ -13662,7 +13733,7 @@ paths: summary: Search website by id tags: - Website - /websites/:id/config/:type: + /websites/{id}/config/{type}: get: consumes: - application/json @@ -13672,6 +13743,11 @@ paths: name: id required: true type: integer + - description: type + in: path + name: type + required: true + type: string responses: "200": description: OK @@ -13683,7 +13759,7 @@ paths: summary: Search website nginx by id tags: - Website Nginx - /websites/:id/https: + /websites/{id}/https: get: consumes: - application/json @@ -13708,6 +13784,11 @@ paths: consumes: - application/json parameters: + - description: request + in: path + name: id + required: true + type: integer - description: request in: body name: request @@ -14145,10 +14226,16 @@ paths: formatEN: Nginx conf update [domain] formatZH: nginx 配置修改 [domain] paramKeys: [] - /websites/default/html/:type: + /websites/default/html/{type}: get: consumes: - application/json + parameters: + - description: type + in: path + name: type + required: true + type: string responses: "200": description: OK @@ -14478,7 +14565,7 @@ paths: formatEN: Create domain [domain] formatZH: 创建域名 [domain] paramKeys: [] - /websites/domains/:websiteId: + /websites/domains/{websiteId}: get: consumes: - application/json @@ -14740,7 +14827,7 @@ paths: formatEN: '[domain] PHP conf update' formatZH: '[domain] PHP 配置修改' paramKeys: [] - /websites/php/config/:id: + /websites/php/config/{id}: get: consumes: - application/json @@ -15103,7 +15190,7 @@ paths: formatEN: Create website ssl [primaryDomain] formatZH: 创建网站 ssl [primaryDomain] paramKeys: [] - /websites/ssl/:id: + /websites/ssl/{id}: get: consumes: - application/json @@ -15325,7 +15412,7 @@ paths: formatEN: Upload ssl [type] formatZH: 上传 ssl [type] paramKeys: [] - /websites/ssl/website/:websiteId: + /websites/ssl/website/{websiteId}: get: consumes: - application/json @@ -15385,7 +15472,7 @@ securityDefinitions: -H "1Panel-Timestamp: " ``` - `1Panel-Token` is the key for the panel API Key. - in: Header + in: header name: 1Panel-Token type: apiKey Timestamp: diff --git a/cmd/server/main.go b/cmd/server/main.go index 112c733cb..42d42b14c 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -4,9 +4,10 @@ import ( "fmt" "os" + _ "net/http/pprof" + "github.com/1Panel-dev/1Panel/cmd/server/cmd" _ "github.com/1Panel-dev/1Panel/cmd/server/docs" - _ "net/http/pprof" ) // @title 1Panel @@ -28,7 +29,7 @@ import ( // @description ``` // @description - `1Panel-Token` is the key for the panel API Key. // @type apiKey -// @in Header +// @in header // @name 1Panel-Token // @securityDefinitions.apikey Timestamp