feat: 实现 RemoteApp 类以支持远程连接,添加初始化和重连逻辑;更新用户路由以支持获取用户信息
This commit is contained in:
@@ -45,6 +45,7 @@ export const runServer = async (port: number = 51015, listenPath = '127.0.0.1')
|
||||
manager.load({ runtime: 'client' }).then(() => {
|
||||
console.log('Assistant App Loaded');
|
||||
});
|
||||
manager.initRemoteApp()
|
||||
}, 1000);
|
||||
return {
|
||||
app,
|
||||
@@ -83,7 +84,7 @@ program
|
||||
|
||||
// 构建 pm2 命令字符串
|
||||
let pm2Command = `pm2 start ${escapePath(runPath)} --interpreter ${escapePath(interpreterPath)} --name ${name} -- -s`;
|
||||
|
||||
|
||||
if (port) {
|
||||
pm2Command += ` -p ${port}`;
|
||||
}
|
||||
@@ -104,7 +105,7 @@ program
|
||||
shell: true,
|
||||
windowsHide: false,
|
||||
});
|
||||
|
||||
|
||||
if (result.error) {
|
||||
console.error(chalk.red('Error starting server:'), result.error.message);
|
||||
console.log(chalk.yellow('\n提示: 请检查:'));
|
||||
@@ -113,14 +114,14 @@ program
|
||||
console.log(' 3. 尝试手动执行:', pm2Command);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
|
||||
if (result.status !== 0) {
|
||||
console.error(chalk.red(`PM2 exited with code ${result.status}`));
|
||||
console.log(chalk.yellow('\n查看详细日志:'), `pm2 logs ${name}`);
|
||||
console.log(chalk.yellow('查看进程状态:'), 'pm2 list');
|
||||
process.exit(result.status || 1);
|
||||
}
|
||||
|
||||
|
||||
console.log(chalk.green('✓ 以守护进程方式运行'));
|
||||
console.log(chalk.gray('查看日志:'), `pm2 logs ${name}`);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user