Add injected css/javascript to plugins (#3195)

* Add injected css/javascript to plugins
* Manual documentation
This commit is contained in:
WithoutPants
2022-12-05 15:08:22 +11:00
committed by GitHub
parent 87cea80e7b
commit b5b9023b3e
7 changed files with 190 additions and 83 deletions

View File

@@ -1,20 +1,20 @@
# Embedded Plugins
# Embedded Plugin Tasks
Embedded plugins are executed within the stash process using a scripting system.
Embedded plugin tasks are executed within the stash process using a scripting system.
## Supported script languages
Stash currently supports Javascript embedded plugins using [otto](https://github.com/robertkrimen/otto).
Stash currently supports Javascript embedded plugin tasks using [otto](https://github.com/robertkrimen/otto).
# Javascript plugins
## Plugin input
The input is provided to Javascript plugins using the `input` global variable, and is an object based on the structure provided in the `Plugin input` section of the [Plugins](/help/Plugins.md) page. Note that the `server_connection` field should not be necessary in most embedded plugins.
The input is provided to Javascript plugin tasks using the `input` global variable, and is an object based on the structure provided in the `Plugin input` section of the [Plugins](/help/Plugins.md) page. Note that the `server_connection` field should not be necessary in most embedded plugins.
## Plugin output
The output of a Javascript plugin is derived from the evaluated value of the script. The output should conform to the structure provided in the `Plugin output` section of the [Plugins](/help/Plugins.md) page.
The output of a Javascript plugin task is derived from the evaluated value of the script. The output should conform to the structure provided in the `Plugin output` section of the [Plugins](/help/Plugins.md) page.
There are a number of ways to return the plugin output:
@@ -53,22 +53,6 @@ See the `Javascript API` section below on how to log with Javascript plugins.
# Plugin configuration file format
The basic structure of an embedded plugin configuration file is as follows:
```
name: <plugin name>
description: <optional description of the plugin>
version: <optional version tag>
url: <optional url>
exec:
- <path to script>
interface: [interface type]
tasks:
- ...
```
The `name`, `description`, `version` and `url` fields are displayed on the plugins page.
## exec
For embedded plugins, the `exec` field is a list with the first element being the path to the Javascript file that will be executed. It is expected that the path to the Javascript file is relative to the directory of the plugin configuration file.