Add proxy speed measurement, connection logs and standalone Android packaging

This commit is contained in:
shen
2026-10-13 23:08:57 -07:00
parent f94dab0555
commit 72566b9a8a
22 changed files with 551 additions and 91 deletions
+3 -1
View File
@@ -30,6 +30,8 @@ cd apps/meshport_lab
flutter build apk "$mode" --target-platform android-arm64 --build-number="$build_number"
cd ../..
mkdir -p outputs/android
output="$PWD/outputs/android/MeshPort-0.1.0-$build_number-$profile.apk"
prefix=MeshPort
if [ "${MESHPORT_ANDROID_STANDALONE:-0}" = 1 ]; then prefix=MeshPort-Standalone; fi
output="$PWD/outputs/android/$prefix-0.1.0-$build_number-$profile.apk"
cp "apps/meshport_lab/build/app/outputs/flutter-apk/app-$profile.apk" "$output"
printf '%s\n' "$output"
+12 -1
View File
@@ -1,6 +1,15 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
case "${1:-}" in
"") ;;
--standalone)
python3 scripts/prepare-android-standalone-signing.py
export MESHPORT_ANDROID_STANDALONE=1
export MESHPORT_ANDROID_SIGNING_PROPERTIES="$PWD/work/android-signing/standalone.properties"
;;
*) printf '%s\n' 'usage: package-lab-android.sh [--standalone]' >&2; exit 2 ;;
esac
config=apps/meshport_lab/assets/config/default.toml
saved=$(mktemp)
had_config=0
@@ -12,5 +21,7 @@ restore_config() {
trap restore_config EXIT HUP INT TERM
build_number=$(date +%s)
MESHPORT_PUBLIC_CONFIG=1 MESHPORT_BUILD_NUMBER="$build_number" sh scripts/build-lab-android.sh --release
output="outputs/android/MeshPort-0.1.0-$build_number-release.apk"
prefix=MeshPort
if [ "${MESHPORT_ANDROID_STANDALONE:-0}" = 1 ]; then prefix=MeshPort-Standalone; fi
output="outputs/android/$prefix-0.1.0-$build_number-release.apk"
shasum -a 256 "$output" > "$output.sha256"
@@ -0,0 +1,40 @@
#!/usr/bin/env python3
"""Create a persistent local signing identity for the independent Android app."""
import os
from pathlib import Path
import secrets
import shutil
import subprocess
root = Path(__file__).resolve().parents[1]
directory = root / "work/android-signing"
directory.mkdir(parents=True, exist_ok=True, mode=0o700)
directory.chmod(0o700)
properties = directory / "standalone.properties"
keystore = directory / "standalone.jks"
if properties.exists() and keystore.exists():
print("Reusing the independent app signing identity")
elif properties.exists() or keystore.exists():
raise SystemExit("Incomplete signing identity; restore its backup instead of generating a new key")
else:
java_home = os.environ.get("JAVA_HOME", "/Applications/Android Studio.app/Contents/jbr/Contents/Home")
keytool = Path(java_home) / "bin/keytool"
if not keytool.is_file():
keytool = shutil.which("keytool")
if not keytool:
raise SystemExit("Set JAVA_HOME to a JDK containing keytool")
password = secrets.token_hex(32)
environment = dict(os.environ, MESHPORT_SIGNING_PASSWORD=password)
subprocess.run([
str(keytool), "-genkeypair", "-keystore", str(keystore),
"-storetype", "JKS", "-storepass:env", "MESHPORT_SIGNING_PASSWORD",
"-keypass:env", "MESHPORT_SIGNING_PASSWORD", "-alias", "meshportstandalone",
"-keyalg", "RSA", "-keysize", "3072", "-validity", "10000",
"-dname", "CN=MeshPort Standalone, O=MeshPort", "-noprompt",
], env=environment, check=True)
keystore.chmod(0o600)
with properties.open("x") as output:
properties.chmod(0o600)
output.write(f"storeFile={keystore}\nstorePassword={password}\n"
f"keyAlias=meshportstandalone\nkeyPassword={password}\n")
print("Created the independent app signing identity; keep work/android-signing for future upgrades")