mirror of
https://github.com/tobychui/zoraxy.git
synced 2025-08-07 05:38:30 +02:00
Added plugin context view
- Added plugin context view - Moved plugin type definition to separate file - Added wip request forwarder
This commit is contained in:
40
src/mod/plugins/typdef.go
Normal file
40
src/mod/plugins/typdef.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package plugins
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"net/http"
|
||||
"os/exec"
|
||||
"sync"
|
||||
|
||||
"imuslab.com/zoraxy/mod/database"
|
||||
"imuslab.com/zoraxy/mod/dynamicproxy/dpcore"
|
||||
"imuslab.com/zoraxy/mod/info/logger"
|
||||
zoraxyPlugin "imuslab.com/zoraxy/mod/plugins/zoraxy_plugin"
|
||||
)
|
||||
|
||||
//go:embed no_img.png
|
||||
var noImg []byte
|
||||
|
||||
type Plugin struct {
|
||||
RootDir string //The root directory of the plugin
|
||||
Spec *zoraxyPlugin.IntroSpect //The plugin specification
|
||||
Enabled bool //Whether the plugin is enabled
|
||||
|
||||
//Runtime
|
||||
AssignedPort int //The assigned port for the plugin
|
||||
uiProxy *dpcore.ReverseProxy //The reverse proxy for the plugin UI
|
||||
process *exec.Cmd //The process of the plugin
|
||||
}
|
||||
|
||||
type ManagerOptions struct {
|
||||
PluginDir string
|
||||
SystemConst *zoraxyPlugin.RuntimeConstantValue
|
||||
Database *database.Database
|
||||
Logger *logger.Logger
|
||||
CSRFTokenGen func(*http.Request) string //The CSRF token generator function
|
||||
}
|
||||
|
||||
type Manager struct {
|
||||
LoadedPlugins sync.Map //Storing *Plugin
|
||||
Options *ManagerOptions
|
||||
}
|
Reference in New Issue
Block a user