mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 09:01:54 +08:00
removed processing flag
This commit is contained in:
@@ -49,13 +49,13 @@ class AtxApi:
|
|||||||
async def __power_handler(self, request: Request) -> Response:
|
async def __power_handler(self, request: Request) -> Response:
|
||||||
action = valid_atx_power_action(request.query.get("action"))
|
action = valid_atx_power_action(request.query.get("action"))
|
||||||
wait = valid_bool(request.query.get("wait", "0"))
|
wait = valid_bool(request.query.get("wait", "0"))
|
||||||
processing = await ({
|
await ({
|
||||||
"on": self.__atx.power_on,
|
"on": self.__atx.power_on,
|
||||||
"off": self.__atx.power_off,
|
"off": self.__atx.power_off,
|
||||||
"off_hard": self.__atx.power_off_hard,
|
"off_hard": self.__atx.power_off_hard,
|
||||||
"reset_hard": self.__atx.power_reset_hard,
|
"reset_hard": self.__atx.power_reset_hard,
|
||||||
}[action])(wait)
|
}[action])(wait)
|
||||||
return make_json_response({"processing": processing})
|
return make_json_response()
|
||||||
|
|
||||||
@exposed_http("POST", "/atx/click")
|
@exposed_http("POST", "/atx/click")
|
||||||
async def __click_handler(self, request: Request) -> Response:
|
async def __click_handler(self, request: Request) -> Response:
|
||||||
|
|||||||
@@ -59,16 +59,16 @@ class BaseAtx(BasePlugin):
|
|||||||
|
|
||||||
# =====
|
# =====
|
||||||
|
|
||||||
async def power_on(self, wait: bool) -> bool:
|
async def power_on(self, wait: bool) -> None:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
async def power_off(self, wait: bool) -> bool:
|
async def power_off(self, wait: bool) -> None:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
async def power_off_hard(self, wait: bool) -> bool:
|
async def power_off_hard(self, wait: bool) -> None:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
async def power_reset_hard(self, wait: bool) -> bool:
|
async def power_reset_hard(self, wait: bool) -> None:
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
# =====
|
# =====
|
||||||
|
|||||||
@@ -54,12 +54,8 @@ class Plugin(BaseAtx):
|
|||||||
|
|
||||||
# =====
|
# =====
|
||||||
|
|
||||||
async def __stub_power(self, wait: bool) -> bool:
|
async def __stub(self, wait: bool) -> None:
|
||||||
raise AtxDisabledError()
|
raise AtxDisabledError()
|
||||||
|
|
||||||
power_on = power_off = power_off_hard = power_reset_hard = __stub_power
|
power_on = power_off = power_off_hard = power_reset_hard = __stub
|
||||||
|
click_power = click_power_long = click_reset = __stub
|
||||||
async def __stub_click(self, wait: bool) -> None:
|
|
||||||
raise AtxDisabledError()
|
|
||||||
|
|
||||||
click_power = click_power_long = click_reset = __stub_click
|
|
||||||
|
|||||||
@@ -130,29 +130,21 @@ class Plugin(BaseAtx): # pylint: disable=too-many-instance-attributes
|
|||||||
|
|
||||||
# =====
|
# =====
|
||||||
|
|
||||||
async def power_on(self, wait: bool) -> bool:
|
async def power_on(self, wait: bool) -> None:
|
||||||
if not (await self.__get_power()):
|
if not (await self.__get_power()):
|
||||||
await self.click_power(wait)
|
await self.click_power(wait)
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
async def power_off(self, wait: bool) -> bool:
|
async def power_off(self, wait: bool) -> None:
|
||||||
if (await self.__get_power()):
|
if (await self.__get_power()):
|
||||||
await self.click_power(wait)
|
await self.click_power(wait)
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
async def power_off_hard(self, wait: bool) -> bool:
|
async def power_off_hard(self, wait: bool) -> None:
|
||||||
if (await self.__get_power()):
|
if (await self.__get_power()):
|
||||||
await self.click_power_long(wait)
|
await self.click_power_long(wait)
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
async def power_reset_hard(self, wait: bool) -> bool:
|
async def power_reset_hard(self, wait: bool) -> None:
|
||||||
if (await self.__get_power()):
|
if (await self.__get_power()):
|
||||||
await self.click_reset(wait)
|
await self.click_reset(wait)
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
# =====
|
# =====
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user