feat: add Android APK with embedded I2P browser and torrent manager
check / check (ubuntu-latest) (push) Failing after 26s
check / check (macos-latest) (push) Failing after 29s
check / check (windows-latest) (push) Failing after 26s

- Add an Android app (org.mooni2p.browser) with an I2P WebView browser defaulting to insulaocculta.i2p, bookmarks, and a diagnostics dialog.
- Run the router in a foreground service and add a Torrents & DHT tab backed by the router API (manager.html).
- Handle magnet links and .torrent files from intents, the file picker, and .i2p downloads.
- Add scripts/build_apk.py and a `just apk` target that builds arm64-v8a and x86_64 APKs.
- Document the APK build and install steps in the README.
- Include related bittorrent, router, streaming, and ntcp2_net updates.
This commit is contained in:
nandi committed 2026-11-28 17:55:42 -08:00
1 parent fbe6818c4e
commit 7a1b4325f9
16 files changed
+3041 -78

No files matched your search

+52
View File
@@ -65,6 +65,11 @@ pub(all) enum PeerMessage {
Request(Int32, Int32, Int32)
Piece(Int32, Int32, Bytes)
Cancel(Int32, Int32, Int32)
SuggestPiece(UInt32)
HaveAll
HaveNone
RejectRequest(Int32, Int32, Int32)
AllowedFast(UInt32)
Extended(Byte, Bytes)
}
@@ -121,6 +126,31 @@ pub fn encode_peer_message(msg : PeerMessage) -> Bytes {
w.write_u32_be(begin.reinterpret_as_uint())
w.write_u32_be(len.reinterpret_as_uint())
}
SuggestPiece(idx) => {
w.write_u32_be(5U)
w.write_u8(b'\x0d')
w.write_u32_be(idx)
}
HaveAll => {
w.write_u32_be(1U)
w.write_u8(b'\x0e')
}
HaveNone => {
w.write_u32_be(1U)
w.write_u8(b'\x0f')
}
RejectRequest(idx, begin, len) => {
w.write_u32_be(13U)
w.write_u8(b'\x10')
w.write_u32_be(idx.reinterpret_as_uint())
w.write_u32_be(begin.reinterpret_as_uint())
w.write_u32_be(len.reinterpret_as_uint())
}
AllowedFast(idx) => {
w.write_u32_be(5U)
w.write_u8(b'\x11')
w.write_u32_be(idx)
}
Extended(ext_id, payload) => {
w.write_u32_be((2 + payload.length()).reinterpret_as_uint())
w.write_u8(b'\x14')
@@ -205,6 +235,22 @@ pub fn try_decode_peer_message(buf : Array[Byte]) -> PeerMessage? raise BtError
let len = (r.read_u32_be() catch { e => raise Encoding(e) }).reinterpret_as_int()
Some(Cancel(idx, begin, len))
}
b'\x0d' => {
let idx = r.read_u32_be() catch { e => raise Encoding(e) }
Some(SuggestPiece(idx))
}
b'\x0e' => Some(HaveAll)
b'\x0f' => Some(HaveNone)
b'\x10' => {
let idx = (r.read_u32_be() catch { e => raise Encoding(e) }).reinterpret_as_int()
let begin = (r.read_u32_be() catch { e => raise Encoding(e) }).reinterpret_as_int()
let len = (r.read_u32_be() catch { e => raise Encoding(e) }).reinterpret_as_int()
Some(RejectRequest(idx, begin, len))
}
b'\x11' => {
let idx = r.read_u32_be() catch { e => raise Encoding(e) }
Some(AllowedFast(idx))
}
b'\x14' => {
let ext_id = r.read_u8() catch { e => raise Encoding(e) }
Some(Extended(ext_id, r.read_remaining()))
@@ -220,6 +266,7 @@ pub(all) struct RemoteExtensions {
mut i2p_pex_id : Byte?
mut i2p_dht_id : Byte?
mut metadata_size : Int32?
mut client_name : String
}
///|
@@ -252,6 +299,7 @@ pub fn decode_ext_handshake(payload : Bytes) -> RemoteExtensions raise BtError {
i2p_pex_id: None,
i2p_dht_id: None,
metadata_size: None,
client_name: "",
}
match bdict_get(d, "m") {
Some(m) => {
@@ -275,6 +323,10 @@ pub fn decode_ext_handshake(payload : Bytes) -> RemoteExtensions raise BtError {
res.metadata_size = Some(sz.to_int())
_ => ()
}
match bdict_get_string(d, "v") {
Some(v) => res.client_name = v
None => ()
}
res
}