修复部分情况下未应用wss的bug

This commit is contained in:
WarmthDawn 2022-02-11 19:55:38 +08:00
parent 5155136e0c
commit ee6a2a538c

View File

@ -5,8 +5,8 @@
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
According to the AGPL, it is forbidden to delete all copyright notices,
According to the AGPL, it is forbidden to delete all copyright notices,
and if you modify the source code, you must open source the
modified source code.
@ -109,13 +109,15 @@ export function parseforwardAddress(addr = "", require = "http") {
else if (addrProtocolString.indexOf("wss://") === 0) protocol = "https://";
else if (addrProtocolString.indexOf("http://") === 0) protocol = "http://";
else if (addrProtocolString.indexOf("https://") === 0) protocol = "https://";
else protocol = `http://`;
else if (protocol === "https://") protocol = "https://";
else protocol = "http://";
}
if (require === "ws") {
if (addrProtocolString.indexOf("http://") === 0) protocol = "ws://";
else if (addrProtocolString.indexOf("https://") === 0) protocol = "wss://";
else if (addrProtocolString.indexOf("ws://") === 0) protocol = "ws://";
else if (addrProtocolString.indexOf("wss://") === 0) protocol = "wss://";
else if (protocol === "https://") protocol = "wss://";
else protocol = "ws://";
}