Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ function ensureUrlFormat(host: string, port: number): string {
if (host.includes("://")) {
return host; // Already in URL format
}
// Convert old hostname-only format to URL
// Heuristic guess to decide if we should use a secure connection
// if the host was entered without a URL prefix
// Insecure connections aren't allowed outside localhost
const isLocalhost =
host === "localhost" || host === "127.0.0.1" || host === "::1";
const scheme = isLocalhost
? "ws"
: port === 6697 || port === 9999 || port === 443 || port === 993
? "wss"
: "ws";
: "wss";
return `${scheme}://${host}:${port}`;
}

Expand Down