diff --git a/agent/cmd/server/main.go b/agent/cmd/server/main.go index 2aa7bcbb1..e06fc21b6 100644 --- a/agent/cmd/server/main.go +++ b/agent/cmd/server/main.go @@ -8,12 +8,31 @@ import ( // @title 1Panel // @version 2.0 -// @description 开源Linux面板 +// @description Top-Rated Web-based Linux Server Management Tool // @termsOfService http://swagger.io/terms/ -// @license.name Apache 2.0 -// @license.url http://www.apache.org/licenses/LICENSE-2.0.html -// @host localhost +// @license.name GPL-3.0 +// @license.url https://www.gnu.org/licenses/gpl-3.0.html // @BasePath /api/v2 +// @schemes http https + +// @securityDefinitions.apikey ApiKeyAuth +// @description Custom Token Format, Format: md5('1panel' + API-Key + UnixTimestamp). +// @description ``` +// @description eg: +// @description curl -X GET "http://{host}:{port}/api/v2/toolbox/device/base" \ +// @description -H "1Panel-Token: <1panel_token>" \ +// @description -H "1Panel-Timestamp: " +// @description ``` +// @description - `1Panel-Token` is the key for the panel API Key. +// @type apiKey +// @in Header +// @name 1Panel-Token +// @securityDefinitions.apikey Timestamp +// @type apiKey +// @in header +// @name 1Panel-Timestamp +// @description - `1Panel-Timestamp` is the Unix timestamp of the current time in seconds. + func main() { if err := cmd.RootCmd.Execute(); err != nil { fmt.Fprintln(os.Stderr, err) diff --git a/core/cmd/server/docs/docs.go b/core/cmd/server/docs/docs.go index 057d01056..24a0e0499 100644 --- a/core/cmd/server/docs/docs.go +++ b/core/cmd/server/docs/docs.go @@ -6,16 +6,16 @@ const docTemplate = `{ "swagger": "2.0", "info": { "contact": {}, - "description": "开源Linux面板", + "description": "Top-Rated Web-based Linux Server Management Tool", "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html" + "name": "GPL-3.0", + "url": "https://www.gnu.org/licenses/gpl-3.0.html" }, "termsOfService": "http://swagger.io/terms/", "title": "1Panel", "version": "2.0" }, - "host": "localhost", + "host": "", "basePath": "/api/v2", "paths": { "/ai/domain/bind": { @@ -20740,6 +20740,23 @@ const docTemplate = `{ }, "type": "object" }, + "dto.ApiInterfaceConfig": { + "properties": { + "apiInterfaceStatus": { + "type": "string" + }, + "apiKey": { + "type": "string" + }, + "apiKeyValidityTime": { + "type": "string" + }, + "ipWhiteList": { + "type": "string" + } + }, + "type": "object" + }, "dto.AppConfigVersion": { "properties": { "additionalProperties": {}, @@ -20920,6 +20937,58 @@ const docTemplate = `{ }, "type": "object" }, + "dto.AppstoreConfig": { + "properties": { + "uninstallDeleteBackup": { + "type": "string" + }, + "uninstallDeleteImage": { + "type": "string" + }, + "upgradeBackup": { + "type": "string" + } + }, + "type": "object" + }, + "dto.AppstoreUpdate": { + "properties": { + "scope": { + "enum": [ + "UninstallDeleteImage", + "UpgradeBackup", + "UninstallDeleteBackup" + ], + "type": "string" + }, + "status": { + "enum": [ + "Disable", + "Enable" + ], + "type": "string" + } + }, + "required": [ + "scope", + "status" + ], + "type": "object" + }, + "dto.BackupClientInfo": { + "properties": { + "client_id": { + "type": "string" + }, + "client_secret": { + "type": "string" + }, + "redirect_uri": { + "type": "string" + } + }, + "type": "object" + }, "dto.BackupOperate": { "properties": { "accessKey": { @@ -21027,6 +21096,25 @@ const docTemplate = `{ ], "type": "object" }, + "dto.BindInfo": { + "properties": { + "bindAddress": { + "type": "string" + }, + "ipv6": { + "enum": [ + "Enable", + "Disable" + ], + "type": "string" + } + }, + "required": [ + "bindAddress", + "ipv6" + ], + "type": "object" + }, "dto.BindUser": { "properties": { "database": { @@ -21054,6 +21142,17 @@ const docTemplate = `{ ], "type": "object" }, + "dto.CaptchaResponse": { + "properties": { + "captchaID": { + "type": "string" + }, + "imagePath": { + "type": "string" + } + }, + "type": "object" + }, "dto.ChangeDBInfo": { "properties": { "database": { @@ -21108,6 +21207,21 @@ const docTemplate = `{ ], "type": "object" }, + "dto.ChangeHostGroup": { + "properties": { + "groupID": { + "type": "integer" + }, + "id": { + "type": "integer" + } + }, + "required": [ + "groupID", + "id" + ], + "type": "object" + }, "dto.ChangePasswd": { "properties": { "passwd": { @@ -21355,6 +21469,21 @@ const docTemplate = `{ }, "type": "object" }, + "dto.CleanLog": { + "properties": { + "logType": { + "enum": [ + "login", + "operation" + ], + "type": "string" + } + }, + "required": [ + "logType" + ], + "type": "object" + }, "dto.CleanTree": { "properties": { "children": { @@ -21387,6 +21516,56 @@ const docTemplate = `{ }, "type": "object" }, + "dto.CommandInfo": { + "properties": { + "command": { + "type": "string" + }, + "groupBelong": { + "type": "string" + }, + "groupID": { + "type": "integer" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + } + }, + "type": "object" + }, + "dto.CommandOperate": { + "properties": { + "command": { + "type": "string" + }, + "groupBelong": { + "type": "string" + }, + "groupID": { + "type": "integer" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + } + }, + "required": [ + "command", + "name" + ], + "type": "object" + }, "dto.CommonBackup": { "properties": { "description": { @@ -23408,6 +23587,43 @@ const docTemplate = `{ ], "type": "object" }, + "dto.HostConnTest": { + "properties": { + "addr": { + "type": "string" + }, + "authMode": { + "enum": [ + "password", + "key" + ], + "type": "string" + }, + "passPhrase": { + "type": "string" + }, + "password": { + "type": "string" + }, + "port": { + "maximum": 65535, + "minimum": 1, + "type": "integer" + }, + "privateKey": { + "type": "string" + }, + "user": { + "type": "string" + } + }, + "required": [ + "addr", + "port", + "user" + ], + "type": "object" + }, "dto.HostHelper": { "properties": { "host": { @@ -23419,6 +23635,122 @@ const docTemplate = `{ }, "type": "object" }, + "dto.HostInfo": { + "properties": { + "addr": { + "type": "string" + }, + "authMode": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "description": { + "type": "string" + }, + "groupBelong": { + "type": "string" + }, + "groupID": { + "type": "integer" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "passPhrase": { + "type": "string" + }, + "password": { + "type": "string" + }, + "port": { + "type": "integer" + }, + "privateKey": { + "type": "string" + }, + "rememberPassword": { + "type": "boolean" + }, + "user": { + "type": "string" + } + }, + "type": "object" + }, + "dto.HostOperate": { + "properties": { + "addr": { + "type": "string" + }, + "authMode": { + "enum": [ + "password", + "key" + ], + "type": "string" + }, + "description": { + "type": "string" + }, + "groupID": { + "type": "integer" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "passPhrase": { + "type": "string" + }, + "password": { + "type": "string" + }, + "port": { + "maximum": 65535, + "minimum": 1, + "type": "integer" + }, + "privateKey": { + "type": "string" + }, + "rememberPassword": { + "type": "boolean" + }, + "user": { + "type": "string" + } + }, + "required": [ + "addr", + "port", + "user" + ], + "type": "object" + }, + "dto.HostTree": { + "properties": { + "children": { + "items": { + "$ref": "#/definitions/dto.TreeChild" + }, + "type": "array" + }, + "id": { + "type": "integer" + }, + "label": { + "type": "string" + } + }, + "type": "object" + }, "dto.ImageBuild": { "properties": { "dockerfile": { @@ -23678,6 +24010,83 @@ const docTemplate = `{ }, "type": "object" }, + "dto.Login": { + "properties": { + "captcha": { + "type": "string" + }, + "captchaID": { + "type": "string" + }, + "ignoreCaptcha": { + "type": "boolean" + }, + "language": { + "enum": [ + "zh", + "en", + "zh-Hant", + "ko", + "ja", + "ru", + "ms", + "pt-BR", + "tr" + ], + "type": "string" + }, + "name": { + "type": "string" + }, + "password": { + "type": "string" + } + }, + "required": [ + "language", + "name", + "password" + ], + "type": "object" + }, + "dto.MFALogin": { + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "password": { + "type": "string" + } + }, + "required": [ + "code", + "name", + "password" + ], + "type": "object" + }, + "dto.MfaCredential": { + "properties": { + "code": { + "type": "string" + }, + "interval": { + "type": "string" + }, + "secret": { + "type": "string" + } + }, + "required": [ + "code", + "interval", + "secret" + ], + "type": "object" + }, "dto.MonitorData": { "properties": { "date": { @@ -24450,9 +24859,6 @@ const docTemplate = `{ "type": "integer" } }, - "required": [ - "id" - ], "type": "object" }, "dto.OperateByIDs": { @@ -24466,6 +24872,22 @@ const docTemplate = `{ }, "type": "object" }, + "dto.OperateByName": { + "properties": { + "name": { + "type": "string" + } + }, + "type": "object" + }, + "dto.OperateByTaskID": { + "properties": { + "taskID": { + "type": "string" + } + }, + "type": "object" + }, "dto.OperateByType": { "properties": { "type": { @@ -24724,6 +25146,21 @@ const docTemplate = `{ ], "type": "object" }, + "dto.PasswordUpdate": { + "properties": { + "newPassword": { + "type": "string" + }, + "oldPassword": { + "type": "string" + } + }, + "required": [ + "newPassword", + "oldPassword" + ], + "type": "object" + }, "dto.PortHelper": { "properties": { "containerPort": { @@ -24794,6 +25231,19 @@ const docTemplate = `{ }, "type": "object" }, + "dto.PortUpdate": { + "properties": { + "serverPort": { + "maximum": 65535, + "minimum": 1, + "type": "integer" + } + }, + "required": [ + "serverPort" + ], + "type": "object" + }, "dto.PostgresqlBindUser": { "properties": { "database": { @@ -24978,6 +25428,35 @@ const docTemplate = `{ ], "type": "object" }, + "dto.ProxyUpdate": { + "properties": { + "proxyDocker": { + "type": "boolean" + }, + "proxyPasswd": { + "type": "string" + }, + "proxyPasswdKeep": { + "type": "string" + }, + "proxyPort": { + "type": "string" + }, + "proxyType": { + "type": "string" + }, + "proxyUrl": { + "type": "string" + }, + "proxyUser": { + "type": "string" + }, + "withDockerRestart": { + "type": "boolean" + } + }, + "type": "object" + }, "dto.QuickJump": { "properties": { "detail": { @@ -25228,6 +25707,29 @@ const docTemplate = `{ ], "type": "object" }, + "dto.ReleasesNotes": { + "properties": { + "content": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "fixCount": { + "type": "integer" + }, + "newCount": { + "type": "integer" + }, + "optimizationCount": { + "type": "integer" + }, + "version": { + "type": "string" + } + }, + "type": "object" + }, "dto.ResourceLimit": { "properties": { "cpu": { @@ -25367,6 +25869,90 @@ const docTemplate = `{ ], "type": "object" }, + "dto.SSLInfo": { + "properties": { + "cert": { + "type": "string" + }, + "domain": { + "type": "string" + }, + "key": { + "type": "string" + }, + "rootPath": { + "type": "string" + }, + "sslID": { + "type": "integer" + }, + "timeout": { + "type": "string" + } + }, + "type": "object" + }, + "dto.SSLUpdate": { + "properties": { + "cert": { + "type": "string" + }, + "domain": { + "type": "string" + }, + "key": { + "type": "string" + }, + "ssl": { + "enum": [ + "Enable", + "Disable" + ], + "type": "string" + }, + "sslID": { + "type": "integer" + }, + "sslType": { + "enum": [ + "self", + "select", + "import", + "import-paste", + "import-local" + ], + "type": "string" + } + }, + "required": [ + "ssl", + "sslType" + ], + "type": "object" + }, + "dto.ScriptOperate": { + "properties": { + "description": { + "type": "string" + }, + "groups": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "isInteractive": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "script": { + "type": "string" + } + }, + "type": "object" + }, "dto.ScriptOptions": { "properties": { "id": { @@ -25459,6 +26045,83 @@ const docTemplate = `{ ], "type": "object" }, + "dto.SearchForTree": { + "properties": { + "info": { + "type": "string" + } + }, + "type": "object" + }, + "dto.SearchLgLogWithPage": { + "properties": { + "ip": { + "type": "string" + }, + "page": { + "type": "integer" + }, + "pageSize": { + "type": "integer" + }, + "status": { + "type": "string" + } + }, + "required": [ + "page", + "pageSize" + ], + "type": "object" + }, + "dto.SearchOpLogWithPage": { + "properties": { + "node": { + "type": "string" + }, + "operation": { + "type": "string" + }, + "page": { + "type": "integer" + }, + "pageSize": { + "type": "integer" + }, + "source": { + "type": "string" + }, + "status": { + "type": "string" + } + }, + "required": [ + "page", + "pageSize" + ], + "type": "object" + }, + "dto.SearchPageWithGroup": { + "properties": { + "groupID": { + "type": "integer" + }, + "info": { + "type": "string" + }, + "page": { + "type": "integer" + }, + "pageSize": { + "type": "integer" + } + }, + "required": [ + "page", + "pageSize" + ], + "type": "object" + }, "dto.SearchPageWithType": { "properties": { "info": { @@ -25575,6 +26238,18 @@ const docTemplate = `{ }, "dto.SettingInfo": { "properties": { + "allowIPs": { + "type": "string" + }, + "apiInterfaceStatus": { + "type": "string" + }, + "apiKey": { + "type": "string" + }, + "apiKeyValidityTime": { + "type": "string" + }, "appStoreLastModified": { "type": "string" }, @@ -25584,46 +26259,97 @@ const docTemplate = `{ "appStoreVersion": { "type": "string" }, - "defaultNetwork": { + "bindAddress": { "type": "string" }, - "dockerSockPath": { + "bindDomain": { "type": "string" }, - "fileRecycleBin": { + "complexityVerification": { "type": "string" }, - "lastCleanData": { + "developerMode": { "type": "string" }, - "lastCleanSize": { + "expirationDays": { "type": "string" }, - "lastCleanTime": { + "expirationTime": { "type": "string" }, - "localTime": { + "hideMenu": { "type": "string" }, - "monitorInterval": { + "ipWhiteList": { "type": "string" }, - "monitorStatus": { + "ipv6": { "type": "string" }, - "monitorStoreDays": { + "language": { "type": "string" }, - "ntpSite": { + "menuTabs": { "type": "string" }, - "systemIP": { + "mfaInterval": { + "type": "string" + }, + "mfaSecret": { + "type": "string" + }, + "mfaStatus": { + "type": "string" + }, + "noAuthSetting": { + "type": "string" + }, + "panelName": { + "type": "string" + }, + "port": { + "type": "string" + }, + "proxyPasswd": { + "type": "string" + }, + "proxyPasswdKeep": { + "type": "string" + }, + "proxyPort": { + "type": "string" + }, + "proxyType": { + "type": "string" + }, + "proxyUrl": { + "type": "string" + }, + "proxyUser": { + "type": "string" + }, + "securityEntrance": { + "type": "string" + }, + "serverPort": { + "type": "string" + }, + "sessionTimeout": { + "type": "string" + }, + "ssl": { + "type": "string" + }, + "sslType": { "type": "string" }, "systemVersion": { "type": "string" }, - "timeZone": { + "theme": { + "type": "string" + }, + "userName": { "type": "string" } }, @@ -25875,6 +26601,20 @@ const docTemplate = `{ ], "type": "object" }, + "dto.SystemSetting": { + "properties": { + "isDemo": { + "type": "boolean" + }, + "isIntl": { + "type": "boolean" + }, + "language": { + "type": "string" + } + }, + "type": "object" + }, "dto.Tag": { "properties": { "key": { @@ -25892,6 +26632,32 @@ const docTemplate = `{ }, "type": "object" }, + "dto.TerminalInfo": { + "properties": { + "cursorBlink": { + "type": "string" + }, + "cursorStyle": { + "type": "string" + }, + "fontSize": { + "type": "string" + }, + "letterSpacing": { + "type": "string" + }, + "lineHeight": { + "type": "string" + }, + "scrollSensitivity": { + "type": "string" + }, + "scrollback": { + "type": "string" + } + }, + "type": "object" + }, "dto.TransHelper": { "properties": { "detailName": { @@ -25903,6 +26669,17 @@ const docTemplate = `{ }, "type": "object" }, + "dto.TreeChild": { + "properties": { + "id": { + "type": "integer" + }, + "label": { + "type": "string" + } + }, + "type": "object" + }, "dto.UpdateByFile": { "properties": { "file": { @@ -25967,6 +26744,34 @@ const docTemplate = `{ ], "type": "object" }, + "dto.Upgrade": { + "properties": { + "version": { + "type": "string" + } + }, + "required": [ + "version" + ], + "type": "object" + }, + "dto.UpgradeInfo": { + "properties": { + "latestVersion": { + "type": "string" + }, + "newVersion": { + "type": "string" + }, + "releaseNote": { + "type": "string" + }, + "testVersion": { + "type": "string" + } + }, + "type": "object" + }, "dto.UploadForRecover": { "properties": { "filePath": { @@ -25978,6 +26783,20 @@ const docTemplate = `{ }, "type": "object" }, + "dto.UserLoginInfo": { + "properties": { + "mfaStatus": { + "type": "string" + }, + "name": { + "type": "string" + }, + "token": { + "type": "string" + } + }, + "type": "object" + }, "dto.VolumeCreate": { "properties": { "driver": { @@ -26122,6 +26941,17 @@ const docTemplate = `{ }, "type": "object" }, + "mfa.Otp": { + "properties": { + "qrImage": { + "type": "string" + }, + "secret": { + "type": "string" + } + }, + "type": "object" + }, "model.App": { "properties": { "architectures": { @@ -32129,7 +32959,7 @@ var SwaggerInfo = &swag.Spec{ BasePath: "/api/v2", Schemes: []string{}, Title: "1Panel", - Description: "开源Linux面板", + Description: "Top-Rated Web-based Linux Server Management Tool", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, LeftDelim: "{{", diff --git a/core/cmd/server/docs/swagger.json b/core/cmd/server/docs/swagger.json index 02620bf21..fb99e4c11 100644 --- a/core/cmd/server/docs/swagger.json +++ b/core/cmd/server/docs/swagger.json @@ -2,16 +2,16 @@ "swagger": "2.0", "info": { "contact": {}, - "description": "开源Linux面板", + "description": "Top-Rated Web-based Linux Server Management Tool", "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html" + "name": "GPL-3.0", + "url": "https://www.gnu.org/licenses/gpl-3.0.html" }, "termsOfService": "http://swagger.io/terms/", "title": "1Panel", "version": "2.0" }, - "host": "localhost", + "host": "", "basePath": "/api/v2", "paths": { "/ai/domain/bind": { @@ -20736,6 +20736,23 @@ }, "type": "object" }, + "dto.ApiInterfaceConfig": { + "properties": { + "apiInterfaceStatus": { + "type": "string" + }, + "apiKey": { + "type": "string" + }, + "apiKeyValidityTime": { + "type": "string" + }, + "ipWhiteList": { + "type": "string" + } + }, + "type": "object" + }, "dto.AppConfigVersion": { "properties": { "additionalProperties": {}, @@ -20916,6 +20933,58 @@ }, "type": "object" }, + "dto.AppstoreConfig": { + "properties": { + "uninstallDeleteBackup": { + "type": "string" + }, + "uninstallDeleteImage": { + "type": "string" + }, + "upgradeBackup": { + "type": "string" + } + }, + "type": "object" + }, + "dto.AppstoreUpdate": { + "properties": { + "scope": { + "enum": [ + "UninstallDeleteImage", + "UpgradeBackup", + "UninstallDeleteBackup" + ], + "type": "string" + }, + "status": { + "enum": [ + "Disable", + "Enable" + ], + "type": "string" + } + }, + "required": [ + "scope", + "status" + ], + "type": "object" + }, + "dto.BackupClientInfo": { + "properties": { + "client_id": { + "type": "string" + }, + "client_secret": { + "type": "string" + }, + "redirect_uri": { + "type": "string" + } + }, + "type": "object" + }, "dto.BackupOperate": { "properties": { "accessKey": { @@ -21023,6 +21092,25 @@ ], "type": "object" }, + "dto.BindInfo": { + "properties": { + "bindAddress": { + "type": "string" + }, + "ipv6": { + "enum": [ + "Enable", + "Disable" + ], + "type": "string" + } + }, + "required": [ + "bindAddress", + "ipv6" + ], + "type": "object" + }, "dto.BindUser": { "properties": { "database": { @@ -21050,6 +21138,17 @@ ], "type": "object" }, + "dto.CaptchaResponse": { + "properties": { + "captchaID": { + "type": "string" + }, + "imagePath": { + "type": "string" + } + }, + "type": "object" + }, "dto.ChangeDBInfo": { "properties": { "database": { @@ -21104,6 +21203,21 @@ ], "type": "object" }, + "dto.ChangeHostGroup": { + "properties": { + "groupID": { + "type": "integer" + }, + "id": { + "type": "integer" + } + }, + "required": [ + "groupID", + "id" + ], + "type": "object" + }, "dto.ChangePasswd": { "properties": { "passwd": { @@ -21351,6 +21465,21 @@ }, "type": "object" }, + "dto.CleanLog": { + "properties": { + "logType": { + "enum": [ + "login", + "operation" + ], + "type": "string" + } + }, + "required": [ + "logType" + ], + "type": "object" + }, "dto.CleanTree": { "properties": { "children": { @@ -21383,6 +21512,56 @@ }, "type": "object" }, + "dto.CommandInfo": { + "properties": { + "command": { + "type": "string" + }, + "groupBelong": { + "type": "string" + }, + "groupID": { + "type": "integer" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + } + }, + "type": "object" + }, + "dto.CommandOperate": { + "properties": { + "command": { + "type": "string" + }, + "groupBelong": { + "type": "string" + }, + "groupID": { + "type": "integer" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + } + }, + "required": [ + "command", + "name" + ], + "type": "object" + }, "dto.CommonBackup": { "properties": { "description": { @@ -23404,6 +23583,43 @@ ], "type": "object" }, + "dto.HostConnTest": { + "properties": { + "addr": { + "type": "string" + }, + "authMode": { + "enum": [ + "password", + "key" + ], + "type": "string" + }, + "passPhrase": { + "type": "string" + }, + "password": { + "type": "string" + }, + "port": { + "maximum": 65535, + "minimum": 1, + "type": "integer" + }, + "privateKey": { + "type": "string" + }, + "user": { + "type": "string" + } + }, + "required": [ + "addr", + "port", + "user" + ], + "type": "object" + }, "dto.HostHelper": { "properties": { "host": { @@ -23415,6 +23631,122 @@ }, "type": "object" }, + "dto.HostInfo": { + "properties": { + "addr": { + "type": "string" + }, + "authMode": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "description": { + "type": "string" + }, + "groupBelong": { + "type": "string" + }, + "groupID": { + "type": "integer" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "passPhrase": { + "type": "string" + }, + "password": { + "type": "string" + }, + "port": { + "type": "integer" + }, + "privateKey": { + "type": "string" + }, + "rememberPassword": { + "type": "boolean" + }, + "user": { + "type": "string" + } + }, + "type": "object" + }, + "dto.HostOperate": { + "properties": { + "addr": { + "type": "string" + }, + "authMode": { + "enum": [ + "password", + "key" + ], + "type": "string" + }, + "description": { + "type": "string" + }, + "groupID": { + "type": "integer" + }, + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "passPhrase": { + "type": "string" + }, + "password": { + "type": "string" + }, + "port": { + "maximum": 65535, + "minimum": 1, + "type": "integer" + }, + "privateKey": { + "type": "string" + }, + "rememberPassword": { + "type": "boolean" + }, + "user": { + "type": "string" + } + }, + "required": [ + "addr", + "port", + "user" + ], + "type": "object" + }, + "dto.HostTree": { + "properties": { + "children": { + "items": { + "$ref": "#/definitions/dto.TreeChild" + }, + "type": "array" + }, + "id": { + "type": "integer" + }, + "label": { + "type": "string" + } + }, + "type": "object" + }, "dto.ImageBuild": { "properties": { "dockerfile": { @@ -23674,6 +24006,83 @@ }, "type": "object" }, + "dto.Login": { + "properties": { + "captcha": { + "type": "string" + }, + "captchaID": { + "type": "string" + }, + "ignoreCaptcha": { + "type": "boolean" + }, + "language": { + "enum": [ + "zh", + "en", + "zh-Hant", + "ko", + "ja", + "ru", + "ms", + "pt-BR", + "tr" + ], + "type": "string" + }, + "name": { + "type": "string" + }, + "password": { + "type": "string" + } + }, + "required": [ + "language", + "name", + "password" + ], + "type": "object" + }, + "dto.MFALogin": { + "properties": { + "code": { + "type": "string" + }, + "name": { + "type": "string" + }, + "password": { + "type": "string" + } + }, + "required": [ + "code", + "name", + "password" + ], + "type": "object" + }, + "dto.MfaCredential": { + "properties": { + "code": { + "type": "string" + }, + "interval": { + "type": "string" + }, + "secret": { + "type": "string" + } + }, + "required": [ + "code", + "interval", + "secret" + ], + "type": "object" + }, "dto.MonitorData": { "properties": { "date": { @@ -24446,9 +24855,6 @@ "type": "integer" } }, - "required": [ - "id" - ], "type": "object" }, "dto.OperateByIDs": { @@ -24462,6 +24868,22 @@ }, "type": "object" }, + "dto.OperateByName": { + "properties": { + "name": { + "type": "string" + } + }, + "type": "object" + }, + "dto.OperateByTaskID": { + "properties": { + "taskID": { + "type": "string" + } + }, + "type": "object" + }, "dto.OperateByType": { "properties": { "type": { @@ -24720,6 +25142,21 @@ ], "type": "object" }, + "dto.PasswordUpdate": { + "properties": { + "newPassword": { + "type": "string" + }, + "oldPassword": { + "type": "string" + } + }, + "required": [ + "newPassword", + "oldPassword" + ], + "type": "object" + }, "dto.PortHelper": { "properties": { "containerPort": { @@ -24790,6 +25227,19 @@ }, "type": "object" }, + "dto.PortUpdate": { + "properties": { + "serverPort": { + "maximum": 65535, + "minimum": 1, + "type": "integer" + } + }, + "required": [ + "serverPort" + ], + "type": "object" + }, "dto.PostgresqlBindUser": { "properties": { "database": { @@ -24974,6 +25424,35 @@ ], "type": "object" }, + "dto.ProxyUpdate": { + "properties": { + "proxyDocker": { + "type": "boolean" + }, + "proxyPasswd": { + "type": "string" + }, + "proxyPasswdKeep": { + "type": "string" + }, + "proxyPort": { + "type": "string" + }, + "proxyType": { + "type": "string" + }, + "proxyUrl": { + "type": "string" + }, + "proxyUser": { + "type": "string" + }, + "withDockerRestart": { + "type": "boolean" + } + }, + "type": "object" + }, "dto.QuickJump": { "properties": { "detail": { @@ -25224,6 +25703,29 @@ ], "type": "object" }, + "dto.ReleasesNotes": { + "properties": { + "content": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "fixCount": { + "type": "integer" + }, + "newCount": { + "type": "integer" + }, + "optimizationCount": { + "type": "integer" + }, + "version": { + "type": "string" + } + }, + "type": "object" + }, "dto.ResourceLimit": { "properties": { "cpu": { @@ -25363,6 +25865,90 @@ ], "type": "object" }, + "dto.SSLInfo": { + "properties": { + "cert": { + "type": "string" + }, + "domain": { + "type": "string" + }, + "key": { + "type": "string" + }, + "rootPath": { + "type": "string" + }, + "sslID": { + "type": "integer" + }, + "timeout": { + "type": "string" + } + }, + "type": "object" + }, + "dto.SSLUpdate": { + "properties": { + "cert": { + "type": "string" + }, + "domain": { + "type": "string" + }, + "key": { + "type": "string" + }, + "ssl": { + "enum": [ + "Enable", + "Disable" + ], + "type": "string" + }, + "sslID": { + "type": "integer" + }, + "sslType": { + "enum": [ + "self", + "select", + "import", + "import-paste", + "import-local" + ], + "type": "string" + } + }, + "required": [ + "ssl", + "sslType" + ], + "type": "object" + }, + "dto.ScriptOperate": { + "properties": { + "description": { + "type": "string" + }, + "groups": { + "type": "string" + }, + "id": { + "type": "integer" + }, + "isInteractive": { + "type": "boolean" + }, + "name": { + "type": "string" + }, + "script": { + "type": "string" + } + }, + "type": "object" + }, "dto.ScriptOptions": { "properties": { "id": { @@ -25455,6 +26041,83 @@ ], "type": "object" }, + "dto.SearchForTree": { + "properties": { + "info": { + "type": "string" + } + }, + "type": "object" + }, + "dto.SearchLgLogWithPage": { + "properties": { + "ip": { + "type": "string" + }, + "page": { + "type": "integer" + }, + "pageSize": { + "type": "integer" + }, + "status": { + "type": "string" + } + }, + "required": [ + "page", + "pageSize" + ], + "type": "object" + }, + "dto.SearchOpLogWithPage": { + "properties": { + "node": { + "type": "string" + }, + "operation": { + "type": "string" + }, + "page": { + "type": "integer" + }, + "pageSize": { + "type": "integer" + }, + "source": { + "type": "string" + }, + "status": { + "type": "string" + } + }, + "required": [ + "page", + "pageSize" + ], + "type": "object" + }, + "dto.SearchPageWithGroup": { + "properties": { + "groupID": { + "type": "integer" + }, + "info": { + "type": "string" + }, + "page": { + "type": "integer" + }, + "pageSize": { + "type": "integer" + } + }, + "required": [ + "page", + "pageSize" + ], + "type": "object" + }, "dto.SearchPageWithType": { "properties": { "info": { @@ -25571,6 +26234,18 @@ }, "dto.SettingInfo": { "properties": { + "allowIPs": { + "type": "string" + }, + "apiInterfaceStatus": { + "type": "string" + }, + "apiKey": { + "type": "string" + }, + "apiKeyValidityTime": { + "type": "string" + }, "appStoreLastModified": { "type": "string" }, @@ -25580,46 +26255,97 @@ "appStoreVersion": { "type": "string" }, - "defaultNetwork": { + "bindAddress": { "type": "string" }, - "dockerSockPath": { + "bindDomain": { "type": "string" }, - "fileRecycleBin": { + "complexityVerification": { "type": "string" }, - "lastCleanData": { + "developerMode": { "type": "string" }, - "lastCleanSize": { + "expirationDays": { "type": "string" }, - "lastCleanTime": { + "expirationTime": { "type": "string" }, - "localTime": { + "hideMenu": { "type": "string" }, - "monitorInterval": { + "ipWhiteList": { "type": "string" }, - "monitorStatus": { + "ipv6": { "type": "string" }, - "monitorStoreDays": { + "language": { "type": "string" }, - "ntpSite": { + "menuTabs": { "type": "string" }, - "systemIP": { + "mfaInterval": { + "type": "string" + }, + "mfaSecret": { + "type": "string" + }, + "mfaStatus": { + "type": "string" + }, + "noAuthSetting": { + "type": "string" + }, + "panelName": { + "type": "string" + }, + "port": { + "type": "string" + }, + "proxyPasswd": { + "type": "string" + }, + "proxyPasswdKeep": { + "type": "string" + }, + "proxyPort": { + "type": "string" + }, + "proxyType": { + "type": "string" + }, + "proxyUrl": { + "type": "string" + }, + "proxyUser": { + "type": "string" + }, + "securityEntrance": { + "type": "string" + }, + "serverPort": { + "type": "string" + }, + "sessionTimeout": { + "type": "string" + }, + "ssl": { + "type": "string" + }, + "sslType": { "type": "string" }, "systemVersion": { "type": "string" }, - "timeZone": { + "theme": { + "type": "string" + }, + "userName": { "type": "string" } }, @@ -25871,6 +26597,20 @@ ], "type": "object" }, + "dto.SystemSetting": { + "properties": { + "isDemo": { + "type": "boolean" + }, + "isIntl": { + "type": "boolean" + }, + "language": { + "type": "string" + } + }, + "type": "object" + }, "dto.Tag": { "properties": { "key": { @@ -25888,6 +26628,32 @@ }, "type": "object" }, + "dto.TerminalInfo": { + "properties": { + "cursorBlink": { + "type": "string" + }, + "cursorStyle": { + "type": "string" + }, + "fontSize": { + "type": "string" + }, + "letterSpacing": { + "type": "string" + }, + "lineHeight": { + "type": "string" + }, + "scrollSensitivity": { + "type": "string" + }, + "scrollback": { + "type": "string" + } + }, + "type": "object" + }, "dto.TransHelper": { "properties": { "detailName": { @@ -25899,6 +26665,17 @@ }, "type": "object" }, + "dto.TreeChild": { + "properties": { + "id": { + "type": "integer" + }, + "label": { + "type": "string" + } + }, + "type": "object" + }, "dto.UpdateByFile": { "properties": { "file": { @@ -25963,6 +26740,34 @@ ], "type": "object" }, + "dto.Upgrade": { + "properties": { + "version": { + "type": "string" + } + }, + "required": [ + "version" + ], + "type": "object" + }, + "dto.UpgradeInfo": { + "properties": { + "latestVersion": { + "type": "string" + }, + "newVersion": { + "type": "string" + }, + "releaseNote": { + "type": "string" + }, + "testVersion": { + "type": "string" + } + }, + "type": "object" + }, "dto.UploadForRecover": { "properties": { "filePath": { @@ -25974,6 +26779,20 @@ }, "type": "object" }, + "dto.UserLoginInfo": { + "properties": { + "mfaStatus": { + "type": "string" + }, + "name": { + "type": "string" + }, + "token": { + "type": "string" + } + }, + "type": "object" + }, "dto.VolumeCreate": { "properties": { "driver": { @@ -26118,6 +26937,17 @@ }, "type": "object" }, + "mfa.Otp": { + "properties": { + "qrImage": { + "type": "string" + }, + "secret": { + "type": "string" + } + }, + "type": "object" + }, "model.App": { "properties": { "architectures": { diff --git a/core/cmd/server/docs/swagger_test.go b/core/cmd/server/docs/swagger_test.go index 6873d4c19..8e16e15d7 100644 --- a/core/cmd/server/docs/swagger_test.go +++ b/core/cmd/server/docs/swagger_test.go @@ -124,6 +124,12 @@ func TestGenerateSwaggerDoc(t *testing.T) { } newSwagger.Paths[key] = val } + for key, val := range coreSwagger.Definitions { + if _, ok := newSwagger.Definitions[key]; ok { + fmt.Printf("duplicate definitions were found: %s \n", key) + } + newSwagger.Definitions[key] = val + } newJson, err := json.MarshalIndent(newSwagger, "", "\t") if err != nil { @@ -150,7 +156,7 @@ type Swagger struct { Host string `json:"host"` BasePath string `json:"basePath"` Paths map[string]interface{} `json:"paths"` - Definitions interface{} `json:"definitions"` + Definitions map[string]interface{} `json:"definitions"` } func loadDefaultDocs() string { @@ -166,7 +172,7 @@ var SwaggerInfo = &swag.Spec{ BasePath: "/api/v2", Schemes: []string{}, Title: "1Panel", - Description: "开源Linux面板", + Description: "Top-Rated Web-based Linux Server Management Tool", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, LeftDelim: "{{", diff --git a/core/cmd/server/main.go b/core/cmd/server/main.go index 08585c1c0..73799cde5 100644 --- a/core/cmd/server/main.go +++ b/core/cmd/server/main.go @@ -11,12 +11,12 @@ import ( ) // @title 1Panel -// @version 1.0 -// @description Open Source Linux Panel +// @version 2.0 +// @description Top-Rated Web-based Linux Server Management Tool // @termsOfService http://swagger.io/terms/ -// @license.name Apache 2.0 -// @license.url http://www.apache.org/licenses/LICENSE-2.0.html -// @BasePath /api/v1 +// @license.name GPL-3.0 +// @license.url https://www.gnu.org/licenses/gpl-3.0.html +// @BasePath /api/v2 // @schemes http https // @securityDefinitions.apikey ApiKeyAuth