Merge branch 'vitorpamplona:main' into labeled-bookmarks

This commit is contained in:
KotlinGeekDev
2025-11-25 11:35:01 +00:00
committed by GitHub
6 changed files with 29 additions and 15 deletions
@@ -21,6 +21,7 @@
package com.vitorpamplona.amethyst.service.relayClient.reqCommand.account.metadata
import com.vitorpamplona.amethyst.model.nip78AppSpecific.AppSpecificState.Companion.APP_SPECIFIC_DATA_D_TAG
import com.vitorpamplona.quartz.experimental.trustedAssertions.list.TrustProviderListEvent
import com.vitorpamplona.quartz.nip01Core.core.HexKey
import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent
import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter
@@ -65,6 +66,7 @@ val AccountInfoAndListsFromKeyKinds2 =
ProxyRelayListEvent.KIND,
HashtagListEvent.KIND,
GeohashListEvent.KIND,
TrustProviderListEvent.KIND,
)
val AmethystMetadataKinds = listOf(AppSpecificDataEvent.KIND)
@@ -20,6 +20,7 @@
*/
package com.vitorpamplona.amethyst.service.relayClient.reqCommand.account.metadata
import com.vitorpamplona.quartz.experimental.trustedAssertions.list.TrustProviderListEvent
import com.vitorpamplona.quartz.nip01Core.core.HexKey
import com.vitorpamplona.quartz.nip01Core.metadata.MetadataEvent
import com.vitorpamplona.quartz.nip01Core.relay.client.pool.RelayBasedFilter
@@ -59,6 +60,7 @@ val BasicAccountInfoKinds2 =
ProxyRelayListEvent.KIND,
HashtagListEvent.KIND,
GeohashListEvent.KIND,
TrustProviderListEvent.KIND,
)
fun filterBasicAccountInfoFromKeys(
@@ -16,6 +16,7 @@
<string name="malware">Ļaunprogrammatūra</string>
<string name="view_count">Skatījumi</string>
<string name="edited">rediģēts</string>
<string name="quote">Citāts</string>
<string name="add">Pievienot</string>
<string name="and">" un "</string>
<string name="following">" Seko"</string>
@@ -231,7 +231,7 @@
<string name="description_to">opis dla</string>
<string name="and_picture_to">i zdjęcie do</string>
<string name="leave">Wyjdź</string>
<string name="unfollow">Porzuć obserwację</string>
<string name="unfollow">Nie obserwuj</string>
<string name="channel_created">Kanał utworzony</string>
<string name="channel_information_changed_to">"Informacje o kanale zmienione na"</string>
<string name="ephemeral_relay_chat">Czat efemeryczny</string>
@@ -347,6 +347,7 @@
<string name="report_dialog_post_report_btn">发布举报</string>
<string name="report_dialog_title">阻止与举报</string>
<string name="block_only">仅阻止</string>
<string name="manual_zaps">手动 Zap 拆分</string>
<string name="bookmarks">书签</string>
<string name="drafts">草稿</string>
<string name="private_bookmarks">私人书签</string>
@@ -28,13 +28,13 @@ class PoolEventOutboxState(
val event: Event,
var relays: Set<NormalizedRelayUrl>,
) {
private val tries = mutableMapOf<NormalizedRelayUrl, Tries>()
private var tries = mapOf<NormalizedRelayUrl, Tries>()
fun updateRelays(newRelays: Set<NormalizedRelayUrl>) {
relays = newRelays
}
fun isDone(url: NormalizedRelayUrl) = tries[url]?.let { it.isDone() } ?: false
fun isDone(url: NormalizedRelayUrl) = tries[url]?.isDone() ?: false
fun isDone() = relays.all { isDone(it) }
@@ -52,9 +52,9 @@ class PoolEventOutboxState(
fun newTry(url: NormalizedRelayUrl) {
val currentTries = tries[url]
if (currentTries != null) {
currentTries.tries.add(TimeUtils.now())
currentTries.addTriedTime(TimeUtils.now())
} else {
tries.put(url, Tries(mutableListOf(TimeUtils.now())))
tries = tries + (url to Tries(listOf(TimeUtils.now())))
}
}
@@ -65,24 +65,32 @@ class PoolEventOutboxState(
) {
val currentTries = tries[url]
if (currentTries != null) {
currentTries.responses.add(Response(success, message))
currentTries.addResponse(Response(success, message))
} else {
tries.put(
url,
Tries(
mutableListOf(TimeUtils.now() - 1),
mutableListOf(Response(success, message)),
),
tries = tries + (
url to
Tries(
listOf(TimeUtils.now() - 1),
listOf(Response(success, message)),
)
)
}
}
// Tries 3 times
class Tries(
val tries: MutableList<Long> = mutableListOf(),
val responses: MutableList<Response> = mutableListOf(),
var tries: List<Long> = listOf(),
var responses: List<Response> = listOf(),
) {
fun isDone() = responses.any { it.success == true } || responses.size > 2 || tries.size > 3
fun isDone() = responses.any { it.success } || responses.size > 2 || tries.size > 3
fun addResponse(r: Response) {
responses += r
}
fun addTriedTime(tried: Long) {
tries += tried
}
}
class Response(