Comparing version 2.4.0 to 2.5.0
# CHANGELOG - PageXray | ||
version 2.5.0 2018-11-16 | ||
------------------------ | ||
### Added | ||
* If you don't add your own firstparty regex, we set a default one based on the hostname. If your hostname is www.sitespeed.io we will use *.sitespeed.* [#68](https://github.com/sitespeedio/pagexray/pull/68). | ||
version 2.4.0 2018-10-05 | ||
@@ -4,0 +9,0 @@ ------------------------ |
@@ -102,3 +102,8 @@ 'use strict'; | ||
const finalUrl = finalEntry.request.url; | ||
const baseDomain = util.getHostname(finalUrl); | ||
// If there is no setup for a first party setup, | ||
// then use a default one | ||
if (!firstParty) { | ||
firstParty = '.*' + util.getMainDomain(baseDomain) + '.*'; | ||
} | ||
currentPage = { | ||
@@ -108,3 +113,4 @@ url: entry.request.url, | ||
finalUrl, | ||
baseDomain: util.getHostname(finalUrl), | ||
baseDomain: baseDomain, | ||
firstPartyRegEx: firstParty, | ||
documentRedirects: redirectChain.length, | ||
@@ -111,0 +117,0 @@ redirectChain, |
@@ -74,2 +74,24 @@ 'use strict'; | ||
/** | ||
* Get the main domain from a hostname | ||
* www.sitespeed.io -> sitespeed | ||
* www.sitespeed.co.uk -> sitespeed | ||
*/ | ||
getMainDomain: hostname => { | ||
let domain = hostname; | ||
if (hostname != null) { | ||
const parts = hostname.split('.').reverse(); | ||
if (parts != null && parts.length > 1) { | ||
domain = parts[1] + '.' + parts[0]; | ||
if ( | ||
hostname.toLowerCase().indexOf('.co.uk') != -1 && | ||
parts.length > 2 | ||
) { | ||
domain = parts[2] + '.' + domain; | ||
} | ||
} | ||
} | ||
return domain.split('.')[0]; | ||
}, | ||
/** | ||
* Get when the page is fully loaded | ||
@@ -76,0 +98,0 @@ * @param {Object} pageId |
{ | ||
"name": "pagexray", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"description": "Xray your HAR file and know all about the page", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
37887
722