mirror of
https://github.com/tnb-labs/panel.git
synced 2026-09-01 04:17:20 +08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 91f1125e6a | |||
| e44a783e9f | |||
| b33a35286d | |||
| 200d763ba4 |
+14
-13
@@ -1,4 +1,4 @@
|
||||
package plugins
|
||||
package openresty
|
||||
|
||||
import (
|
||||
"os"
|
||||
@@ -14,22 +14,23 @@ import (
|
||||
"github.com/goravel/framework/facades"
|
||||
|
||||
"panel/app/http/controllers"
|
||||
"panel/app/http/controllers/plugins"
|
||||
"panel/packages/helpers"
|
||||
)
|
||||
|
||||
type OpenRestyController struct {
|
||||
//Dependent services
|
||||
// Dependent services
|
||||
}
|
||||
|
||||
func NewOpenrestyController() *OpenRestyController {
|
||||
return &OpenRestyController{
|
||||
//Inject services
|
||||
// Inject services
|
||||
}
|
||||
}
|
||||
|
||||
// Status 获取运行状态
|
||||
func (r *OpenRestyController) Status(ctx http.Context) {
|
||||
if !Check(ctx, "openresty") {
|
||||
if !plugins.Check(ctx, "openresty") {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -55,7 +56,7 @@ func (r *OpenRestyController) Status(ctx http.Context) {
|
||||
|
||||
// Reload 重载配置
|
||||
func (r *OpenRestyController) Reload(ctx http.Context) {
|
||||
if !Check(ctx, "openresty") {
|
||||
if !plugins.Check(ctx, "openresty") {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -90,7 +91,7 @@ func (r *OpenRestyController) Reload(ctx http.Context) {
|
||||
|
||||
// Start 启动OpenResty
|
||||
func (r *OpenRestyController) Start(ctx http.Context) {
|
||||
if !Check(ctx, "openresty") {
|
||||
if !plugins.Check(ctx, "openresty") {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -125,7 +126,7 @@ func (r *OpenRestyController) Start(ctx http.Context) {
|
||||
|
||||
// Stop 停止OpenResty
|
||||
func (r *OpenRestyController) Stop(ctx http.Context) {
|
||||
if !Check(ctx, "openresty") {
|
||||
if !plugins.Check(ctx, "openresty") {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -160,7 +161,7 @@ func (r *OpenRestyController) Stop(ctx http.Context) {
|
||||
|
||||
// Restart 重启OpenResty
|
||||
func (r *OpenRestyController) Restart(ctx http.Context) {
|
||||
if !Check(ctx, "openresty") {
|
||||
if !plugins.Check(ctx, "openresty") {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -195,7 +196,7 @@ func (r *OpenRestyController) Restart(ctx http.Context) {
|
||||
|
||||
// GetConfig 获取配置
|
||||
func (r *OpenRestyController) GetConfig(ctx http.Context) {
|
||||
if !Check(ctx, "openresty") {
|
||||
if !plugins.Check(ctx, "openresty") {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -210,7 +211,7 @@ func (r *OpenRestyController) GetConfig(ctx http.Context) {
|
||||
|
||||
// SaveConfig 保存配置
|
||||
func (r *OpenRestyController) SaveConfig(ctx http.Context) {
|
||||
if !Check(ctx, "openresty") {
|
||||
if !plugins.Check(ctx, "openresty") {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -265,7 +266,7 @@ func (r *OpenRestyController) SaveConfig(ctx http.Context) {
|
||||
|
||||
// ErrorLog 获取错误日志
|
||||
func (r *OpenRestyController) ErrorLog(ctx http.Context) {
|
||||
if !Check(ctx, "openresty") {
|
||||
if !plugins.Check(ctx, "openresty") {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -282,7 +283,7 @@ func (r *OpenRestyController) ErrorLog(ctx http.Context) {
|
||||
|
||||
// ClearErrorLog 清空错误日志
|
||||
func (r *OpenRestyController) ClearErrorLog(ctx http.Context) {
|
||||
if !Check(ctx, "openresty") {
|
||||
if !plugins.Check(ctx, "openresty") {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -299,7 +300,7 @@ func (r *OpenRestyController) ClearErrorLog(ctx http.Context) {
|
||||
|
||||
// Load 获取负载
|
||||
func (r *OpenRestyController) Load(ctx http.Context) {
|
||||
if !Check(ctx, "openresty") {
|
||||
if !plugins.Check(ctx, "openresty") {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package mysql57
|
||||
|
||||
var (
|
||||
Name = "MySQL-5.7"
|
||||
Author = "耗子"
|
||||
Description = "MySQL 是最流行的关系型数据库管理系统之一,Oracle 旗下产品。"
|
||||
Slug = "mysql57"
|
||||
Version = "5.7.42"
|
||||
Requires = []string{}
|
||||
Excludes = []string{"mysql80"}
|
||||
)
|
||||
@@ -0,0 +1,11 @@
|
||||
package mysql80
|
||||
|
||||
var (
|
||||
Name = "MySQL-8.0"
|
||||
Author = "耗子"
|
||||
Description = "MySQL 是最流行的关系型数据库管理系统之一,Oracle 旗下产品。"
|
||||
Slug = "mysql80"
|
||||
Version = "8.0.33"
|
||||
Requires = []string{}
|
||||
Excludes = []string{"mysql57"}
|
||||
)
|
||||
@@ -0,0 +1,11 @@
|
||||
package php80
|
||||
|
||||
var (
|
||||
Name = "PHP-8.0"
|
||||
Author = "耗子"
|
||||
Description = "PHP 是世界上最好的语言!"
|
||||
Slug = "php80"
|
||||
Version = "8.0.29"
|
||||
Requires = []string{}
|
||||
Excludes = []string{}
|
||||
)
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"github.com/goravel/framework/facades"
|
||||
|
||||
"panel/app/models"
|
||||
"panel/plugins/openresty"
|
||||
"panel/app/plugins/openresty"
|
||||
)
|
||||
|
||||
// PanelPlugin 插件元数据结构
|
||||
|
||||
@@ -6,7 +6,7 @@ require (
|
||||
github.com/gertd/go-pluralize v0.2.1
|
||||
github.com/gin-contrib/static v0.0.1
|
||||
github.com/gookit/color v1.5.3
|
||||
github.com/goravel/framework v1.12.1-0.20230708041054-23981ffb073e
|
||||
github.com/goravel/framework v1.12.1-0.20230710043919-4b0ca1d027f8
|
||||
github.com/iancoleman/strcase v0.2.0
|
||||
github.com/imroc/req/v3 v3.37.2
|
||||
github.com/mojocn/base64Captcha v1.3.5
|
||||
|
||||
@@ -356,8 +356,8 @@ github.com/goravel/file-rotatelogs v0.0.0-20211215053220-2ab31dd9575c h1:obhFK91
|
||||
github.com/goravel/file-rotatelogs v0.0.0-20211215053220-2ab31dd9575c/go.mod h1:YSWsLXlG16u5CWFaXNZHhEQD10+NwF3xfgDV816OwLE=
|
||||
github.com/goravel/file-rotatelogs/v2 v2.4.1 h1:ogkeIFcTHSBRUBpZYiyJbpul8hkVXxHPuDbOaP78O1M=
|
||||
github.com/goravel/file-rotatelogs/v2 v2.4.1/go.mod h1:euk9qr52WrzM8ICs1hecFcR4CZ/ZZOPdacHfvHgbOf0=
|
||||
github.com/goravel/framework v1.12.1-0.20230708041054-23981ffb073e h1:Hsd4IKjFbMWuN5jyGalPQLrZJA3Cs9DAjp5xv8+05cM=
|
||||
github.com/goravel/framework v1.12.1-0.20230708041054-23981ffb073e/go.mod h1:SBsBTY8KTqSDipGPEZXnRRC1mWzKmL55Eo1P5aHNDgY=
|
||||
github.com/goravel/framework v1.12.1-0.20230710043919-4b0ca1d027f8 h1:77KSGfnxfSIrkCBZfv9xSMjui2w96Z2GO8MsZ2Gdd+s=
|
||||
github.com/goravel/framework v1.12.1-0.20230710043919-4b0ca1d027f8/go.mod h1:SBsBTY8KTqSDipGPEZXnRRC1mWzKmL55Eo1P5aHNDgY=
|
||||
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/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI=
|
||||
|
||||
+2
-2
@@ -4,14 +4,14 @@ import (
|
||||
"github.com/goravel/framework/contracts/route"
|
||||
"github.com/goravel/framework/facades"
|
||||
|
||||
"panel/app/http/controllers/plugins"
|
||||
"panel/app/http/controllers/plugins/openresty"
|
||||
"panel/app/http/middleware"
|
||||
)
|
||||
|
||||
// Plugin 加载插件路由
|
||||
func Plugin() {
|
||||
facades.Route().Prefix("api/plugins/openresty").Middleware(middleware.Jwt()).Group(func(route route.Route) {
|
||||
openRestyController := plugins.NewOpenrestyController()
|
||||
openRestyController := openresty.NewOpenrestyController()
|
||||
route.Get("status", openRestyController.Status)
|
||||
route.Post("reload", openRestyController.Reload)
|
||||
route.Post("start", openRestyController.Start)
|
||||
|
||||
Reference in New Issue
Block a user