dsh-apk-vm 0.10.0 → 0.10.1

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,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.10.1
4
+
5
+ Fix panel requests failing with non-ISO-8859-1 header values.
6
+
7
+ ### Fixed
8
+
9
+ - Percent-encode the panel owner label before sending it as `x-apk-vm-label`, so Chromium
10
+ `fetch` no longer rejects requests with `String contains non ISO-8859-1 code point`.
11
+ - Decode percent-encoded owner HTTP headers/query values on the Host, including Chinese
12
+ workspace paths and labels.
13
+
3
14
  ## 0.10.0
4
15
 
5
16
  VM ownership and dedicated conversation/project VMs.
package/README.md CHANGED
@@ -45,7 +45,7 @@ same-origin, loopback-only debug HTTP API and an `apk_vm` Agent tool.
45
45
  > 当前 **Windows x64 与 Linux x86_64(headless)为端到端已验证平台**;macOS 仅做探测/CI
46
46
  > 覆盖,详见 `docs/LINUX-E2E.md`。
47
47
 
48
- **Status:** `0.10.0` · Apache-2.0 · no npm runtime dependencies · no build step.
48
+ **Status:** `0.10.1` · Apache-2.0 · no npm runtime dependencies · no build step.
49
49
 
50
50
  This is an open-source DSH plugin published on npm as **`dsh-apk-vm`**. Repository:
51
51
  [github.com/yuxiaole-bili/dsh-apk-vm](https://github.com/yuxiaole-bili/dsh-apk-vm).
@@ -350,7 +350,9 @@ or `project`), session id, workspace, and `since` / `lastSeenAt` timestamps; lea
350
350
  `GET /apk-vm/state` and `GET /apk-vm/instances` include owner metadata.
351
351
  - When the panel makes a mutating HTTP request it sends
352
352
  `x-apk-vm-owner`, `x-apk-vm-scope`, `x-apk-vm-session`, `x-apk-vm-workspace` and
353
- `x-apk-vm-label`. A request that supplies an owner header auto-claims a free VM; on a leased VM
353
+ `x-apk-vm-label`. Header values may be percent-encoded (UTF-8); the Host decodes them, so
354
+ non-ASCII labels and workspace paths remain valid for browser `fetch`. A request that
355
+ supplies an owner header auto-claims a free VM; on a leased VM
354
356
  it must match the current owner key. `POST /apk-vm/*` control routes return `409 vm-busy` with
355
357
  the current owner when the header is missing or does not match. Read-only `GET` routes are
356
358
  never blocked.
package/client.js CHANGED
@@ -30,7 +30,7 @@ window.__ModuleLoader__.load({
30
30
  var SWIPE_THRESHOLD_PX = 24;
31
31
  var FRAME_INTERVAL_MS = 500;
32
32
  var STATE_INTERVAL_MS = 2000;
33
- var CLIENT_VERSION = '0.10.0';
33
+ var CLIENT_VERSION = '0.10.1';
34
34
 
35
35
  /* ------------------------------------------------------------------ *
36
36
  * Optional dsh-better-sidebar integration.
@@ -850,7 +850,7 @@ window.__ModuleLoader__.load({
850
850
  return {
851
851
  'x-apk-vm-owner': panelOwnerKey(),
852
852
  'x-apk-vm-scope': panelOwnerScope(),
853
- 'x-apk-vm-label': '桌面面板',
853
+ 'x-apk-vm-label': encodeURIComponent('桌面面板'),
854
854
  };
855
855
  }
856
856
 
package/lib/http-owner.js CHANGED
@@ -12,16 +12,26 @@ const HEADER_NAMES = [
12
12
  ['label', 'x-apk-vm-label'],
13
13
  ];
14
14
 
15
+ function decodeHeaderValue(value) {
16
+ const text = String(value);
17
+ if (!/%[0-9A-Fa-f]{2}/.test(text)) return text;
18
+ try {
19
+ return decodeURIComponent(text);
20
+ } catch (error) {
21
+ return text;
22
+ }
23
+ }
24
+
15
25
  function firstValue(headers, query, header) {
16
26
  const source = headers || {};
17
27
  const direct = source[header];
18
28
  if (direct !== undefined && direct !== null) {
19
- if (Array.isArray(direct)) return String(direct[0] || '').trim();
20
- return String(direct).trim();
29
+ if (Array.isArray(direct)) return decodeHeaderValue(String(direct[0] || '').trim());
30
+ return decodeHeaderValue(String(direct).trim());
21
31
  }
22
32
  if (query && typeof query.get === 'function') {
23
33
  const fromQuery = query.get(header.replace(/^x-apk-vm-/, ''));
24
- if (fromQuery !== undefined && fromQuery !== null) return String(fromQuery).trim();
34
+ if (fromQuery !== undefined && fromQuery !== null) return decodeHeaderValue(String(fromQuery).trim());
25
35
  }
26
36
  return '';
27
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-apk-vm",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "type": "module",
5
5
  "description": "Local AOSP Android VM for DeepSeek Harness: preview rooted APKs at up to 60 fps, automate UIAutomator flows, and give each Agent an isolated VM.",
6
6
  "license": "Apache-2.0",