dsh-apk-vm 0.4.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,49 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.6.0
4
+
5
+ Network controls.
6
+
7
+ ### Added
8
+
9
+ - Port forwarding management (`forward-add` / `forward-remove`) over adb, with a host-port →
10
+ guest-port list and optional `shared` rules.
11
+ - Custom DNS servers via the emulator `-dns-server` launch flag (restart required) and guest
12
+ `/etc/hosts` injection through a root bind mount, reapplied after boot.
13
+ - Proxy connectivity test from inside the guest (`ping` + toybox `nc`), and current proxy
14
+ display in the Network card.
15
+ - Per-instance network mode:
16
+ - `isolated` (default QEMU-NAT isolation)
17
+ - `shared` (host-mediated TCP sharing through shared port forwards)
18
+ - Optional emulator pcap capture (`-tcpdump`) with `GET /apk-vm/network/pcap` download.
19
+ - Network card UI for forwards, DNS, hosts, mode, test, and pcap; `apk_vm` action `network`.
20
+ - Per-instance network route: `/apk-vm/instances/<id>/network`.
21
+
22
+ ### Notes
23
+
24
+ - Shared mode is host-mediated TCP sharing, not L2 bridging; instances keep their own QEMU NAT.
25
+ - DNS changes take effect on the next emulator start; hosts changes apply live and survive a
26
+ restart while the plugin keeps the configured entries.
27
+ - pcap export is opt-in and only writes traffic from the emulator's user-mode network.
28
+
29
+ ## 0.5.0
30
+
31
+ Storage management.
32
+
33
+ ### Added
34
+
35
+ - Storage panel: AVD / snapshot / SDK / plugin temp / free-disk footprint, with guarded
36
+ cleanup actions (two-click confirmation for destructive actions).
37
+ - `GET /apk-vm/storage` and `POST /apk-vm/storage` (`temp`, `snapshots`, `orphan-avds`).
38
+ - `apk_vm` actions `storage` and `clean_storage`.
39
+ - `lib/storage.js` with dependency-free size accounting and cleanup helpers; unit coverage for
40
+ temp cleanup, orphan AVD detection and snapshot-aware accounting.
41
+
42
+ ### Notes
43
+
44
+ - Snapshot cleanup only targets a stopped plugin-managed AVD; the active VM is never deleted.
45
+ - Orphan cleanup only matches `dsh_apk_*` AVDs that are not registered to an instance.
46
+
3
47
  ## 0.4.1
4
48
 
5
49
  Privacy cleanup for the published proof assets.
package/README.md CHANGED
@@ -24,7 +24,7 @@ same-origin, loopback-only debug HTTP API and an `apk_vm` Agent tool.
24
24
  > 当前 **Windows x64 与 Linux x86_64(headless)为端到端已验证平台**;macOS 仅做探测/CI
25
25
  > 覆盖,详见 `docs/LINUX-E2E.md`。
26
26
 
27
- **Status:** `0.4.1` · Apache-2.0 · no npm runtime dependencies · no build step.
27
+ **Status:** `0.6.0` · Apache-2.0 · no npm runtime dependencies · no build step.
28
28
 
29
29
  This is an open-source DSH plugin published on npm as **`dsh-apk-vm`**. Repository:
30
30
  [github.com/yuxiaole-bili/dsh-apk-vm](https://github.com/yuxiaole-bili/dsh-apk-vm).
@@ -170,10 +170,15 @@ key {"text":"HOME"} -> returned to launcher
170
170
  then save the tap / swipe / key / text sequence as a JSON flow under the OS temp directory.
171
171
  Flows can be listed, replayed with their original relative timing, downloaded or deleted.
172
172
  Agents get `flow_start`, `flow_stop`, `flow_list` and `flow_replay`.
173
- - **Network debugging: proxy + CA.** The Network card sets/clears the guest global HTTP proxy
174
- (`settings put global http_proxy`) and installs a local `.pem`/`.crt` CA into the rooted
175
- Android user CA store with the correct OpenSSL subject-hash filename; the system CA store is
176
- updated when the guest allows a remount.
173
+ - **Network debugging and port forwarding.** The Network card manages host→guest port
174
+ forwards, custom DNS (next emulator start), guest `/etc/hosts` via a root bind mount,
175
+ HTTP proxy + CA installation, isolated/shared instance modes, and a guest-side connectivity
176
+ test. Optional pcap capture can be downloaded from the panel. See
177
+ [Network controls](#network-controls).
178
+ - **Storage panel + guarded cleanup.** A Storage card reports the AVD, snapshot, SDK, temp-file
179
+ and free-disk footprint and offers explicit cleanups: plugin temp files, quick-boot
180
+ snapshots for a stopped AVD, and orphan `dsh_apk_*` AVDs. Destructive actions need a second
181
+ click and never touch the active VM.
177
182
  - **Installed-app management.** The panel's **Installed apps** card lists third-party packages
178
183
  for the active instance and offers force-stop, clear-data and uninstall; it uses the same
179
184
  rooted `debug/packages` + `debug/action` API as the Agent tool.
@@ -237,7 +242,52 @@ key {"text":"HOME"} -> returned to launcher
237
242
  - `POST /apk-vm/debug/ca` accepts a host `.pem`/`.crt` path and installs it under the guest's
238
243
  user CA directory with the correct subject hash.
239
244
 
240
- ## Reproducible demo
245
+ ## Storage management
246
+
247
+ `GET /apk-vm/storage` reports the logical size of every AVD, its quick-boot snapshots, the
248
+ Android SDK, plugin temp files and the free space on the AVD volume. The panel's **Storage**
249
+ card uses the same endpoint.
250
+
251
+ `POST /apk-vm/storage` accepts:
252
+
253
+ ```json
254
+ { "action": "temp" }
255
+ { "action": "snapshots", "avdName": "dsh_apk", "confirm": true }
256
+ { "action": "orphan-avds", "confirm": true }
257
+ ```
258
+
259
+ - `temp` removes only screenshots, MP4 recordings, uploaded APKs and flow JSON created by this
260
+ plugin.
261
+ - `snapshots` deletes the quick-boot snapshots of a **stopped** plugin-managed AVD; the next
262
+ boot is a cold boot.
263
+ - `orphan-avds` removes only `dsh_apk_*` AVDs that are not registered to any instance and are
264
+ not active.
265
+ - `apk_vm` tool actions: `storage`, `clean_storage` (`storageAction`, `avdName`, `confirm`).
266
+
267
+ ## Network controls
268
+
269
+ `GET /apk-vm/network` returns the guest addresses, current proxy, DNS, hosts count, mode,
270
+ port forwards and pcap status. `POST /apk-vm/network` accepts `action`:
271
+
272
+ ```json
273
+ { "action": "mode", "mode": "isolated|shared" }
274
+ { "action": "forward-add", "localPort": 18080, "remotePort": 8080, "shared": false }
275
+ { "action": "forward-remove", "localPort": 18080 }
276
+ { "action": "dns", "servers": ["1.1.1.1"] }
277
+ { "action": "hosts", "entries": ["198.51.100.10 api.example.test"] }
278
+ { "action": "test", "host": "198.51.100.10", "port": 8080 }
279
+ { "action": "pcap", "path": "D:\\apk-vm-capture.pcap" }
280
+ ```
281
+
282
+ - Port forwards use `adb forward tcp:<hostPort> tcp:<guestPort>`.
283
+ - DNS is applied by the emulator `-dns-server` flag on the next start.
284
+ - Hosts entries are bind-mounted over the guest `/etc/hosts` (root required) and reapplied
285
+ after a plugin-managed boot.
286
+ - `shared` forwards are reachable from other VMs through the emulator's host alias; the
287
+ QEMU NAT itself remains isolated.
288
+ - pcap capture is passed to the emulator as `-tcpdump` and starts on the next emulator start;
289
+ download via `GET /apk-vm/network/pcap`.
290
+
241
291
 
242
292
  A public, dependency-free demo lives in [examples](examples/README.md):
243
293