Plugin API Reference¶
This page shows the available public API available for plugins to access.
You can access them by importing them like this:
Variables¶
Route Decorators¶
used to ensure the app has not gone through setup wizard, aborting to 404 if it has.
Source code in web_portal/core/auth.py
used the same as login_required but checks whether user is admin
Source code in web_portal/core/auth.py
login is required if public access is disabled, otherwise skip
Source code in web_portal/core/auth.py
Used to decorate a Quart response, allowing redirects to a provided back_to request arg
Source code in web_portal/core/helpers.py
Settings Access¶
Gets a plugin's system setting stored in db or from cache
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plugin_name
|
str
|
The plugin's internal name |
required |
key
|
str
|
The setting's key |
required |
default
|
Any | None
|
The default value to use if no setting was found, defaults to None |
None
|
skip_cache
|
bool
|
Whether the skip cache and load from db directly, defaults to False |
False
|
Returns:
| Type | Description |
|---|---|
Any | None
|
The loaded value or None |
Source code in web_portal/core/plugin.py
Set a plugin's system setting stored in db and updates cache
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plugin_name
|
str
|
The plugin's internal name |
required |
key
|
str
|
The setting's key |
required |
value
|
Any
|
Value to update setting to |
required |
Source code in web_portal/core/plugin.py
Removes a set plugin's system setting stored in db and cache
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plugin_name
|
str
|
The plugin's internal name |
required |
key
|
str
|
The setting's key |
required |
Source code in web_portal/core/plugin.py
Widget Access¶
Used for storing information about a widget, returned by get_widget_details()
Source code in web_portal/core/plugin.py
Get a widgets details
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
widget_id
|
int
|
The widgets id |
required |
Returns:
| Type | Description |
|---|---|
WidgetDetails
|
The details |
Source code in web_portal/core/plugin.py
Plugin¶
Class used when creating a plugin, stores all information about a plugin and what it supports.
Source code in web_portal/core/plugin.py
is_supported_version(app_version)
¶
Check whether the version requirement matches the given app version
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app_version
|
str
|
The app version, given as a semantic version number |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether it is supported |
Source code in web_portal/core/plugin.py
Get a plugins's data path for storing persistant data outside of the database, path will be created if not exists when this function is run
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
plugin_name
|
str
|
The plugin's internal name |
required |
Returns:
| Type | Description |
|---|---|
Path
|
The data path |