mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
pc -> server
This commit is contained in:
@@ -30,7 +30,7 @@ class IsNotOperationalError(MassStorageError):
|
||||
|
||||
class AlreadyConnectedToPcError(MassStorageError):
|
||||
def __init__(self) -> None:
|
||||
super().__init__("Mass-storage is already connected to PC")
|
||||
super().__init__("Mass-storage is already connected to Server")
|
||||
|
||||
|
||||
class AlreadyConnectedToKvmError(MassStorageError):
|
||||
@@ -180,12 +180,12 @@ class MassStorageDevice: # pylint: disable=too-many-instance-attributes
|
||||
raise AlreadyConnectedToPcError()
|
||||
# TODO: enable gpio
|
||||
self.__device_info = None
|
||||
get_logger().info("Mass-storage device switched to PC")
|
||||
get_logger().info("Mass-storage device switched to Server")
|
||||
|
||||
def get_state(self) -> Dict:
|
||||
return {
|
||||
"in_operate": bool(self._bind),
|
||||
"connected_to": ("kvm" if self.__device_info else "pc"),
|
||||
"connected_to": ("kvm" if self.__device_info else "server"),
|
||||
"is_busy": bool(self._device_file),
|
||||
"writed": self.__writed,
|
||||
"info": (self.__device_info._asdict() if self.__device_info else None),
|
||||
|
||||
@@ -159,9 +159,9 @@ class Server: # pylint: disable=too-many-instance-attributes
|
||||
if to == "kvm":
|
||||
await self.__msd.connect_to_kvm()
|
||||
await self.__broadcast_event("msd_state", state="connected_to_kvm") # type: ignore
|
||||
elif to == "pc":
|
||||
elif to == "server":
|
||||
await self.__msd.connect_to_pc()
|
||||
await self.__broadcast_event("msd_state", state="connected_to_pc") # type: ignore
|
||||
await self.__broadcast_event("msd_state", state="connected_to_server") # type: ignore
|
||||
else:
|
||||
raise RuntimeError("Missing or invalid 'to=%s'" % (to))
|
||||
return _json_200(self.__msd.get_state())
|
||||
|
||||
Reference in New Issue
Block a user