mirror of
https://github.com/TheNetsky/Microsoft-Rewards-Script.git
synced 2026-01-11 10:56:17 +00:00
1.0.6
This commit is contained in:
42
src/browser/Browser.ts
Normal file
42
src/browser/Browser.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import puppeteer from 'puppeteer-extra'
|
||||
import StealthPlugin from 'puppeteer-extra-plugin-stealth'
|
||||
|
||||
import { getUserAgent } from '../util/UserAgent'
|
||||
import { loadSesion } from './BrowserFunc'
|
||||
|
||||
import { headless } from '../config.json'
|
||||
|
||||
puppeteer.use(StealthPlugin())
|
||||
|
||||
export async function Browser(email: string) {
|
||||
const userAgent = await getUserAgent(false)
|
||||
|
||||
const browser = await puppeteer.launch({
|
||||
headless: headless,
|
||||
userDataDir: await loadSesion(email),
|
||||
args: [
|
||||
'--no-sandbox',
|
||||
'--disable-setuid-sandbox',
|
||||
`--user-agent=${userAgent.userAgent}`
|
||||
]
|
||||
})
|
||||
|
||||
return browser
|
||||
}
|
||||
|
||||
export async function mobileBrowser(email: string) {
|
||||
const userAgent = await getUserAgent(true)
|
||||
|
||||
const browser = await puppeteer.launch({
|
||||
headless: headless,
|
||||
userDataDir: await loadSesion(email),
|
||||
args: [
|
||||
'--no-sandbox',
|
||||
'--disable-setuid-sandbox',
|
||||
`--user-agent=${userAgent.userAgent}`,
|
||||
'--window-size=568,1024'
|
||||
]
|
||||
})
|
||||
|
||||
return browser
|
||||
}
|
||||
Reference in New Issue
Block a user