mirror of
https://github.com/TheNetsky/Microsoft-Rewards-Script.git
synced 2026-01-11 19:06:18 +00:00
1.3.2
- Better generation of mobile user agents
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "microsoft-rewards-script",
|
"name": "microsoft-rewards-script",
|
||||||
"version": "1.3.1",
|
"version": "1.3.2",
|
||||||
"description": "Automatically do tasks for Microsoft Rewards but in TS!",
|
"description": "Automatically do tasks for Microsoft Rewards but in TS!",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ http://f.vision/
|
|||||||
|
|
||||||
class Browser {
|
class Browser {
|
||||||
private bot: MicrosoftRewardsBot
|
private bot: MicrosoftRewardsBot
|
||||||
|
private usedUserAgents: string[] = []
|
||||||
|
|
||||||
constructor(bot: MicrosoftRewardsBot) {
|
constructor(bot: MicrosoftRewardsBot) {
|
||||||
this.bot = bot
|
this.bot = bot
|
||||||
@@ -38,21 +39,34 @@ class Browser {
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
const { fingerprint, headers } = new FingerprintGenerator().getFingerprint({
|
let fingerPrintData = new FingerprintGenerator().getFingerprint({
|
||||||
devices: this.bot.isMobile ? ['mobile'] : ['desktop'],
|
devices: this.bot.isMobile ? ['mobile'] : ['desktop'],
|
||||||
operatingSystems: this.bot.isMobile ? ['android'] : ['windows'],
|
operatingSystems: this.bot.isMobile ? ['android'] : ['windows'],
|
||||||
browsers: ['edge'],
|
browsers: ['edge']
|
||||||
browserListQuery: 'last 2 Edge versions'
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (this.usedUserAgents) {
|
||||||
|
while (this.usedUserAgents.includes(fingerPrintData.fingerprint.navigator.userAgent)) {
|
||||||
|
fingerPrintData = new FingerprintGenerator().getFingerprint({
|
||||||
|
devices: this.bot.isMobile ? ['mobile'] : ['desktop'],
|
||||||
|
operatingSystems: this.bot.isMobile ? ['android'] : ['windows'],
|
||||||
|
browsers: ['edge']
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.usedUserAgents.push(fingerPrintData.fingerprint.navigator.userAgent)
|
||||||
|
|
||||||
// Modify the newPage function to attach the fingerprint
|
// Modify the newPage function to attach the fingerprint
|
||||||
const originalNewPage = browser.newPage
|
const originalNewPage = browser.newPage
|
||||||
browser.newPage = async function () {
|
browser.newPage = async function () {
|
||||||
const page = await originalNewPage.apply(browser)
|
const page = await originalNewPage.apply(browser)
|
||||||
await new FingerprintInjector().attachFingerprintToPuppeteer(page, { fingerprint, headers })
|
await new FingerprintInjector().attachFingerprintToPuppeteer(page, fingerPrintData)
|
||||||
return page
|
return page
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.bot.log('BROWSER', `Created browser with User-Agent: "${fingerPrintData.fingerprint.navigator.userAgent}"`)
|
||||||
|
|
||||||
return browser
|
return browser
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user