mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-10 00:16:59 +00:00
fix(relayauth): expand IF_IN_MY_LIST to all live relay lists minus blocked
Replace the localRelayServers-only check with account.trustedRelays (nip65, private outbox, local, dm, search, indexer, proxy, trusted, broadcast relay lists combined) minus account.blockedRelayList. Uses normalizeRelayUrlOrNull for consistent URL comparison. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013hTFpoExYYLYEGGtXBx6ZT
This commit is contained in:
+4
-3
@@ -28,6 +28,7 @@ import com.vitorpamplona.amethyst.service.relayClient.authCommand.model.AuthCoor
|
||||
import com.vitorpamplona.amethyst.service.relayClient.authCommand.model.RelayAuthPermissionLedger
|
||||
import com.vitorpamplona.amethyst.service.relayClient.authCommand.model.ScreenAuthAccount
|
||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
|
||||
import com.vitorpamplona.quartz.nip01Core.relay.normalizer.normalizeRelayUrlOrNull
|
||||
|
||||
@Composable
|
||||
fun RelayAuthSubscription(accountViewModel: AccountViewModel) = RelayAuthSubscription(accountViewModel, Amethyst.instance.authCoordinator)
|
||||
@@ -50,9 +51,9 @@ fun RelayAuthSubscription(
|
||||
store = Amethyst.instance.relayAuthPermissionStore,
|
||||
globalPolicy = { account.settings.defaultRelayAuthPolicy.value },
|
||||
isInMyRelayList = { relayUrl ->
|
||||
account.settings.localRelayServers.value.any {
|
||||
it.trimEnd('/') == relayUrl.trimEnd('/')
|
||||
}
|
||||
val normalized = relayUrl.normalizeRelayUrlOrNull() ?: return@RelayAuthPermissionLedger false
|
||||
normalized !in account.blockedRelayList.flow.value &&
|
||||
normalized in account.trustedRelays.flow.value
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user