Add proxy support based on environment variables (#1855)
We pull proxy settings from environment variables: - HTTPS_PROXY for sending, profile pulls, and attachment download/upload - WSS_PROXY for connecting to the websocket for receiving messages - ALL_PROXY to provide one server for both More details on our proxy handling: - https://github.com/Rob--W/proxy-from-env#environment-variables - https://github.com/TooTallNate/node-proxy-agent This is the natural way of things for Linux. My understanding is that most proxies on MacOS are system-wide and transparent, so it's not so urgent. But Windows will likely require further UI for configuration. Will need to do some testing with Windows users.
This commit is contained in:
parent
79c4893b5f
commit
acc94edd23
5 changed files with 364 additions and 9 deletions
|
@ -37461,7 +37461,19 @@ var TextSecureServer = (function() {
|
|||
}
|
||||
|
||||
function createSocket(url) {
|
||||
var requestOptions = { ca: window.config.certificateAuthorities };
|
||||
var proxyUrl = window.getProxyForUrl(url);
|
||||
var requestOptions;
|
||||
if (proxyUrl) {
|
||||
console.log('createSocket: using proxy url', proxyUrl);
|
||||
requestOptions = {
|
||||
agent: ProxyAgent(proxyUrl)
|
||||
};
|
||||
} else {
|
||||
requestOptions = {
|
||||
ca: window.config.certificateAuthorities,
|
||||
};
|
||||
}
|
||||
|
||||
return new nodeWebSocket(url, null, null, null, requestOptions);
|
||||
}
|
||||
|
||||
|
@ -37475,12 +37487,23 @@ var TextSecureServer = (function() {
|
|||
console.log(options.type, url);
|
||||
var timeout = typeof options.timeout !== 'undefined' ? options.timeout : 10000;
|
||||
|
||||
var proxyUrl = window.getProxyForUrl(url);
|
||||
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 = {
|
||||
method: options.type,
|
||||
body: options.data || null,
|
||||
headers: { 'X-Signal-Agent': 'OWD' },
|
||||
agent: new httpsAgent({ca: options.certificateAuthorities}),
|
||||
timeout: timeout
|
||||
agent: agent,
|
||||
timeout: timeout,
|
||||
};
|
||||
|
||||
if (fetchOptions.body instanceof ArrayBuffer) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue