Plugin hooks (#1452)

* Refactor session and plugin code
* Add context to job tasks
* Show hooks in plugins page
* Refactor session management
This commit is contained in:
WithoutPants
2021-06-11 17:24:58 +10:00
committed by GitHub
parent dde361f9f3
commit 46bbede9a0
48 changed files with 1289 additions and 338 deletions

View File

@@ -2,6 +2,10 @@ package common
import "net/http"
const (
HookContextKey = "hookContext"
)
// StashServerConnection represents the connection details needed for a
// plugin instance to connect to its parent stash server.
type StashServerConnection struct {
@@ -97,3 +101,12 @@ func (o *PluginOutput) SetError(err error) {
errStr := err.Error()
o.Error = &errStr
}
// HookContext is passed as a PluginArgValue and indicates what hook triggered
// this plugin task.
type HookContext struct {
ID int `json:"id,omitempty"`
Type string `json:"type"`
Input interface{} `json:"input"`
InputFields []string `json:"inputFields,omitempty"`
}