mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-27 19:06:34 +02:00
Merge pull request #946 from greenart7c3/main
check for localhost when adding a new relay
This commit is contained in:
@@ -31,7 +31,9 @@ class RelayUrlFormatter {
|
|||||||
fun normalize(url: String): String {
|
fun normalize(url: String): String {
|
||||||
val newUrl =
|
val newUrl =
|
||||||
if (!url.startsWith("wss://") && !url.startsWith("ws://")) {
|
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()}"
|
"ws://${url.trim()}"
|
||||||
} else {
|
} else {
|
||||||
"wss://${url.trim()}"
|
"wss://${url.trim()}"
|
||||||
|
Reference in New Issue
Block a user