From 9a510c8dfcbc8797c105dc0cbfbf3288facb32d5 Mon Sep 17 00:00:00 2001 From: Hunter Long Date: Mon, 11 Jun 2018 00:49:41 -0700 Subject: [PATCH] upgrades - plugins --- core.go | 6 ++- database.go | 3 +- html/tmpl/plugins.html | 6 +++ main.go | 60 ++++++++++++++++++++++ plugins/plugins.go => plugin/plugin.go | 55 +++++++++----------- plugins.go | 38 -------------- plugins/html/slack.html | 1 - plugins/slack.go | 67 ------------------------- plugins/slack.so | Bin 0 -> 6370344 bytes slack.so | Bin 0 -> 6430960 bytes web.go | 15 ++++-- 11 files changed, 109 insertions(+), 142 deletions(-) rename plugins/plugins.go => plugin/plugin.go (50%) delete mode 100644 plugins.go delete mode 100644 plugins/html/slack.html delete mode 100644 plugins/slack.go create mode 100644 plugins/slack.so create mode 100644 slack.so diff --git a/core.go b/core.go index af8a358c..1f7ce47e 100644 --- a/core.go +++ b/core.go @@ -1,6 +1,9 @@ package main -import "github.com/gorilla/sessions" +import ( + "github.com/gorilla/sessions" + "github.com/hunterlong/statup/plugin" +) type Core struct { Name string @@ -8,6 +11,7 @@ type Core struct { Key string Secret string Version string + Plugins []*plugin.Plugin } func SelectCore() (*Core, error) { diff --git a/database.go b/database.go index eca79959..70fb2133 100644 --- a/database.go +++ b/database.go @@ -6,6 +6,7 @@ import ( _ "github.com/lib/pq" "math/rand" "time" + "github.com/hunterlong/statup/plugin" ) func DbConnection() { @@ -15,7 +16,7 @@ func DbConnection() { if err != nil { panic(err) } - InitPluginsDatabase() + plugin.SetDatabase(db) } func UpgradeDatabase() { diff --git a/html/tmpl/plugins.html b/html/tmpl/plugins.html index fe3c87de..030861e1 100644 --- a/html/tmpl/plugins.html +++ b/html/tmpl/plugins.html @@ -18,6 +18,12 @@
+ {{ range .Plugins }} + + {{ . }} + + {{end}} +