mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
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:
@@ -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"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user