feat(onboarding): always include relay.wisp.talk in new user's NIP-65
When a new user finishes profile setup, OnboardingViewModel.finishProfile saves the discovered+tested relays locally and publishes a kind 10002 relay list event. Insert wss://relay.wisp.talk into that list before saving and publishing, so every new Wisp account advertises Wisp's relay to the network from day one. Read+write so the new user both publishes to and reads from it. Dedup on URL (case-insensitive) so we don't duplicate if probing already discovered the relay independently. Reverts the earlier change to RelayConfig.DEFAULTS — that was the wrong place. The DEFAULTS list is a fallback for users without an onboarding flow; new-account injection belongs in onboarding where the relay list event is actually constructed and published.
This commit is contained in:
@@ -31,7 +31,6 @@ data class RelayConfig(
|
||||
val DEFAULTS = listOf(
|
||||
RelayConfig("wss://relay.damus.io", read = true, write = true),
|
||||
RelayConfig("wss://relay.primal.net", read = true, write = true),
|
||||
RelayConfig("wss://relay.wisp.talk", read = true, write = true),
|
||||
RelayConfig("wss://indexer.coracle.social", read = true, write = false),
|
||||
RelayConfig("wss://relay.nos.social", read = true, write = false)
|
||||
)
|
||||
|
||||
@@ -95,6 +95,7 @@ class OnboardingViewModel(app: Application) : AndroidViewModel(app) {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "OnboardingSuggestions"
|
||||
private const val WISP_RELAY_URL = "wss://relay.wisp.talk"
|
||||
val CREATOR_PUBKEYS = listOf(
|
||||
"3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d", // fiatjaf
|
||||
"e2ccf7cf20403f3f2a4a55b328f0de3be38558a7d5f33632fdaaefc726c1c8eb" // utxo
|
||||
@@ -211,7 +212,15 @@ class OnboardingViewModel(app: Application) : AndroidViewModel(app) {
|
||||
signer: NostrSigner? = null
|
||||
): Boolean {
|
||||
val s = signer ?: keyRepo.getKeypair()?.let { LocalSigner(it.privkey, it.pubkey) } ?: return false
|
||||
val relays = _discoveredRelays.value ?: RelayConfig.DEFAULTS
|
||||
val discovered = _discoveredRelays.value ?: RelayConfig.DEFAULTS
|
||||
// Always include Wisp's own relay in the new account's NIP-65 list,
|
||||
// regardless of what relay probing discovered. Read+write so the new
|
||||
// user both publishes to and reads from it from day one.
|
||||
val relays = if (discovered.any { it.url.equals(WISP_RELAY_URL, ignoreCase = true) }) {
|
||||
discovered
|
||||
} else {
|
||||
discovered + RelayConfig(WISP_RELAY_URL, read = true, write = true)
|
||||
}
|
||||
|
||||
return try {
|
||||
_publishing.value = true
|
||||
|
||||
Reference in New Issue
Block a user