new(all): Auto import for logo, colors and website content.

This commit is contained in:
Rodrigo Rodriguez 2024-05-21 13:54:52 -03:00
parent e91c3a4e06
commit 2f570244b6
3 changed files with 13 additions and 12 deletions

1
.gitignore vendored
View file

@ -27,6 +27,5 @@ GB.log.json
yarn-error.log
package-lock.json
yarn-lock.json
packages/saas.gbapp.zip
logo.svg
screenshot.png

View file

@ -597,7 +597,7 @@ export class AzureDeployerService implements IGBInstallationDeployer {
const resChannel = await httpClient.sendRequest(req);
const key = JSON.parse(resChannel.bodyAsText).properties.properties.sites[0].key;
instance.webchatKey = key;
instance.webchatKey = key;
resolve(instance);
} catch (error) {
reject(error);

View file

@ -1002,15 +1002,6 @@ export class KBService implements IGBKBService {
if (website) {
const browser = await puppeteer.launch({ headless: false });
const page = await browser.newPage();
await page.setRequestInterception(true);
page.on('request', req => {
if (req.resourceType() === 'image' || req.resourceType() === 'stylesheet') {
req.abort();
} else {
req.continue();
}
});
await page.goto(website);
const logo = await this.getLogoByPage(page);
@ -1030,7 +1021,18 @@ export class KBService implements IGBKBService {
await min.core['setConfig'](min, 'Color1', colors[0].hex());
await min.core['setConfig'](min, 'Color2', colors[1].hex());
const maxDepth = 2; // Maximum depth of recursion
// Disables images in crawling.
await page.setRequestInterception(true);
page.on('request', req => {
if (req.resourceType() === 'image' || req.resourceType() === 'stylesheet') {
req.abort();
} else {
req.continue();
}
});
const maxDepth = 3; // Maximum depth of recursion
const visited = new Set<string>();
files = files.concat(await this.crawl(min, website, visited, 0, maxDepth, page));