mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
extended msd api for future otg
This commit is contained in:
@@ -20,10 +20,13 @@
|
||||
# ========================================================================== #
|
||||
|
||||
|
||||
import re
|
||||
|
||||
from typing import Any
|
||||
|
||||
from .. import keymap
|
||||
|
||||
from . import check_not_none_string
|
||||
from . import check_string_in_list
|
||||
|
||||
from .basic import valid_number
|
||||
@@ -38,6 +41,18 @@ def valid_atx_button(arg: Any) -> str:
|
||||
return check_string_in_list(arg, "ATX button", ["power", "power_long", "reset"])
|
||||
|
||||
|
||||
def valid_msd_image_name(arg: Any) -> str:
|
||||
if len(str(arg).strip()) == 0:
|
||||
arg = None
|
||||
arg = check_not_none_string(arg, "MSD image name", strip=True)
|
||||
arg = re.sub(r"[^\w\.+@()\[\]-]", "_", arg)
|
||||
if arg == ".":
|
||||
arg = "_"
|
||||
if arg == "..":
|
||||
arg = "__"
|
||||
return arg[:255]
|
||||
|
||||
|
||||
def valid_log_seek(arg: Any) -> int:
|
||||
return int(valid_number(arg, min=0, name="log seek"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user