-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #424 from postmanlabs/MARKENG-3397-PROD
[MARKENG-3397][c] add fingerprintJs & pmt.user variable [cherry-pick from develop, for PROD]
- Loading branch information
Showing
4 changed files
with
47 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const sh = require('shelljs'); | ||
|
||
async function cacheCdn(url, name) { | ||
const fetch = (await import('node-fetch')).default; | ||
|
||
sh.exec('mkdir -p public'); | ||
|
||
fetch(url).then((res) => { | ||
res.text().then((resp) => { | ||
if (resp) { | ||
fs.writeFile(path.join('public', `${name}.js`), resp, (err) => { | ||
if (err) { | ||
throw err; | ||
} | ||
}); | ||
} | ||
}); | ||
}); | ||
} | ||
|
||
module.exports = cacheCdn; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const cacheCdn = require('./cacheCdn'); | ||
|
||
cacheCdn('https://fpjscdn.net/v3/vytU6aPKbOCzx72ch0fn', 'fp'); |