Improve VPN video routing, profile storage and authorization reuse
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
sh scripts/prepare-lab-default.sh
|
||||
if [ "${MESHPORT_PUBLIC_CONFIG:-0}" = 1 ]; then
|
||||
cp apps/meshport_lab/assets/config/default.example.toml apps/meshport_lab/assets/config/default.toml
|
||||
else
|
||||
sh scripts/prepare-lab-default.sh
|
||||
fi
|
||||
mode="${1:---release}"
|
||||
case "$mode" in --debug|--release) ;; *) printf '%s\n' 'usage: build-lab-android.sh [--debug|--release]' >&2; exit 2;; esac
|
||||
sdk="${ANDROID_SDK_ROOT:-$HOME/Library/Android/sdk}"
|
||||
@@ -21,7 +25,7 @@ sh scripts/build-singbox-library.sh android
|
||||
mkdir -p apps/meshport_lab/android/app/src/main/jniLibs/arm64-v8a
|
||||
cp "target/aarch64-linux-android/$profile/libmeshport_ffi.so" apps/meshport_lab/android/app/src/main/jniLibs/arm64-v8a/
|
||||
cp target/singbox/android-arm64/libmeshport_proxy.so apps/meshport_lab/android/app/src/main/jniLibs/arm64-v8a/
|
||||
build_number=$(date +%s)
|
||||
build_number="${MESHPORT_BUILD_NUMBER:-$(date +%s)}"
|
||||
cd apps/meshport_lab
|
||||
flutter build apk "$mode" --target-platform android-arm64 --build-number="$build_number"
|
||||
cd ../..
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Remove reproducible workspace artifacts, keeping tools, profiles and packages."""
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
paths = [
|
||||
"target",
|
||||
"apps/meshport_lab/build",
|
||||
"apps/meshport_lab/.dart_tool",
|
||||
"apps/meshport_lab/android/.gradle",
|
||||
"apps/meshport_lab/android/.kotlin",
|
||||
"apps/meshport_lab/android/app/src/main/jniLibs",
|
||||
"work/cache",
|
||||
"work/bin",
|
||||
"work/android-validation",
|
||||
"work/ui-preview",
|
||||
"work/menubar-preview",
|
||||
"work/menubar-native-tests.xcresult",
|
||||
"work/menubar-native-tests-2.xcresult",
|
||||
"work/menubar-native-tests-3.xcresult",
|
||||
"work/video-tcp-core",
|
||||
"work/singbox-patched",
|
||||
"work/singbox-patched.go.mod",
|
||||
"work/singbox-patched.go.sum",
|
||||
"work/easytier-upstream.tar.gz",
|
||||
"work/toolchain/go-sdk.tar.gz",
|
||||
"work/toolchain/protoc.zip",
|
||||
"work/toolchain/rustup-init.sh",
|
||||
]
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--delete", action="store_true", help="Actually delete; default only lists paths")
|
||||
args = parser.parse_args()
|
||||
repository = subprocess.check_output(["git", "rev-parse", "--show-toplevel"], cwd=root, text=True).strip()
|
||||
if Path(repository).resolve() != root:
|
||||
raise SystemExit("Refusing cleanup outside the repository root")
|
||||
tracked = subprocess.check_output(["git", "ls-files", "-z", "--", *paths], cwd=root)
|
||||
if tracked:
|
||||
raise SystemExit("Refusing to remove tracked files under a cleanup path")
|
||||
# Check every parent before deleting anything. Leaf symlinks are unlinked only.
|
||||
for relative in paths:
|
||||
if not (root / relative).parent.resolve().is_relative_to(root):
|
||||
raise SystemExit(f"Refusing path with an external parent: {relative}")
|
||||
for relative in paths:
|
||||
path = root / relative
|
||||
if not path.exists() and not path.is_symlink():
|
||||
continue
|
||||
print(("Removing " if args.delete else "Would remove ") + relative, flush=True)
|
||||
if args.delete:
|
||||
if path.is_symlink() or path.is_file():
|
||||
path.unlink()
|
||||
else:
|
||||
shutil.rmtree(path)
|
||||
print("Kept toolchains, user configuration, Git history and outputs/android + outputs/macos")
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
config=apps/meshport_lab/assets/config/default.toml
|
||||
saved=$(mktemp)
|
||||
had_config=0
|
||||
if [ -f "$config" ]; then cp -p "$config" "$saved"; had_config=1; fi
|
||||
restore_config() {
|
||||
if [ "$had_config" = 1 ]; then cp -p "$saved" "$config"; else rm -f "$config"; fi
|
||||
rm -f "$saved"
|
||||
}
|
||||
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"
|
||||
shasum -a 256 "$output" > "$output.sha256"
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
root="$PWD"
|
||||
# A stable Apple signing identity keeps the app's Keychain requirement stable
|
||||
# across updates. An explicit identity can also be a Developer ID certificate.
|
||||
signing_identity="${MESHPORT_SIGNING_IDENTITY:-}"
|
||||
if [ -z "$signing_identity" ]; then
|
||||
signing_identity=$(security find-identity -v -p codesigning | python3 -c 'import re,sys; ids=re.findall(r"([0-9A-F]{40}) \"Apple Development:", sys.stdin.read()); print(ids[0] if len(ids)==1 else "-")')
|
||||
fi
|
||||
config="$root/apps/meshport_lab/assets/config/default.toml"
|
||||
saved=$(mktemp)
|
||||
had_config=0
|
||||
if [ -f "$config" ]; then
|
||||
cp -p "$config" "$saved"
|
||||
had_config=1
|
||||
fi
|
||||
restore_config() {
|
||||
if [ "$had_config" = 1 ]; then cp -p "$saved" "$config"; else rm -f "$config"; fi
|
||||
rm -f "$saved"
|
||||
}
|
||||
trap restore_config EXIT HUP INT TERM
|
||||
# Distribution bundles use only the public template, never local credentials.
|
||||
cp "$root/apps/meshport_lab/assets/config/default.example.toml" "$config"
|
||||
scripts/cargo-local.sh build -p meshport-ffi -p meshport-vpn-helper --release --locked
|
||||
sh scripts/build-singbox-library.sh macos
|
||||
build_number=$(date +%s)
|
||||
build_arch=$(uname -m)
|
||||
cd "$root/apps/meshport_lab"
|
||||
# Rust and Go libraries above target this host architecture as well.
|
||||
FLUTTER_XCODE_ARCHS="$build_arch" flutter build macos --release --build-number="$build_number"
|
||||
app="$PWD/build/macos/Build/Products/Release/MeshPort.app"
|
||||
cp "$root/target/release/libmeshport_ffi.dylib" "$app/Contents/Frameworks/"
|
||||
cp "$root/target/debug/libmeshport_proxy.dylib" "$app/Contents/Frameworks/"
|
||||
cp "$root/target/release/meshport-vpn-helper" "$app/Contents/MacOS/"
|
||||
codesign --force --sign "$signing_identity" "$app/Contents/MacOS/meshport-vpn-helper"
|
||||
codesign --force --sign "$signing_identity" "$app/Contents/Frameworks/libmeshport_ffi.dylib"
|
||||
codesign --force --sign "$signing_identity" "$app/Contents/Frameworks/libmeshport_proxy.dylib"
|
||||
codesign --force --deep --sign "$signing_identity" --entitlements macos/Runner/Release.entitlements "$app"
|
||||
codesign --verify --deep --strict "$app"
|
||||
out="$root/outputs/macos/MeshPort-0.1.0-$build_number-$build_arch-release"
|
||||
mkdir -p "$root/outputs/macos"
|
||||
ditto "$app" "$out.app"
|
||||
# Keep the installed filename stable so dragging it replaces the old APP.
|
||||
ditto -c -k --sequesterRsrc --keepParent "$app" "$out.zip"
|
||||
shasum -a 256 "$out.zip" > "$out.zip.sha256"
|
||||
printf '%s\n' "$out.app" "$out.zip"
|
||||
Executable
+6
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
mkdir -p work/bin
|
||||
xcrun swiftc -parse-as-library apps/meshport_lab/macos/Runner/LocalProfileStore.swift tools/tests/local-profile-store.swift -o work/bin/local-profile-store-check
|
||||
work/bin/local-profile-store-check
|
||||
Reference in New Issue
Block a user