Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ dependencies {
// EXIF orientation handling for images
implementation("androidx.exifinterface:exifinterface:1.3.7")

// Async image loading from URLs (Coil)
implementation(libs.coil.compose)

// Testing
testImplementation(libs.bundles.testing)
androidTestImplementation(platform(libs.androidx.compose.bom))
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/java/com/bitchat/android/mesh/BluetoothMeshService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,18 @@ class BluetoothMeshService(private val context: Context) {
}
}

/**
* Broadcast a pre-built BitchatPacket (signs it before sending).
* Used by NostrProfileManager for mesh fallback when relays are unavailable.
*/
fun broadcastPacket(packet: BitchatPacket) {
serviceScope.launch {
val signedPacket = signPacketBeforeBroadcast(packet)
connectionManager.broadcastPacket(RoutedPacket(signedPacket))
try { gossipSyncManager.onPublicPacketSeen(signedPacket) } catch (_: Exception) { }
}
}

/**
* Send a file over mesh as a broadcast MESSAGE (public mesh timeline/channels).
*/
Expand Down
12 changes: 12 additions & 0 deletions app/src/main/java/com/bitchat/android/mesh/MessageHandler.kt
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,18 @@ class MessageHandler(private val myPeerID: String, private val appContext: andro
val packet = routed.packet
val peerID = routed.peerID ?: "unknown"

// Check if this is a Nostr relay request packet (should be forwarded to relays, not displayed)
if (packet.payload.isNotEmpty()) {
val header = packet.payload[0]
if (header == com.bitchat.android.nostr.NostrMeshSerializer.TYPE_NOSTR_RELAY_REQUEST ||
header == com.bitchat.android.nostr.NostrMeshSerializer.TYPE_NOSTR_PLAINTEXT) {
Log.d(TAG, "📡 Received Nostr relay request via mesh from ${peerID.take(8)}, routing to gateway")
// Route to NostrMeshGateway for relay publishing (if we have internet)
com.bitchat.android.nostr.NostrMeshGateway.meshPacketReceived(appContext, packet.payload, null)
return // Don't display Nostr relay packets as chat messages
}
}

// Enforce: only accept public messages from verified peers we know
val peerInfo = delegate?.getPeerInfo(peerID)
if (peerInfo == null || !peerInfo.isVerifiedNickname) {
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/java/com/bitchat/android/nostr/NostrFilter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ data class NostrFilter(
fun forEvents(ids: List<String>): NostrFilter {
return NostrFilter(ids = ids)
}

/**
* Create filter for user metadata (kind 0) - profile information
*/
fun profileMetadata(pubkey: String): NostrFilter {
return NostrFilter(
kinds = listOf(NostrKind.METADATA),
authors = listOf(pubkey),
limit = 1
)
}
}

/**
Expand Down
Loading