From 5da28b0f8771834ae208d61431d632875e9f8e7d Mon Sep 17 00:00:00 2001 From: Ruben Rodriguez Date: Thu, 8 Sep 2022 20:18:54 -0400 Subject: Updated extensions: * Upgraded Privacy Redirect to 1.1.49 and configured to use the 10 most reliable invidious instances * Removed ViewTube * Added torproxy@icecat.gnu based on 'Proxy toggle' extension * Added jShelter 0.11.1 * Upgraded LibreJS to 7.21.0 * Upgraded HTTPS Everywhere to 2021.7.13 * Upgraded SubmitMe to 1.9 --- .../background-scripts/util.js | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'data/extensions/https-everywhere@eff.org/background-scripts/util.js') diff --git a/data/extensions/https-everywhere@eff.org/background-scripts/util.js b/data/extensions/https-everywhere@eff.org/background-scripts/util.js index 5a4097c..e2b069b 100644 --- a/data/extensions/https-everywhere@eff.org/background-scripts/util.js +++ b/data/extensions/https-everywhere@eff.org/background-scripts/util.js @@ -62,11 +62,16 @@ function loadExtensionFile(url, returnType) { /** * Remove tailing dots from hostname, e.g. "www.example.com." + * Preserve port numbers if they are used */ -function getNormalisedHostname(hostname) { +function getNormalisedHostname(host) { + let [ hostname, port ] = host.split(":"); while (hostname && hostname[hostname.length - 1] === '.' && hostname !== '.') { hostname = hostname.slice(0, -1); } + if (port) { + return `${hostname}:${port}`; + } return hostname; } @@ -143,6 +148,19 @@ function ArrayBufferToString(ab) { return string; } +/** + * Convert a string to an ArrayBuffer + * + * @param string: a string to convert + */ +function StringToArrayBuffer(str) { + var byteArray = new Uint8Array(str.length); + for (var i = 0; i < str.length; i++) { + byteArray[i] = str.charCodeAt(i); + } + return byteArray; +} + Object.assign(exports, { VERB, @@ -158,7 +176,8 @@ Object.assign(exports, { setDefaultLogLevel, getDefaultLogLevel, loadExtensionFile, - ArrayBufferToString + ArrayBufferToString, + StringToArrayBuffer }); })(typeof exports == 'undefined' ? require.scopes.util = {} : exports); -- cgit v1.2.3