Skip to content

Commit 8303765

Browse files
committed
plugins params
1 parent 80d3ac3 commit 8303765

2 files changed

Lines changed: 60 additions & 0 deletions

File tree

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,3 +103,62 @@ SYSTEM_DEPS_DAV1D_BUILD_INTERNAL=auto
103103

104104
## run with watch
105105
cargo watch -c -w src -x "run --bin redseat-rust"
106+
107+
# Plugin Settings
108+
109+
## Parameter Definitions
110+
111+
Plugins can define configurable parameters via the `params` field in `PluginInformation`. These parameter definitions are exposed through the `GET /plugins` endpoint.
112+
113+
Each parameter includes:
114+
- `name`: Parameter identifier
115+
- `param`: Type and default value (one of: `text`, `url`, `integer`, `uInteger`, `float`)
116+
- `description`: Human-readable description
117+
- `required`: Whether the parameter must be set
118+
119+
Example response from `GET /plugins`:
120+
```json
121+
{
122+
"id": "jackett_lookup",
123+
"name": "jackett_lookup",
124+
"params": [
125+
{
126+
"name": "base_url",
127+
"param": { "url": "http://localhost:9117" },
128+
"description": "Jackett server base URL",
129+
"required": false
130+
}
131+
],
132+
"credentialType": { "type": "token" },
133+
...
134+
}
135+
```
136+
137+
## Credentials and User Settings
138+
139+
User-configured values for plugin parameters are stored in the `Credential` object, not in the plugin itself.
140+
141+
The relationship works as follows:
142+
1. `Plugin.params` → Parameter **definitions** (schema, types, defaults)
143+
2. `Plugin.credential` → ID reference to a `Credential`
144+
3. `Credential.settings` → User-configured **values** (JSON object)
145+
146+
To get a plugin's configured values:
147+
1. Fetch the plugin via `GET /plugins/:id` to get the `credential` ID
148+
2. Fetch the credential via `GET /credentials/:id` to get the `settings` values
149+
150+
Example credential with user settings:
151+
```json
152+
{
153+
"id": "cred_abc123",
154+
"name": "My Jackett",
155+
"source": "jackett_lookup",
156+
"type": "token",
157+
"settings": {
158+
"base_url": "http://192.168.1.100:9117"
159+
},
160+
...
161+
}
162+
```
163+
164+
The `settings` field contains the user's values for the parameters defined in `Plugin.params`.

src/model/plugins/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ impl ModelController {
3636
if let Some(existing) = existing {
3737
existing.description = plugin.infos.description.clone();
3838
existing.credential_type = plugin.infos.credential_kind.clone();
39+
existing.params = plugin.infos.settings.clone();
3940
} else {
4041
installed_plugins.push(plugin.into());
4142

0 commit comments

Comments
 (0)