mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 08:47:43 +00:00
feat: add chromium sandbox skipping (#209)
This commit is contained in:
@@ -5,6 +5,7 @@ config({path: path.resolve(__dirname, '../.env')});
|
||||
|
||||
const browser = {
|
||||
isHeadless: process.env.HEADLESS ? process.env.HEADLESS === 'true' : true,
|
||||
isTrusted: process.env.BROWSER_TRUSTED ? process.env.BROWSER_TRUSTED === 'true' : false,
|
||||
maxSleep: Number(process.env.PAGE_SLEEP_MAX ?? 10000),
|
||||
minSleep: Number(process.env.PAGE_SLEEP_MIN ?? 5000),
|
||||
open: process.env.OPEN_BROWSER === 'true'
|
||||
|
||||
@@ -14,7 +14,17 @@ puppeteer.use(adBlocker);
|
||||
* Starts the bot.
|
||||
*/
|
||||
async function main() {
|
||||
const args: string[] = [];
|
||||
|
||||
// Skip Chromium Linux Sandbox
|
||||
// https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#setting-up-chrome-linux-sandbox
|
||||
if (Config.browser.isTrusted) {
|
||||
args.push('--no-sandbox');
|
||||
args.push('--disable-setuid-sandbox');
|
||||
}
|
||||
|
||||
const browser = await puppeteer.launch({
|
||||
args,
|
||||
defaultViewport: {
|
||||
height: Config.page.height,
|
||||
width: Config.page.width
|
||||
|
||||
Reference in New Issue
Block a user