mirror of
https://github.com/okhsunrog/vpnhide.git
synced 2026-05-20 09:03:10 +00:00
Move UID resolution from Save-time to apply-time so app reinstalls
(which rotate UIDs) get picked up automatically without manual Save.
observers.txt now stores one package name per line — vpnhide_ports_apply.sh
reads it, queries \`pm list packages -U\`, and resolves to UIDs inline
when building the iptables ruleset. Same pattern kmod's service.sh
already uses for its targets.
Other review points:
- uninstall.sh loops \`-D OUTPUT -j …\` so duplicate jumps are fully
cleaned up, and redirects all probes to /dev/null
- PortsHidingScreen detects the module via \`cat module.prop\` rather
than \`[ -d \$dir ]\` — a KSU-Next remove-pending dir stays on disk
until reboot, so bare dir-check misreports install state
- Dashboard observer count now uses the existing countTargets helper,
consistent with kmod/zygisk line counting
- Dropped the awkward \`when (moduleInstalled) { null, true -> Unit;
false -> … return }\` in a Composable — plain if/else reads cleaner
- Comment on apply.sh explaining v4/v6 restores are per-family, not
transactional — if v6 fails, v4 rules are already live
- Simplified buildPortsSaveCommand: no more per-package UID resolver
shell-script construction, just a base64-encoded newline list
29 lines
953 B
Bash
29 lines
953 B
Bash
#!/system/bin/sh
|
|
SKIPUNZIP=0
|
|
MOD_VER="$(grep '^version=' "$MODPATH/module.prop" | cut -d= -f2)"
|
|
ui_print "- VPN Hide (Ports) ${MOD_VER:-unknown}"
|
|
ui_print "- Installing to $MODPATH"
|
|
|
|
# Persistent config directory (survives module updates)
|
|
PERSIST_DIR="/data/adb/vpnhide_ports"
|
|
PERSIST_OBSERVERS="$PERSIST_DIR/observers.txt"
|
|
|
|
mkdir -p "$PERSIST_DIR"
|
|
set_perm "$PERSIST_DIR" 0 0 0755
|
|
|
|
# Seed empty observers list on fresh install
|
|
if [ ! -f "$PERSIST_OBSERVERS" ]; then
|
|
cat > "$PERSIST_OBSERVERS" <<'EOF'
|
|
# vpnhide-ports observers
|
|
# One package name per line. Lines starting with '#' are comments.
|
|
# Managed via the VPN Hide app.
|
|
EOF
|
|
fi
|
|
set_perm "$PERSIST_OBSERVERS" 0 0 0644
|
|
|
|
set_perm "$MODPATH/vpnhide_ports_apply.sh" 0 0 0755
|
|
set_perm "$MODPATH/service.sh" 0 0 0755
|
|
set_perm "$MODPATH/uninstall.sh" 0 0 0755
|
|
|
|
ui_print "- Observers: $PERSIST_OBSERVERS (preserved across updates)"
|
|
ui_print "- Pick apps via the VPN Hide app → Protection → Ports."
|