Open shredsonic opened 9 years ago
I think the issue is that commands are run in a terminal (essentially) and a quick google suggests that the terminal doesn't use OSX' proxy settings. This url has more info an maybe also some solutions: http://apple.stackexchange.com/questions/99671/how-to-connect-to-the-internet-from-terminal-when-using-a-proxy-with-authenticat
This issue came up with Alfred 2, in that its workflows (which are Python/Ruby/bash scripts) wouldn't use the system proxy for the same reason.
There are a couple of problems with hard-coding http(s)_proxy
manually in a script:
It is possible, but difficult, to get the currently configured proxy server via the command line using networksetup
, but it's complicated and something that every widget would probably have to do for itself.
The best solution (which is what Alfred did) was for Alfred to query the system network settings for the configured proxy (which is way easier from a Mac app than from a shell) and set the http_proxy
and https_proxy
environmental vars for NSTask
. Python, Ruby and curl will automatically use the proxy specified in those environmental variables without any user intervention, which is fantastic, as it's then something that widget authors wouldn't even have to think about.
I'm afraid I have no idea precisely how to do that :(
awesome, thanks for the info @deanishe! I will see what i can do ... problem is that commands aren't run using NSTask, but via the nodejs backend (child_process), so I'll see if there is an easy way to accomplish the same in node
I've likely read the code wrong (I'm not good with Objective-C, and may be looking in the wrong place), but isn't the nodejs backend launched via NSTask?
you are right! But the nodejs process then launches a bash process to run the command and I am not sure whether that process will also inherit the proxy settings. Worth trying tho!
Should do. It's just another environmental variable and will be inherited by subprocesses.
In v1.2.48, you can now load your bash env (option is in Preferences), which should probably fix this. Feel free to re-open if that is not the case!
That won't work with the system proxy settings. macOS doesn't export them to your shell environment and—as noted above—extracting them via the networksetup
command is difficult.
It would "just work" if Übersicht retrieved the settings itself and set http_proxy
and https_proxy
. This is much easier for a native program than for scripts.
Also, it won't work for people who use zsh
, fish
etc.
I see, sorry I was too quick closing this then!
the default shell which uebersicht use is bash, but i use zsh as my default shell, uebersicht can not use zsh's profile, that makes me inconvenience to write scripts, hope this can be improved soon
thanks so much
i try to modify command_server.coffee, the code is:
{spawn} = require('child_process')
module.exports = (workingDir, useLoginShell) ->
args = if useLoginShell then ['-l'] else []
# the Connect middleware
(req, res, next) ->
return next() unless req.method == 'POST' and req.url == '/run/'
shell = spawn 'bash', args, cwd: workingDir
change "bash" to "zsh", but still i can NOT get a correct result
btw: there are some commands which are only available in my zsh shell
@zacklocx you could try prefixing your commands with chsh -s /bin/zsh
, i.e. switch to zsh. Not sure if there is a noticeable performance impact tho
cors_host = '127.0.0.1' # bind to loopback only
cors_port = port + 1
cors_proxy.createServer(
originWhitelist: ['http://127.0.0.1:' + port]
requireHeader: ['origin']
removeHeaders: ['cookie']
httpProxyOptions:
secure: false
).listen(cors_port, cors_host, ->
console.log 'CORS Anywhere on port', cors_port
)
Isn't cors-anywhere using proxy-from-env ? I've added httpProxyOptions: { secure: false }
to my server config here for now. Hoping to get a chance to dig into this later.
It looks like Übersicht is not using any of my proxy settings. When I connect to a normal network, the widgets seem to work fine. When I connect to a network a proxy setup, my widgets can't connect to the internet. Could this be added or is there a way I can set proxy settings for the app?