diff --git a/js/libtextsecure.js b/js/libtextsecure.js index f8cd18f21..823c3cbee 100644 --- a/js/libtextsecure.js +++ b/js/libtextsecure.js @@ -37461,12 +37461,12 @@ var TextSecureServer = (function() { } function createSocket(url) { - var proxyUrl = window.getProxyForUrl(url); + var proxyUrl = window.config.proxyUrl; var requestOptions; if (proxyUrl) { - console.log('createSocket: using proxy url', proxyUrl); requestOptions = { - agent: ProxyAgent(proxyUrl) + ca: window.config.certificateAuthorities, + agent: new ProxyAgent(proxyUrl), }; } else { requestOptions = { @@ -37487,15 +37487,10 @@ var TextSecureServer = (function() { console.log(options.type, url); var timeout = typeof options.timeout !== 'undefined' ? options.timeout : 10000; - var proxyUrl = window.getProxyForUrl(url); + var proxyUrl = window.config.proxyUrl; var agent; if (proxyUrl) { - console.log('promixe_ajax: using proxy url', proxyUrl); agent = new ProxyAgent(proxyUrl); - } else { - agent = new httpsAgent({ - ca: options.certificateAuthorities - }); } var fetchOptions = { @@ -37503,6 +37498,7 @@ var TextSecureServer = (function() { body: options.data || null, headers: { 'X-Signal-Agent': 'OWD' }, agent: agent, + ca: options.certificateAuthorities, timeout: timeout, }; diff --git a/libtextsecure/api.js b/libtextsecure/api.js index da9dd4a73..d6836bcc8 100644 --- a/libtextsecure/api.js +++ b/libtextsecure/api.js @@ -25,12 +25,12 @@ var TextSecureServer = (function() { } function createSocket(url) { - var proxyUrl = window.getProxyForUrl(url); + var proxyUrl = window.config.proxyUrl; var requestOptions; if (proxyUrl) { - console.log('createSocket: using proxy url', proxyUrl); requestOptions = { - agent: ProxyAgent(proxyUrl) + ca: window.config.certificateAuthorities, + agent: new ProxyAgent(proxyUrl), }; } else { requestOptions = { @@ -51,15 +51,10 @@ var TextSecureServer = (function() { console.log(options.type, url); var timeout = typeof options.timeout !== 'undefined' ? options.timeout : 10000; - var proxyUrl = window.getProxyForUrl(url); + var proxyUrl = window.config.proxyUrl; var agent; if (proxyUrl) { - console.log('promixe_ajax: using proxy url', proxyUrl); agent = new ProxyAgent(proxyUrl); - } else { - agent = new httpsAgent({ - ca: options.certificateAuthorities - }); } var fetchOptions = { @@ -67,6 +62,7 @@ var TextSecureServer = (function() { body: options.data || null, headers: { 'X-Signal-Agent': 'OWD' }, agent: agent, + ca: options.certificateAuthorities, timeout: timeout, }; diff --git a/main.js b/main.js index 76b915106..36d740386 100644 --- a/main.js +++ b/main.js @@ -93,6 +93,7 @@ function prepareURL(pathSegments) { hostname: os.hostname(), appInstance: process.env.NODE_APP_INSTANCE, polyfillNotifications: polyfillNotifications ? true : undefined, // for stringify() + proxyUrl: process.env.HTTPS_PROXY || process.env.https_proxy, } }) } diff --git a/package.json b/package.json index 8bb967a77..4a1f04e4a 100644 --- a/package.json +++ b/package.json @@ -170,11 +170,10 @@ "google-libphonenumber": "^3.0.7", "lodash": "^4.17.4", "mkdirp": "^0.5.1", - "node-fetch": "^1.7.3", + "node-fetch": "https://github.com/scottnonnenberg/node-fetch.git#3e5f51e08c647ee5f20c43b15cf2d352d61c36b4", "node-notifier": "^5.1.2", "os-locale": "^2.1.0", "proxy-agent": "^2.1.0", - "proxy-from-env": "^1.0.0", "rimraf": "^2.6.2", "semver": "^5.4.1", "spellchecker": "^3.4.3", diff --git a/preload.js b/preload.js index 67345f0ee..217e06a91 100644 --- a/preload.js +++ b/preload.js @@ -42,6 +42,11 @@ // We pull these dependencies in now, from here, because they have Node.js dependencies require('./js/logging'); + + if (window.config.proxyUrl) { + console.log('using proxy url', window.config.proxyUrl); + } + require('./js/backup'); window.nodeSetImmediate = setImmediate; @@ -52,12 +57,10 @@ window.nodeSetImmediate(function() {}); }, 1000); - window.getProxyForUrl = require('proxy-from-env').getProxyForUrl; window.ProxyAgent = require('proxy-agent'); window.EmojiConvertor = require('emoji-js'); window.emojiData = require('emoji-datasource'); window.nodeFetch = require('node-fetch'); - window.httpsAgent = require('https').Agent; window.nodeBuffer = Buffer; window.EmojiPanel = require('emoji-panel'); window.libphonenumber = require('google-libphonenumber').PhoneNumberUtil.getInstance(); diff --git a/yarn.lock b/yarn.lock index 9d31353e3..e694a8bb4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2689,9 +2689,9 @@ node-emoji@^1.8.1: dependencies: lodash.toarray "^4.4.0" -node-fetch@^1.7.3: +"node-fetch@https://github.com/scottnonnenberg/node-fetch.git#3e5f51e08c647ee5f20c43b15cf2d352d61c36b4": version "1.7.3" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" + resolved "https://github.com/scottnonnenberg/node-fetch.git#3e5f51e08c647ee5f20c43b15cf2d352d61c36b4" dependencies: encoding "^0.1.11" is-stream "^1.0.1" @@ -3181,10 +3181,6 @@ proxy-agent@^2.1.0: pac-proxy-agent "^2.0.0" socks-proxy-agent "2" -proxy-from-env@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.0.0.tgz#33c50398f70ea7eb96d21f7b817630a55791c7ee" - pseudomap@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"