Add support for proxies
Added the app protocol which is used inside the nw.js container to the proxy whitelist. Now proxies should work.
Fixes #49
Merge request reports
Activity
Created by: mydigitalself
@Nhu how can we test it? where does one add the proxy?
@mydigitalself you can just add a proxy to your system. The old version keeps beeing white on startup because the proxy cannot resolve "app://" requests. So with the fix you bypass the system proxy for "app://" requests and you should see the login page of Gitter.
For testing it on my machine i have picked a random proxy from http://proxylist.hidemyass.com/
I'm using OS X El Capitan and after setting up the dev environment locally I ran a quick test. I ran
npm start
and the gitter login window appeared as expected.I then fetched this PR to a branch I called
test
using the following command:git fetch origin pull/80/head:test
After pulling down this patch, I ran
npm i
again to make sure all dependencies were installed, followed bynpm start
. The window did not open this time and I received the following output:[21666:0301/095315:WARNING:dns_config_service_posix.cc(151)] dns_config has unhandled options! [21666:0301/095315:WARNING:web_database.cc(99)] Web database is too new. [21666:0301/095315:ERROR:web_data_service_backend.cc(54)] Cannot initialize the web database: 2 [21667:0301/095315:ERROR:breakpad_mac.mm(238)] Breakpad initializaiton failed [21668:0301/095315:ERROR:breakpad_mac.mm(238)] Breakpad initializaiton failed [21666:0301/095315:WARNING:nw_form_database_service.cc(21)] initializing autocomplete database failed [21666:0301/095316:INFO:CONSOLE(38)] ""version:" "2.4.0"", source: app://gitter/index.js (38) [21666:0301/095316:INFO:CONSOLE(66)] ""Rebuilding tray menu"", source: /Users/wcjohnso/projects/desktop/nwapp/components/tray-menu.js (66) [21666:0301/095316:INFO:CONSOLE(121)] ""checking" "https://update.gitter.im/osx/package.json" "for app updates"", source: /Users/wcjohnso/projects/desktop/nwapp/utils/auto-update.js (121) [21666:0301/095316:WARNING:backend_impl.cc(1785)] Destroying invalid entry.
I went back to the master branch and ran
npm start
to see if the window would come up again and sure enough it did. One thing to note, I am applying anhttp_proxy
andhttps_proxy
environment variable whenever I start an application. To do this, I'm using anenvironment.plist
file in~/Library/LaunchAgents
and the file contents reads:<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>my.startup</string> <key>ProgramArguments</key> <array> <string>sh</string> <string>-c</string> <string> launchctl setenv http_proxy xxx launchctl setenv https_proxy xxx </string> </array> <key>RunAtLoad</key> <true/> </dict> </plist>
I also tried unloading this file with:
launchctl unload environment.plist
and then ran
npm start
again but the window still does no appear. Any idea why the window doesn't launch? If I can provide any more helpful information please let me know. I'll help out any way I can to get this patch landed.Created by: MadLittleMods
@Nhu Does this fix still work on
#master
? @johnsonw tried it and it was not working, https://gitter.im/gitterHQ/desktop?at=56d5b216656b38831abc4e43@MadLittleMods hi no this fix does not work because once you passed the trouble with the app framework you will stuck at the oauth2 library which doesnt support proxies. They have also pull requests pending. So if you would take this PR and change the oauth lib it should work fine. I have rewritten the client entierly because of that.
Here my gitter client written in es6 and hosted in electron: https://github.com/nhu/gitter2
My own oauth lib written for the client relies on request which supports proxies: https://github.com/nhu/oauthjs