Merge pull request #946 from greenart7c3/main

check for localhost when adding a new relay
This commit is contained in:
Vitor Pamplona
2024-06-26 15:44:00 -04:00
committed by GitHub

View File

@@ -31,7 +31,9 @@ class RelayUrlFormatter {
fun normalize(url: String): String {
val newUrl =
if (!url.startsWith("wss://") && !url.startsWith("ws://")) {
if (url.endsWith(".onion") || url.endsWith(".onion/")) {
// TODO: How to identify relays on the local network?
val isLocalHost = url.contains("127.0.0.1") || url.contains("localhost")
if (url.endsWith(".onion") || url.endsWith(".onion/") || isLocalHost) {
"ws://${url.trim()}"
} else {
"wss://${url.trim()}"