signal-desktop/patches/node-fetch+2.6.7.patch

166 lines
5.5 KiB
Diff
Raw Normal View History

diff --git a/node_modules/node-fetch/lib/index.es.js b/node_modules/node-fetch/lib/index.es.js
index 4852f7c..8a6bee9 100644
--- a/node_modules/node-fetch/lib/index.es.js
+++ b/node_modules/node-fetch/lib/index.es.js
2022-02-11 19:32:37 +00:00
@@ -1253,6 +1253,9 @@ class Request {
2020-11-13 19:57:55 +00:00
this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true;
this.counter = init.counter || input.counter || 0;
this.agent = init.agent || input.agent;
+
+ // Custom Signal Desktop option
+ this.ca = init.ca || input.ca;
}
get method() {
2022-02-11 19:32:37 +00:00
@@ -1372,7 +1375,7 @@ function getNodeRequestOptions(request) {
2020-11-13 19:57:55 +00:00
method: request.method,
headers: exportNodeCompatibleHeaders(headers),
agent
- });
+ }, request.ca ? { ca: request.ca } : {});
}
/**
@@ -1406,11 +1409,20 @@ const URL$1 = Url.URL || whatwgUrl.URL;
// fix an issue where "PassThrough", "resolve" aren't a named export for node <10
const PassThrough$1 = Stream.PassThrough;
+function isSignalVoipUrl(hostname) {
+ return hostname.endsWith('.voip.signal.org');
+}
+
const isDomainOrSubdomain = function isDomainOrSubdomain(destination, original) {
const orig = new URL$1(original).hostname;
const dest = new URL$1(destination).hostname;
- return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest);
+ return (
+ orig === dest ||
+ (orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest)) ||
+ // An additional check to keep Authorization for Signal's voip URLs.
+ (isSignalVoipUrl(orig) && isSignalVoipUrl(dest))
+ );
};
/**
@@ -1556,7 +1568,8 @@ function fetch(url, opts) {
2020-11-13 19:57:55 +00:00
body: request.body,
signal: request.signal,
timeout: request.timeout,
- size: request.size
+ size: request.size,
+ ca: request.ca,
};
2022-02-11 19:32:37 +00:00
if (!isDomainOrSubdomain(request.url, locationURL)) {
diff --git a/node_modules/node-fetch/lib/index.js b/node_modules/node-fetch/lib/index.js
index e5b04f1..5153530 100644
--- a/node_modules/node-fetch/lib/index.js
+++ b/node_modules/node-fetch/lib/index.js
2022-02-11 19:32:37 +00:00
@@ -1257,6 +1257,9 @@ class Request {
2020-11-13 19:57:55 +00:00
this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true;
this.counter = init.counter || input.counter || 0;
this.agent = init.agent || input.agent;
+
+ // Custom Signal Desktop option
+ this.ca = init.ca || input.ca;
}
get method() {
2022-02-11 19:32:37 +00:00
@@ -1376,7 +1379,7 @@ function getNodeRequestOptions(request) {
2020-11-13 19:57:55 +00:00
method: request.method,
headers: exportNodeCompatibleHeaders(headers),
agent
- });
+ }, request.ca ? { ca: request.ca } : {});
}
/**
@@ -1410,11 +1413,20 @@ const URL$1 = Url.URL || whatwgUrl.URL;
// fix an issue where "PassThrough", "resolve" aren't a named export for node <10
const PassThrough$1 = Stream.PassThrough;
+function isSignalVoipUrl(hostname) {
+ return hostname.endsWith('.voip.signal.org');
+}
+
const isDomainOrSubdomain = function isDomainOrSubdomain(destination, original) {
const orig = new URL$1(original).hostname;
const dest = new URL$1(destination).hostname;
- return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest);
+ return (
+ orig === dest ||
+ (orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest)) ||
+ // An additional check to keep Authorization for Signal's voip URLs.
+ (isSignalVoipUrl(orig) && isSignalVoipUrl(dest))
+ );
};
/**
@@ -1560,7 +1572,8 @@ function fetch(url, opts) {
2020-11-13 19:57:55 +00:00
body: request.body,
signal: request.signal,
timeout: request.timeout,
- size: request.size
+ size: request.size,
+ ca: request.ca,
};
2022-02-11 19:32:37 +00:00
if (!isDomainOrSubdomain(request.url, locationURL)) {
diff --git a/node_modules/node-fetch/lib/index.mjs b/node_modules/node-fetch/lib/index.mjs
index 49ee05e..ec12540 100644
--- a/node_modules/node-fetch/lib/index.mjs
+++ b/node_modules/node-fetch/lib/index.mjs
2022-02-11 19:32:37 +00:00
@@ -1251,6 +1251,9 @@ class Request {
2020-11-13 19:57:55 +00:00
this.compress = init.compress !== undefined ? init.compress : input.compress !== undefined ? input.compress : true;
this.counter = init.counter || input.counter || 0;
this.agent = init.agent || input.agent;
+
+ // Custom Signal Desktop option
+ this.ca = init.ca || input.ca;
}
get method() {
2022-02-11 19:32:37 +00:00
@@ -1370,7 +1373,7 @@ function getNodeRequestOptions(request) {
method: request.method,
headers: exportNodeCompatibleHeaders(headers),
agent
- });
+ }, request.ca ? { ca: request.ca } : {});
}
/**
@@ -1404,11 +1407,20 @@ const URL$1 = Url.URL || whatwgUrl.URL;
// fix an issue where "PassThrough", "resolve" aren't a named export for node <10
const PassThrough$1 = Stream.PassThrough;
+function isSignalVoipUrl(hostname) {
+ return hostname.endsWith('.voip.signal.org');
+}
+
const isDomainOrSubdomain = function isDomainOrSubdomain(destination, original) {
const orig = new URL$1(original).hostname;
const dest = new URL$1(destination).hostname;
- return orig === dest || orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest);
+ return (
+ orig === dest ||
+ (orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest)) ||
+ // An additional check to keep Authorization for Signal's voip URLs.
+ (isSignalVoipUrl(orig) && isSignalVoipUrl(dest))
+ );
};
/**
@@ -1554,7 +1566,8 @@ function fetch(url, opts) {
2020-11-13 19:57:55 +00:00
body: request.body,
signal: request.signal,
timeout: request.timeout,
- size: request.size
+ size: request.size,
+ ca: request.ca,
};
2022-02-11 19:32:37 +00:00
if (!isDomainOrSubdomain(request.url, locationURL)) {