mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Refactor custom_plugin method to accept arguments/body from request
This commit is contained in:
parent
bc65918fa9
commit
ad1625a867
1 changed files with 6 additions and 1 deletions
|
|
@ -1299,7 +1299,12 @@ def custom_plugin(plugin):
|
|||
try:
|
||||
# Try to get the custom plugin custom function and call it
|
||||
method = getattr(actions, plugin)
|
||||
res = method()
|
||||
if request.args:
|
||||
res = method(**request.args.to_dict())
|
||||
elif request.json:
|
||||
res = method(**request.json)
|
||||
else:
|
||||
res = method()
|
||||
except AttributeError:
|
||||
message = f'The plugin "{plugin}" does not have a "{plugin}" method'
|
||||
error = 404
|
||||
|
|
|
|||
Loading…
Reference in a new issue