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

@@ -3,7 +3,6 @@ package plugin
import (
"net/http"
"github.com/stashapp/stash/pkg/models"
"github.com/stashapp/stash/pkg/plugin/common"
)
@@ -31,11 +30,10 @@ type taskBuilder interface {
}
type pluginTask struct {
plugin *Config
operation *OperationConfig
serverConnection common.StashServerConnection
args []*models.PluginArgInput
gqlHandler http.HandlerFunc
plugin *Config
operation *OperationConfig
input common.PluginInput
gqlHandler http.Handler
progress chan float64
result *common.PluginOutput
@@ -48,12 +46,3 @@ func (t *pluginTask) GetResult() *common.PluginOutput {
func (t *pluginTask) createTask() Task {
return t.plugin.Interface.getTaskBuilder().build(*t)
}
func (t *pluginTask) buildPluginInput() common.PluginInput {
args := applyDefaultArgs(t.args, t.operation.DefaultArgs)
t.serverConnection.PluginDir = t.plugin.getConfigPath()
return common.PluginInput{
ServerConnection: t.serverConnection,
Args: toPluginArgs(args),
}
}