feat: Refactor settings management into a dedicated page with new configuration options

This commit is contained in:
zimplexing
2025-07-11 13:49:45 +08:00
parent 7b3fd4b9d5
commit fc8da352fb
13 changed files with 596 additions and 157 deletions

View File

@@ -119,11 +119,6 @@ class RemoteControlService {
public async startServer(): Promise<string> {
console.log('[RemoteControl] Attempting to start server...');
if (this.httpServer.getIsRunning()) {
console.log('[RemoteControl] Server is already running.');
throw new Error('Server is already running.');
}
try {
const url = await this.httpServer.start();
console.log(`[RemoteControl] Server started successfully at: ${url}`);

View File

@@ -96,10 +96,6 @@ class TCPHttpServer {
}
public async start(): Promise<string> {
if (this.isRunning) {
throw new Error('Server is already running');
}
const netState = await NetInfo.fetch();
let ipAddress: string | null = null;
@@ -111,6 +107,11 @@ class TCPHttpServer {
throw new Error('无法获取IP地址请确认设备已连接到WiFi或以太网。');
}
if (this.isRunning) {
console.log('[TCPHttpServer] Server is already running.');
return `http://${ipAddress}:${PORT}`;
}
return new Promise((resolve, reject) => {
try {
this.server = TcpSocket.createServer((socket: TcpSocket.Socket) => {