fix: 修复 rtsp 和 RustDesk 扩展启停错误;修改部分参数描述文本

This commit is contained in:
mofeng-git
2026-05-23 15:16:39 +00:00
parent 3de72677e6
commit dc6475776e
10 changed files with 271 additions and 457 deletions

View File

@@ -2,85 +2,51 @@
Generated by typeshare 1.13.4
*/
/** Authentication configuration */
export interface AuthConfig {
/** Session timeout in seconds */
session_timeout_secs: number;
/** Allow multiple concurrent web sessions (single-user mode) */
single_user_allow_multiple_sessions: boolean;
/** Enable 2FA */
totp_enabled: boolean;
/** TOTP secret (encrypted) */
totp_secret?: string;
}
/** Video capture configuration */
export interface VideoConfig {
/** Video device path (e.g., /dev/video0) */
device?: string;
/** Video pixel format (e.g., "MJPEG", "YUYV", "NV12") */
format?: string;
/** Resolution width */
width: number;
/** Resolution height */
height: number;
/** Frame rate */
fps: number;
/** JPEG quality (1-100) */
quality: number;
}
/** HID backend type */
export enum HidBackend {
/** USB OTG HID gadget */
Otg = "otg",
/** CH9329 serial HID controller */
Ch9329 = "ch9329",
/** Disabled */
None = "none",
}
/** OTG USB device descriptor configuration */
export interface OtgDescriptorConfig {
/** USB Vendor ID (e.g., 0x1d6b) */
vendor_id: number;
/** USB Product ID (e.g., 0x0104) */
product_id: number;
/** Manufacturer string */
manufacturer: string;
/** Product string */
product: string;
/** Serial number (optional, auto-generated if not set) */
serial_number?: string;
}
/** OTG HID function profile */
export enum OtgHidProfile {
/** Full HID device set (keyboard + relative mouse + absolute mouse + consumer control) */
Full = "full",
/** Full HID device set without consumer control */
FullNoConsumer = "full_no_consumer",
/** Legacy profile: only keyboard */
LegacyKeyboard = "legacy_keyboard",
/** Legacy profile: only relative mouse */
LegacyMouseRelative = "legacy_mouse_relative",
/** Custom function selection */
Custom = "custom",
}
/** OTG endpoint budget policy. */
export enum OtgEndpointBudget {
/** Derive a safe default from the selected UDC. */
Auto = "auto",
/** Limit OTG gadget functions to 5 endpoints. */
Five = "five",
/** Limit OTG gadget functions to 6 endpoints. */
Six = "six",
/** Do not impose a software endpoint budget. */
Unlimited = "unlimited",
}
/** OTG HID function selection (used when profile is Custom) */
export interface OtgHidFunctions {
keyboard: boolean;
mouse_relative: boolean;
@@ -88,226 +54,104 @@ export interface OtgHidFunctions {
consumer: boolean;
}
/** HID configuration */
export interface HidConfig {
/** HID backend type */
backend: HidBackend;
/** OTG UDC (USB Device Controller) name */
otg_udc?: string;
/** OTG USB device descriptor configuration */
otg_descriptor?: OtgDescriptorConfig;
/** OTG HID function profile */
otg_profile?: OtgHidProfile;
/** OTG endpoint budget policy */
otg_endpoint_budget?: OtgEndpointBudget;
/** OTG HID function selection (used when profile is Custom) */
otg_functions?: OtgHidFunctions;
/** Enable keyboard LED/status feedback for OTG keyboard */
otg_keyboard_leds?: boolean;
/** CH9329 serial port */
ch9329_port: string;
/** CH9329 baud rate */
ch9329_baudrate: number;
/** Mouse mode: absolute or relative */
mouse_absolute: boolean;
}
/** MSD configuration */
export interface MsdConfig {
/** Enable MSD functionality */
enabled: boolean;
/** MSD base directory (absolute path) */
msd_dir: string;
}
/** Driver type for ATX key operations */
export enum AtxDriverType {
/** GPIO control via Linux character device */
Gpio = "gpio",
/** USB HID relay module */
UsbRelay = "usbrelay",
/** Serial/COM port relay (taobao LCUS type) */
Serial = "serial",
/** Disabled / Not configured */
None = "none",
}
/** Active level for GPIO pins */
export enum ActiveLevel {
/** Active high (default for most cases) */
High = "high",
/** Active low (inverted) */
Low = "low",
}
/**
* Configuration for a single ATX key (power or reset)
* This is the "four-tuple" configuration: (driver, device, pin/channel, level)
*/
export interface AtxKeyConfig {
/** Driver type (GPIO or USB Relay) */
driver: AtxDriverType;
/**
* Device path:
* - For GPIO: /dev/gpiochipX
* - For USB Relay: /dev/hidrawX
*/
device: string;
/**
* Pin or channel number:
* - For GPIO: GPIO pin number
* - For USB Relay: relay channel (0-based)
* - For Serial Relay (LCUS): relay channel (1-based)
*/
pin: number;
/** Active level (only applicable to GPIO, ignored for USB Relay) */
active_level: ActiveLevel;
/** Baud rate for serial relay (start with 9600) */
baud_rate: number;
}
/** LED sensing configuration (optional) */
export interface AtxLedConfig {
/** Whether LED sensing is enabled */
enabled: boolean;
/** GPIO chip for LED sensing */
gpio_chip: string;
/** GPIO pin for LED input */
gpio_pin: number;
/** Whether LED is active low (inverted logic) */
inverted: boolean;
}
/**
* ATX power control configuration
*
* Each ATX action (power, reset) can be independently configured with its own
* hardware binding using the four-tuple: (driver, device, pin, active_level).
*/
export interface AtxConfig {
/** Enable ATX functionality */
enabled: boolean;
/** Power button configuration (used for both short and long press) */
power: AtxKeyConfig;
/** Reset button configuration */
reset: AtxKeyConfig;
/** LED sensing configuration (optional) */
led: AtxLedConfig;
/** Network interface for WOL packets (empty = auto) */
wol_interface: string;
}
/**
* Audio configuration
*
* Note: Sample rate is fixed at 48000Hz and channels at 2 (stereo).
* These are optimal for Opus encoding and match WebRTC requirements.
*/
export interface AudioConfig {
/** Enable audio capture */
enabled: boolean;
/** ALSA device name */
device: string;
/** Audio quality preset: "voice", "balanced", "high" */
quality: string;
}
/** Stream mode */
export enum StreamMode {
/** WebRTC with H264/H265 */
WebRTC = "webrtc",
/** MJPEG over HTTP */
Mjpeg = "mjpeg",
}
/** Encoder type */
export enum EncoderType {
/** Auto-detect best encoder */
Auto = "auto",
/** Software encoder (libx264) */
Software = "software",
/** VAAPI hardware encoder */
Vaapi = "vaapi",
/** NVIDIA NVENC hardware encoder */
Nvenc = "nvenc",
/** Intel Quick Sync hardware encoder */
Qsv = "qsv",
/** AMD AMF hardware encoder */
Amf = "amf",
/** Rockchip MPP hardware encoder */
Rkmpp = "rkmpp",
/** V4L2 M2M hardware encoder */
V4l2m2m = "v4l2m2m",
}
/**
* Bitrate preset for video encoding
*
* Simplifies bitrate configuration by providing three intuitive presets
* plus a custom option for advanced users.
*/
export type BitratePreset =
/**
* Speed priority: 1 Mbps, lowest latency, smaller GOP
* Best for: slow networks, remote management, low-bandwidth scenarios
*/
| { type: "Speed", value?: undefined }
/**
* Balanced: 4 Mbps, good quality/latency tradeoff
* Best for: typical usage, recommended default
*/
| { type: "Balanced", value?: undefined }
/**
* Quality priority: 8 Mbps, best visual quality
* Best for: local network, high-bandwidth scenarios, detailed work
*/
| { type: "Quality", value?: undefined }
/** Custom bitrate in kbps (for advanced users) */
| { type: "Custom", value: number };
/** Streaming configuration */
export interface StreamConfig {
/** Stream mode */
mode: StreamMode;
/** Encoder type for H264/H265 */
encoder: EncoderType;
/** Bitrate preset (Speed/Balanced/Quality) */
bitrate_preset: BitratePreset;
/**
* Custom STUN server (e.g., "stun:stun.l.google.com:19302")
* If empty, uses public ICE servers from secrets.toml
*/
stun_server?: string;
/**
* Custom TURN server (e.g., "turn:turn.example.com:3478")
* If empty, uses public ICE servers from secrets.toml
*/
turn_server?: string;
/** TURN username */
turn_username?: string;
/** TURN password (stored encrypted in DB, not exposed via API) */
turn_password?: string;
}
/**
* Web server configuration persisted in the database (includes on-disk TLS paths).
*
* The HTTP API for `/api/config/web` uses `WebConfigResponse` instead: no path fields, includes `has_custom_cert`.
*/
export interface WebConfig {
/** HTTP port */
http_port: number;
/** HTTPS port */
https_port: number;
/** Bind addresses (preferred) */
bind_addresses: string[];
/** Bind address (legacy) */
bind_address: string;
/** Enable HTTPS */
https_enabled: boolean;
/** Custom SSL certificate path */
ssl_cert_path?: string;
/** Custom SSL key path */
ssl_key_path?: string;
}
@@ -337,74 +181,46 @@ export interface ExtensionsConfig {
easytier: EasytierConfig;
}
/** RustDesk configuration */
export interface RustDeskConfig {
/** Enable RustDesk protocol */
enabled: boolean;
/**
* Rendezvous server address (hbbs), e.g., "rs.example.com" or "192.168.1.100:21116"
* Required for RustDesk to function
*/
rendezvous_server: string;
/**
* Relay server address (hbbr), if different from rendezvous server
* Usually the same host as rendezvous server but different port (21117)
*/
relay_server?: string;
/** Device ID (9-digit number), auto-generated if empty */
device_id: string;
}
/** RTSP output codec */
export enum RtspCodec {
H264 = "h264",
H265 = "h265",
}
/** RTSP configuration */
export interface RtspConfig {
/** Enable RTSP output */
enabled: boolean;
/** Bind IP address */
bind: string;
/** RTSP TCP listen port */
port: number;
/** Stream path (without leading slash) */
path: string;
/** Allow only one client connection at a time */
allow_one_client: boolean;
/** Output codec (H264/H265) */
codec: RtspCodec;
/** Optional username for authentication */
username?: string;
}
/** Main application configuration */
export interface RedfishConfig {
enabled: boolean;
}
export interface AppConfig {
/** Whether initial setup has been completed */
initialized: boolean;
/** Authentication settings */
auth: AuthConfig;
/** Video capture settings */
video: VideoConfig;
/** HID (keyboard/mouse) settings */
hid: HidConfig;
/** Mass Storage Device settings */
msd: MsdConfig;
/** ATX power control settings */
atx: AtxConfig;
/** Audio settings */
audio: AudioConfig;
/** Streaming settings */
stream: StreamConfig;
/** Web server settings */
web: WebConfig;
/** Extensions settings (ttyd, gostc, easytier) */
extensions: ExtensionsConfig;
/** RustDesk remote access settings */
rustdesk: RustDeskConfig;
/** RTSP streaming settings */
rtsp: RtspConfig;
redfish: RedfishConfig;
}
/** Update for a single ATX key configuration */
@@ -437,13 +253,9 @@ export interface AtxConfigUpdate {
wol_interface?: string;
}
/** Available ATX devices for discovery */
export interface AtxDevices {
/** Available GPIO chips (/dev/gpiochip*) */
gpio_chips: string[];
/** Available USB HID relay devices (/dev/hidraw*) */
usb_relays: string[];
/** Available Serial ports (/dev/ttyUSB*) */
serial_ports: string[];
}
@@ -457,7 +269,6 @@ export interface AuthConfigUpdate {
single_user_allow_multiple_sessions?: boolean;
}
/** Update easytier config */
export interface EasytierConfigUpdate {
enabled?: boolean;
network_name?: string;
@@ -471,9 +282,6 @@ export type ExtensionStatus =
| { state: "stopped", data?: undefined }
| { state: "running", data: {
pid: number;
}}
| { state: "failed", data: {
error: string;
}};
export interface EasytierInfo {
@@ -516,7 +324,6 @@ export interface ExtensionsStatus {
easytier: EasytierInfo;
}
/** Update gostc config */
export interface GostcConfigUpdate {
enabled?: boolean;
addr?: string;
@@ -566,7 +373,7 @@ export interface RtspConfigResponse {
allow_one_client: boolean;
codec: RtspCodec;
username?: string;
has_password: boolean;
password?: string;
}
export interface RtspConfigUpdate {
@@ -593,7 +400,7 @@ export interface RustDeskConfigUpdate {
device_password?: string;
}
/** Stream configuration response (includes has_turn_password) */
/** Stream configuration response */
export interface StreamConfigResponse {
mode: StreamMode;
encoder: EncoderType;
@@ -605,8 +412,7 @@ export interface StreamConfigResponse {
stun_server?: string;
turn_server?: string;
turn_username?: string;
/** Indicates whether TURN password has been configured (password is not returned) */
has_turn_password: boolean;
turn_password?: string;
}
export interface StreamConfigUpdate {
@@ -629,7 +435,6 @@ export interface StreamConfigUpdate {
turn_password?: string;
}
/** Update ttyd config */
export interface TtydConfigUpdate {
enabled?: boolean;
shell?: string;
@@ -673,12 +478,6 @@ export interface WebConfigUpdate {
clear_custom_cert?: boolean;
}
/**
* Shared canonical keyboard key identifiers used across frontend and backend.
*
* The enum names intentionally mirror `KeyboardEvent.code` style values so the
* browser, virtual keyboard, and HID backend can all speak the same language.
*/
export enum CanonicalKey {
KeyA = "KeyA",
KeyB = "KeyB",