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 -2
View File
@@ -345,11 +345,53 @@ fn Router::build_api_torrents_json(self : Router) -> String {
}
}
let mut active_peers = 0
for p in t.peers {
let mut unchoked_peers = 0
let mut seeder_peers = 0
let peers_sb = StringBuilder()
peers_sb.write_char('[')
for pi = 0; pi < t.peers.length(); pi = pi + 1 {
let p = t.peers[pi]
if pi > 0 {
peers_sb.write_char(',')
}
let mut p_pieces = 0
for hp in p.peer_bitfield {
if hp {
p_pieces += 1
}
}
if p.state == 3 {
active_peers += 1
if !p.peer_choking {
unchoked_peers += 1
}
if p_pieces > 0 || p.peer_have_all {
seeder_peers += 1
}
}
let pb32 = bt_short_b32(p.peer_hash)
peers_sb.write_char('{')
peers_sb.write_string("\"b32\":\"\{api_json_escape(pb32)}\",")
peers_sb.write_string("\"state\":\{p.state},")
peers_sb.write_string("\"choking\":\{p.peer_choking},")
peers_sb.write_string("\"pieces\":\{p_pieces},")
peers_sb.write_string("\"in_flight\":\{p.in_flight.length()},")
peers_sb.write_string("\"blocks_recv\":\{p.blocks_recv},")
peers_sb.write_string(
"\"client\":\"\{api_json_escape(p.remote_client)}\"",
)
peers_sb.write_char('}')
}
peers_sb.write_char(']')
let mut inflight_blocks = 0
for pbuf in t.inflight_pieces {
for g in pbuf.got_blocks {
if g {
inflight_blocks += 1
}
}
}
let inflight_bytes = inflight_blocks.to_int64() * 16384L
let state_str = if t.error.length() > 0 {
"error"
} else if t.paused {
@@ -380,12 +422,20 @@ fn Router::build_api_torrents_json(self : Router) -> String {
sb.write_string("\"uploaded_bytes\":\{t.uploaded_bytes},")
sb.write_string("\"have_pieces\":\{have_cnt},")
sb.write_string("\"num_pieces\":\{num_pieces},")
sb.write_string("\"inflight_blocks\":\{inflight_blocks},")
sb.write_string("\"inflight_bytes\":\{inflight_bytes},")
sb.write_string("\"progress_pct\":\{progress_pct},")
sb.write_string("\"known_peers\":\{t.known_peers.length()},")
sb.write_string("\"connected_peers\":\{active_peers},")
sb.write_string("\"unchoked_peers\":\{unchoked_peers},")
sb.write_string("\"seeder_peers\":\{seeder_peers},")
sb.write_string("\"trackers\":\{t.trackers.length()},")
sb.write_string(
"\"last_tracker_status\":\"\{api_json_escape(t.last_tracker_status)}\",",
)
sb.write_string("\"download_dir\":\"\{api_json_escape(t.download_dir)}\",")
sb.write_string("\"error\":\"\{api_json_escape(t.error)}\"")
sb.write_string("\"error\":\"\{api_json_escape(t.error)}\",")
sb.write_string("\"peers\":\{peers_sb.to_string()}")
sb.write_char('}')
}
sb.write_string("]}")