From babde3fa6c224851701b34fa827ee99d3956c58c Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Wed, 21 Aug 2024 15:40:08 -0300 Subject: [PATCH] fix(all): TRUE multicloud. --- packages/core.gbapp/services/GBMinService.ts | 6 +++--- src/webapp.ts | 21 ++++++++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 src/webapp.ts diff --git a/packages/core.gbapp/services/GBMinService.ts b/packages/core.gbapp/services/GBMinService.ts index 254122b8..f0eb1ce3 100644 --- a/packages/core.gbapp/services/GBMinService.ts +++ b/packages/core.gbapp/services/GBMinService.ts @@ -170,9 +170,6 @@ export class GBMinService { await CollectionUtil.asyncForEach( instances, (async instance => { - if (!GBConfigService.get('STORAGE_NAME')) { - startRouter(GBServer.globals.server, instance.botId); - } try { GBLog.info(`Mounting ${instance.botId}...`); @@ -270,6 +267,8 @@ export class GBMinService { * installing all BASIC artifacts from .gbdialog and OAuth2. */ public async mountBot(instance: IGBInstance) { + + // Build bot adapter. const { min, adapter, conversationState } = await this.buildBotAdapter( @@ -773,6 +772,7 @@ export class GBMinService { : GBConfigService.get('MARKETPLACE_SECRET') }; if (!GBConfigService.get('STORAGE_NAME')) { + startRouter(GBServer.globals.server, instance.botId); config['clientOptions'] = { baseUri: `http://localhost:${process.env.PORT}` }; } diff --git a/src/webapp.ts b/src/webapp.ts new file mode 100644 index 00000000..03dc804b --- /dev/null +++ b/src/webapp.ts @@ -0,0 +1,21 @@ +import { GBConfigService } from "../packages/core.gbapp/services/GBConfigService"; + +const { app, BrowserWindow } = require('electron'); +const path = require('path'); +const url = require('url'); + +function createWindow() { + // Create the browser window. + const win = new BrowserWindow({ width: 800, height: 600 }); + + // and load the index.html of the app. + win.loadURL( + url.format({ + pathname: path.join(__dirname, `http://localhost:${GBConfigService.get('PORT')}`), + protocol: 'file:', + slashes: true + }) + ); +} + +app.on('ready', createWindow);