diff options
author | Devaev Maxim <[email protected]> | 2020-09-09 16:21:49 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2020-09-09 16:21:49 +0300 |
commit | 015baee6d719723672037b0ea738106fbd2c8198 (patch) | |
tree | 9e3c4eaf8029fe9baec611323773c7a399986cd5 /kvmd/apps | |
parent | 2d44539484c56c6300a582ea026728442d9bc618 (diff) |
sync atx api
Diffstat (limited to 'kvmd/apps')
-rw-r--r-- | kvmd/apps/kvmd/api/atx.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/kvmd/apps/kvmd/api/atx.py b/kvmd/apps/kvmd/api/atx.py index 5f1fb154..b3a287a0 100644 --- a/kvmd/apps/kvmd/api/atx.py +++ b/kvmd/apps/kvmd/api/atx.py @@ -25,6 +25,8 @@ from aiohttp.web import Response from ....plugins.atx import BaseAtx +from ....validators.basic import valid_bool + from ....validators.kvm import valid_atx_power_action from ....validators.kvm import valid_atx_button @@ -46,20 +48,22 @@ class AtxApi: @exposed_http("POST", "/atx/power") async def __power_handler(self, request: Request) -> Response: action = valid_atx_power_action(request.query.get("action")) + wait = valid_bool(request.query.get("wait", "0")) processing = await ({ "on": self.__atx.power_on, "off": self.__atx.power_off, "off_hard": self.__atx.power_off_hard, "reset_hard": self.__atx.power_reset_hard, - }[action])() + }[action])(wait) return make_json_response({"processing": processing}) @exposed_http("POST", "/atx/click") async def __click_handler(self, request: Request) -> Response: button = valid_atx_button(request.query.get("button")) + wait = valid_bool(request.query.get("wait", "0")) await ({ "power": self.__atx.click_power, "power_long": self.__atx.click_power_long, "reset": self.__atx.click_reset, - }[button])() + }[button])(wait) return make_json_response() |