Keep parity diagnostics and archive reads compatible with older Android

This commit is contained in:
callebtc 2026-09-08 00:43:59 +03:00
parent 43d9d85797
commit f41e844298
5 changed files with 20 additions and 13 deletions

View File

@ -80,7 +80,7 @@ internal class MeshPingManager(
times.lastOrNull()?.let { now - it >= MeshDiagnosticsConstants.INBOUND_RATE_WINDOW_MILLIS } != false
}
}
if (inboundByLink.size >= 256 && link !in inboundByLink) return false
if (inboundByLink.size >= 256 && !inboundByLink.containsKey(link)) return false
inboundByLink.putIfAbsent(link, ArrayDeque())
}
val timestamps = inboundByLink[link] ?: return false

View File

@ -457,15 +457,18 @@ class GossipSyncManager(
if (!file.exists()) return
try {
restoringArchive = true
val input = java.io.DataInputStream(file.inputStream().buffered())
val count = input.readInt().coerceIn(0, configProvider.seenCapacity())
repeat(count) {
val length = input.readInt()
if (length <= 0 || length > com.bitchat.android.util.AppConstants.Protocol.MAX_PAYLOAD_LENGTH + 256) return@repeat
val packet = com.bitchat.android.protocol.BinaryProtocol.decode(input.readNBytes(length)) ?: return@repeat
onPublicPacketSeen(packet)
java.io.DataInputStream(file.inputStream().buffered()).use { input ->
val count = input.readInt()
require(count in 0..configProvider.seenCapacity())
repeat(count) {
val length = input.readInt()
require(length in 1..(com.bitchat.android.util.AppConstants.Protocol.MAX_PAYLOAD_LENGTH + 256))
val bytes = ByteArray(length)
input.readFully(bytes)
val packet = com.bitchat.android.protocol.BinaryProtocol.decode(bytes) ?: return@repeat
onPublicPacketSeen(packet)
}
}
input.close()
} catch (_: Exception) {
synchronized(messages) { messages.clear() }
} finally {

View File

@ -233,13 +233,16 @@ fun LocationChannelsSheet(
// Mesh section: icon + title header, offline subtitle, then selection card
(selectedChannel as? ChannelID.Location)?.channel?.geohash?.let { cell ->
item(key = "share_channel") {
val shareTitle = stringResource(R.string.share_channel)
val link = com.bitchat.android.services.ChannelInvitation.link(cell)
val invitation = stringResource(R.string.channel_invitation, cell, link.orEmpty())
androidx.compose.material3.TextButton(onClick = {
val link = com.bitchat.android.services.ChannelInvitation.link(cell)
if (link != null) context.startActivity(android.content.Intent.createChooser(
android.content.Intent(android.content.Intent.ACTION_SEND).apply {
type = "text/plain"
putExtra(android.content.Intent.EXTRA_TEXT, context.getString(R.string.channel_invitation, cell, link))
}, context.getString(R.string.share_channel)))
putExtra(android.content.Intent.EXTRA_TEXT, invitation)
}, shareTitle))
}, modifier = Modifier.fillMaxWidth()) { Text(stringResource(R.string.share_channel)) }
}
}

View File

@ -184,7 +184,7 @@
<string name="about_no_tracking_desc">No servers, accounts, or data collection.</string>
<string name="about_ephemeral_title">Ephemeral Identity</string>
<string name="about_ephemeral_desc">A new peer ID is generated regularly.</string>
<string name="about_panic_desc">Triple-tap the logo to instantly clear all data.</string>
<string name="about_panic_desc">Triple-tap the logo to review and confirm erasing local app data.</string>
<!-- About sheet: settings labels -->
<string name="about_tor_title">Tor Network</string>

View File

@ -116,7 +116,8 @@ Physical Mesh Lab and Android-to-iOS interoperability are required separately:
- One-time-prekey races and consumption persistence, plus iOS vectors on both
real clients. Static screenshots cannot establish any of these properties.
Full locale coverage, accessibility review and the physical matrix remain
The updated panic-help sentence falls back to English where previous translations
still promised immediate erasure; those stale claims are removed. Full locale coverage, accessibility review and the physical matrix remain
release work. Manual-channel Nostr board publication still obeys the existing
location-note privacy gate; this integration does not weaken it to force a
successful publish. No claim is made that this large integration is ready to