2.2 KiB
Plugins
Stash supports the running tasks via plugins. Plugins can be implemented using embedded Javascript, or by calling an external binary.
⚠️ Note: Plugin support is still experimental and is likely to change.
Adding plugins
By default, Stash looks for plugin configurations in the plugins sub-directory of the directory where the stash config.yml is read. This will either be the $HOME/.stash directory or the current working directory.
Plugins are added by adding configuration yaml files (format: pluginName.yml) to the plugins directory.
Loaded plugins can be viewed in the Plugins page of the Settings. After plugins are added, removed or edited while stash is running, they can be reloaded by clicking Reload Plugins button.
Using plugins
Plugins provide tasks which can be run from the Tasks page.
Creating plugins
See External Plugins for details for making external plugins.
See Embedded Plugins for details for making embedded plugins.
Plugin input
Plugins may accept an input from the stash server. This input is encoded according to the interface, and has the following structure (presented here in JSON format):
{
"server_connection": {
"Scheme": "http",
"Port": 9999,
"SessionCookie": {
"Name":"session",
"Value":"cookie-value",
"Path":"",
"Domain":"",
"Expires":"0001-01-01T00:00:00Z",
"RawExpires":"",
"MaxAge":0,
"Secure":false,
"HttpOnly":false,
"SameSite":0,
"Raw":"",
"Unparsed":null
},
"Dir": <path to stash config directory>,
"PluginDir": <path to plugin config directory>,
},
"args": {
"argKey": "argValue"
}
}
The server_connection field contains all the information needed for a plugin to access the parent stash server, if necessary.
Plugin output
Plugin output is expected in the following structure (presented here as JSON format):
{
"error": <optional error string>
"output": <anything>
}
The error field is logged in stash at the error log level if present. The output is written at the debug log level.