new(all): Auto import for logo, colors and website content.
This commit is contained in:
parent
d6578de4fd
commit
e18094fd5e
1 changed files with 1 additions and 2 deletions
|
@ -859,8 +859,7 @@ export class KBService implements IGBKBService {
|
||||||
if (response.headers && response.status() === 200) {
|
if (response.headers && response.status() === 200) {
|
||||||
const contentType = response.headers()['content-type'];
|
const contentType = response.headers()['content-type'];
|
||||||
if (contentType && contentType.includes('text/html')) {
|
if (contentType && contentType.includes('text/html')) {
|
||||||
let buffer = await page.content();
|
const buffer = await page.$eval('*', el => el[ 'innerText']);
|
||||||
buffer = buffer?.replace(/<[^>]*>/g, '');
|
|
||||||
const urlObj = new URL(url);
|
const urlObj = new URL(url);
|
||||||
const urlPath = urlObj.pathname.endsWith('/') ? urlObj.pathname.slice(0, -1) : urlObj.pathname; // Remove trailing slash if present
|
const urlPath = urlObj.pathname.endsWith('/') ? urlObj.pathname.slice(0, -1) : urlObj.pathname; // Remove trailing slash if present
|
||||||
let filename = urlPath.split('/').pop() || 'index'; // Get the filename from the URL path or set it to 'index.html' as default
|
let filename = urlPath.split('/').pop() || 'index'; // Get the filename from the URL path or set it to 'index.html' as default
|
||||||
|
|
Loading…
Add table
Reference in a new issue