mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-02-03 03:21:54 +08:00
pikvm/pikvm#231, pikvm/pikvm#279: pak options
This commit is contained in:
@@ -108,19 +108,22 @@ class HidApi:
|
||||
|
||||
# =====
|
||||
|
||||
@exposed_http("GET", "/hid/keymaps")
|
||||
async def __keymaps_handler(self, _: Request) -> Response:
|
||||
def get_keymaps(self) -> Dict: # Ugly hack to generate hid_keymaps_state (see server.py)
|
||||
keymaps: Set[str] = set()
|
||||
for keymap_name in os.listdir(self.__keymaps_dir_path):
|
||||
path = os.path.join(self.__keymaps_dir_path, keymap_name)
|
||||
if os.access(path, os.R_OK) and stat.S_ISREG(os.stat(path).st_mode):
|
||||
keymaps.add(keymap_name)
|
||||
return make_json_response({
|
||||
return {
|
||||
"keymaps": {
|
||||
"default": self.__default_keymap_name,
|
||||
"available": sorted(keymaps),
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
@exposed_http("GET", "/hid/keymaps")
|
||||
async def __keymaps_handler(self, _: Request) -> Response:
|
||||
return make_json_response(self.get_keymaps())
|
||||
|
||||
@exposed_http("POST", "/hid/print")
|
||||
async def __print_handler(self, request: Request) -> Response:
|
||||
|
||||
Reference in New Issue
Block a user