mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-28 16:41:52 +08:00
init
This commit is contained in:
494
web/src/types/generated.ts
Normal file
494
web/src/types/generated.ts
Normal file
@@ -0,0 +1,494 @@
|
||||
/*
|
||||
Generated by typeshare 1.13.4
|
||||
*/
|
||||
|
||||
/** Authentication configuration */
|
||||
export interface AuthConfig {
|
||||
/** Session timeout in seconds */
|
||||
session_timeout_secs: number;
|
||||
/** 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",
|
||||
}
|
||||
|
||||
/** HID configuration */
|
||||
export interface HidConfig {
|
||||
/** HID backend type */
|
||||
backend: HidBackend;
|
||||
/** OTG keyboard device path */
|
||||
otg_keyboard: string;
|
||||
/** OTG mouse device path */
|
||||
otg_mouse: string;
|
||||
/** OTG UDC (USB Device Controller) name */
|
||||
otg_udc?: string;
|
||||
/** 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;
|
||||
/** Storage path for ISO/IMG images */
|
||||
images_path: string;
|
||||
/** Path for Ventoy bootable drive file */
|
||||
drive_path: string;
|
||||
/** Ventoy drive size in MB (minimum 1024 MB / 1 GB) */
|
||||
virtual_drive_size_mb: number;
|
||||
}
|
||||
|
||||
/** Driver type for ATX key operations */
|
||||
export enum AtxDriverType {
|
||||
/** GPIO control via Linux character device */
|
||||
Gpio = "gpio",
|
||||
/** USB HID relay module */
|
||||
UsbRelay = "usbrelay",
|
||||
/** 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)
|
||||
*/
|
||||
pin: number;
|
||||
/** Active level (only applicable to GPIO, ignored for USB Relay) */
|
||||
active_level: ActiveLevel;
|
||||
}
|
||||
|
||||
/** 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",
|
||||
}
|
||||
|
||||
/** Streaming configuration */
|
||||
export interface StreamConfig {
|
||||
/** Stream mode */
|
||||
mode: StreamMode;
|
||||
/** Encoder type for H264/H265 */
|
||||
encoder: EncoderType;
|
||||
/** Target bitrate in kbps (for H264/H265) */
|
||||
bitrate_kbps: number;
|
||||
/** GOP size */
|
||||
gop_size: number;
|
||||
/** Custom STUN server (e.g., "stun:stun.l.google.com:19302") */
|
||||
stun_server?: string;
|
||||
/** Custom TURN server (e.g., "turn:turn.example.com:3478") */
|
||||
turn_server?: string;
|
||||
/** TURN username */
|
||||
turn_username?: string;
|
||||
/** TURN password (stored encrypted in DB, not exposed via API) */
|
||||
turn_password?: string;
|
||||
}
|
||||
|
||||
/** Web server configuration */
|
||||
export interface WebConfig {
|
||||
/** HTTP port */
|
||||
http_port: number;
|
||||
/** HTTPS port */
|
||||
https_port: number;
|
||||
/** Bind address */
|
||||
bind_address: string;
|
||||
/** Enable HTTPS */
|
||||
https_enabled: boolean;
|
||||
/** Custom SSL certificate path */
|
||||
ssl_cert_path?: string;
|
||||
/** Custom SSL key path */
|
||||
ssl_key_path?: string;
|
||||
}
|
||||
|
||||
/** ttyd configuration (Web Terminal) */
|
||||
export interface TtydConfig {
|
||||
/** Enable auto-start */
|
||||
enabled: boolean;
|
||||
/** Port to listen on */
|
||||
port: number;
|
||||
/** Shell to execute */
|
||||
shell: string;
|
||||
/** Credential in format "user:password" (optional) */
|
||||
credential?: string;
|
||||
}
|
||||
|
||||
/** gostc configuration (NAT traversal based on FRP) */
|
||||
export interface GostcConfig {
|
||||
/** Enable auto-start */
|
||||
enabled: boolean;
|
||||
/** Server address (e.g., gostc.mofeng.run) */
|
||||
addr: string;
|
||||
/** Client key from GOSTC management panel */
|
||||
key: string;
|
||||
/** Enable TLS */
|
||||
tls: boolean;
|
||||
}
|
||||
|
||||
/** EasyTier configuration (P2P VPN) */
|
||||
export interface EasytierConfig {
|
||||
/** Enable auto-start */
|
||||
enabled: boolean;
|
||||
/** Network name */
|
||||
network_name: string;
|
||||
/** Network secret/password */
|
||||
network_secret: string;
|
||||
/** Peer node URLs */
|
||||
peer_urls: string[];
|
||||
/** Virtual IP address (optional, auto-assigned if not set) */
|
||||
virtual_ip?: string;
|
||||
}
|
||||
|
||||
/** Combined extensions configuration */
|
||||
export interface ExtensionsConfig {
|
||||
ttyd: TtydConfig;
|
||||
gostc: GostcConfig;
|
||||
easytier: EasytierConfig;
|
||||
}
|
||||
|
||||
/** Main application configuration */
|
||||
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;
|
||||
}
|
||||
|
||||
/** Update for a single ATX key configuration */
|
||||
export interface AtxKeyConfigUpdate {
|
||||
driver?: AtxDriverType;
|
||||
device?: string;
|
||||
pin?: number;
|
||||
active_level?: ActiveLevel;
|
||||
}
|
||||
|
||||
/** Update for LED sensing configuration */
|
||||
export interface AtxLedConfigUpdate {
|
||||
enabled?: boolean;
|
||||
gpio_chip?: string;
|
||||
gpio_pin?: number;
|
||||
inverted?: boolean;
|
||||
}
|
||||
|
||||
/** ATX configuration update request */
|
||||
export interface AtxConfigUpdate {
|
||||
enabled?: boolean;
|
||||
/** Power button configuration */
|
||||
power?: AtxKeyConfigUpdate;
|
||||
/** Reset button configuration */
|
||||
reset?: AtxKeyConfigUpdate;
|
||||
/** LED sensing configuration */
|
||||
led?: AtxLedConfigUpdate;
|
||||
/** Network interface for WOL packets (empty = auto) */
|
||||
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[];
|
||||
}
|
||||
|
||||
export interface AudioConfigUpdate {
|
||||
enabled?: boolean;
|
||||
device?: string;
|
||||
quality?: string;
|
||||
}
|
||||
|
||||
/** Update easytier config */
|
||||
export interface EasytierConfigUpdate {
|
||||
enabled?: boolean;
|
||||
network_name?: string;
|
||||
network_secret?: string;
|
||||
peer_urls?: string[];
|
||||
virtual_ip?: string;
|
||||
}
|
||||
|
||||
/** Extension running status */
|
||||
export type ExtensionStatus =
|
||||
/** Binary not found at expected path */
|
||||
| { state: "unavailable", data?: undefined }
|
||||
/** Extension is stopped */
|
||||
| { state: "stopped", data?: undefined }
|
||||
/** Extension is running */
|
||||
| { state: "running", data: {
|
||||
/** Process ID */
|
||||
pid: number;
|
||||
}}
|
||||
/** Extension failed to start */
|
||||
| { state: "failed", data: {
|
||||
/** Error message */
|
||||
error: string;
|
||||
}};
|
||||
|
||||
/** easytier extension info */
|
||||
export interface EasytierInfo {
|
||||
/** Whether binary exists */
|
||||
available: boolean;
|
||||
/** Current status */
|
||||
status: ExtensionStatus;
|
||||
/** Configuration */
|
||||
config: EasytierConfig;
|
||||
}
|
||||
|
||||
/** Extension info with status and config */
|
||||
export interface ExtensionInfo {
|
||||
/** Whether binary exists */
|
||||
available: boolean;
|
||||
/** Current status */
|
||||
status: ExtensionStatus;
|
||||
}
|
||||
|
||||
/** Extension identifier (fixed set of supported extensions) */
|
||||
export enum ExtensionId {
|
||||
/** Web terminal (ttyd) */
|
||||
Ttyd = "ttyd",
|
||||
/** NAT traversal client (gostc) */
|
||||
Gostc = "gostc",
|
||||
/** P2P VPN (easytier) */
|
||||
Easytier = "easytier",
|
||||
}
|
||||
|
||||
/** Extension logs response */
|
||||
export interface ExtensionLogs {
|
||||
id: ExtensionId;
|
||||
logs: string[];
|
||||
}
|
||||
|
||||
/** ttyd extension info */
|
||||
export interface TtydInfo {
|
||||
/** Whether binary exists */
|
||||
available: boolean;
|
||||
/** Current status */
|
||||
status: ExtensionStatus;
|
||||
/** Configuration */
|
||||
config: TtydConfig;
|
||||
}
|
||||
|
||||
/** gostc extension info */
|
||||
export interface GostcInfo {
|
||||
/** Whether binary exists */
|
||||
available: boolean;
|
||||
/** Current status */
|
||||
status: ExtensionStatus;
|
||||
/** Configuration */
|
||||
config: GostcConfig;
|
||||
}
|
||||
|
||||
/** All extensions status response */
|
||||
export interface ExtensionsStatus {
|
||||
ttyd: TtydInfo;
|
||||
gostc: GostcInfo;
|
||||
easytier: EasytierInfo;
|
||||
}
|
||||
|
||||
/** Update gostc config */
|
||||
export interface GostcConfigUpdate {
|
||||
enabled?: boolean;
|
||||
addr?: string;
|
||||
key?: string;
|
||||
tls?: boolean;
|
||||
}
|
||||
|
||||
export interface HidConfigUpdate {
|
||||
backend?: HidBackend;
|
||||
ch9329_port?: string;
|
||||
ch9329_baudrate?: number;
|
||||
otg_udc?: string;
|
||||
mouse_absolute?: boolean;
|
||||
}
|
||||
|
||||
export interface MsdConfigUpdate {
|
||||
enabled?: boolean;
|
||||
images_path?: string;
|
||||
drive_path?: string;
|
||||
virtual_drive_size_mb?: number;
|
||||
}
|
||||
|
||||
/** Stream 配置响应(包含 has_turn_password 字段) */
|
||||
export interface StreamConfigResponse {
|
||||
mode: StreamMode;
|
||||
encoder: EncoderType;
|
||||
bitrate_kbps: number;
|
||||
gop_size: number;
|
||||
stun_server?: string;
|
||||
turn_server?: string;
|
||||
turn_username?: string;
|
||||
/** 指示是否已设置 TURN 密码(实际密码不返回) */
|
||||
has_turn_password: boolean;
|
||||
}
|
||||
|
||||
export interface StreamConfigUpdate {
|
||||
mode?: StreamMode;
|
||||
encoder?: EncoderType;
|
||||
bitrate_kbps?: number;
|
||||
gop_size?: number;
|
||||
/** STUN server URL (e.g., "stun:stun.l.google.com:19302") */
|
||||
stun_server?: string;
|
||||
/** TURN server URL (e.g., "turn:turn.example.com:3478") */
|
||||
turn_server?: string;
|
||||
/** TURN username */
|
||||
turn_username?: string;
|
||||
/** TURN password */
|
||||
turn_password?: string;
|
||||
}
|
||||
|
||||
/** Update ttyd config */
|
||||
export interface TtydConfigUpdate {
|
||||
enabled?: boolean;
|
||||
port?: number;
|
||||
shell?: string;
|
||||
credential?: string;
|
||||
}
|
||||
|
||||
/** Simple ttyd status for console view */
|
||||
export interface TtydStatus {
|
||||
available: boolean;
|
||||
running: boolean;
|
||||
}
|
||||
|
||||
export interface VideoConfigUpdate {
|
||||
device?: string;
|
||||
format?: string;
|
||||
width?: number;
|
||||
height?: number;
|
||||
fps?: number;
|
||||
quality?: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user