plugin.configDialog

Massimo Melina committed May 2, 2022 at 11:55 UTC c23a38c0c24bf620d4be3053430f9339bc817aea
3 files changed +10 -2
admin/src/PluginsPage.ts
+1
@@ -73,6 +73,7 @@ export default function PluginsPage() {
73 title: `${id} configuration`,
74 fields: [ h(Box, {}, row.description), ...makeFields(config) ],
75 values: pl.config,
76 + ...row.configDialog,
77 })
78 if (values)
79 await apiCall('set_plugin', { id, config: values })
dev-plugins.md
+4
@@ -25,6 +25,8 @@ Let's first look at the things you can return:
25
26 ## Things a plugin can return or export
27
28 +All the following properties are essentially optional.
29 +
30 - `description: string` try to explain what this plugin is for. This must go in `exports` and use "double quotes".
31 - `version: number` use progressive numbers to distinguish each release. This must go in `exports`.
32 - `frontend_css: string | string[]` path to one or more css files that you want the frontend to load. These are to be placed in the `public` folder (refer below).
@@ -56,6 +58,8 @@ Let's first look at the things you can return:
58 ```
59 When necessary your plugin will read its value using `api.getConfig('message')`.
60
61 +- `configDialog: FormDialog` object to override dialog options. Please refer to sources for details.
62 +
63 ### FieldDescriptor
64
65 Currently, these properties are supported:
plugins/antibrute/plugin.js
+5 -2
@@ -3,8 +3,11 @@ exports.description = "Introduce increasing delays between login attempts."
3 exports.apiRequired = 3 // log
4
5 exports.config = {
6 - increment: { type: 'number', min: 1, defaultValue: 5, md: 6, helperText: "Seconds to add to the delay for each login attempt" },
7 - max: { type: 'number', min: 1, defaultValue: 60, md: 6, helperText: "Max seconds to delay before next login is allowed" },
6 + increment: { type: 'number', min: 1, defaultValue: 5, helperText: "Seconds to add to the delay for each login attempt" },
7 + max: { type: 'number', min: 1, defaultValue: 60, helperText: "Max seconds to delay before next login is allowed" },
8 +}
9 +exports.configDialog = {
10 + maxWidth: 'sm',
11 }
12
13 const byIp = {}