Plugin to enable/disable http proxy

plugin-idea

#1

Hello!

I’m behind a corporate http proxy at the office, but want to turn off the proxy setting when I’m away from the office.
Is there an easy way (not manually editing config.cson) to toggle the proxy settings?
I’d love a plugin, but even a script or batch would suffice for starters.

Or on a more constructive note, could someone point me in the right direction so that I could try to develop and contribute said plugin?

– Stu


Allow to pause synchronization
#2

Hi Stuart,

You can get current config from your plugin like so:

var currentHttpProxyConfig = inkdrop.config.get('core.network.http_proxy')
var currentHttpsProxyConfig = inkdrop.config.get('core.network.https_proxy')

Remove the config:

inkdrop.config.unset('core.network.http_proxy')
inkdrop.config.unset('core.network.https_proxy')

Restore the config:

inkdrop.config.set('core.network.http_proxy', currentHttpProxyConfig)
inkdrop.config.set('core.network.https_proxy', currentHttpsProxyConfig)

Hope that helps!


#3

Hello Craftzdog,

Thank you for the advice!

Stu