-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathplugin.schema.json
More file actions
418 lines (418 loc) · 13 KB
/
Copy pathplugin.schema.json
File metadata and controls
418 lines (418 loc) · 13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/oliverbravery/PrintGuard/main/plugins/plugin.schema.json",
"title": "PrintGuard plugin",
"description": "The manifest of a PrintGuard plugin. See https://github.com/oliverbravery/PrintGuard/blob/main/docs/plugins.md",
"type": "object",
"required": [
"id",
"version"
],
"additionalProperties": false,
"properties": {
"$schema": {
"type": "string"
},
"id": {
"type": "string",
"pattern": "^[a-z0-9][a-z0-9-]{1,38}[a-z0-9]$",
"description": "Identifies the plugin everywhere, 3 to 40 lowercase letters, digits or hyphens."
},
"name": {
"type": "string",
"description": "Shown on the panel and in Settings. Defaults to the id."
},
"version": {
"type": "string",
"pattern": "^[\\w.+-]{1,32}$",
"description": "Your own version, shown beside the name."
},
"description": {
"type": "string",
"maxLength": 400,
"description": "One line about what it does."
},
"author": {
"type": "string",
"maxLength": 80
},
"homepage": {
"type": "string",
"maxLength": 200,
"format": "uri"
},
"permissions": {
"type": "array",
"uniqueItems": true,
"description": "What it asks for. The user accepts all of it or none of it before the plugin can be enabled.",
"items": {
"anyOf": [
{
"const": "state:read",
"description": "Monitor names, scores and alerts, camera and printer status."
},
{
"const": "camera:view",
"description": "Show a live feed in its panel."
},
{
"const": "monitor:control",
"description": "Enable, disable and retune any monitor."
},
{
"const": "monitor:manage",
"description": "Add monitors, and delete them with their history."
},
{
"const": "camera:control",
"description": "Change any camera's picture and frame rate."
},
{
"const": "camera:manage",
"description": "Add and delete cameras."
},
{
"const": "camera:frames",
"description": "Take a still from any camera. With net, it can send your pictures anywhere."
},
{
"const": "history:read",
"description": "Every monitor's score history and past alerts."
},
{
"const": "printer:manage",
"description": "Add and delete printers. It can set credentials, not read them."
},
{
"const": "settings",
"description": "Change anything in Settings. It can set credentials, not read them."
},
{
"const": "tokens",
"description": "Mint and revoke API tokens. It never sees the secret."
},
{
"const": "printer:control",
"description": "Pause, resume and cancel any print."
},
{
"const": "notify",
"description": "Show a message in the dashboard."
},
{
"const": "sound",
"description": "Play a sound on this device."
},
{
"const": "alert:send",
"description": "Send through your ntfy, Pushover, Telegram or Discord."
},
{
"const": "net",
"description": "Reach the addresses it lists."
},
{
"const": "net:local",
"description": "Reach this machine and the network around it."
},
{
"const": "oauth",
"description": "Sign you in to a service. PrintGuard holds the tokens."
},
{
"const": "background",
"description": "Put a picture behind the dashboard."
},
{
"const": "link:provide",
"description": "Answer other plugins on the channels it lists."
},
{
"const": "link:consume",
"description": "Call the plugins and channels it names."
},
{
"const": "routes",
"description": "Serve pages under /plugins/<id>/, reading your session cookie."
},
{
"const": "gate",
"description": "Approve or refuse every request to the hub. It can lock you out."
}
]
}
},
"reasons": {
"type": "object",
"description": "Why it wants each permission, in your own words, shown when the user is asked to accept them. One line per permission, and every one it asks for needs one.",
"propertyNames": {
"enum": [
"state:read",
"camera:view",
"monitor:control",
"monitor:manage",
"camera:control",
"camera:manage",
"camera:frames",
"history:read",
"printer:manage",
"settings",
"tokens",
"printer:control",
"notify",
"sound",
"alert:send",
"net",
"net:local",
"oauth",
"background",
"link:provide",
"link:consume",
"routes",
"gate"
]
},
"additionalProperties": {
"type": "string",
"minLength": 1,
"maxLength": 200
}
},
"secrets": {
"type": "object",
"description": "Credentials you need but never see. PrintGuard draws a form for these, and you reference one as {{secret.name}} in a ctx.http request. Each line says what the user should paste in.",
"propertyNames": {
"pattern": "^[a-z0-9_-]{1,40}$"
},
"additionalProperties": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"maxProperties": 8
},
"provides": {
"type": "object",
"description": "Channels other plugins may ask you for, or hear you publish on. Needs the link:provide permission, and each line says what the channel answers.",
"propertyNames": {
"pattern": "^[a-z0-9][a-z0-9-]{0,38}[a-z0-9]$"
},
"additionalProperties": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"maxProperties": 8
},
"consumes": {
"type": "array",
"uniqueItems": true,
"maxItems": 16,
"description": "The plugins and channels you call or listen to, each written plugin-id:channel. Needs the link:consume permission, and you reach nothing you do not name here.",
"items": {
"type": "string",
"pattern": "^([a-z0-9][a-z0-9-]{1,38}[a-z0-9]):([a-z0-9][a-z0-9-]{0,38}[a-z0-9])$"
}
},
"oauth": {
"type": "object",
"description": "Sign the user in to a service and hold the tokens for you. Needs the oauth permission, and the access token arrives as {{secret.oauth}}. No client id here: whoever installs the plugin registers their own app and PrintGuard asks them for it.",
"required": [
"authorize_url",
"token_url"
],
"additionalProperties": false,
"properties": {
"authorize_url": {
"type": "string",
"format": "uri",
"description": "Where the user is sent to sign in."
},
"token_url": {
"type": "string",
"format": "uri",
"description": "Where the code is exchanged for tokens."
},
"register_url": {
"type": "string",
"format": "uri",
"maxLength": 200,
"description": "Where the user goes to register their own app, shown alongside the redirect URI to give it."
},
"scopes": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
}
},
"label": {
"type": "string",
"maxLength": 80,
"description": "What the service is called, shown when the user is asked. Defaults to the authorize host."
}
}
},
"surfaces": {
"type": "array",
"uniqueItems": true,
"description": "Where plugin.js draws. Defaults to a dashboard panel.",
"items": {
"anyOf": [
{
"const": "panel",
"description": "A panel of its own on the dashboard."
},
{
"const": "monitor",
"description": "Drawn on every monitor tile, once per monitor."
},
{
"const": "settings",
"description": "Drawn in every monitor's settings, once per monitor."
}
]
}
},
"platforms": {
"type": "array",
"uniqueItems": true,
"description": "Where it runs. Leave it out for everywhere, and name a bare platform to cover its variants.",
"items": {
"anyOf": [
{
"const": "docker",
"description": "Docker"
},
{
"const": "docker-nvidia",
"description": "NVIDIA image"
},
{
"const": "docker-intel",
"description": "Intel image"
},
{
"const": "macos",
"description": "macOS"
},
{
"const": "windows",
"description": "Windows"
},
{
"const": "browser",
"description": "Browser"
}
]
}
},
"icon": {
"type": "string",
"pattern": "^[a-z0-9][\\w-]*(?:/[\\w-]+)*\\.(?:png|jpe?g|webp|gif|svg)$",
"description": "An image in your plugin's folder shown beside its name in the catalogue and the installed list. Square reads best. Read from your repository at the pinned commit, or carried inside a zip install."
},
"media": {
"type": "array",
"uniqueItems": true,
"maxItems": 8,
"description": "Screenshots or GIFs in your plugin's folder, shown as a gallery on your page. Read from your repository at the pinned commit, or carried inside a zip install.",
"items": {
"type": "string",
"pattern": "^[a-z0-9][\\w-]*(?:/[\\w-]+)*\\.(?:png|jpe?g|webp|gif|svg)$"
}
},
"assets": {
"type": "array",
"uniqueItems": true,
"description": "Files it ships beside its code, each named here and sitting next to plugin.js.",
"items": {
"type": "string",
"pattern": "^[a-z0-9][a-z0-9._-]{0,39}\\.(csv|gif|jpeg|jpg|json|mp3|mp4|ogg|png|txt|wav|webm|webp)$"
}
},
"urls": {
"type": "array",
"uniqueItems": true,
"description": "The only addresses ctx.http and ctx.socket may reach, each a match pattern of scheme://host/path. Naming a private or loopback address needs the net:local permission as well as net.",
"items": {
"type": "string",
"pattern": "^(?P<scheme>\\*|http|https|ws|wss|rtsp|rtsps)://(?P<host>\\*|(?:\\*\\.)?[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?|\\[[0-9a-f:]+\\])(?::(?P<port>\\*|\\d{1,5}))?(?P<path>/[^\\s]*)$"
}
},
"events": {
"type": "array",
"uniqueItems": true,
"description": "The engine events that wake worker.js.",
"items": {
"anyOf": [
{
"const": "http",
"description": "Carries tag, status, body."
},
{
"const": "frame",
"description": "Carries camera_id, jpeg."
},
{
"const": "call",
"description": "Carries from, channel, body, call_id."
},
{
"const": "answer",
"description": "Carries tag, from, channel, body."
},
{
"const": "message",
"description": "Carries from, channel, body."
},
{
"const": "history",
"description": "Carries monitor_id, now, buckets, alerts, stats."
},
{
"const": "socket",
"description": "Carries tag, state, text."
},
{
"const": "result",
"description": "Carries monitor_id, camera_id, score, prediction, margin, ms, ts."
},
{
"const": "alert",
"description": "Carries monitor_id, score, action, ts."
},
{
"const": "warning",
"description": "Carries monitor_id, message, recovered."
},
{
"const": "device",
"description": "Carries printer_id, status, progress, job."
},
{
"const": "error",
"description": "Carries message."
},
{
"const": "state",
"description": "The snapshot your permissions allow."
}
]
}
},
"tick_s": {
"type": "number",
"description": "Run worker.js this often as well, in seconds. 0, or 5 at the least.",
"anyOf": [
{
"const": 0
},
{
"minimum": 5.0,
"maximum": 86400
}
]
}
}
}