mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Embedded javascript plugins (#1393)
This commit is contained in:
@@ -9,6 +9,7 @@ package plugin
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
@@ -19,8 +20,9 @@ import (
|
||||
|
||||
// Cache stores plugin details.
|
||||
type Cache struct {
|
||||
path string
|
||||
plugins []Config
|
||||
path string
|
||||
plugins []Config
|
||||
gqlHandler http.HandlerFunc
|
||||
}
|
||||
|
||||
// NewCache returns a new Cache loading plugin configurations
|
||||
@@ -41,6 +43,10 @@ func NewCache(pluginPath string) (*Cache, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (c *Cache) RegisterGQLHandler(handler http.HandlerFunc) {
|
||||
c.gqlHandler = handler
|
||||
}
|
||||
|
||||
// ReloadPlugins clears the plugin cache and reloads from the plugin path.
|
||||
// In the event of an error during loading, the cache will be left empty.
|
||||
func (c *Cache) ReloadPlugins() error {
|
||||
@@ -125,6 +131,7 @@ func (c Cache) CreateTask(pluginID string, operationName string, serverConnectio
|
||||
serverConnection: serverConnection,
|
||||
args: args,
|
||||
progress: progress,
|
||||
gqlHandler: c.gqlHandler,
|
||||
}
|
||||
return task.createTask(), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user