new(all): Auto import for logo, colors and website content.
This commit is contained in:
parent
e91c3a4e06
commit
2f570244b6
3 changed files with 13 additions and 12 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -27,6 +27,5 @@ GB.log.json
|
||||||
yarn-error.log
|
yarn-error.log
|
||||||
package-lock.json
|
package-lock.json
|
||||||
yarn-lock.json
|
yarn-lock.json
|
||||||
packages/saas.gbapp.zip
|
|
||||||
logo.svg
|
logo.svg
|
||||||
screenshot.png
|
screenshot.png
|
||||||
|
|
|
@ -597,7 +597,7 @@ export class AzureDeployerService implements IGBInstallationDeployer {
|
||||||
const resChannel = await httpClient.sendRequest(req);
|
const resChannel = await httpClient.sendRequest(req);
|
||||||
const key = JSON.parse(resChannel.bodyAsText).properties.properties.sites[0].key;
|
const key = JSON.parse(resChannel.bodyAsText).properties.properties.sites[0].key;
|
||||||
instance.webchatKey = key;
|
instance.webchatKey = key;
|
||||||
instance.webchatKey = key;
|
|
||||||
resolve(instance);
|
resolve(instance);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
reject(error);
|
reject(error);
|
||||||
|
|
|
@ -1002,15 +1002,6 @@ export class KBService implements IGBKBService {
|
||||||
if (website) {
|
if (website) {
|
||||||
const browser = await puppeteer.launch({ headless: false });
|
const browser = await puppeteer.launch({ headless: false });
|
||||||
const page = await browser.newPage();
|
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);
|
await page.goto(website);
|
||||||
|
|
||||||
const logo = await this.getLogoByPage(page);
|
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, 'Color1', colors[0].hex());
|
||||||
await min.core['setConfig'](min, 'Color2', colors[1].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>();
|
const visited = new Set<string>();
|
||||||
files = files.concat(await this.crawl(min, website, visited, 0, maxDepth, page));
|
files = files.concat(await this.crawl(min, website, visited, 0, maxDepth, page));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue