Skip to content

Commit

Permalink
fix: host json resources on github #197
Browse files Browse the repository at this point in the history
  • Loading branch information
abrahamjuliot committed Aug 17, 2022
1 parent 6fe4fec commit 074f049
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
1 change: 1 addition & 0 deletions docs/data/samples.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/tests/iframes.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@
}

// get feature data
const webapp = 'https://script.google.com/macros/s/AKfycbw26MLaK1PwIGzUiStwweOeVfl-sEmIxFIs5Ax7LMoP1Cuw-s0llN-aJYS7F8vxQuVG-A/exec'
const samples = await fetch(webapp)
const url = '../data/samples.json'
const samples = await fetch(url)
.then(response => response.json())
.catch(error => {
console.error(error)
Expand Down Expand Up @@ -477,7 +477,7 @@
let uaBase, verBase, platformBase, canvasBase
return contexts.map((context, i) => {
const { uaReported, verReported, uaRestored, verRestored, features, platform, canvas } = context || {}
// set base values
if (i == 0) {
uaBase = uaReported
Expand Down
8 changes: 4 additions & 4 deletions docs/tests/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@
}

// get data
const webapp = 'https://script.google.com/macros/s/AKfycbw26MLaK1PwIGzUiStwweOeVfl-sEmIxFIs5Ax7LMoP1Cuw-s0llN-aJYS7F8vxQuVG-A/exec'
const samples = await fetch(webapp)
const url = '../data/samples.json'
const samples = await fetch(url)
.then(response => response.json())
.catch(error => {
console.error(error)
Expand All @@ -188,10 +188,10 @@
</div>
`)
}

const { window: windowSamples } = samples || {}

// construct template
// construct template
let matchingIndex
const computeTemplate = ({ name, fingerprints, index }) => {
fingerprints = fingerprints.sort((a, b) => (a.systems[0] > b.systems[0]) ? 1 : -1)
Expand Down
12 changes: 9 additions & 3 deletions src/creep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ import getBestWorkerScope, { Scope, spawnWorker, workerScopeHTML } from './worke
headlessComputed,
featuresComputed,
] = await Promise.all([
getHeadlessFeatures(workerScopeComputed),
getHeadlessFeatures({
webgl: canvasWebglComputed,
workerScope: workerScopeComputed,
}),
getEngineFeatures({
cssComputed,
navigatorComputed,
Expand Down Expand Up @@ -574,7 +577,7 @@ import getBestWorkerScope, { Scope, spawnWorker, workerScopeHTML } from './worke
capturedErrors: !!errorsLen,
lies: !!liesLen,
resistance: fp.resistance || undefined,
forceRenew: 1660540659730,
forceRenew: 1660712729417,
}

console.log('%c✔ stable fingerprint passed', 'color:#4cca9f')
Expand Down Expand Up @@ -1433,7 +1436,10 @@ import getBestWorkerScope, { Scope, spawnWorker, workerScopeHTML } from './worke
samplesDidLoadFromSession: true,
}
}
const url = 'https://script.google.com/macros/s/AKfycbw26MLaK1PwIGzUiStwweOeVfl-sEmIxFIs5Ax7LMoP1Cuw-s0llN-aJYS7F8vxQuVG-A/exec'
const url = (
/\.github\.io/.test(location.origin) ? './data/samples.json' :
'../docs/data/samples.json'
)
const cloudSamples = await fetch(url).then((res) => res.json()).catch((error) => {
console.error(error)
return
Expand Down

0 comments on commit 074f049

Please sign in to comment.