2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 09:13:49 +08:00

fix: lint

This commit is contained in:
耗子
2024-06-08 19:27:53 +08:00
parent 77aa4bea34
commit bde93b488c
5 changed files with 704 additions and 9 deletions

View File

@@ -94,7 +94,7 @@ func (r *PluginController) Install(ctx http.Context) http.Response {
slug := ctx.Request().Input("slug")
if err := r.plugin.Install(slug); err != nil {
return ErrorSystem(ctx)
return Error(ctx, http.StatusInternalServerError, err.Error())
}
return Success(ctx, "任务已提交")
@@ -105,7 +105,7 @@ func (r *PluginController) Uninstall(ctx http.Context) http.Response {
slug := ctx.Request().Input("slug")
if err := r.plugin.Uninstall(slug); err != nil {
return ErrorSystem(ctx)
return Error(ctx, http.StatusInternalServerError, err.Error())
}
return Success(ctx, "任务已提交")
@@ -116,7 +116,7 @@ func (r *PluginController) Update(ctx http.Context) http.Response {
slug := ctx.Request().Input("slug")
if err := r.plugin.Update(slug); err != nil {
return ErrorSystem(ctx)
return Error(ctx, http.StatusInternalServerError, err.Error())
}
return Success(ctx, "任务已提交")

View File

@@ -58,7 +58,7 @@ func (r *GiteaController) IsEnabled(ctx http.Context) http.Response {
// @Tags 插件-Gitea
// @Produce json
// @Security BearerToken
// @Success 200 {object} controllers.SuccessResponse
// @Success 200 {object} controllers.SuccessResponse
// @Router /plugins/gitea/enable [post]
func (r *GiteaController) Enable(ctx http.Context) http.Response {
if err := tools.ServiceEnable("gitea"); err != nil {
@@ -75,7 +75,7 @@ func (r *GiteaController) Enable(ctx http.Context) http.Response {
// @Tags 插件-Gitea
// @Produce json
// @Security BearerToken
// @Success 200 {object} controllers.SuccessResponse
// @Success 200 {object} controllers.SuccessResponse
// @Router /plugins/gitea/disable [post]
func (r *GiteaController) Disable(ctx http.Context) http.Response {
if err := tools.ServiceDisable("gitea"); err != nil {
@@ -92,7 +92,7 @@ func (r *GiteaController) Disable(ctx http.Context) http.Response {
// @Tags 插件-Gitea
// @Produce json
// @Security BearerToken
// @Success 200 {object} controllers.SuccessResponse
// @Success 200 {object} controllers.SuccessResponse
// @Router /plugins/gitea/restart [post]
func (r *GiteaController) Restart(ctx http.Context) http.Response {
if err := tools.ServiceRestart("gitea"); err != nil {
@@ -109,7 +109,7 @@ func (r *GiteaController) Restart(ctx http.Context) http.Response {
// @Tags 插件-Gitea
// @Produce json
// @Security BearerToken
// @Success 200 {object} controllers.SuccessResponse
// @Success 200 {object} controllers.SuccessResponse
// @Router /plugins/gitea/start [post]
func (r *GiteaController) Start(ctx http.Context) http.Response {
if err := tools.ServiceStart("gitea"); err != nil {
@@ -131,7 +131,7 @@ func (r *GiteaController) Start(ctx http.Context) http.Response {
// @Tags 插件-Gitea
// @Produce json
// @Security BearerToken
// @Success 200 {object} controllers.SuccessResponse
// @Success 200 {object} controllers.SuccessResponse
// @Router /plugins/gitea/stop [post]
func (r *GiteaController) Stop(ctx http.Context) http.Response {
if err := tools.ServiceStop("gitea"); err != nil {
@@ -153,7 +153,7 @@ func (r *GiteaController) Stop(ctx http.Context) http.Response {
// @Tags 插件-Gitea
// @Produce json
// @Security BearerToken
// @Success 200 {object} controllers.SuccessResponse
// @Success 200 {object} controllers.SuccessResponse
// @Router /plugins/gitea/config [get]
func (r *GiteaController) GetConfig(ctx http.Context) http.Response {
config, err := tools.Read("/www/server/gitea/app.ini")

View File

@@ -3551,6 +3551,31 @@ const docTemplate = `{
}
}
},
"/plugins/frp/isEnabled": {
"get": {
"security": [
{
"BearerToken": []
}
],
"description": "获取是否启用 Frp 服务",
"produces": [
"application/json"
],
"tags": [
"插件-Frp"
],
"summary": "是否启用服务",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.SuccessResponse"
}
}
}
}
},
"/plugins/frp/restart": {
"post": {
"security": [
@@ -3684,6 +3709,240 @@ const docTemplate = `{
}
}
},
"/plugins/gitea/config": {
"get": {
"security": [
{
"BearerToken": []
}
],
"description": "获取 Gitea 配置",
"produces": [
"application/json"
],
"tags": [
"插件-Gitea"
],
"summary": "获取配置",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.SuccessResponse"
}
}
}
},
"post": {
"security": [
{
"BearerToken": []
}
],
"description": "更新 Gitea 配置",
"produces": [
"application/json"
],
"tags": [
"插件-Gitea"
],
"summary": "更新配置",
"parameters": [
{
"description": "request",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/github_com_TheTNB_panel_app_http_requests_plugins_gitea.UpdateConfig"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.SuccessResponse"
}
}
}
}
},
"/plugins/gitea/disable": {
"post": {
"security": [
{
"BearerToken": []
}
],
"description": "禁用 Gitea 服务",
"produces": [
"application/json"
],
"tags": [
"插件-Gitea"
],
"summary": "禁用服务",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.SuccessResponse"
}
}
}
}
},
"/plugins/gitea/enable": {
"post": {
"security": [
{
"BearerToken": []
}
],
"description": "启用 Gitea 服务",
"produces": [
"application/json"
],
"tags": [
"插件-Gitea"
],
"summary": "启用服务",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.SuccessResponse"
}
}
}
}
},
"/plugins/gitea/isEnabled": {
"get": {
"security": [
{
"BearerToken": []
}
],
"description": "获取是否启用 Gitea 服务",
"produces": [
"application/json"
],
"tags": [
"插件-Gitea"
],
"summary": "是否启用服务",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.SuccessResponse"
}
}
}
}
},
"/plugins/gitea/restart": {
"post": {
"security": [
{
"BearerToken": []
}
],
"description": "重启 Gitea 服务",
"produces": [
"application/json"
],
"tags": [
"插件-Gitea"
],
"summary": "重启服务",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.SuccessResponse"
}
}
}
}
},
"/plugins/gitea/start": {
"post": {
"security": [
{
"BearerToken": []
}
],
"description": "启动 Gitea 服务",
"produces": [
"application/json"
],
"tags": [
"插件-Gitea"
],
"summary": "启动服务",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.SuccessResponse"
}
}
}
}
},
"/plugins/gitea/status": {
"get": {
"security": [
{
"BearerToken": []
}
],
"description": "获取 Gitea 服务状态",
"produces": [
"application/json"
],
"tags": [
"插件-Gitea"
],
"summary": "服务状态",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.SuccessResponse"
}
}
}
}
},
"/plugins/gitea/stop": {
"post": {
"security": [
{
"BearerToken": []
}
],
"description": "停止 Gitea 服务",
"produces": [
"application/json"
],
"tags": [
"插件-Gitea"
],
"summary": "停止服务",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.SuccessResponse"
}
}
}
}
},
"/plugins/rsync/config": {
"get": {
"security": [
@@ -4075,6 +4334,14 @@ const docTemplate = `{
}
}
},
"github_com_TheTNB_panel_app_http_requests_plugins_gitea.UpdateConfig": {
"type": "object",
"properties": {
"config": {
"type": "string"
}
}
},
"github_com_TheTNB_panel_app_http_requests_plugins_rsync.Update": {
"type": "object",
"properties": {

View File

@@ -3544,6 +3544,31 @@
}
}
},
"/plugins/frp/isEnabled": {
"get": {
"security": [
{
"BearerToken": []
}
],
"description": "获取是否启用 Frp 服务",
"produces": [
"application/json"
],
"tags": [
"插件-Frp"
],
"summary": "是否启用服务",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.SuccessResponse"
}
}
}
}
},
"/plugins/frp/restart": {
"post": {
"security": [
@@ -3677,6 +3702,240 @@
}
}
},
"/plugins/gitea/config": {
"get": {
"security": [
{
"BearerToken": []
}
],
"description": "获取 Gitea 配置",
"produces": [
"application/json"
],
"tags": [
"插件-Gitea"
],
"summary": "获取配置",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.SuccessResponse"
}
}
}
},
"post": {
"security": [
{
"BearerToken": []
}
],
"description": "更新 Gitea 配置",
"produces": [
"application/json"
],
"tags": [
"插件-Gitea"
],
"summary": "更新配置",
"parameters": [
{
"description": "request",
"name": "data",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/github_com_TheTNB_panel_app_http_requests_plugins_gitea.UpdateConfig"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.SuccessResponse"
}
}
}
}
},
"/plugins/gitea/disable": {
"post": {
"security": [
{
"BearerToken": []
}
],
"description": "禁用 Gitea 服务",
"produces": [
"application/json"
],
"tags": [
"插件-Gitea"
],
"summary": "禁用服务",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.SuccessResponse"
}
}
}
}
},
"/plugins/gitea/enable": {
"post": {
"security": [
{
"BearerToken": []
}
],
"description": "启用 Gitea 服务",
"produces": [
"application/json"
],
"tags": [
"插件-Gitea"
],
"summary": "启用服务",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.SuccessResponse"
}
}
}
}
},
"/plugins/gitea/isEnabled": {
"get": {
"security": [
{
"BearerToken": []
}
],
"description": "获取是否启用 Gitea 服务",
"produces": [
"application/json"
],
"tags": [
"插件-Gitea"
],
"summary": "是否启用服务",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.SuccessResponse"
}
}
}
}
},
"/plugins/gitea/restart": {
"post": {
"security": [
{
"BearerToken": []
}
],
"description": "重启 Gitea 服务",
"produces": [
"application/json"
],
"tags": [
"插件-Gitea"
],
"summary": "重启服务",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.SuccessResponse"
}
}
}
}
},
"/plugins/gitea/start": {
"post": {
"security": [
{
"BearerToken": []
}
],
"description": "启动 Gitea 服务",
"produces": [
"application/json"
],
"tags": [
"插件-Gitea"
],
"summary": "启动服务",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.SuccessResponse"
}
}
}
}
},
"/plugins/gitea/status": {
"get": {
"security": [
{
"BearerToken": []
}
],
"description": "获取 Gitea 服务状态",
"produces": [
"application/json"
],
"tags": [
"插件-Gitea"
],
"summary": "服务状态",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.SuccessResponse"
}
}
}
}
},
"/plugins/gitea/stop": {
"post": {
"security": [
{
"BearerToken": []
}
],
"description": "停止 Gitea 服务",
"produces": [
"application/json"
],
"tags": [
"插件-Gitea"
],
"summary": "停止服务",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/controllers.SuccessResponse"
}
}
}
}
},
"/plugins/rsync/config": {
"get": {
"security": [
@@ -4068,6 +4327,14 @@
}
}
},
"github_com_TheTNB_panel_app_http_requests_plugins_gitea.UpdateConfig": {
"type": "object",
"properties": {
"config": {
"type": "string"
}
}
},
"github_com_TheTNB_panel_app_http_requests_plugins_rsync.Update": {
"type": "object",
"properties": {

View File

@@ -43,6 +43,11 @@ definitions:
service:
type: string
type: object
github_com_TheTNB_panel_app_http_requests_plugins_gitea.UpdateConfig:
properties:
config:
type: string
type: object
github_com_TheTNB_panel_app_http_requests_plugins_rsync.Update:
properties:
auth_user:
@@ -2811,6 +2816,21 @@ paths:
summary: 启用服务
tags:
- 插件-Frp
/plugins/frp/isEnabled:
get:
description: 获取是否启用 Frp 服务
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/controllers.SuccessResponse'
security:
- BearerToken: []
summary: 是否启用服务
tags:
- 插件-Frp
/plugins/frp/restart:
post:
description: 重启 Frp 服务
@@ -2892,6 +2912,147 @@ paths:
summary: 停止服务
tags:
- 插件-Frp
/plugins/gitea/config:
get:
description: 获取 Gitea 配置
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/controllers.SuccessResponse'
security:
- BearerToken: []
summary: 获取配置
tags:
- 插件-Gitea
post:
description: 更新 Gitea 配置
parameters:
- description: request
in: body
name: data
required: true
schema:
$ref: '#/definitions/github_com_TheTNB_panel_app_http_requests_plugins_gitea.UpdateConfig'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/controllers.SuccessResponse'
security:
- BearerToken: []
summary: 更新配置
tags:
- 插件-Gitea
/plugins/gitea/disable:
post:
description: 禁用 Gitea 服务
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/controllers.SuccessResponse'
security:
- BearerToken: []
summary: 禁用服务
tags:
- 插件-Gitea
/plugins/gitea/enable:
post:
description: 启用 Gitea 服务
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/controllers.SuccessResponse'
security:
- BearerToken: []
summary: 启用服务
tags:
- 插件-Gitea
/plugins/gitea/isEnabled:
get:
description: 获取是否启用 Gitea 服务
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/controllers.SuccessResponse'
security:
- BearerToken: []
summary: 是否启用服务
tags:
- 插件-Gitea
/plugins/gitea/restart:
post:
description: 重启 Gitea 服务
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/controllers.SuccessResponse'
security:
- BearerToken: []
summary: 重启服务
tags:
- 插件-Gitea
/plugins/gitea/start:
post:
description: 启动 Gitea 服务
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/controllers.SuccessResponse'
security:
- BearerToken: []
summary: 启动服务
tags:
- 插件-Gitea
/plugins/gitea/status:
get:
description: 获取 Gitea 服务状态
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/controllers.SuccessResponse'
security:
- BearerToken: []
summary: 服务状态
tags:
- 插件-Gitea
/plugins/gitea/stop:
post:
description: 停止 Gitea 服务
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/controllers.SuccessResponse'
security:
- BearerToken: []
summary: 停止服务
tags:
- 插件-Gitea
/plugins/rsync/config:
get:
description: 获取 Rsync 配置