@tryghost/domain-validator 1.4.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/pro.js +9 -0
- package/package.json +3 -3
package/lib/pro.js
CHANGED
|
@@ -106,6 +106,12 @@ _private.buildResponse = (result, proto, subdomain, customdomain, subdirectory,
|
|
|
106
106
|
if (result.length > 1) {
|
|
107
107
|
response.hasRedirect = true;
|
|
108
108
|
response.redirect = result.slice(0, -1);
|
|
109
|
+
|
|
110
|
+
const validRedirectDomains = [customdomain];
|
|
111
|
+
if (subdomain && prodomain) {
|
|
112
|
+
validRedirectDomains.push(`${subdomain}.${prodomain}`);
|
|
113
|
+
}
|
|
114
|
+
response.isGhostProRedirect = response.redirect.every(redirect => validRedirectDomains.includes(new URL(redirect.headers.location).hostname));
|
|
109
115
|
}
|
|
110
116
|
|
|
111
117
|
// If we find the x-ghost-cache-status header, we're seeing Ghost(Pro)
|
|
@@ -116,6 +122,9 @@ _private.buildResponse = (result, proto, subdomain, customdomain, subdirectory,
|
|
|
116
122
|
}
|
|
117
123
|
}
|
|
118
124
|
|
|
125
|
+
// Ensure that we only set isGhostPro to true if the redirect only uses valid domains
|
|
126
|
+
response.isGhostPro = response.isGhostPro && (!response.hasRedirect || response.isGhostProRedirect);
|
|
127
|
+
|
|
119
128
|
response.isProxy = _private.detectProxy(headers, proto);
|
|
120
129
|
|
|
121
130
|
// Generate a proxy report
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryghost/domain-validator",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "ssh://git@github.com/TryGhost/Pro",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"main": "lib/validate.js",
|
|
12
12
|
"bin": {
|
|
13
|
-
"dv": "./bin/
|
|
13
|
+
"dv": "./bin/dv.js"
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"bin",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"got": "8.3.2",
|
|
39
39
|
"lodash": "4.17.21"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "5df7c05817db64681a73e0fbfa06131722f6b2e0"
|
|
42
42
|
}
|