mirror of https://github.com/statping/statping
upgrades - plugins
parent
c7ff4ef9ef
commit
15c74bf4d2
41
main.go
41
main.go
|
@ -89,27 +89,28 @@ func LoadPlugins() {
|
|||
if len(ext) != 2 {
|
||||
continue
|
||||
}
|
||||
if ext[1] == "so" {
|
||||
plug, err := plg.Open("plugins/"+f.Name())
|
||||
if err != nil {
|
||||
fmt.Printf("Plugin '%v' could not load correctly.\n", f.Name())
|
||||
continue
|
||||
}
|
||||
symPlugin, err := plug.Lookup("Plugin")
|
||||
var plugActions plugin.PluginActions
|
||||
plugActions, ok := symPlugin.(plugin.PluginActions)
|
||||
if !ok {
|
||||
fmt.Printf("Plugin '%v' could not load correctly, error: %v\n", f.Name(), "unexpected type from module symbol")
|
||||
continue
|
||||
}
|
||||
//plugin := plugActions.Plugin()
|
||||
//
|
||||
//fmt.Println(plugin.OnLoad)
|
||||
|
||||
plugActions.OnLoad()
|
||||
|
||||
allPlugins = append(allPlugins, plugActions.Plugin())
|
||||
if ext[1] != "so" {
|
||||
continue
|
||||
}
|
||||
plug, err := plg.Open("plugins/" + f.Name())
|
||||
if err != nil {
|
||||
fmt.Printf("Plugin '%v' could not load correctly.\n", f.Name())
|
||||
continue
|
||||
}
|
||||
symPlugin, err := plug.Lookup("Plugin")
|
||||
var plugActions plugin.PluginActions
|
||||
plugActions, ok := symPlugin.(plugin.PluginActions)
|
||||
if !ok {
|
||||
fmt.Printf("Plugin '%v' could not load correctly, error: %v\n", f.Name(), "unexpected type from module symbol")
|
||||
continue
|
||||
}
|
||||
//plugin := plugActions.Plugin()
|
||||
//
|
||||
//fmt.Println(plugin.OnLoad)
|
||||
|
||||
plugActions.OnLoad()
|
||||
|
||||
//allPlugins = append(allPlugins, plugActions.Plugin())
|
||||
}
|
||||
core.Plugins = allPlugins
|
||||
fmt.Printf("Loaded %v Plugins\n", len(allPlugins))
|
||||
|
|
|
@ -26,7 +26,7 @@ type Routing struct {
|
|||
}
|
||||
|
||||
type PluginActions interface {
|
||||
Plugin() *PluginInfo
|
||||
//Plugin() *PluginInfo
|
||||
SaveForm()
|
||||
OnInstall()
|
||||
OnUninstall()
|
||||
|
@ -34,8 +34,11 @@ type PluginActions interface {
|
|||
OnHit()
|
||||
OnSettingsSaved()
|
||||
OnNewUser()
|
||||
OnNewService()
|
||||
OnShutdown()
|
||||
OnLoad()
|
||||
OnBeforeRequest()
|
||||
OnAfterRequest()
|
||||
}
|
||||
|
||||
func SetDatabase(db *sql.DB) {
|
||||
|
|
BIN
plugins/slack.so
BIN
plugins/slack.so
Binary file not shown.
Loading…
Reference in New Issue