Add file:// support, fix timeout in NPM driver

main
Elbert Alias 4 years ago
parent 5c241d49e1
commit 7f99a67f70

@ -11194,10 +11194,8 @@
10 10
], ],
"icon": "splitbee.svg", "icon": "splitbee.svg",
"js": {
"splitbee": ""
},
"script": "^https://cdn\\.splitbee\\.io/sb\\.js", "script": "^https://cdn\\.splitbee\\.io/sb\\.js",
"js": { "splitbee": "" },
"website": "https://splitbee.io" "website": "https://splitbee.io"
}, },
"Splunk": { "Splunk": {
@ -11395,6 +11393,7 @@
"website": "https://strikingly.com" "website": "https://strikingly.com"
}, },
"Stripe": { "Stripe": {
"description": "Stripe offers online payment processing for internet businesses.",
"cats": [ "cats": [
41 41
], ],
@ -12707,10 +12706,10 @@
"website": "https://www.volusion.com" "website": "https://www.volusion.com"
}, },
"Vue.js": { "Vue.js": {
"description": "Vue is a progressive framework for building user interfaces.",
"cats": [ "cats": [
12 12
], ],
"description": "Vue is a progressive framework for building user interfaces.",
"html": "<[^>]+\\sdata-v(?:ue)?-", "html": "<[^>]+\\sdata-v(?:ue)?-",
"icon": "vue.svg", "icon": "vue.svg",
"js": { "js": {

@ -197,10 +197,9 @@ class Site {
timeout() { timeout() {
return new Promise((resolve, reject) => return new Promise((resolve, reject) =>
setTimeout( setTimeout(() => {
() => reject(new Error('The website took too long to respond')), reject(new Error('The website took too long to respond'))
this.options.maxWait }, this.options.maxWait)
)
) )
} }
@ -301,7 +300,7 @@ class Site {
try { try {
await Promise.race([ await Promise.race([
await this.timeout(), this.timeout(),
page.goto(url.href, { waitUntil: 'domcontentloaded' }) page.goto(url.href, { waitUntil: 'domcontentloaded' })
]) ])
@ -309,7 +308,7 @@ class Site {
// Links // Links
const links = await Promise.race([ const links = await Promise.race([
await this.timeout(), this.timeout(),
( (
await page.evaluateHandle(() => await page.evaluateHandle(() =>
Array.from(document.getElementsByTagName('a')).map( Array.from(document.getElementsByTagName('a')).map(
@ -328,7 +327,7 @@ class Site {
// Script tags // Script tags
const scripts = await Promise.race([ const scripts = await Promise.race([
await this.timeout(), this.timeout(),
( (
await page.evaluateHandle(() => await page.evaluateHandle(() =>
Array.from(document.getElementsByTagName('script')) Array.from(document.getElementsByTagName('script'))
@ -340,7 +339,7 @@ class Site {
// Meta tags // Meta tags
const meta = await Promise.race([ const meta = await Promise.race([
await this.timeout(), this.timeout(),
( (
await page.evaluateHandle(() => await page.evaluateHandle(() =>
Array.from(document.querySelectorAll('meta')).reduce( Array.from(document.querySelectorAll('meta')).reduce(
@ -362,7 +361,7 @@ class Site {
// JavaScript // JavaScript
const js = await Promise.race([ const js = await Promise.race([
await this.timeout(), this.timeout(),
page.evaluate( page.evaluate(
(technologies) => { (technologies) => {
return technologies.reduce((technologies, { name, chains }) => { return technologies.reduce((technologies, { name, chains }) => {
@ -432,7 +431,7 @@ class Site {
} }
// Validate response // Validate response
if (!this.analyzedUrls[url.href].status) { if (url.protocol !== 'file:' && !this.analyzedUrls[url.href].status) {
await page.close() await page.close()
this.log('Page closed') this.log('Page closed')
@ -442,7 +441,7 @@ class Site {
if (!this.language) { if (!this.language) {
this.language = await Promise.race([ this.language = await Promise.race([
await this.timeout(), this.timeout(),
( (
await page.evaluateHandle( await page.evaluateHandle(
() => () =>

Loading…
Cancel
Save