Compare commits

...

7 Commits

Author SHA1 Message Date
耗子 3a70d80bb5 feat: 发布v2.2.5 2024-06-08 19:30:30 +08:00
耗子 7c58d8dcce feat: 发布v2.2.5 2024-06-08 19:30:21 +08:00
耗子 bde93b488c fix: lint 2024-06-08 19:27:53 +08:00
耗子 77aa4bea34 feat: 添加Gitea 2024-06-08 19:26:23 +08:00
耗子 f7ba602a50 fix: lint 2024-06-08 17:58:19 +08:00
耗子 3101486a44 fix: lint 2024-06-08 17:49:40 +08:00
耗子 b51a8e1d03 chore: 更新依赖 2024-06-08 17:37:04 +08:00
24 changed files with 1292 additions and 126 deletions
+3 -2
View File
@@ -45,8 +45,9 @@ func (receiver *Monitoring) Handle(console.Context) error {
}
// 将等待中的任务分发
task := services.NewTaskImpl()
_ = task.DispatchWaiting()
// TODO 有bug,需要设计一个锁机制防止重复分发
//task := services.NewTaskImpl()
//_ = task.DispatchWaiting()
setting := services.NewSettingImpl()
monitor := setting.Get(models.SettingKeyMonitor)
+4 -4
View File
@@ -108,8 +108,8 @@ func (r *InfoController) CountInfo(ctx http.Context) http.Response {
}
var databaseCount int64
if mysqlInstalled {
status, err := tools.Exec("systemctl status mysqld | grep Active | grep -v grep | awk '{print $2}'")
if status == "active" && err == nil {
status, err := tools.ServiceStatus("mysqld")
if status && err == nil {
rootPassword := r.setting.Get(models.SettingKeyMysqlRootPassword)
type database struct {
Name string `json:"name"`
@@ -150,8 +150,8 @@ func (r *InfoController) CountInfo(ctx http.Context) http.Response {
}
}
if postgresqlInstalled {
status, err := tools.Exec("systemctl status postgresql | grep Active | grep -v grep | awk '{print $2}'")
if status == "active" && err == nil {
status, err := tools.ServiceStatus("postgresql")
if status && err == nil {
raw, err := tools.Exec(`echo "\l" | su - postgres -c "psql"`)
if err == nil {
databases := strings.Split(raw, "\n")
+3 -3
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, "任务已提交")
@@ -38,7 +38,7 @@ func (r *Fail2banController) Status(ctx http.Context) http.Response {
// Reload 重载配置
func (r *Fail2banController) Reload(ctx http.Context) http.Response {
if _, err := tools.Exec("systemctl reload fail2ban"); err != nil {
if err := tools.ServiceReload("fail2ban"); err != nil {
return controllers.Error(ctx, http.StatusInternalServerError, "重载配置失败")
}
@@ -0,0 +1,193 @@
package plugins
import (
"github.com/goravel/framework/contracts/http"
"github.com/TheTNB/panel/app/http/controllers"
requests "github.com/TheTNB/panel/app/http/requests/plugins/gitea"
"github.com/TheTNB/panel/pkg/tools"
)
type GiteaController struct {
}
func NewGiteaController() *GiteaController {
return &GiteaController{}
}
// Status
//
// @Summary 服务状态
// @Description 获取 Gitea 服务状态
// @Tags 插件-Gitea
// @Produce json
// @Security BearerToken
// @Success 200 {object} controllers.SuccessResponse
// @Router /plugins/gitea/status [get]
func (r *GiteaController) Status(ctx http.Context) http.Response {
status, err := tools.ServiceStatus("gitea")
if err != nil {
return controllers.Error(ctx, http.StatusInternalServerError, "获取 Gitea 服务运行状态失败")
}
return controllers.Success(ctx, status)
}
// IsEnabled
//
// @Summary 是否启用服务
// @Description 获取是否启用 Gitea 服务
// @Tags 插件-Gitea
// @Produce json
// @Security BearerToken
// @Success 200 {object} controllers.SuccessResponse
// @Router /plugins/gitea/isEnabled [get]
func (r *GiteaController) IsEnabled(ctx http.Context) http.Response {
enabled, err := tools.ServiceIsEnabled("gitea")
if err != nil {
return controllers.Error(ctx, http.StatusInternalServerError, "获取 Gitea 服务启用状态失败")
}
return controllers.Success(ctx, enabled)
}
// Enable
//
// @Summary 启用服务
// @Description 启用 Gitea 服务
// @Tags 插件-Gitea
// @Produce json
// @Security BearerToken
// @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 {
return controllers.Error(ctx, http.StatusInternalServerError, "启用 Gitea 服务失败")
}
return controllers.Success(ctx, nil)
}
// Disable
//
// @Summary 禁用服务
// @Description 禁用 Gitea 服务
// @Tags 插件-Gitea
// @Produce json
// @Security BearerToken
// @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 {
return controllers.Error(ctx, http.StatusInternalServerError, "禁用 Gitea 服务失败")
}
return controllers.Success(ctx, nil)
}
// Restart
//
// @Summary 重启服务
// @Description 重启 Gitea 服务
// @Tags 插件-Gitea
// @Produce json
// @Security BearerToken
// @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 {
return controllers.Error(ctx, http.StatusInternalServerError, "重启 Gitea 服务失败")
}
return controllers.Success(ctx, nil)
}
// Start
//
// @Summary 启动服务
// @Description 启动 Gitea 服务
// @Tags 插件-Gitea
// @Produce json
// @Security BearerToken
// @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 {
return controllers.Error(ctx, http.StatusInternalServerError, "启动 Gitea 服务失败")
}
status, err := tools.ServiceStatus("gitea")
if err != nil {
return controllers.Error(ctx, http.StatusInternalServerError, "获取 Gitea 服务运行状态失败")
}
return controllers.Success(ctx, status)
}
// Stop
//
// @Summary 停止服务
// @Description 停止 Gitea 服务
// @Tags 插件-Gitea
// @Produce json
// @Security BearerToken
// @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 {
return controllers.Error(ctx, http.StatusInternalServerError, "停止 Gitea 服务失败")
}
status, err := tools.ServiceStatus("gitea")
if err != nil {
return controllers.Error(ctx, http.StatusInternalServerError, "获取 Gitea 服务运行状态失败")
}
return controllers.Success(ctx, !status)
}
// GetConfig
//
// @Summary 获取配置
// @Description 获取 Gitea 配置
// @Tags 插件-Gitea
// @Produce json
// @Security BearerToken
// @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")
if err != nil {
return controllers.Error(ctx, http.StatusInternalServerError, err.Error())
}
return controllers.Success(ctx, config)
}
// UpdateConfig
//
// @Summary 更新配置
// @Description 更新 Gitea 配置
// @Tags 插件-Gitea
// @Produce json
// @Security BearerToken
// @Param data body requests.UpdateConfig true "request"
// @Success 200 {object} controllers.SuccessResponse
// @Router /plugins/gitea/config [post]
func (r *GiteaController) UpdateConfig(ctx http.Context) http.Response {
var updateRequest requests.UpdateConfig
sanitize := controllers.Sanitize(ctx, &updateRequest)
if sanitize != nil {
return sanitize
}
if err := tools.Write("/www/server/gitea/app.ini", updateRequest.Config, 0644); err != nil {
return controllers.Error(ctx, http.StatusInternalServerError, err.Error())
}
if err := tools.ServiceRestart("gitea"); err != nil {
return controllers.Error(ctx, http.StatusInternalServerError, err.Error())
}
return controllers.Success(ctx, nil)
}
+32 -68
View File
@@ -12,12 +12,19 @@ import (
)
type SafeController struct {
// Dependent services
ssh string
}
func NewSafeController() *SafeController {
var ssh string
if tools.IsRHEL() {
ssh = "sshd"
} else {
ssh = "ssh"
}
return &SafeController{
// Inject services
ssh: ssh,
}
}
@@ -28,24 +35,23 @@ func (r *SafeController) GetFirewallStatus(ctx http.Context) http.Response {
// SetFirewallStatus 设置防火墙状态
func (r *SafeController) SetFirewallStatus(ctx http.Context) http.Response {
var out string
var err error
if ctx.Request().InputBool("status") {
if tools.IsRHEL() {
out, err = tools.Exec("systemctl start firewalld")
err = tools.ServiceStart("firewalld")
} else {
out, err = tools.Exec("echo y | ufw enable")
_, err = tools.Exec("echo y | ufw enable")
}
} else {
if tools.IsRHEL() {
out, err = tools.Exec("systemctl stop firewalld")
err = tools.ServiceStop("firewalld")
} else {
out, err = tools.Exec("ufw disable")
_, err = tools.Exec("ufw disable")
}
}
if err != nil {
return Error(ctx, http.StatusInternalServerError, out)
return Error(ctx, http.StatusInternalServerError, err.Error())
}
return Success(ctx, nil)
@@ -213,27 +219,11 @@ func (r *SafeController) DeleteFirewallRule(ctx http.Context) http.Response {
// firewallStatus 获取防火墙状态
func (r *SafeController) firewallStatus() bool {
var out string
var err error
var running bool
if tools.IsRHEL() {
out, err = tools.Exec("systemctl status firewalld | grep Active | awk '{print $3}'")
if out == "(running)" {
running = true
} else {
running = false
}
running, _ = tools.ServiceStatus("firewalld")
} else {
out, err = tools.Exec("ufw status | grep Status | awk '{print $2}'")
if out == "active" {
running = true
} else {
running = false
}
}
if err != nil {
return false
running, _ = tools.ServiceStatus("ufw")
}
return running
@@ -241,54 +231,29 @@ func (r *SafeController) firewallStatus() bool {
// GetSshStatus 获取 SSH 状态
func (r *SafeController) GetSshStatus(ctx http.Context) http.Response {
var out string
var err error
if tools.IsRHEL() {
out, err = tools.Exec("systemctl status sshd | grep Active | awk '{print $3}'")
} else {
out, err = tools.Exec("systemctl status ssh | grep Active | awk '{print $3}'")
}
running, err := tools.ServiceStatus(r.ssh)
if err != nil {
return Error(ctx, http.StatusInternalServerError, out)
return Error(ctx, http.StatusInternalServerError, err.Error())
}
return Success(ctx, out == "(running)")
return Success(ctx, running)
}
// SetSshStatus 设置 SSH 状态
func (r *SafeController) SetSshStatus(ctx http.Context) http.Response {
if ctx.Request().InputBool("status") {
if tools.IsRHEL() {
if out, err := tools.Exec("systemctl enable sshd"); err != nil {
return Error(ctx, http.StatusInternalServerError, out)
}
if out, err := tools.Exec("systemctl start sshd"); err != nil {
return Error(ctx, http.StatusInternalServerError, out)
}
} else {
if out, err := tools.Exec("systemctl enable ssh"); err != nil {
return Error(ctx, http.StatusInternalServerError, out)
}
if out, err := tools.Exec("systemctl start ssh"); err != nil {
return Error(ctx, http.StatusInternalServerError, out)
}
if err := tools.ServiceEnable(r.ssh); err != nil {
return Error(ctx, http.StatusInternalServerError, err.Error())
}
if err := tools.ServiceStart(r.ssh); err != nil {
return Error(ctx, http.StatusInternalServerError, err.Error())
}
} else {
if tools.IsRHEL() {
if out, err := tools.Exec("systemctl stop sshd"); err != nil {
return Error(ctx, http.StatusInternalServerError, out)
}
if out, err := tools.Exec("systemctl disable sshd"); err != nil {
return Error(ctx, http.StatusInternalServerError, out)
}
} else {
if out, err := tools.Exec("systemctl stop ssh"); err != nil {
return Error(ctx, http.StatusInternalServerError, out)
}
if out, err := tools.Exec("systemctl disable ssh"); err != nil {
return Error(ctx, http.StatusInternalServerError, out)
}
if err := tools.ServiceStop(r.ssh); err != nil {
return Error(ctx, http.StatusInternalServerError, err.Error())
}
if err := tools.ServiceDisable(r.ssh); err != nil {
return Error(ctx, http.StatusInternalServerError, err.Error())
}
}
@@ -319,12 +284,11 @@ func (r *SafeController) SetSshPort(ctx http.Context) http.Response {
_, _ = tools.Exec("sed -i 's/#Port " + oldPort + "/Port " + cast.ToString(port) + "/g' /etc/ssh/sshd_config")
_, _ = tools.Exec("sed -i 's/Port " + oldPort + "/Port " + cast.ToString(port) + "/g' /etc/ssh/sshd_config")
out, err := tools.Exec("systemctl status sshd | grep Active | awk '{print $3}'")
if err != nil || out != "(running)" {
Error(ctx, http.StatusInternalServerError, out)
status, _ := tools.ServiceStatus(r.ssh)
if status {
_ = tools.ServiceRestart(r.ssh)
}
_, _ = tools.Exec("systemctl restart sshd")
return Success(ctx, nil)
}
+5 -5
View File
@@ -606,8 +606,8 @@ server
if err := tools.Write("/www/server/vhost/rewrite"+website.Name+".conf", "", 0644); err != nil {
return nil
}
if exec, err := tools.Exec("systemctl reload openresty"); err != nil {
return Error(ctx, http.StatusInternalServerError, exec)
if err := tools.ServiceReload("openresty"); err != nil {
return Error(ctx, http.StatusInternalServerError, err.Error())
}
return Success(ctx, nil)
@@ -670,11 +670,11 @@ func (r *WebsiteController) Status(ctx http.Context) http.Response {
}
}
if err := tools.Write("/www/server/vhost/"+website.Name+".conf", raw, 0644); err != nil {
if err = tools.Write("/www/server/vhost/"+website.Name+".conf", raw, 0644); err != nil {
return ErrorSystem(ctx)
}
if exec, err := tools.Exec("systemctl reload openresty"); err != nil {
return Error(ctx, http.StatusInternalServerError, exec)
if err = tools.ServiceReload("openresty"); err != nil {
return Error(ctx, http.StatusInternalServerError, err.Error())
}
return Success(ctx, nil)
@@ -0,0 +1,32 @@
package requests
import (
"github.com/goravel/framework/contracts/http"
"github.com/goravel/framework/contracts/validation"
)
type UpdateConfig struct {
Config string `form:"config" json:"config"`
}
func (r *UpdateConfig) Authorize(ctx http.Context) error {
return nil
}
func (r *UpdateConfig) Rules(ctx http.Context) map[string]string {
return map[string]string{
"config": "required|string",
}
}
func (r *UpdateConfig) Messages(ctx http.Context) map[string]string {
return map[string]string{}
}
func (r *UpdateConfig) Attributes(ctx http.Context) map[string]string {
return map[string]string{}
}
func (r *UpdateConfig) PrepareForValidation(ctx http.Context, data validation.Data) error {
return nil
}
+1 -1
View File
@@ -8,7 +8,7 @@ func init() {
config := facades.Config()
config.Add("panel", map[string]any{
"name": "耗子 Linux 面板",
"version": "v2.2.4",
"version": "v2.2.5",
"ssl": config.Env("APP_SSL", false),
})
}
+267
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": {
+267
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": {
+161
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 配置
+11 -12
View File
@@ -7,8 +7,8 @@ require (
github.com/docker/go-connections v0.5.0
github.com/go-resty/resty/v2 v2.13.1
github.com/gookit/validate v1.5.2
github.com/goravel/framework v1.13.1-0.20240529174304-bddcb8bcc28a
github.com/goravel/gin v1.1.6-0.20240426085159-718e4d6d5f4f
github.com/goravel/framework v1.14.1-0.20240608091017-72e9e3621f24
github.com/goravel/gin v1.2.1
github.com/gorilla/websocket v1.5.1
github.com/libdns/alidns v1.0.3
github.com/libdns/cloudflare v0.1.1
@@ -73,7 +73,7 @@ require (
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.4 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect
github.com/gin-gonic/gin v1.9.1 // indirect
github.com/gin-gonic/gin v1.10.0 // indirect
github.com/glebarez/go-sqlite v1.22.0 // indirect
github.com/glebarez/sqlite v1.11.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
@@ -85,7 +85,7 @@ require (
github.com/go-openapi/swag v0.22.7 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.15.5 // indirect
github.com/go-playground/validator/v10 v10.20.0 // indirect
github.com/go-sql-driver/mysql v1.8.1 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
@@ -120,7 +120,7 @@ require (
github.com/klauspost/compress v1.17.7 // indirect
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/klauspost/pgzip v1.2.6 // indirect
github.com/leodido/go-urn v1.2.4 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/lithammer/fuzzysearch v1.1.8 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
@@ -142,7 +142,7 @@ require (
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc5 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pierrec/lz4/v4 v4.1.16 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
@@ -163,21 +163,21 @@ require (
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.18.2 // indirect
github.com/spf13/viper v1.19.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/swaggo/files/v2 v2.0.0 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.2.11 // indirect
github.com/ugorji/go/codec v1.2.12 // indirect
github.com/ulikunitz/xz v0.5.11 // indirect
github.com/unrolled/secure v1.14.0 // indirect
github.com/urfave/cli/v2 v2.27.2 // indirect
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/otel v1.24.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.3.0 // indirect
@@ -186,7 +186,7 @@ require (
go.opentelemetry.io/otel/trace v1.24.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/arch v0.7.0 // indirect
golang.org/x/arch v0.8.0 // indirect
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
golang.org/x/image v0.13.0 // indirect
golang.org/x/mod v0.17.0 // indirect
@@ -195,10 +195,9 @@ require (
golang.org/x/term v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
google.golang.org/grpc v1.64.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gorm.io/driver/mysql v1.5.6 // indirect
+22 -22
View File
@@ -164,8 +164,8 @@ github.com/gabriel-vasile/mimetype v1.4.4/go.mod h1:JwLei5XPtWdGiMFB5Pjle1oEeoSe
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg=
github.com/gin-gonic/gin v1.9.1/go.mod h1:hPrL7YrpYKXt5YId3A/Tnip5kqbEAP+KLuI3SUcPTeU=
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
github.com/glebarez/go-sqlite v1.22.0 h1:uAcMJhaA6r3LHMTFgP0SifzgXg46yJkgxqyuyec+ruQ=
github.com/glebarez/go-sqlite v1.22.0/go.mod h1:PlBIdHe0+aUEFn+r2/uthrWq4FxbzugL0L8Li6yQJbc=
github.com/glebarez/sqlite v1.11.0 h1:wSG0irqzP6VurnMEpFGer5Li19RpIRi2qvQz++w0GMw=
@@ -196,8 +196,8 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.15.5 h1:LEBecTWb/1j5TNY1YYG2RcOUN3R7NLylN+x8TTueE24=
github.com/go-playground/validator/v10 v10.15.5/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU=
github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8=
github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
github.com/go-resty/resty/v2 v2.13.1 h1:x+LHXBI2nMB1vqndymf26quycC4aggYJ7DECYbiz03g=
github.com/go-resty/resty/v2 v2.13.1/go.mod h1:GznXlLxkq6Nh4sU59rPmUw3VtgpO3aS96ORAI6Q7d+0=
github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
@@ -277,10 +277,10 @@ github.com/gookit/validate v1.5.2 h1:i5I2OQ7WYHFRPRATGu9QarR9snnNHydvwSuHXaRWAV0
github.com/gookit/validate v1.5.2/go.mod h1:yuPy2WwDlwGRa06fFJ5XIO8QEwhRnTC2LmxmBa5SE14=
github.com/goravel/file-rotatelogs/v2 v2.4.2 h1:g68AzbePXcm0V2CpUMc9j4qVzcDn7+7aoWSjZ51C0m4=
github.com/goravel/file-rotatelogs/v2 v2.4.2/go.mod h1:23VuSW8cBS4ax5cmbV+5AaiLpq25b8UJ96IhbAkdo8I=
github.com/goravel/framework v1.13.1-0.20240529174304-bddcb8bcc28a h1:Ykie+6W4648p6s7eq/51AQwUCFUb/bJy/FCsuMFAkuQ=
github.com/goravel/framework v1.13.1-0.20240529174304-bddcb8bcc28a/go.mod h1:6TRukoCNPuUuyLKHcb9FDj9e/bG68S5tseCg8FDM2jY=
github.com/goravel/gin v1.1.6-0.20240426085159-718e4d6d5f4f h1:4+sGiuMXtJRgP1vDxOm5wP4z9cXr/noWDxTBU2hnvRM=
github.com/goravel/gin v1.1.6-0.20240426085159-718e4d6d5f4f/go.mod h1:kX2QEYJO8UJRTMb52g2L+Ec/53WdJ8CHwlFeqy4fRfo=
github.com/goravel/framework v1.14.1-0.20240608091017-72e9e3621f24 h1:LEE75NYDaUasNfcxHvQU7Bpfyt7kA2P8izMXAxFqK9w=
github.com/goravel/framework v1.14.1-0.20240608091017-72e9e3621f24/go.mod h1:xGI8IGkgJoqqjCE3ExbpUNJutbG1ZtjhFkzx68UuW7I=
github.com/goravel/gin v1.2.1 h1:lnQX3NKUEaSx8x7AAJpoeVkXgi+MVQ9FXy4QywHQElo=
github.com/goravel/gin v1.2.1/go.mod h1:Qt3NJysg/eoxXL4y/swwFUcfcIT7XG+xb0rWChweZfY=
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY=
@@ -347,8 +347,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc h1:RKf14vYWi2ttpEmkA4aQ3j4u9dStX2t4M8UM6qqNsG8=
github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc/go.mod h1:kopuH9ugFRkIXf3YoqHKyrJ9YfUFsckUU9S7B+XP+is=
github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
@@ -418,8 +418,8 @@ github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVn
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc=
github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ=
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
github.com/pierrec/lz4/v4 v4.1.2/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
github.com/pierrec/lz4/v4 v4.1.16 h1:kQPfno+wyx6C5572ABwV+Uo3pDFzQ7yhyGchSyRda0c=
github.com/pierrec/lz4/v4 v4.1.16/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
@@ -484,8 +484,8 @@ github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0=
github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ=
github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk=
github.com/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI=
github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
@@ -519,8 +519,8 @@ github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+F
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU=
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/ulikunitz/xz v0.5.9/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8=
@@ -539,8 +539,8 @@ github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913/go.mod h1:4aEEwZQut
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw=
github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 h1:jq9TW8u3so/bN+JPT166wjOI6/vQPF6Xe7nMNIltagk=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0/go.mod h1:p8pYQP+m5XfbZm9fxtSKAbM6oIllS7s2AfxrChvc7iw=
go.opentelemetry.io/otel v1.3.0/go.mod h1:PWIKzi6JCp7sM0k9yZ43VX+T345uNbAkDKwHVjb2PTs=
@@ -576,8 +576,8 @@ go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
golang.org/x/arch v0.7.0 h1:pskyeJh/3AmoQ8CPE95vxHLqp1G1GfGNXTmcl9NEKTc=
golang.org/x/arch v0.7.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc=
golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
@@ -765,8 +765,8 @@ google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlba
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+5
View File
@@ -8,6 +8,7 @@ import (
"github.com/TheTNB/panel/app/models"
"github.com/TheTNB/panel/internal"
"github.com/TheTNB/panel/pkg/tools"
"github.com/TheTNB/panel/types"
)
@@ -53,6 +54,7 @@ func (r *PluginImpl) All() []types.Plugin {
types.PluginSupervisor,
types.PluginFail2ban,
types.PluginFrp,
types.PluginGitea,
types.PluginToolBox,
}
@@ -122,6 +124,7 @@ func (r *PluginImpl) Install(slug string) error {
return errors.New("创建任务失败")
}
_ = tools.Remove(task.Log)
return r.task.Process(task.ID)
}
@@ -167,6 +170,7 @@ func (r *PluginImpl) Uninstall(slug string) error {
return errors.New("创建任务失败")
}
_ = tools.Remove(task.Log)
return r.task.Process(task.ID)
}
@@ -212,5 +216,6 @@ func (r *PluginImpl) Update(slug string) error {
return errors.New("创建任务失败")
}
_ = tools.Remove(task.Log)
return r.task.Process(task.ID)
}
+3 -3
View File
@@ -224,7 +224,7 @@ server
return models.Website{}, err
}
if _, err := tools.Exec("systemctl reload openresty"); err != nil {
if err := tools.ServiceReload("openresty"); err != nil {
return models.Website{}, err
}
@@ -265,10 +265,10 @@ func (r *WebsiteImpl) SaveConfig(config requests.SaveConfig) error {
return err
}
if strings.TrimSpace(raw) != strings.TrimSpace(config.Raw) {
if err := tools.Write("/www/server/vhost/"+website.Name+".conf", config.Raw, 0644); err != nil {
if err = tools.Write("/www/server/vhost/"+website.Name+".conf", config.Raw, 0644); err != nil {
return err
}
if _, err := tools.Exec("systemctl reload openresty"); err != nil {
if err = tools.ServiceReload("openresty"); err != nil {
return err
}
+12
View File
@@ -365,6 +365,18 @@ func Plugin() {
route.Get("config", frpController.GetConfig)
route.Post("config", frpController.UpdateConfig)
})
r.Prefix("gitea").Group(func(route route.Router) {
giteaController := plugins.NewGiteaController()
route.Get("status", giteaController.Status)
route.Get("isEnabled", giteaController.IsEnabled)
route.Post("enable", giteaController.Enable)
route.Post("disable", giteaController.Disable)
route.Post("start", giteaController.Start)
route.Post("stop", giteaController.Stop)
route.Post("restart", giteaController.Restart)
route.Get("config", giteaController.GetConfig)
route.Post("config", giteaController.UpdateConfig)
})
r.Prefix("toolbox").Group(func(route route.Router) {
toolboxController := plugins.NewToolBoxController()
route.Get("dns", toolboxController.GetDNS)
+4 -1
View File
@@ -96,4 +96,7 @@ systemctl start frps
systemctl start frpc
panel writePlugin frp ${frpVersion}
echo -e "${HR}\nfrp 安装完成\n${HR}"
echo -e ${HR}
echo "frp 安装完成"
echo -e ${HR}
+2 -2
View File
@@ -19,7 +19,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
'
HR="+----------------------------------------------------"
frpPath="/usr/local/frp"
frpPath="/www/server/frp"
systemctl stop frps
systemctl stop frpc
@@ -34,4 +34,4 @@ systemctl daemon-reload
panel deletePlugin frp
echo -e $HR
echo "frp 卸载完成"
echo -e $HR
echo -e $HR
+143
View File
@@ -0,0 +1,143 @@
#!/bin/bash
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/www/server/bin:/www/server/sbin:$PATH
: '
Copyright (C) 2022 - now HaoZi Technology Co., Ltd.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
'
HR="+----------------------------------------------------"
ARCH=$(uname -m)
OS=$(source /etc/os-release && { [[ "$ID" == "debian" ]] && echo "debian"; } || { [[ "$ID" == "centos" ]] || [[ "$ID" == "rhel" ]] || [[ "$ID" == "rocky" ]] || [[ "$ID" == "almalinux" ]] && echo "centos"; } || echo "unknown")
downloadUrl="https://dl.cdn.haozi.net/panel/gitea"
giteaPath="/www/server/gitea"
giteaVersion="1.22.0"
if [ ! -d "${giteaPath}" ]; then
mkdir -p ${giteaPath}
fi
# 架构判断
if [ "${ARCH}" == "x86_64" ]; then
giteaFile="gitea-${giteaVersion}-linux-amd64.7z"
elif [ "${ARCH}" == "aarch64" ]; then
giteaFile="gitea-${giteaVersion}-linux-arm64.7z"
else
echo -e $HR
echo "错误:不支持的架构"
exit 1
fi
# 安装依赖
if [ "${OS}" == "centos" ]; then
dnf makecache -y
dnf install git git-lfs -y
elif [ "${OS}" == "debian" ]; then
apt-get update
apt-get install git git-lfs -y
else
echo -e $HR
echo "错误:耗子 Linux 面板不支持该系统"
exit 1
fi
git lfs install
git lfs version
# 下载
cd ${giteaPath}
wget -T 120 -t 3 -O ${giteaPath}/${giteaFile} ${downloadUrl}/${giteaFile}
wget -T 20 -t 3 -O ${giteaPath}/${giteaFile}.checksum.txt ${downloadUrl}/${giteaFile}.checksum.txt
if ! sha256sum --status -c ${giteaPath}/${giteaFile}.checksum.txt; then
echo -e $HR
echo "错误:gitea checksum 校验失败,文件可能被篡改或不完整,已终止操作"
rm -rf ${giteaPath}
exit 1
fi
# 解压
cd ${giteaPath}
7z x ${giteaFile}
rm -f ${giteaFile} ${giteaFile}.checksum.txt
mv gitea-${giteaVersion}-linux-* gitea
if [ ! -f "${giteaPath}/gitea" ]; then
echo -e $HR
echo "错误:gitea 解压失败"
rm -rf ${giteaPath}
exit 1
fi
# 初始化目录
mkdir -p ${giteaPath}/{custom,data,log}
chown -R www:www ${giteaPath}
chmod -R 750 ${giteaPath}
ln -sf ${giteaPath}/gitea /usr/local/bin/gitea
# 配置systemd
cat >/etc/systemd/system/gitea.service <<EOF
[Unit]
Description=Gitea (Git with a cup of tea)
After=network.target
###
# 可以自行添加数据库服务依赖
# Can add database service dependencies yourself
###
#
#Wants=mysqld.service
#After=mysqld.service
#
#Wants=postgresql.service
#After=postgresql.service
#
#Wants=redis.service
#After=redis.service
#
[Service]
LimitNOFILE=524288:524288
RestartSec=2s
Type=simple
User=www
Group=www
WorkingDirectory=/www/server/gitea/
ExecStart=/usr/local/bin/gitea web --config /www/server/gitea/app.ini
Restart=always
Environment=USER=www HOME=/home/www GITEA_WORK_DIR=/www/server/gitea
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_BIND_SERVICE
PrivateUsers=false
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable gitea
systemctl start gitea
# 防火墙
if [ "${OS}" == "centos" ]; then
firewall-cmd --zone=public --add-port=3000/tcp --permanent
firewall-cmd --reload
elif [ "${OS}" == "debian" ]; then
ufw allow 3000/tcp
ufw reload
fi
panel writePlugin gitea ${giteaVersion}
echo -e $HR
echo "gitea 安装完成,请访问 IP:3000 完成初始化向导"
echo "安装后建议修改 systemd 配置 /etc/systemd/system/gitea.service 中的数据库依赖"
echo -e $HR
+35
View File
@@ -0,0 +1,35 @@
#!/bin/bash
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
: '
Copyright (C) 2022 - now HaoZi Technology Co., Ltd.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
'
HR="+----------------------------------------------------"
giteaPath="/www/server/gitea"
systemctl stop gitea
systemctl disable gitea
rm -f /usr/local/bin/gitea
rm -rf ${giteaPath}
rm -f /etc/systemd/system/gitea.service
systemctl daemon-reload
panel deletePlugin gitea
echo -e $HR
echo "gitea 卸载完成,数据库可能需自行删除"
echo -e $HR
+72
View File
@@ -0,0 +1,72 @@
#!/bin/bash
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/www/server/bin:/www/server/sbin:$PATH
: '
Copyright (C) 2022 - now HaoZi Technology Co., Ltd.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
'
HR="+----------------------------------------------------"
ARCH=$(uname -m)
downloadUrl="https://dl.cdn.haozi.net/panel/gitea"
giteaPath="/www/server/gitea"
giteaVersion="1.22.0"
# 架构判断
if [ "${ARCH}" == "x86_64" ]; then
giteaFile="gitea-${giteaVersion}-linux-amd64.7z"
elif [ "${ARCH}" == "aarch64" ]; then
giteaFile="gitea-${giteaVersion}-linux-arm64.7z"
else
echo -e $HR
echo "错误:不支持的架构"
exit 1
fi
# 下载
cd ${giteaPath}
wget -T 120 -t 3 -O ${giteaPath}/${giteaFile} ${downloadUrl}/${giteaFile}
wget -T 20 -t 3 -O ${giteaPath}/${giteaFile}.checksum.txt ${downloadUrl}/${giteaFile}.checksum.txt
if ! sha256sum --status -c ${giteaPath}/${giteaFile}.checksum.txt; then
echo -e $HR
echo "错误:gitea checksum 校验失败,文件可能被篡改或不完整,已终止操作"
rm -rf ${giteaPath}
exit 1
fi
# 解压
cd ${giteaPath}
7z x ${giteaFile}
rm -f ${giteaFile} ${giteaFile}.checksum.txt
# 替换文件
systemctl stop gitea
rm -f gitea
mv gitea-${giteaVersion}-linux-* gitea
if [ ! -f "${giteaPath}/gitea" ]; then
echo -e $HR
echo "错误:gitea 解压失败"
rm -rf ${giteaPath}
exit 1
fi
chown -R www:www ${giteaPath}
chmod -R 750 ${giteaPath}
systemctl start gitea
panel writePlugin gitea ${giteaVersion}
echo -e $HR
echo "gitea 升级完成"
echo -e $HR
+2 -2
View File
@@ -94,8 +94,8 @@ sed -i 's/ADD_SUBDIRECTORY(mysql-test)//g' CMakeLists.txt
mkdir build
cd build
# 5.7 需要 boost
if [[ "${1}" == "57" ]]; then
# 5.7 和 8.0 需要 boost
if [[ "${1}" == "57" ]] || [[ "${1}" == "80" ]]; then
MAYBE_WITH_BOOST="-DWITH_BOOST=../boost"
fi
+12
View File
@@ -228,6 +228,18 @@ var PluginFrp = Plugin{
Update: `bash /www/panel/scripts/frp/install.sh`,
}
var PluginGitea = Plugin{
Name: "Gitea",
Description: "Gitea 是一款极易搭建的自助 Git 服务,它包括 Git 托管、代码审查、团队协作、软件包注册和 CI/CD。",
Slug: "gitea",
Version: "1.22.0",
Requires: []string{},
Excludes: []string{},
Install: `bash /www/panel/scripts/gitea/install.sh`,
Uninstall: `bash /www/panel/scripts/gitea/uninstall.sh`,
Update: `bash /www/panel/scripts/gitea/install.sh`,
}
var PluginToolBox = Plugin{
Name: "系统工具箱",
Description: "可视化调整一些常用的配置项,如 DNS、SWAP、时区等",