Skip to content
This repository has been archived by the owner on Apr 10, 2023. It is now read-only.

Launch options #117

Open
b2sabNvM9dmg2LkomN4pc3CB4AhwASYtJ4DE opened this issue Feb 14, 2022 · 0 comments
Open

Launch options #117

b2sabNvM9dmg2LkomN4pc3CB4AhwASYtJ4DE opened this issue Feb 14, 2022 · 0 comments

Comments

@b2sabNvM9dmg2LkomN4pc3CB4AhwASYtJ4DE
Copy link

b2sabNvM9dmg2LkomN4pc3CB4AhwASYtJ4DE commented Feb 14, 2022

Quick question: how do I specify "config.puppeteerOpts puppeteer launch options"

If you were to use a Tor proxy to launch the puppeteer as such:

"const browser = await puppeteer.launch({headless:true, args: ['--proxy-server=socks5://127.0.0.1:9050','--no-sandbox', '--disable-setuid-sandbox']})"

How would you specify that option when sending an email - I can of course hardcode it into your proton-mail.js module, but is there a way to specify the option without rewriting your code when sending emails?

Many thanks - great project.

---- FOLLOW UP ----

I just found this doc: file:///Users/master/code/protonmail-api/docs/ProtonMail.html

Does that mean the following code would solve the above issue?

const ProtonMail = require('protonmail-api');

(async () => {
const pm = await ProtonMail.connect({
username: '[email protected]',
password: 'somethingsecure',
puppeteerOpts: {args: ['--proxy-server=socks5://127.0.0.1:9050','--no-sandbox', '--disable-setuid-sandbox']}
})

await pm.sendEmail({
to: '[email protected]',
subject: 'Send email tutorial',
body: 'Hello world'
})

pm.close()
})()

ANSWER: Yes this is how it works. I tested it by modifying the proton-mail.js as follows:

if (this._browser === undefined) {
// console.log(typeof this._config.puppeteerOpts)
this._browser = await puppeteer.launch({ headless: false, ...this._config.puppeteerOpts })
this._page = await this._browser.newPage()
}

const page = this._page
await page.goto('https://api.ipify.org')

This opens the Chromium browser with your IP and the IP is a Tor IP.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant