mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 09:01:54 +08:00
feat: merge upstream master - version 4.94
Merge upstream PiKVM master branch updates: - Bump version from 4.93 to 4.94 - HID: improved jiggler pattern for better compatibility - Streamer: major refactoring for improved performance and maintainability - Prometheus: tidying GPIO channel name formatting - Web: added __gpio-label class for custom styling - HID: customizable /api/hid/print delay configuration - ATX: independent power/reset regions for better control - OLED: added --fill option for display testing - Web: improved keyboard handling in modal dialogs - Web: enhanced login error messages - Switch: added heartbeat functionality - Web: mouse touch code simplification and refactoring - Configs: use systemd-networkd-wait-online --any by default - PKGBUILD: use cp -r to install systemd units properly - Various bug fixes and performance improvements
This commit is contained in:
@@ -27,12 +27,14 @@ import multiprocessing.queues
|
||||
import queue
|
||||
import shlex
|
||||
|
||||
from typing import Generator
|
||||
from typing import TypeVar
|
||||
|
||||
|
||||
# =====
|
||||
def remap(value: int, in_min: int, in_max: int, out_min: int, out_max: int) -> int:
|
||||
return int((value - in_min) * (out_max - out_min) // (in_max - in_min) + out_min)
|
||||
result = int((value - in_min) * (out_max - out_min) // ((in_max - in_min) or 1) + out_min)
|
||||
return min(max(result, out_min), out_max)
|
||||
|
||||
|
||||
# =====
|
||||
@@ -81,3 +83,13 @@ def build_cmd(cmd: list[str], cmd_remove: list[str], cmd_append: list[str]) -> l
|
||||
*filter((lambda item: item not in cmd_remove), cmd[1:]),
|
||||
*cmd_append,
|
||||
]
|
||||
|
||||
|
||||
# =====
|
||||
def passwds_splitted(text: str) -> Generator[tuple[int, str], None, None]:
|
||||
for (lineno, line) in enumerate(text.split("\n")):
|
||||
line = line.rstrip("\r")
|
||||
ls = line.strip()
|
||||
if len(ls) == 0 or ls.startswith("#"):
|
||||
continue
|
||||
yield (lineno, line)
|
||||
|
||||
Reference in New Issue
Block a user