mirror of
https://github.com/acepanel/panel.git
synced 2026-02-04 07:57:21 +08:00
refactor: rename plugin to apps
This commit is contained in:
@@ -3,12 +3,12 @@ package fail2ban
|
||||
import (
|
||||
"github.com/go-chi/chi/v5"
|
||||
|
||||
"github.com/TheTNB/panel/pkg/pluginloader"
|
||||
"github.com/TheTNB/panel/pkg/apploader"
|
||||
"github.com/TheTNB/panel/pkg/types"
|
||||
)
|
||||
|
||||
func init() {
|
||||
pluginloader.Register(&types.Plugin{
|
||||
apploader.Register(&types.Plugin{
|
||||
Slug: "fail2ban",
|
||||
Name: "Fail2ban",
|
||||
Description: "Fail2ban 扫描系统日志文件并从中找出多次尝试失败的IP地址,将该IP地址加入防火墙的拒绝访问列表中",
|
||||
13
internal/apps/init.go
Normal file
13
internal/apps/init.go
Normal file
@@ -0,0 +1,13 @@
|
||||
package apps
|
||||
|
||||
import (
|
||||
"github.com/go-chi/chi/v5"
|
||||
|
||||
_ "github.com/TheTNB/panel/internal/apps/fail2ban"
|
||||
_ "github.com/TheTNB/panel/internal/apps/openresty"
|
||||
"github.com/TheTNB/panel/pkg/apploader"
|
||||
)
|
||||
|
||||
func Boot(r chi.Router) {
|
||||
apploader.Boot(r)
|
||||
}
|
||||
@@ -3,12 +3,12 @@ package openresty
|
||||
import (
|
||||
"github.com/go-chi/chi/v5"
|
||||
|
||||
"github.com/TheTNB/panel/pkg/pluginloader"
|
||||
"github.com/TheTNB/panel/pkg/apploader"
|
||||
"github.com/TheTNB/panel/pkg/types"
|
||||
)
|
||||
|
||||
func init() {
|
||||
pluginloader.Register(&types.Plugin{
|
||||
apploader.Register(&types.Plugin{
|
||||
Order: -100,
|
||||
Slug: "openresty",
|
||||
Name: "OpenResty",
|
||||
@@ -6,9 +6,9 @@ import (
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
|
||||
"github.com/TheTNB/panel/internal/apps"
|
||||
"github.com/TheTNB/panel/internal/http/middleware"
|
||||
"github.com/TheTNB/panel/internal/panel"
|
||||
"github.com/TheTNB/panel/internal/plugin"
|
||||
"github.com/TheTNB/panel/internal/route"
|
||||
)
|
||||
|
||||
@@ -20,7 +20,7 @@ func initHttp() {
|
||||
|
||||
// add route
|
||||
route.Http(panel.Http)
|
||||
plugin.Boot(panel.Http)
|
||||
apps.Boot(panel.Http)
|
||||
|
||||
server := &http.Server{
|
||||
Addr: panel.Conf.MustString("http.address"),
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"github.com/TheTNB/panel/internal/biz"
|
||||
"github.com/TheTNB/panel/internal/job"
|
||||
"github.com/TheTNB/panel/internal/panel"
|
||||
"github.com/TheTNB/panel/pkg/pluginloader"
|
||||
"github.com/TheTNB/panel/pkg/apploader"
|
||||
"github.com/TheTNB/panel/pkg/types"
|
||||
)
|
||||
|
||||
@@ -22,7 +22,7 @@ func NewPluginRepo() biz.PluginRepo {
|
||||
}
|
||||
|
||||
func (r *pluginRepo) All() []*types.Plugin {
|
||||
return pluginloader.All()
|
||||
return apploader.All()
|
||||
}
|
||||
|
||||
func (r *pluginRepo) Installed() ([]*biz.Plugin, error) {
|
||||
@@ -36,7 +36,7 @@ func (r *pluginRepo) Installed() ([]*biz.Plugin, error) {
|
||||
}
|
||||
|
||||
func (r *pluginRepo) Get(slug string) (*types.Plugin, error) {
|
||||
return pluginloader.Get(slug)
|
||||
return apploader.Get(slug)
|
||||
}
|
||||
|
||||
func (r *pluginRepo) GetInstalled(slug string) (*biz.Plugin, error) {
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
package plugin
|
||||
|
||||
import (
|
||||
"github.com/go-chi/chi/v5"
|
||||
|
||||
_ "github.com/TheTNB/panel/internal/plugin/fail2ban"
|
||||
_ "github.com/TheTNB/panel/internal/plugin/openresty"
|
||||
"github.com/TheTNB/panel/pkg/pluginloader"
|
||||
)
|
||||
|
||||
func Boot(r chi.Router) {
|
||||
pluginloader.Boot(r)
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// Package pluginloader 面板插件加载器
|
||||
package pluginloader
|
||||
// Package apploader 面板应用加载器
|
||||
package apploader
|
||||
|
||||
import (
|
||||
"cmp"
|
||||
Reference in New Issue
Block a user