Skip to content

Commit

Permalink
new(all): Auto import for logo, colors and website content.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodrigo Rodriguez committed May 21, 2024
1 parent e91c3a4 commit 2f57024
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,5 @@ GB.log.json
yarn-error.log
package-lock.json
yarn-lock.json
packages/saas.gbapp.zip
logo.svg
screenshot.png
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
22 changes: 12 additions & 10 deletions packages/kb.gbapp/services/KBService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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));

Expand Down

0 comments on commit 2f57024

Please sign in to comment.