v0.9.5: bubble for Android 0.7.8 — the relay is just a relay server: its address is a setting, and deploy-relay.sh reads scripts/relay.env

This commit is contained in:
2026-11-16 11:19:54 -08:00
parent 8b3cfdca24
commit 6f365df087
24 changed files with 103 additions and 93 deletions
+3 -3
View File
@@ -87,7 +87,7 @@ Install/Sync buttons then target the dev app with the sandbox's made-up data.
side, through `MmsFiles`. Long texts go as multipart SMS; photos, voice notes
and group chats as MMS (needs mobile data on). The dev app's sandbox never
uses the SIM.
- Relay (`Relay`, `RelayJob`): the desktop's link through jai (its
- Relay (`Relay`, `RelayJob`): the desktop's link through the relay server (its
`src/main/relay.ts`, server `server/bubble_relay.py`). config.json's `relay`
(address, token, AES-256-GCM key) comes from Sync to Rabbit. The SIM's
messages go to the desktop, sends typed there go out here (each one at most
@@ -96,7 +96,7 @@ Install/Sync buttons then target the dev app with the sandbox's made-up data.
of its own: it rides along with `PollJob`'s checks, plus one network job a few
seconds after something happens here (a text in, a send done, a swipe or
rename), and a catch-up when the app is opened (at most once a minute). Plain
http is allowed only to jai's tailscale address and localhost
(`res/xml/network_security_config.xml`).
http is allowed only to a tailscale (100.64/10) address and localhost
(`Config`; `res/xml/network_security_config.xml` lets cleartext through).
- The scroll wheel is left alone: it stays the volume control (and volume
down + the side button still takes a screenshot).
@@ -53,7 +53,7 @@ final class Config {
final List<Did> dids = new CopyOnWriteArrayList<>();
private boolean hasSim;
String defaultDid;
/** The relay through jai (Relay.java): address, bearer token, and the 32-byte key that seals everything. */
/** The relay server (Relay.java): address, bearer token, and the 32-byte key that seals everything. */
String relayUrl, relayToken;
byte[] relayKey;
/** Made-up data for testing (android/tools/push_sandbox.py): never goes online. */
@@ -127,8 +127,8 @@ final class Config {
if (r != null) {
String url = r.optString("url", ""), token = r.optString("token", "");
byte[] key = android.util.Base64.decode(r.optString("key", ""), android.util.Base64.DEFAULT);
// Only the addresses network_security_config lets through, and a real key.
if (url.matches("http://(100\\.\\d+\\.\\d+\\.\\d+|127\\.0\\.0\\.1)(:\\d+)?|https://[^/]+") && !token.isEmpty() && key.length == 32) {
// Plain http only to a tailscale (100.64/10) address or localhost, as the desktop allows, and a real key.
if (url.matches("http://(100\\.(6[4-9]|[7-9]\\d|1[01]\\d|12[0-7])\\.\\d+\\.\\d+|127\\.0\\.0\\.1)(:\\d+)?|https://[^/]+") && !token.isEmpty() && key.length == 32) {
cfg.relayUrl = url;
cfg.relayToken = token;
cfg.relayKey = key;
@@ -28,13 +28,13 @@ import javax.crypto.spec.GCMParameterSpec;
import javax.crypto.spec.SecretKeySpec;
/**
* The relay through jai (the desktop's src/main/relay.ts; server in
* The relay server (the desktop's src/main/relay.ts; server in
* server/bubble_relay.py): the SIM's texts go to the desktop, texts typed
* there go out over the SIM here, and chat names and read/unread/archived
* stay in step without a cable.
*
* Everything is AES-256-GCM sealed with the key the desktop handed over USB
* (config.json "relay"); jai only passes blobs on. It runs with the checks
* (config.json "relay"); the relay server only passes blobs on. It runs with the checks
* the Rabbit already makes (PollJob) plus one network job after something
* happens here (a text, a send, a swipe), never on a timer of its own: the
* battery pays for nothing new while nothing's going on.
@@ -141,7 +141,7 @@ final class Relay {
// ---- one sync ----
/** One round with jai (more while there's more). Off the main thread; quiet when jai's unreachable. */
/** One round with the relay server (more while there's more). Off the main thread; quiet when it's unreachable. */
static void sync(Context c) {
Config cfg = Config.get(c);
if (!configured(cfg)) return;
@@ -241,11 +241,11 @@ final class Relay {
h.put("Authorization", "Bearer " + cfg.relayToken);
h.put("Content-Type", "application/json");
Http.Response r = Http.request("POST", cfg.relayUrl + "/sync", h, body, 120_000);
if (r.status == 401) throw new Exception("jai turned down the token (Sync to Rabbit from the desktop again)");
if (r.status != 200) throw new Exception("jai answered " + r.status);
if (r.status == 401) throw new Exception("The relay server turned down the token (Sync to Rabbit from the desktop again)");
if (r.status != 200) throw new Exception("The relay server answered " + r.status);
JSONObject res = new JSONObject(new String(r.body, StandardCharsets.UTF_8));
// jai has them now.
// The relay server has them now.
if (resultsPushed > 0) takeList(c, "results", resultsPushed);
if (wantsDone > 0) takeList(c, "wants", wantsDone);
SharedPreferences.Editor ed = p.edit().putLong("smsLast", newSms[0]).putLong("mmsLast", newMms[0]);
@@ -144,7 +144,7 @@ public final class SettingsActivity extends BaseActivity {
}
if (Relay.configured(cfg)) {
section("Relay (jai)");
section("Relay server");
kv("Desktop link", Relay.status(c));
note("Texts typed on the desktop for \"via SIM\" go out at this Rabbit's background check, and chat names and read status"
+ " go both ways. Sealed with a key only the desktop and this Rabbit have.");
@@ -1,11 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Everything is https, except the relay on jai over tailscale (WireGuard
<!-- Everything is https, except the relay server over tailscale (WireGuard
already encrypts that hop, and what it carries is sealed: Relay.java) and
localhost for testing it with adb reverse. -->
localhost for testing it with adb reverse. Its address is a setting, so
cleartext can't be pinned to it here: Config only accepts http:// for a
tailscale (100.64/10) address or 127.0.0.1, and nothing else uses http. -->
<network-security-config>
<base-config cleartextTrafficPermitted="false" />
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="false">100.69.139.40</domain>
<domain includeSubdomains="false">127.0.0.1</domain>
</domain-config>
<base-config cleartextTrafficPermitted="true" />
</network-security-config>
+2 -2
View File
@@ -26,8 +26,8 @@ import sys
import zipfile
from pathlib import Path
VERSION_NAME = "0.7.7"
VERSION_CODE = 15
VERSION_NAME = "0.7.8"
VERSION_CODE = 16
PACKAGE = "me.teafry.voipmessages"
DEV_PACKAGE = PACKAGE + ".dev"