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

@@ -28,11 +28,6 @@ type jsPluginTask struct {
vm *otto.Otto
}
func throw(vm *otto.Otto, str string) {
value, _ := vm.Call("new Error", nil, str)
panic(value)
}
func (t *jsPluginTask) onError(err error) {
errString := err.Error()
t.result = &common.PluginOutput{
@@ -76,12 +71,10 @@ func (t *jsPluginTask) Start() error {
return err
}
input := t.buildPluginInput()
t.vm.Set("input", input)
t.vm.Set("input", t.input)
js.AddLogAPI(t.vm, t.progress)
js.AddUtilAPI(t.vm)
js.AddGQLAPI(t.vm, t.gqlHandler)
js.AddGQLAPI(t.vm, t.input.ServerConnection.SessionCookie, t.gqlHandler)
t.vm.Interrupt = make(chan func(), 1)