browser-with-fingerprints
Advanced tools
Comparing version 1.1.2 to 1.2.0
@@ -7,3 +7,3 @@ { | ||
"author": "CheshireCaat", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"license": "MIT", | ||
@@ -60,3 +60,3 @@ "bugs": { | ||
"async-lock": "^1.4.0", | ||
"bas-remote-node": "^1.4.0", | ||
"bas-remote-node": "^1.4.1", | ||
"chrome-remote-interface": "^0.32.1", | ||
@@ -63,0 +63,0 @@ "compare-versions": "^5.0.3", |
@@ -8,14 +8,25 @@ const { env } = require('process'); | ||
async function call(name, params = {}) { | ||
if (name === 'fetch' && !params.token) notify(); | ||
try { | ||
const { error, ...result } = await sync(client.start).then(() => { | ||
let timer = null; | ||
return await lock.acquire('client', async () => { | ||
try { | ||
await client.start(); | ||
reset(client._engine.exeDir, client._engine.zipDir); | ||
return client.runFunction(`api_${name}`, params); | ||
}); | ||
if (name === 'fetch') timer = notify(params.token); | ||
const { error, ...result } = await Promise.race([ | ||
client.runFunction(`api_${name}`, params), | ||
new Promise((_, reject) => { | ||
setTimeout( | ||
() => reject(new Error(`Timed out while calling a "${name}" method.`)), | ||
env.FINGERPRINT_TIMEOUT ?? 240000 | ||
).unref(); | ||
}), | ||
]); | ||
if (error) throw new Error(error); | ||
return result.response ?? result; | ||
} finally { | ||
await sync(client.close); | ||
} | ||
if (error) throw new Error(error); | ||
return result.response ?? result; | ||
} finally { | ||
clearTimeout(timer); | ||
await client.close(); | ||
} | ||
}); | ||
} | ||
@@ -31,6 +42,4 @@ | ||
const sync = (method) => lock.acquire('mutex', () => method.call(client)); | ||
exports.fetch = (token, parameters) => call('fetch', { token, parameters }); | ||
exports.setup = (proxy, fingerprint) => call('setup', { proxy, fingerprint }); |
const once = require('once'); | ||
const print = once(console.log); | ||
const dedent = require('dedent'); | ||
exports.notify = once(() => { | ||
if (process.env.NODE_ENV !== 'test') { | ||
console.log(dedent` | ||
Try the full version of the fingerprint service which has advantages over the free one: | ||
const notify = once(() => { | ||
console.log(dedent` | ||
Try the full version of the fingerprint service which has advantages over the free one: | ||
✔ Emulate fingerprints for other platforms and browsers. | ||
✔ Increased limits when receiving a fingerprints from the service. | ||
✔ Filters by tags, versions, screen resolution and many other parameters. | ||
✔ Popular perfect canvas queries are already included in the received fingerprints. | ||
✔ Emulate fingerprints for other platforms and browsers. | ||
✔ Increased limits when receiving a fingerprints from the service. | ||
✔ Filters by tags, versions, screen resolution and many other parameters. | ||
✔ Popular perfect canvas queries are already included in the received fingerprints. | ||
If you want to buy the full version, please visit this website - https://bablosoft.com/directbuy/FingerprintSwitcher/2. | ||
`); | ||
If you want to buy the full version, please visit this website - https://bablosoft.com/directbuy/FingerprintSwitcher/2. | ||
`); | ||
}); | ||
exports.notify = (premium) => { | ||
if (!premium && process.env.NODE_ENV !== 'test') { | ||
return notify(), setTimeout(print, 20000, 'Fetching a fingerprint can take a long time in the free version.'); | ||
} | ||
}); | ||
}; |
@@ -5,7 +5,4 @@ const fs = require('fs'); | ||
exports.reset = once((path) => { | ||
['settings.ini', 'worker_command_line.txt', 'chrome_command_line.txt'].forEach((file, idx) => { | ||
if (SETTINGS[idx]) fs.writeFileSync(`${path}/${file}`, SETTINGS[idx]); | ||
}); | ||
fs.writeFileSync(`${path}/worker_command_line.txt`, '--mock-connector'); | ||
fs.writeFileSync(`${path}/settings.ini`, 'RunProfileRemoverImmediately=true'); | ||
}); | ||
const SETTINGS = ['RunProfileRemoverImmediately=true', '--mock-connector']; |
@@ -1,2 +0,2 @@ | ||
const mutex = require('../mutex'); | ||
const mutex = require('./mutex'); | ||
const cleaner = require('./cleaner'); | ||
@@ -7,9 +7,7 @@ const launcher = require('./launcher'); | ||
const { configure, synchronize } = require('./config'); | ||
const { defaultArgs, validateLauncher } = require('./utils'); | ||
const { defaultArgs, validateConfig, validateLauncher } = require('./utils'); | ||
module.exports = class FingerprintPlugin extends EventEmitter { | ||
useFingerprint(value = '', options = {}) { | ||
if (typeof value !== 'string' || typeof options !== 'object') { | ||
throw new Error('Invalid arguments for fingerprint configuration.'); | ||
} | ||
validateConfig('fingerprint', value, options); | ||
@@ -21,5 +19,3 @@ this.fingerprint = { value, options }; | ||
useProxy(value = '', options = {}) { | ||
if (typeof value !== 'string' || typeof options !== 'object') { | ||
throw new Error('Invalid arguments for proxy configuration.'); | ||
} | ||
validateConfig('proxy', value, options); | ||
@@ -26,0 +22,0 @@ this.proxy = { value, options }; |
@@ -15,2 +15,8 @@ const IGNORED_ARGS = ['--kiosk', '--headless', '--start-maximized', '--start-fullscreen']; | ||
exports.validateConfig = (type, value, options) => { | ||
if (typeof value !== 'string' || typeof options !== 'object') { | ||
throw new Error(`Invalid arguments for ${type} configuration.`); | ||
} | ||
}; | ||
exports.validateLauncher = (launcher) => { | ||
@@ -17,0 +23,0 @@ if (launcher == null || typeof launcher !== 'object' || typeof launcher.launch !== 'function') { |
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 2 instances 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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 2 instances in 1 package
1054250
781
+ Added@types/node@22.10.1(transitive)
+ Addedundici-types@6.20.0(transitive)
- Removed@types/node@22.9.3(transitive)
- Removedundici-types@6.19.8(transitive)
Updatedbas-remote-node@^1.4.1