diff --git a/src/index.ts b/src/index.ts index e0e523c..930d8c3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,6 +2,7 @@ import { app } from './app.ts' export { app, db } from './app.ts'; export { Core } from './playwright/core.ts'; import './routes/index.ts'; +import { RemoteApp } from '@kevisual/remote-app' // 如果是直接运行,则启动应用 // better-sqlite3 不支持 bun // playwright 也不支持 bun @@ -25,4 +26,19 @@ if (import.meta.main || isPm2) { export const browserAgentPlugin = createRouterAgentPluginFn({ // router: app., router: app, -}) \ No newline at end of file +}) +const token = process.env.KEVISUAL_TOKEN || ''; + +const remoteApp = new RemoteApp({ + id: 'browser-helper', + url: 'https://kevisual.cn/ws/proxy', + token: token, + app: app, +}) +const connect = await remoteApp.isConnect() +if (connect) { + console.log('Remote app connected successfully!'); + remoteApp.listenProxy() +} else { + console.error('Failed to connect remote app. Please check your token and network connection.'); +} \ No newline at end of file