@yume-chan/adb 0.0.18 → 0.0.19

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.
Files changed (164) hide show
  1. package/CHANGELOG.json +21 -0
  2. package/CHANGELOG.md +11 -1
  3. package/esm/adb.d.ts +63 -60
  4. package/esm/adb.d.ts.map +1 -1
  5. package/esm/adb.js +257 -249
  6. package/esm/adb.js.map +1 -1
  7. package/esm/auth.d.ts +51 -51
  8. package/esm/auth.d.ts.map +1 -1
  9. package/esm/auth.js +95 -96
  10. package/esm/auth.js.map +1 -1
  11. package/esm/backend.d.ts +8 -8
  12. package/esm/backend.d.ts.map +1 -1
  13. package/esm/backend.js +1 -1
  14. package/esm/commands/base.d.ts +6 -6
  15. package/esm/commands/base.d.ts.map +1 -1
  16. package/esm/commands/base.js +8 -8
  17. package/esm/commands/framebuffer.d.ts +53 -53
  18. package/esm/commands/framebuffer.d.ts.map +1 -1
  19. package/esm/commands/framebuffer.js +46 -46
  20. package/esm/commands/framebuffer.js.map +1 -1
  21. package/esm/commands/index.d.ts +7 -8
  22. package/esm/commands/index.d.ts.map +1 -1
  23. package/esm/commands/index.js +7 -8
  24. package/esm/commands/index.js.map +1 -1
  25. package/esm/commands/install.d.ts +9 -3
  26. package/esm/commands/install.d.ts.map +1 -1
  27. package/esm/commands/install.js +26 -26
  28. package/esm/commands/install.js.map +1 -1
  29. package/esm/commands/power.d.ts +22 -22
  30. package/esm/commands/power.js +48 -48
  31. package/esm/commands/reverse.d.ts +41 -28
  32. package/esm/commands/reverse.d.ts.map +1 -1
  33. package/esm/commands/reverse.js +125 -100
  34. package/esm/commands/reverse.js.map +1 -1
  35. package/esm/commands/subprocess/command.d.ts +57 -51
  36. package/esm/commands/subprocess/command.d.ts.map +1 -1
  37. package/esm/commands/subprocess/command.js +86 -80
  38. package/esm/commands/subprocess/command.js.map +1 -1
  39. package/esm/commands/subprocess/index.d.ts +3 -3
  40. package/esm/commands/subprocess/index.js +3 -3
  41. package/esm/commands/subprocess/protocols/index.d.ts +3 -3
  42. package/esm/commands/subprocess/protocols/index.js +3 -3
  43. package/esm/commands/subprocess/protocols/none.d.ts +35 -35
  44. package/esm/commands/subprocess/protocols/none.d.ts.map +1 -1
  45. package/esm/commands/subprocess/protocols/none.js +65 -55
  46. package/esm/commands/subprocess/protocols/none.js.map +1 -1
  47. package/esm/commands/subprocess/protocols/shell.d.ts +39 -38
  48. package/esm/commands/subprocess/protocols/shell.d.ts.map +1 -1
  49. package/esm/commands/subprocess/protocols/shell.js +166 -162
  50. package/esm/commands/subprocess/protocols/shell.js.map +1 -1
  51. package/esm/commands/subprocess/protocols/types.d.ts +49 -49
  52. package/esm/commands/subprocess/protocols/types.d.ts.map +1 -1
  53. package/esm/commands/subprocess/protocols/types.js +1 -1
  54. package/esm/commands/subprocess/utils.d.ts +1 -1
  55. package/esm/commands/subprocess/utils.js +18 -18
  56. package/esm/commands/sync/index.d.ts +8 -7
  57. package/esm/commands/sync/index.d.ts.map +1 -1
  58. package/esm/commands/sync/index.js +8 -7
  59. package/esm/commands/sync/index.js.map +1 -1
  60. package/esm/commands/sync/list.d.ts +42 -40
  61. package/esm/commands/sync/list.d.ts.map +1 -1
  62. package/esm/commands/sync/list.js +67 -47
  63. package/esm/commands/sync/list.js.map +1 -1
  64. package/esm/commands/sync/pull.d.ts +13 -11
  65. package/esm/commands/sync/pull.d.ts.map +1 -1
  66. package/esm/commands/sync/pull.js +35 -37
  67. package/esm/commands/sync/pull.js.map +1 -1
  68. package/esm/commands/sync/push.d.ts +46 -7
  69. package/esm/commands/sync/push.d.ts.map +1 -1
  70. package/esm/commands/sync/push.js +89 -22
  71. package/esm/commands/sync/push.js.map +1 -1
  72. package/esm/commands/sync/request.d.ts +26 -23
  73. package/esm/commands/sync/request.d.ts.map +1 -1
  74. package/esm/commands/sync/request.js +40 -42
  75. package/esm/commands/sync/request.js.map +1 -1
  76. package/esm/commands/sync/response.d.ts +19 -19
  77. package/esm/commands/sync/response.d.ts.map +1 -1
  78. package/esm/commands/sync/response.js +54 -54
  79. package/esm/commands/sync/response.js.map +1 -1
  80. package/esm/commands/sync/socket.d.ts +27 -0
  81. package/esm/commands/sync/socket.d.ts.map +1 -0
  82. package/esm/commands/sync/socket.js +66 -0
  83. package/esm/commands/sync/socket.js.map +1 -0
  84. package/esm/commands/sync/stat.d.ts +72 -72
  85. package/esm/commands/sync/stat.d.ts.map +1 -1
  86. package/esm/commands/sync/stat.js +116 -104
  87. package/esm/commands/sync/stat.js.map +1 -1
  88. package/esm/commands/sync/sync.d.ts +72 -60
  89. package/esm/commands/sync/sync.d.ts.map +1 -1
  90. package/esm/commands/sync/sync.js +127 -149
  91. package/esm/commands/sync/sync.js.map +1 -1
  92. package/esm/commands/tcpip.d.ts +5 -5
  93. package/esm/commands/tcpip.js +18 -18
  94. package/esm/crypto.d.ts +36 -36
  95. package/esm/crypto.js +248 -248
  96. package/esm/features.d.ts +10 -7
  97. package/esm/features.d.ts.map +1 -1
  98. package/esm/features.js +13 -10
  99. package/esm/features.js.map +1 -1
  100. package/esm/index.d.ts +9 -9
  101. package/esm/index.js +9 -9
  102. package/esm/packet.d.ts +45 -46
  103. package/esm/packet.d.ts.map +1 -1
  104. package/esm/packet.js +43 -48
  105. package/esm/packet.js.map +1 -1
  106. package/esm/socket/dispatcher.d.ts +59 -59
  107. package/esm/socket/dispatcher.d.ts.map +1 -1
  108. package/esm/socket/dispatcher.js +223 -234
  109. package/esm/socket/dispatcher.js.map +1 -1
  110. package/esm/socket/index.d.ts +2 -2
  111. package/esm/socket/index.js +2 -2
  112. package/esm/socket/socket.d.ts +59 -59
  113. package/esm/socket/socket.d.ts.map +1 -1
  114. package/esm/socket/socket.js +118 -118
  115. package/esm/socket/socket.js.map +1 -1
  116. package/esm/utils/auto-reset-event.d.ts +9 -9
  117. package/esm/utils/auto-reset-event.d.ts.map +1 -1
  118. package/esm/utils/auto-reset-event.js +33 -33
  119. package/esm/utils/auto-reset-event.js.map +1 -1
  120. package/esm/utils/base64.d.ts +27 -27
  121. package/esm/utils/base64.js +246 -246
  122. package/esm/utils/conditional-variable.d.ts +9 -0
  123. package/esm/utils/conditional-variable.d.ts.map +1 -0
  124. package/esm/utils/conditional-variable.js +34 -0
  125. package/esm/utils/conditional-variable.js.map +1 -0
  126. package/esm/utils/index.d.ts +4 -3
  127. package/esm/utils/index.d.ts.map +1 -1
  128. package/esm/utils/index.js +4 -3
  129. package/esm/utils/index.js.map +1 -1
  130. package/package.json +11 -10
  131. package/src/adb.ts +47 -37
  132. package/src/auth.ts +7 -6
  133. package/src/backend.ts +4 -4
  134. package/src/commands/base.ts +1 -1
  135. package/src/commands/framebuffer.ts +4 -4
  136. package/src/commands/index.ts +7 -8
  137. package/src/commands/reverse.ts +35 -10
  138. package/src/commands/subprocess/command.ts +12 -4
  139. package/src/commands/subprocess/index.ts +3 -3
  140. package/src/commands/subprocess/protocols/index.ts +3 -3
  141. package/src/commands/subprocess/protocols/none.ts +25 -11
  142. package/src/commands/subprocess/protocols/shell.ts +50 -28
  143. package/src/commands/subprocess/protocols/types.ts +8 -7
  144. package/src/commands/subprocess/utils.ts +1 -1
  145. package/src/commands/sync/index.ts +8 -7
  146. package/src/commands/sync/list.ts +42 -23
  147. package/src/commands/sync/pull.ts +40 -45
  148. package/src/commands/sync/push.ts +146 -39
  149. package/src/commands/sync/request.ts +20 -15
  150. package/src/commands/sync/response.ts +7 -6
  151. package/src/commands/sync/socket.ts +97 -0
  152. package/src/commands/sync/stat.ts +47 -42
  153. package/src/commands/sync/sync.ts +68 -108
  154. package/src/commands/tcpip.ts +5 -5
  155. package/src/features.ts +9 -6
  156. package/src/packet.ts +19 -34
  157. package/src/socket/dispatcher.ts +32 -47
  158. package/src/socket/index.ts +2 -2
  159. package/src/socket/socket.ts +26 -17
  160. package/src/utils/auto-reset-event.ts +14 -15
  161. package/src/utils/conditional-variable.ts +45 -0
  162. package/src/utils/index.ts +4 -3
  163. package/tsconfig.build.tsbuildinfo +1 -1
  164. package/src/commands/install.ts +0 -40
@@ -1,9 +1,8 @@
1
- export * from './base.js';
2
- export * from './framebuffer.js';
3
- export * from './install.js';
4
- export * from './power.js';
5
- export * from './reverse.js';
6
- export * from './subprocess/index.js';
7
- export * from './sync/index.js';
8
- export * from './tcpip.js';
1
+ export * from "./base.js";
2
+ export * from "./framebuffer.js";
3
+ export * from "./power.js";
4
+ export * from "./reverse.js";
5
+ export * from "./subprocess/index.js";
6
+ export * from "./sync/index.js";
7
+ export * from "./tcpip.js";
9
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC"}
@@ -1,4 +1,10 @@
1
- import { type WritableStream } from "@yume-chan/stream-extra";
2
- import { type Adb } from "../adb.js";
3
- export declare function install(adb: Adb): WritableStream<Uint8Array>;
1
+ import type { ReadableStream } from "@yume-chan/stream-extra";
2
+ import type { Adb } from "../adb.js";
3
+ /**
4
+ * Install an apk file to the device.
5
+ * @param adb An Adb instance
6
+ * @returns A writable stream that accepts an APK file
7
+ * @deprecated Use `PackageManager#installStream` from `@yume-chan/android-bin` package instead.
8
+ */
9
+ export declare function install(adb: Adb, file: ReadableStream<Uint8Array>): Promise<void>;
4
10
  //# sourceMappingURL=install.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,cAAc,EACtB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AAKrC,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,cAAc,CAAC,UAAU,CAAC,CA6B5D"}
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAIrC;;;;;GAKG;AACH,wBAAsB,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,iBAoBvE"}
@@ -1,29 +1,29 @@
1
- import { WrapWritableStream, } from "@yume-chan/stream-extra";
2
1
  import { escapeArg } from "./subprocess/index.js";
3
- export function install(adb) {
4
- const filename = `/data/local/tmp/${Math.random()
5
- .toString()
6
- .substring(2)}.apk`;
7
- let sync;
8
- return new WrapWritableStream({
9
- async start() {
10
- // TODO: install: support other install apk methods (streaming, etc.)
11
- // TODO: install: support split apk formats (`adb install-multiple`)
12
- // Upload apk file to tmp folder
13
- sync = await adb.sync();
14
- return sync.write(filename, undefined, undefined);
15
- },
16
- async close() {
17
- await sync.dispose();
18
- // Invoke `pm install` to install it
19
- await adb.subprocess.spawnAndWaitLegacy([
20
- "pm",
21
- "install",
22
- escapeArg(filename),
23
- ]);
24
- // Remove the temp file
25
- await adb.rm(filename);
26
- },
27
- });
2
+ /**
3
+ * Install an apk file to the device.
4
+ * @param adb An Adb instance
5
+ * @returns A writable stream that accepts an APK file
6
+ * @deprecated Use `PackageManager#installStream` from `@yume-chan/android-bin` package instead.
7
+ */
8
+ export async function install(adb, file) {
9
+ const fileName = Math.random().toString().substring(2);
10
+ const filePath = `/data/local/tmp/${fileName}.apk`;
11
+ const sync = await adb.sync();
12
+ try {
13
+ await sync.write(filePath, file, undefined, undefined);
14
+ }
15
+ finally {
16
+ await sync.dispose();
17
+ }
18
+ try {
19
+ await adb.subprocess.spawnAndWaitLegacy([
20
+ "pm",
21
+ "install",
22
+ escapeArg(filePath),
23
+ ]);
24
+ }
25
+ finally {
26
+ await adb.rm(filePath);
27
+ }
28
28
  }
29
29
  //# sourceMappingURL=install.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,kBAAkB,GAErB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,MAAM,UAAU,OAAO,CAAC,GAAQ;IAC5B,MAAM,QAAQ,GAAG,mBAAmB,IAAI,CAAC,MAAM,EAAE;SAC5C,QAAQ,EAAE;SACV,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;IAExB,IAAI,IAAc,CAAC;IACnB,OAAO,IAAI,kBAAkB,CAAa;QACtC,KAAK,CAAC,KAAK;YACP,qEAAqE;YACrE,oEAAoE;YAEpE,gCAAgC;YAChC,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YACxB,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QACtD,CAAC;QACD,KAAK,CAAC,KAAK;YACP,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;YAErB,oCAAoC;YACpC,MAAM,GAAG,CAAC,UAAU,CAAC,kBAAkB,CAAC;gBACpC,IAAI;gBACJ,SAAS;gBACT,SAAS,CAAC,QAAQ,CAAC;aACtB,CAAC,CAAC;YAEH,uBAAuB;YACvB,MAAM,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;QAC3B,CAAC;KACJ,CAAC,CAAC;AACP,CAAC"}
1
+ {"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,GAAQ,EAAE,IAAgC;IACpE,MAAM,QAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACvD,MAAM,QAAQ,GAAG,mBAAmB,QAAQ,MAAM,CAAC;IAEnD,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAC9B,IAAI;QACA,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;KAC1D;YAAS;QACN,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;KACxB;IAED,IAAI;QACA,MAAM,GAAG,CAAC,UAAU,CAAC,kBAAkB,CAAC;YACpC,IAAI;YACJ,SAAS;YACT,SAAS,CAAC,QAAQ,CAAC;SACtB,CAAC,CAAC;KACN;YAAS;QACN,MAAM,GAAG,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;KAC1B;AACL,CAAC"}
@@ -1,23 +1,23 @@
1
- import { AdbCommandBase } from "./base.js";
2
- export declare class AdbPower extends AdbCommandBase {
3
- reboot(name?: string): Promise<string>;
4
- bootloader(): Promise<string>;
5
- fastboot(): Promise<string>;
6
- recovery(): Promise<string>;
7
- sideload(): Promise<string>;
8
- /**
9
- * Reboot to Qualcomm Emergency Download (EDL) Mode.
10
- *
11
- * Only works on some Qualcomm devices.
12
- */
13
- qualcommEdlMode(): Promise<string>;
14
- powerOff(): Promise<string>;
15
- powerButton(longPress?: boolean): Promise<string>;
16
- /**
17
- * Reboot to Samsung Odin download mode.
18
- *
19
- * Only works on Samsung devices.
20
- */
21
- samsungOdin(): Promise<string>;
22
- }
1
+ import { AdbCommandBase } from "./base.js";
2
+ export declare class AdbPower extends AdbCommandBase {
3
+ reboot(name?: string): Promise<string>;
4
+ bootloader(): Promise<string>;
5
+ fastboot(): Promise<string>;
6
+ recovery(): Promise<string>;
7
+ sideload(): Promise<string>;
8
+ /**
9
+ * Reboot to Qualcomm Emergency Download (EDL) Mode.
10
+ *
11
+ * Only works on some Qualcomm devices.
12
+ */
13
+ qualcommEdlMode(): Promise<string>;
14
+ powerOff(): Promise<string>;
15
+ powerButton(longPress?: boolean): Promise<string>;
16
+ /**
17
+ * Reboot to Samsung Odin download mode.
18
+ *
19
+ * Only works on Samsung devices.
20
+ */
21
+ samsungOdin(): Promise<string>;
22
+ }
23
23
  //# sourceMappingURL=power.d.ts.map
@@ -1,49 +1,49 @@
1
- // cspell: ignore bootloader
2
- // cspell: ignore fastboot
3
- // cspell: ignore keyevent
4
- // cspell: ignore longpress
5
- import { AdbCommandBase } from "./base.js";
6
- export class AdbPower extends AdbCommandBase {
7
- reboot(name = "") {
8
- return this.adb.createSocketAndWait(`reboot:${name}`);
9
- }
10
- bootloader() {
11
- return this.reboot("bootloader");
12
- }
13
- fastboot() {
14
- return this.reboot("fastboot");
15
- }
16
- recovery() {
17
- return this.reboot("recovery");
18
- }
19
- sideload() {
20
- return this.reboot("sideload");
21
- }
22
- /**
23
- * Reboot to Qualcomm Emergency Download (EDL) Mode.
24
- *
25
- * Only works on some Qualcomm devices.
26
- */
27
- qualcommEdlMode() {
28
- return this.reboot("edl");
29
- }
30
- powerOff() {
31
- return this.adb.subprocess.spawnAndWaitLegacy(["reboot", "-p"]);
32
- }
33
- powerButton(longPress = false) {
34
- return this.adb.subprocess.spawnAndWaitLegacy([
35
- "input",
36
- "keyevent",
37
- longPress ? "--longpress POWER" : "POWER",
38
- ]);
39
- }
40
- /**
41
- * Reboot to Samsung Odin download mode.
42
- *
43
- * Only works on Samsung devices.
44
- */
45
- samsungOdin() {
46
- return this.reboot("download");
47
- }
48
- }
1
+ // cspell: ignore bootloader
2
+ // cspell: ignore fastboot
3
+ // cspell: ignore keyevent
4
+ // cspell: ignore longpress
5
+ import { AdbCommandBase } from "./base.js";
6
+ export class AdbPower extends AdbCommandBase {
7
+ reboot(name = "") {
8
+ return this.adb.createSocketAndWait(`reboot:${name}`);
9
+ }
10
+ bootloader() {
11
+ return this.reboot("bootloader");
12
+ }
13
+ fastboot() {
14
+ return this.reboot("fastboot");
15
+ }
16
+ recovery() {
17
+ return this.reboot("recovery");
18
+ }
19
+ sideload() {
20
+ return this.reboot("sideload");
21
+ }
22
+ /**
23
+ * Reboot to Qualcomm Emergency Download (EDL) Mode.
24
+ *
25
+ * Only works on some Qualcomm devices.
26
+ */
27
+ qualcommEdlMode() {
28
+ return this.reboot("edl");
29
+ }
30
+ powerOff() {
31
+ return this.adb.subprocess.spawnAndWaitLegacy(["reboot", "-p"]);
32
+ }
33
+ powerButton(longPress = false) {
34
+ return this.adb.subprocess.spawnAndWaitLegacy([
35
+ "input",
36
+ "keyevent",
37
+ longPress ? "--longpress POWER" : "POWER",
38
+ ]);
39
+ }
40
+ /**
41
+ * Reboot to Samsung Odin download mode.
42
+ *
43
+ * Only works on Samsung devices.
44
+ */
45
+ samsungOdin() {
46
+ return this.reboot("download");
47
+ }
48
+ }
49
49
  //# sourceMappingURL=power.js.map
@@ -1,29 +1,42 @@
1
- import { AutoDisposable } from "@yume-chan/event";
2
- import { type Adb } from "../adb.js";
3
- import { type AdbIncomingSocketHandler, type AdbSocket } from "../socket/index.js";
4
- export interface AdbForwardListener {
5
- deviceSerial: string;
6
- localName: string;
7
- remoteName: string;
8
- }
9
- export declare class AdbReverseCommand extends AutoDisposable {
10
- protected localAddressToHandler: Map<string, AdbIncomingSocketHandler>;
11
- protected deviceAddressToLocalAddress: Map<string, string>;
12
- protected adb: Adb;
13
- protected listening: boolean;
14
- constructor(adb: Adb);
15
- protected handleIncomingSocket: (socket: AdbSocket) => Promise<boolean>;
16
- private createBufferedStream;
17
- private sendRequest;
18
- list(): Promise<AdbForwardListener[]>;
19
- /**
20
- * @param deviceAddress The address adbd on device is listening on. Can be `tcp:0` to let adbd choose an available TCP port by itself.
21
- * @param localAddress Native ADB client will open a connection to this address when reverse connection received. In WebADB, it's only used to uniquely identify a reverse tunnel registry, `handler` will be called to handle the connection.
22
- * @param handler A callback to handle incoming connections. It must return `true` if it accepts the connection.
23
- * @returns `tcp:{ACTUAL_LISTENING_PORT}`, If `deviceAddress` is `tcp:0`; otherwise, `deviceAddress`.
24
- */
25
- add(deviceAddress: string, localAddress: string, handler: AdbIncomingSocketHandler): Promise<string>;
26
- remove(deviceAddress: string): Promise<void>;
27
- removeAll(): Promise<void>;
28
- }
1
+ import { AutoDisposable } from "@yume-chan/event";
2
+ import type { Adb } from "../adb.js";
3
+ import type { AdbIncomingSocketHandler, AdbSocket } from "../socket/index.js";
4
+ export interface AdbForwardListener {
5
+ deviceSerial: string;
6
+ localName: string;
7
+ remoteName: string;
8
+ }
9
+ export declare class AdbReverseError extends Error {
10
+ constructor(message: string);
11
+ }
12
+ export declare class AdbReverseNotSupportedError extends Error {
13
+ constructor();
14
+ }
15
+ export declare class AdbReverseCommand extends AutoDisposable {
16
+ protected localAddressToHandler: Map<string, AdbIncomingSocketHandler>;
17
+ protected deviceAddressToLocalAddress: Map<string, string>;
18
+ protected adb: Adb;
19
+ protected listening: boolean;
20
+ constructor(adb: Adb);
21
+ protected handleIncomingSocket: (socket: AdbSocket) => Promise<boolean>;
22
+ private createBufferedStream;
23
+ private sendRequest;
24
+ list(): Promise<AdbForwardListener[]>;
25
+ /**
26
+ * @param deviceAddress
27
+ * The address to be listened on device by ADB daemon. Or `tcp:0` to choose an available TCP port.
28
+ * @param localAddress
29
+ * An identifier for the reverse tunnel.
30
+ *
31
+ * When a socket wants to connect to {@link deviceAddress}, native ADB client will forward that connection to {@link localAddress}.
32
+ * However in this library, the {@link handler} is invoked instead. So this parameter is only used to identify the reverse tunnel.
33
+ * @param handler A callback to handle incoming connections. It must return `true` if it accepts the connection.
34
+ * @returns `tcp:{ACTUAL_LISTENING_PORT}`, If `deviceAddress` is `tcp:0`; otherwise, `deviceAddress`.
35
+ * @throws {AdbReverseNotSupportedError} If ADB reverse tunnel is not supported on this device when connected wirelessly.
36
+ * @throws {AdbReverseError} If ADB daemon returns an error.
37
+ */
38
+ add(deviceAddress: string, localAddress: string, handler: AdbIncomingSocketHandler): Promise<string>;
39
+ remove(deviceAddress: string): Promise<void>;
40
+ removeAll(): Promise<void>;
41
+ }
29
42
  //# sourceMappingURL=reverse.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"reverse.d.ts","sourceRoot":"","sources":["../../src/commands/reverse.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAOlD,OAAO,EAAE,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EACH,KAAK,wBAAwB,EAC7B,KAAK,SAAS,EACjB,MAAM,oBAAoB,CAAC;AAG5B,MAAM,WAAW,kBAAkB;IAC/B,YAAY,EAAE,MAAM,CAAC;IAErB,SAAS,EAAE,MAAM,CAAC;IAElB,UAAU,EAAE,MAAM,CAAC;CACtB;AAYD,qBAAa,iBAAkB,SAAQ,cAAc;IACjD,SAAS,CAAC,qBAAqB,wCAG3B;IAEJ,SAAS,CAAC,2BAA2B,sBAA6B;IAElE,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC;IAEnB,SAAS,CAAC,SAAS,UAAS;gBAET,GAAG,EAAE,GAAG;IAS3B,SAAS,CAAC,oBAAoB,WAAkB,SAAS,sBAKvD;YAEY,oBAAoB;YAKpB,WAAW;IASZ,IAAI,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC;IAgBlD;;;;;OAKG;IACU,GAAG,CACZ,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,wBAAwB,GAClC,OAAO,CAAC,MAAM,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cspell: ignore killforward
2
- import { AutoDisposable } from "@yume-chan/event";
3
- import { BufferedReadableStream, BufferedReadableStreamEndedError, } from "@yume-chan/stream-extra";
4
- import Struct from "@yume-chan/struct";
5
- import { decodeUtf8 } from "../utils/index.js";
6
- const AdbReverseStringResponse = new Struct()
7
- .string("length", { length: 4 })
8
- .string("content", { lengthField: "length", lengthFieldRadix: 16 });
9
- const AdbReverseErrorResponse = new Struct()
10
- .fields(AdbReverseStringResponse)
11
- .postDeserialize((value) => {
12
- throw new Error(value.content);
13
- });
14
- export class AdbReverseCommand extends AutoDisposable {
15
- localAddressToHandler = new Map();
16
- deviceAddressToLocalAddress = new Map();
17
- adb;
18
- listening = false;
19
- constructor(adb) {
20
- super();
21
- this.adb = adb;
22
- this.addDisposable(this.adb.onIncomingSocket(this.handleIncomingSocket));
23
- }
24
- handleIncomingSocket = async (socket) => {
25
- let address = socket.serviceString;
26
- // ADB daemon appends `\0` to the service string
27
- address = address.replace(/\0/g, "");
28
- return !!(await this.localAddressToHandler.get(address)?.(socket));
29
- };
30
- async createBufferedStream(service) {
31
- const socket = await this.adb.createSocket(service);
32
- return new BufferedReadableStream(socket.readable);
33
- }
34
- async sendRequest(service) {
35
- const stream = await this.createBufferedStream(service);
36
- const success = decodeUtf8(await stream.read(4)) === "OKAY";
37
- if (!success) {
38
- await AdbReverseErrorResponse.deserialize(stream);
39
- }
40
- return stream;
41
- }
42
- async list() {
43
- const stream = await this.createBufferedStream("reverse:list-forward");
44
- const response = await AdbReverseStringResponse.deserialize(stream);
45
- return response.content.split("\n").map((line) => {
46
- const [deviceSerial, localName, remoteName] = line.split(" ");
47
- return { deviceSerial, localName, remoteName };
48
- });
49
- // No need to close the stream, device will close it
50
- }
51
- /**
52
- * @param deviceAddress The address adbd on device is listening on. Can be `tcp:0` to let adbd choose an available TCP port by itself.
53
- * @param localAddress Native ADB client will open a connection to this address when reverse connection received. In WebADB, it's only used to uniquely identify a reverse tunnel registry, `handler` will be called to handle the connection.
54
- * @param handler A callback to handle incoming connections. It must return `true` if it accepts the connection.
55
- * @returns `tcp:{ACTUAL_LISTENING_PORT}`, If `deviceAddress` is `tcp:0`; otherwise, `deviceAddress`.
56
- */
57
- async add(deviceAddress, localAddress, handler) {
58
- // TODO(reverse): handle ADB bug
59
- // https://issuetracker.google.com/issues/37066218
60
- const stream = await this.sendRequest(`reverse:forward:${deviceAddress};${localAddress}`);
61
- // `tcp:0` tells the device to pick an available port.
62
- // On Android >=8, device will respond with the selected port for all `tcp:` requests.
63
- if (deviceAddress.startsWith("tcp:")) {
64
- let length;
65
- try {
66
- length = Number.parseInt(decodeUtf8(await stream.read(4)), 16);
67
- }
68
- catch (e) {
69
- if (!(e instanceof BufferedReadableStreamEndedError)) {
70
- throw e;
71
- }
72
- // Android <8 doesn't have this response.
73
- // (the stream is closed now)
74
- // Can be safely ignored.
75
- }
76
- if (length !== undefined) {
77
- const port = decodeUtf8(await stream.read(length));
78
- deviceAddress = `tcp:${Number.parseInt(port, 10)}`;
79
- }
80
- }
81
- this.localAddressToHandler.set(localAddress, handler);
82
- this.deviceAddressToLocalAddress.set(deviceAddress, localAddress);
83
- return deviceAddress;
84
- // No need to close the stream, device will close it
85
- }
86
- async remove(deviceAddress) {
87
- await this.sendRequest(`reverse:killforward:${deviceAddress}`);
88
- if (this.deviceAddressToLocalAddress.has(deviceAddress)) {
89
- this.localAddressToHandler.delete(this.deviceAddressToLocalAddress.get(deviceAddress));
90
- this.deviceAddressToLocalAddress.delete(deviceAddress);
91
- }
92
- // No need to close the stream, device will close it
93
- }
94
- async removeAll() {
95
- await this.sendRequest(`reverse:killforward-all`);
96
- this.deviceAddressToLocalAddress.clear();
97
- this.localAddressToHandler.clear();
98
- // No need to close the stream, device will close it
99
- }
100
- }
1
+ // cspell: ignore killforward
2
+ import { AutoDisposable } from "@yume-chan/event";
3
+ import { BufferedReadableStream, BufferedReadableStreamEndedError, } from "@yume-chan/stream-extra";
4
+ import Struct from "@yume-chan/struct";
5
+ import { decodeUtf8 } from "../utils/index.js";
6
+ const AdbReverseStringResponse = new Struct()
7
+ .string("length", { length: 4 })
8
+ .string("content", { lengthField: "length", lengthFieldRadix: 16 });
9
+ export class AdbReverseError extends Error {
10
+ constructor(message) {
11
+ super(message);
12
+ Object.setPrototypeOf(this, AdbReverseError.prototype);
13
+ }
14
+ }
15
+ export class AdbReverseNotSupportedError extends Error {
16
+ constructor() {
17
+ super("ADB reverse tunnel is not supported on this device when connected wirelessly.");
18
+ Object.setPrototypeOf(this, AdbReverseNotSupportedError.prototype);
19
+ }
20
+ }
21
+ const AdbReverseErrorResponse = new Struct()
22
+ .fields(AdbReverseStringResponse)
23
+ .postDeserialize((value) => {
24
+ // https://issuetracker.google.com/issues/37066218
25
+ // ADB on Android <9 can't create reverse tunnels when connected wirelessly (ADB over WiFi),
26
+ // and returns this confusing "more than one device/emulator" error.
27
+ if (value.content === "more than one device/emulator") {
28
+ throw new AdbReverseNotSupportedError();
29
+ }
30
+ else {
31
+ throw new AdbReverseError(value.content);
32
+ }
33
+ });
34
+ export class AdbReverseCommand extends AutoDisposable {
35
+ localAddressToHandler = new Map();
36
+ deviceAddressToLocalAddress = new Map();
37
+ adb;
38
+ listening = false;
39
+ constructor(adb) {
40
+ super();
41
+ this.adb = adb;
42
+ this.addDisposable(this.adb.onIncomingSocket(this.handleIncomingSocket));
43
+ }
44
+ handleIncomingSocket = async (socket) => {
45
+ let address = socket.serviceString;
46
+ // ADB daemon appends `\0` to the service string
47
+ address = address.replace(/\0/g, "");
48
+ return !!(await this.localAddressToHandler.get(address)?.(socket));
49
+ };
50
+ async createBufferedStream(service) {
51
+ const socket = await this.adb.createSocket(service);
52
+ return new BufferedReadableStream(socket.readable);
53
+ }
54
+ async sendRequest(service) {
55
+ const stream = await this.createBufferedStream(service);
56
+ const success = decodeUtf8(await stream.read(4)) === "OKAY";
57
+ if (!success) {
58
+ await AdbReverseErrorResponse.deserialize(stream);
59
+ }
60
+ return stream;
61
+ }
62
+ async list() {
63
+ const stream = await this.createBufferedStream("reverse:list-forward");
64
+ const response = await AdbReverseStringResponse.deserialize(stream);
65
+ return response.content.split("\n").map((line) => {
66
+ const [deviceSerial, localName, remoteName] = line.split(" ");
67
+ return { deviceSerial, localName, remoteName };
68
+ });
69
+ // No need to close the stream, device will close it
70
+ }
71
+ /**
72
+ * @param deviceAddress
73
+ * The address to be listened on device by ADB daemon. Or `tcp:0` to choose an available TCP port.
74
+ * @param localAddress
75
+ * An identifier for the reverse tunnel.
76
+ *
77
+ * When a socket wants to connect to {@link deviceAddress}, native ADB client will forward that connection to {@link localAddress}.
78
+ * However in this library, the {@link handler} is invoked instead. So this parameter is only used to identify the reverse tunnel.
79
+ * @param handler A callback to handle incoming connections. It must return `true` if it accepts the connection.
80
+ * @returns `tcp:{ACTUAL_LISTENING_PORT}`, If `deviceAddress` is `tcp:0`; otherwise, `deviceAddress`.
81
+ * @throws {AdbReverseNotSupportedError} If ADB reverse tunnel is not supported on this device when connected wirelessly.
82
+ * @throws {AdbReverseError} If ADB daemon returns an error.
83
+ */
84
+ async add(deviceAddress, localAddress, handler) {
85
+ const stream = await this.sendRequest(`reverse:forward:${deviceAddress};${localAddress}`);
86
+ // `tcp:0` tells the device to pick an available port.
87
+ // On Android >=8, device will respond with the selected port for all `tcp:` requests.
88
+ if (deviceAddress.startsWith("tcp:")) {
89
+ let length;
90
+ try {
91
+ length = Number.parseInt(decodeUtf8(await stream.read(4)), 16);
92
+ }
93
+ catch (e) {
94
+ if (!(e instanceof BufferedReadableStreamEndedError)) {
95
+ throw e;
96
+ }
97
+ // Android <8 doesn't have this response.
98
+ // (the stream is closed now)
99
+ // Can be safely ignored.
100
+ }
101
+ if (length !== undefined) {
102
+ const port = decodeUtf8(await stream.read(length));
103
+ deviceAddress = `tcp:${Number.parseInt(port, 10)}`;
104
+ }
105
+ }
106
+ this.localAddressToHandler.set(localAddress, handler);
107
+ this.deviceAddressToLocalAddress.set(deviceAddress, localAddress);
108
+ return deviceAddress;
109
+ // No need to close the stream, device will close it
110
+ }
111
+ async remove(deviceAddress) {
112
+ await this.sendRequest(`reverse:killforward:${deviceAddress}`);
113
+ if (this.deviceAddressToLocalAddress.has(deviceAddress)) {
114
+ this.localAddressToHandler.delete(this.deviceAddressToLocalAddress.get(deviceAddress));
115
+ this.deviceAddressToLocalAddress.delete(deviceAddress);
116
+ }
117
+ // No need to close the stream, device will close it
118
+ }
119
+ async removeAll() {
120
+ await this.sendRequest(`reverse:killforward-all`);
121
+ this.deviceAddressToLocalAddress.clear();
122
+ this.localAddressToHandler.clear();
123
+ // No need to close the stream, device will close it
124
+ }
125
+ }
101
126
  //# sourceMappingURL=reverse.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reverse.js","sourceRoot":"","sources":["../../src/commands/reverse.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAE7B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACH,sBAAsB,EACtB,gCAAgC,GACnC,MAAM,yBAAyB,CAAC;AACjC,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAOvC,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAU/C,MAAM,wBAAwB,GAAG,IAAI,MAAM,EAAE;KACxC,MAAM,CAAC,QAAQ,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;KAC/B,MAAM,CAAC,SAAS,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,gBAAgB,EAAE,EAAE,EAAE,CAAC,CAAC;AAExE,MAAM,uBAAuB,GAAG,IAAI,MAAM,EAAE;KACvC,MAAM,CAAC,wBAAwB,CAAC;KAChC,eAAe,CAAC,CAAC,KAAK,EAAE,EAAE;IACvB,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC,CAAC,CAAC;AAEP,MAAM,OAAO,iBAAkB,SAAQ,cAAc;IACvC,qBAAqB,GAAG,IAAI,GAAG,EAGtC,CAAC;IAEM,2BAA2B,GAA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