mirror of
https://github.com/TheNetsky/Microsoft-Rewards-Script.git
synced 2026-01-20 23:13:58 +00:00
1.0
This commit is contained in:
40
src/Browser.ts
Normal file
40
src/Browser.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import puppeteer from 'puppeteer-extra'
|
||||
import StealthPlugin from 'puppeteer-extra-plugin-stealth'
|
||||
|
||||
import { getUserAgent } from './util/UserAgent'
|
||||
import { loadSesion } from './BrowserFunc'
|
||||
|
||||
puppeteer.use(StealthPlugin())
|
||||
|
||||
export async function Browser(email: string, headless = false) {
|
||||
const userAgent = await getUserAgent(false)
|
||||
|
||||
const browser = await puppeteer.launch({
|
||||
headless: headless, // Set to true for a headless browser
|
||||
userDataDir: await loadSesion(email),
|
||||
args: [
|
||||
'--no-sandbox',
|
||||
'--disable-setuid-sandbox',
|
||||
`--user-agent=${userAgent.userAgent}`
|
||||
]
|
||||
})
|
||||
|
||||
return browser
|
||||
}
|
||||
|
||||
export async function mobileBrowser(email: string, headless = false) {
|
||||
const userAgent = await getUserAgent(true)
|
||||
|
||||
const browser = await puppeteer.launch({
|
||||
headless: headless, // Set to true for a headless browser,
|
||||
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