Skip to content

Commit

Permalink
Fix duplicated relay url
Browse files Browse the repository at this point in the history
  • Loading branch information
greenart7c3 committed Nov 4, 2024
1 parent 8ff4517 commit b122408
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ data class BunkerRequest(
}.toTypedArray(),
localKey = jsonObject.get("localKey")?.asText()?.intern() ?: "",
relays = jsonObject.get("relays")?.asIterable()?.toList()?.map {
RelaySetupInfo(it.asText().intern(), read = true, write = true, feedTypes = COMMON_FEED_TYPES)
var relayUrl = it.asText().intern()
if (relayUrl.endsWith("/")) relayUrl = relayUrl.dropLast(1)
RelaySetupInfo(relayUrl, read = true, write = true, feedTypes = COMMON_FEED_TYPES)
} ?: NostrSigner.getInstance().getSavedRelays().toList(),
secret = jsonObject.get("secret")?.asText()?.intern() ?: "",
currentAccount = jsonObject.get("currentAccount")?.asText()?.intern() ?: "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -806,8 +806,10 @@ object IntentUtils {
if (index == 0) null else s
}.joinToString { data -> data }
if (paramName == "relay") {
var relayUrl = json
if (relayUrl.endsWith("/")) relayUrl = relayUrl.dropLast(1)
relays.add(
RelaySetupInfo(json, read = true, write = true, feedTypes = COMMON_FEED_TYPES),
RelaySetupInfo(relayUrl, read = true, write = true, feedTypes = COMMON_FEED_TYPES),
)
}
if (paramName == "name") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
import android.provider.Settings
import android.util.Log
import android.widget.Toast
import androidx.activity.compose.ManagedActivityResultLauncher
Expand Down

0 comments on commit b122408

Please sign in to comment.