Skip to content
Snippets Groups Projects

Add support for proxies

Open username-removed-1394269 requested to merge gh-830c968e/80/nhu/master into master

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

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Created by: iamnku

    Would love to see this fix get merged soon, as the Gitter desktop client currently doesn't work for anyone that is behind a corporate proxy.

  • 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/

  • Created by: mydigitalself

    Ah ok, cool, thanks.

    I'm on a loaner Macbook at the moment and don't have my full environment setup. Hopefully I'll get my machine back soon and I'll test this out for you.

  • 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 by npm 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 an http_proxy and https_proxy environment variable whenever I start an application. To do this, I'm using an environment.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.

  • My guess is that

    [21666:0301/095315:WARNING:dns_config_service_posix.cc(151)] dns_config has unhandled options!

    is the culprit. Is that something I need to adjust on my end?

  • 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

  • Created by: MadLittleMods

    @Nhu Thanks for the update!

    It looks like the oauth package we use is a bit dead and I do see the PR's for proxy support. So we are blocked until we decide on a new oauth package whether it be @Nhu's package or otherwise.

  • Created by: vpavic

    Any updates on this? Thanks.

Please register or sign in to reply
Loading