Website: Conditionally show swag CTA (#6964)

* conditionally hide fleet swag form

* Check cp-ipcountry and cp-iplongitude

* update comment

* use req.get(), update comment
This commit is contained in:
Eric
2022-08-01 15:58:05 -05:00
committed by GitHub
parent 4bcd14dc83
commit f4c2b62fd5
2 changed files with 8 additions and 1 deletions
@@ -55,6 +55,12 @@ module.exports = {
}
}
let showSwagForm = false;
// Due to shipping costs, we'll check the requesting user's cf-ipcountry to see if they're in the US, and their cf-iplongitude header to see if they're in the contiguous US.
if(this.req.get('cf-ipcountry') === 'US' && this.req.get('cf-iplongitude') > -125) {
showSwagForm = true;
}
// Respond with view.
return {
path: require('path'),
@@ -69,6 +75,7 @@ module.exports = {
thisPage.meta.description ? thisPage.meta.description // « custom meta description for this page, if provided in markdown
: 'Documentation for Fleet for osquery.'// « otherwise use the generic description
),
showSwagForm
};
}