@yume-chan/adb 0.0.17 → 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.
- package/CHANGELOG.json +27 -0
- package/CHANGELOG.md +16 -1
- package/LICENSE +1 -1
- package/esm/adb.d.ts +63 -60
- package/esm/adb.d.ts.map +1 -1
- package/esm/adb.js +257 -229
- package/esm/adb.js.map +1 -1
- package/esm/auth.d.ts +51 -51
- package/esm/auth.d.ts.map +1 -1
- package/esm/auth.js +95 -96
- package/esm/auth.js.map +1 -1
- package/esm/backend.d.ts +8 -8
- package/esm/backend.d.ts.map +1 -1
- package/esm/backend.js +1 -1
- package/esm/commands/base.d.ts +6 -6
- package/esm/commands/base.js +8 -8
- package/esm/commands/framebuffer.d.ts +53 -53
- package/esm/commands/framebuffer.d.ts.map +1 -1
- package/esm/commands/framebuffer.js +46 -47
- package/esm/commands/framebuffer.js.map +1 -1
- package/esm/commands/index.d.ts +7 -8
- package/esm/commands/index.d.ts.map +1 -1
- package/esm/commands/index.js +7 -8
- package/esm/commands/index.js.map +1 -1
- package/esm/commands/install.d.ts +9 -3
- package/esm/commands/install.d.ts.map +1 -1
- package/esm/commands/install.js +27 -21
- package/esm/commands/install.js.map +1 -1
- package/esm/commands/power.d.ts +22 -22
- package/esm/commands/power.d.ts.map +1 -1
- package/esm/commands/power.js +48 -44
- package/esm/commands/power.js.map +1 -1
- package/esm/commands/reverse.d.ts +41 -28
- package/esm/commands/reverse.d.ts.map +1 -1
- package/esm/commands/reverse.js +125 -98
- package/esm/commands/reverse.js.map +1 -1
- package/esm/commands/subprocess/command.d.ts +57 -51
- package/esm/commands/subprocess/command.d.ts.map +1 -1
- package/esm/commands/subprocess/command.js +86 -82
- package/esm/commands/subprocess/command.js.map +1 -1
- package/esm/commands/subprocess/index.d.ts +3 -3
- package/esm/commands/subprocess/index.js +3 -3
- package/esm/commands/subprocess/protocols/index.d.ts +3 -3
- package/esm/commands/subprocess/protocols/index.js +3 -3
- package/esm/commands/subprocess/protocols/none.d.ts +35 -35
- package/esm/commands/subprocess/protocols/none.d.ts.map +1 -1
- package/esm/commands/subprocess/protocols/none.js +65 -55
- package/esm/commands/subprocess/protocols/none.js.map +1 -1
- package/esm/commands/subprocess/protocols/shell.d.ts +39 -38
- package/esm/commands/subprocess/protocols/shell.d.ts.map +1 -1
- package/esm/commands/subprocess/protocols/shell.js +166 -154
- package/esm/commands/subprocess/protocols/shell.js.map +1 -1
- package/esm/commands/subprocess/protocols/types.d.ts +49 -49
- package/esm/commands/subprocess/protocols/types.d.ts.map +1 -1
- package/esm/commands/subprocess/protocols/types.js +1 -1
- package/esm/commands/subprocess/utils.d.ts +1 -1
- package/esm/commands/subprocess/utils.js +18 -18
- package/esm/commands/sync/index.d.ts +8 -7
- package/esm/commands/sync/index.d.ts.map +1 -1
- package/esm/commands/sync/index.js +8 -7
- package/esm/commands/sync/index.js.map +1 -1
- package/esm/commands/sync/list.d.ts +42 -40
- package/esm/commands/sync/list.d.ts.map +1 -1
- package/esm/commands/sync/list.js +67 -35
- package/esm/commands/sync/list.js.map +1 -1
- package/esm/commands/sync/pull.d.ts +13 -11
- package/esm/commands/sync/pull.d.ts.map +1 -1
- package/esm/commands/sync/pull.js +35 -36
- package/esm/commands/sync/pull.js.map +1 -1
- package/esm/commands/sync/push.d.ts +46 -7
- package/esm/commands/sync/push.d.ts.map +1 -1
- package/esm/commands/sync/push.js +89 -23
- package/esm/commands/sync/push.js.map +1 -1
- package/esm/commands/sync/request.d.ts +26 -23
- package/esm/commands/sync/request.d.ts.map +1 -1
- package/esm/commands/sync/request.js +40 -42
- package/esm/commands/sync/request.js.map +1 -1
- package/esm/commands/sync/response.d.ts +19 -19
- package/esm/commands/sync/response.d.ts.map +1 -1
- package/esm/commands/sync/response.js +54 -54
- package/esm/commands/sync/response.js.map +1 -1
- package/esm/commands/sync/socket.d.ts +27 -0
- package/esm/commands/sync/socket.d.ts.map +1 -0
- package/esm/commands/sync/socket.js +66 -0
- package/esm/commands/sync/socket.js.map +1 -0
- package/esm/commands/sync/stat.d.ts +72 -72
- package/esm/commands/sync/stat.d.ts.map +1 -1
- package/esm/commands/sync/stat.js +116 -94
- package/esm/commands/sync/stat.js.map +1 -1
- package/esm/commands/sync/sync.d.ts +72 -60
- package/esm/commands/sync/sync.d.ts.map +1 -1
- package/esm/commands/sync/sync.js +127 -148
- package/esm/commands/sync/sync.js.map +1 -1
- package/esm/commands/tcpip.d.ts +5 -5
- package/esm/commands/tcpip.js +18 -18
- package/esm/crypto.d.ts +36 -36
- package/esm/crypto.d.ts.map +1 -1
- package/esm/crypto.js +248 -238
- package/esm/crypto.js.map +1 -1
- package/esm/features.d.ts +10 -7
- package/esm/features.d.ts.map +1 -1
- package/esm/features.js +13 -10
- package/esm/features.js.map +1 -1
- package/esm/index.d.ts +9 -9
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +9 -9
- package/esm/index.js.map +1 -1
- package/esm/packet.d.ts +45 -46
- package/esm/packet.d.ts.map +1 -1
- package/esm/packet.js +43 -46
- package/esm/packet.js.map +1 -1
- package/esm/socket/dispatcher.d.ts +59 -59
- package/esm/socket/dispatcher.d.ts.map +1 -1
- package/esm/socket/dispatcher.js +223 -231
- package/esm/socket/dispatcher.js.map +1 -1
- package/esm/socket/index.d.ts +2 -2
- package/esm/socket/index.js +2 -2
- package/esm/socket/socket.d.ts +59 -59
- package/esm/socket/socket.d.ts.map +1 -1
- package/esm/socket/socket.js +118 -98
- package/esm/socket/socket.js.map +1 -1
- package/esm/utils/auto-reset-event.d.ts +9 -9
- package/esm/utils/auto-reset-event.d.ts.map +1 -1
- package/esm/utils/auto-reset-event.js +33 -33
- package/esm/utils/auto-reset-event.js.map +1 -1
- package/esm/utils/base64.d.ts +27 -27
- package/esm/utils/base64.d.ts.map +1 -1
- package/esm/utils/base64.js +246 -245
- package/esm/utils/base64.js.map +1 -1
- package/esm/utils/conditional-variable.d.ts +9 -0
- package/esm/utils/conditional-variable.d.ts.map +1 -0
- package/esm/utils/conditional-variable.js +34 -0
- package/esm/utils/conditional-variable.js.map +1 -0
- package/esm/utils/index.d.ts +4 -3
- package/esm/utils/index.d.ts.map +1 -1
- package/esm/utils/index.js +4 -3
- package/esm/utils/index.js.map +1 -1
- package/package.json +17 -13
- package/src/adb.ts +160 -101
- package/src/auth.ts +31 -22
- package/src/backend.ts +6 -4
- package/src/commands/base.ts +2 -2
- package/src/commands/framebuffer.ts +37 -41
- package/src/commands/index.ts +7 -8
- package/src/commands/power.ts +15 -11
- package/src/commands/reverse.ts +74 -30
- package/src/commands/subprocess/command.ts +34 -23
- package/src/commands/subprocess/index.ts +3 -3
- package/src/commands/subprocess/protocols/index.ts +3 -3
- package/src/commands/subprocess/protocols/none.ts +26 -11
- package/src/commands/subprocess/protocols/shell.ts +110 -56
- package/src/commands/subprocess/protocols/types.ts +10 -6
- package/src/commands/subprocess/utils.ts +1 -1
- package/src/commands/sync/index.ts +8 -7
- package/src/commands/sync/list.ts +74 -28
- package/src/commands/sync/pull.ts +49 -37
- package/src/commands/sync/push.ts +153 -32
- package/src/commands/sync/request.ts +37 -34
- package/src/commands/sync/response.ts +34 -27
- package/src/commands/sync/socket.ts +97 -0
- package/src/commands/sync/stat.ts +98 -70
- package/src/commands/sync/sync.ts +78 -97
- package/src/commands/tcpip.ts +5 -5
- package/src/crypto.ts +60 -32
- package/src/features.ts +9 -6
- package/src/index.ts +9 -10
- package/src/packet.ts +41 -46
- package/src/socket/dispatcher.ts +130 -108
- package/src/socket/index.ts +2 -2
- package/src/socket/socket.ts +84 -34
- package/src/utils/auto-reset-event.ts +16 -17
- package/src/utils/base64.ts +51 -41
- package/src/utils/conditional-variable.ts +45 -0
- package/src/utils/index.ts +4 -3
- package/tsconfig.build.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/src/commands/install.ts +0 -32
package/esm/auth.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","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,SAAS,gBAAgB,EAAE,EAC3C,eAAe,EAAE,kBAAkB;IAMvC,OAAO,CAAC,cAAc,CAEpB;YAEa,mBAAmB;IAuBrB,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAe5D,OAAO;CAGjB"}
|
package/esm/auth.js
CHANGED
|
@@ -1,97 +1,96 @@
|
|
|
1
|
-
import { PromiseResolver } from
|
|
2
|
-
import { calculatePublicKey, calculatePublicKeyLength, sign } from
|
|
3
|
-
import { AdbCommand } from
|
|
4
|
-
import { calculateBase64EncodedLength, encodeBase64 } from
|
|
5
|
-
export var AdbAuthType;
|
|
6
|
-
(function (AdbAuthType) {
|
|
7
|
-
AdbAuthType[AdbAuthType["Token"] = 1] = "Token";
|
|
8
|
-
AdbAuthType[AdbAuthType["Signature"] = 2] = "Signature";
|
|
9
|
-
AdbAuthType[AdbAuthType["PublicKey"] = 3] = "PublicKey";
|
|
10
|
-
})(AdbAuthType = AdbAuthType || (AdbAuthType = {}));
|
|
11
|
-
export const AdbSignatureAuthenticator = async function* (credentialStore, getNextRequest) {
|
|
12
|
-
for await (const key of credentialStore.iterateKeys()) {
|
|
13
|
-
const packet = await getNextRequest();
|
|
14
|
-
if (packet.arg0 !== AdbAuthType.Token) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
const signature = sign(key, packet.payload);
|
|
18
|
-
yield {
|
|
19
|
-
command: AdbCommand.Auth,
|
|
20
|
-
arg0: AdbAuthType.Signature,
|
|
21
|
-
arg1: 0,
|
|
22
|
-
payload: new Uint8Array(signature),
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
export const AdbPublicKeyAuthenticator = async function* (credentialStore, getNextRequest) {
|
|
27
|
-
const packet = await getNextRequest();
|
|
28
|
-
if (packet.arg0 !== AdbAuthType.Token) {
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
let privateKey;
|
|
32
|
-
for await (const key of credentialStore.iterateKeys()) {
|
|
33
|
-
privateKey = key;
|
|
34
|
-
break;
|
|
35
|
-
}
|
|
36
|
-
if (!privateKey) {
|
|
37
|
-
privateKey = await credentialStore.generateKey();
|
|
38
|
-
}
|
|
39
|
-
const publicKeyLength = calculatePublicKeyLength();
|
|
40
|
-
const [publicKeyBase64Length] = calculateBase64EncodedLength(publicKeyLength);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
this.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
//
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
//
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
this.
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
1
|
+
import { PromiseResolver } from "@yume-chan/async";
|
|
2
|
+
import { calculatePublicKey, calculatePublicKeyLength, sign, } from "./crypto.js";
|
|
3
|
+
import { AdbCommand } from "./packet.js";
|
|
4
|
+
import { calculateBase64EncodedLength, encodeBase64 } from "./utils/index.js";
|
|
5
|
+
export var AdbAuthType;
|
|
6
|
+
(function (AdbAuthType) {
|
|
7
|
+
AdbAuthType[AdbAuthType["Token"] = 1] = "Token";
|
|
8
|
+
AdbAuthType[AdbAuthType["Signature"] = 2] = "Signature";
|
|
9
|
+
AdbAuthType[AdbAuthType["PublicKey"] = 3] = "PublicKey";
|
|
10
|
+
})(AdbAuthType = AdbAuthType || (AdbAuthType = {}));
|
|
11
|
+
export const AdbSignatureAuthenticator = async function* (credentialStore, getNextRequest) {
|
|
12
|
+
for await (const key of credentialStore.iterateKeys()) {
|
|
13
|
+
const packet = await getNextRequest();
|
|
14
|
+
if (packet.arg0 !== AdbAuthType.Token) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const signature = sign(key, packet.payload);
|
|
18
|
+
yield {
|
|
19
|
+
command: AdbCommand.Auth,
|
|
20
|
+
arg0: AdbAuthType.Signature,
|
|
21
|
+
arg1: 0,
|
|
22
|
+
payload: new Uint8Array(signature),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
export const AdbPublicKeyAuthenticator = async function* (credentialStore, getNextRequest) {
|
|
27
|
+
const packet = await getNextRequest();
|
|
28
|
+
if (packet.arg0 !== AdbAuthType.Token) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
let privateKey;
|
|
32
|
+
for await (const key of credentialStore.iterateKeys()) {
|
|
33
|
+
privateKey = key;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
if (!privateKey) {
|
|
37
|
+
privateKey = await credentialStore.generateKey();
|
|
38
|
+
}
|
|
39
|
+
const publicKeyLength = calculatePublicKeyLength();
|
|
40
|
+
const [publicKeyBase64Length] = calculateBase64EncodedLength(publicKeyLength);
|
|
41
|
+
const publicKeyBuffer = new Uint8Array(publicKeyBase64Length + 1 // Null character
|
|
42
|
+
);
|
|
43
|
+
calculatePublicKey(privateKey, publicKeyBuffer);
|
|
44
|
+
encodeBase64(publicKeyBuffer.subarray(0, publicKeyLength), publicKeyBuffer);
|
|
45
|
+
yield {
|
|
46
|
+
command: AdbCommand.Auth,
|
|
47
|
+
arg0: AdbAuthType.PublicKey,
|
|
48
|
+
arg1: 0,
|
|
49
|
+
payload: publicKeyBuffer,
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export const ADB_DEFAULT_AUTHENTICATORS = [
|
|
53
|
+
AdbSignatureAuthenticator,
|
|
54
|
+
AdbPublicKeyAuthenticator,
|
|
55
|
+
];
|
|
56
|
+
export class AdbAuthenticationProcessor {
|
|
57
|
+
authenticators;
|
|
58
|
+
credentialStore;
|
|
59
|
+
pendingRequest = new PromiseResolver();
|
|
60
|
+
iterator;
|
|
61
|
+
constructor(authenticators, credentialStore) {
|
|
62
|
+
this.authenticators = authenticators;
|
|
63
|
+
this.credentialStore = credentialStore;
|
|
64
|
+
}
|
|
65
|
+
getNextRequest = () => {
|
|
66
|
+
return this.pendingRequest.promise;
|
|
67
|
+
};
|
|
68
|
+
async *invokeAuthenticator() {
|
|
69
|
+
for (const authenticator of this.authenticators) {
|
|
70
|
+
for await (const packet of authenticator(this.credentialStore, this.getNextRequest)) {
|
|
71
|
+
// If the authenticator yielded a response
|
|
72
|
+
// Prepare `nextRequest` for next authentication request
|
|
73
|
+
this.pendingRequest = new PromiseResolver();
|
|
74
|
+
// Yield the response to outer layer
|
|
75
|
+
yield packet;
|
|
76
|
+
}
|
|
77
|
+
// If the authenticator returned,
|
|
78
|
+
// Next authenticator will be given the same `pendingRequest`
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async process(packet) {
|
|
82
|
+
if (!this.iterator) {
|
|
83
|
+
this.iterator = this.invokeAuthenticator();
|
|
84
|
+
}
|
|
85
|
+
this.pendingRequest.resolve(packet);
|
|
86
|
+
const result = await this.iterator.next();
|
|
87
|
+
if (result.done) {
|
|
88
|
+
throw new Error("No authenticator can handle the request");
|
|
89
|
+
}
|
|
90
|
+
return result.value;
|
|
91
|
+
}
|
|
92
|
+
dispose() {
|
|
93
|
+
void this.iterator?.return?.();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
97
96
|
//# sourceMappingURL=auth.js.map
|
package/esm/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAInD,OAAO,
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAInD,OAAO,EACH,kBAAkB,EAClB,wBAAwB,EACxB,IAAI,GACP,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,4BAA4B,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAoB9E,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACnB,+CAAS,CAAA;IACT,uDAAa,CAAA;IACb,uDAAa,CAAA;AACjB,CAAC,EAJW,WAAW,GAAX,WAAW,KAAX,WAAW,QAItB;AAoBD,MAAM,CAAC,MAAM,yBAAyB,GAAqB,KAAK,SAAS,CAAC,EACtE,eAAmC,EACnC,cAA4C;IAE5C,IAAI,KAAK,EAAE,MAAM,GAAG,IAAI,eAAe,CAAC,WAAW,EAAE,EAAE;QACnD,MAAM,MAAM,GAAG,MAAM,cAAc,EAAE,CAAC;QAEtC,IAAI,MAAM,CAAC,IAAI,KAAK,WAAW,CAAC,KAAK,EAAE;YACnC,OAAO;SACV;QAED,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;QAC5C,MAAM;YACF,OAAO,EAAE,UAAU,CAAC,IAAI;YACxB,IAAI,EAAE,WAAW,CAAC,SAAS;YAC3B,IAAI,EAAE,CAAC;YACP,OAAO,EAAE,IAAI,UAAU,CAAC,SAAS,CAAC;SACrC,CAAC;KACL;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAqB,KAAK,SAAS,CAAC,EACtE,eA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;IAEO,cAAc,GAAG,GAA2B,EAAE;QAClD,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;IACvC,CAAC,CAAC;IAEM,KAAK,CAAC,CAAC,mBAAmB;QAK9B,KAAK,MAAM,aAAa,IAAI,IAAI,CAAC,cAAc,EAAE;YAC7C,IAAI,KAAK,EAAE,MAAM,MAAM,IAAI,aAAa,CACpC,IAAI,CAAC,eAAe,EACpB,IAAI,CAAC,cAAc,CACtB,EAAE;gBACC,0CAA0C;gBAC1C,wDAAwD;gBACxD,IAAI,CAAC,cAAc,GAAG,IAAI,eAAe,EAAE,CAAC;gBAE5C,oCAAoC;gBACpC,MAAM,MAAM,CAAC;aAChB;YAED,iCAAiC;YACjC,6DAA6D;SAChE;IACL,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,MAAqB;QACtC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAChB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,mBAAmB,EAAE,CAAC;SAC9C;QAED,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEpC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC1C,IAAI,MAAM,CAAC,IAAI,EAAE;YACb,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;SAC9D;QAED,OAAO,MAAM,CAAC,KAAK,CAAC;IACxB,CAAC;IAEM,OAAO;QACV,KAAK,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC;IACnC,CAAC;CACJ"}
|
package/esm/backend.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { ReadableWritablePair } from
|
|
2
|
-
import type { ValueOrPromise } from
|
|
3
|
-
import type { AdbPacketData, AdbPacketInit } from
|
|
4
|
-
export interface AdbBackend {
|
|
5
|
-
readonly serial: string;
|
|
6
|
-
readonly name: string | undefined;
|
|
7
|
-
connect(): ValueOrPromise<ReadableWritablePair<AdbPacketData, AdbPacketInit
|
|
8
|
-
}
|
|
1
|
+
import type { Consumable, ReadableWritablePair } from "@yume-chan/stream-extra";
|
|
2
|
+
import type { ValueOrPromise } from "@yume-chan/struct";
|
|
3
|
+
import type { AdbPacketData, AdbPacketInit } from "./packet.js";
|
|
4
|
+
export interface AdbBackend {
|
|
5
|
+
readonly serial: string;
|
|
6
|
+
readonly name: string | undefined;
|
|
7
|
+
connect(): ValueOrPromise<ReadableWritablePair<AdbPacketData, Consumable<AdbPacketInit>>>;
|
|
8
|
+
}
|
|
9
9
|
//# sourceMappingURL=backend.d.ts.map
|
package/esm/backend.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../src/backend.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEhE,MAAM,WAAW,UAAU;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAExB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAElC,OAAO,IAAI,cAAc,CACrB,oBAAoB,CAAC,aAAa,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC,CACjE,CAAC;CACL"}
|
package/esm/backend.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export {};
|
|
2
2
|
//# sourceMappingURL=backend.js.map
|
package/esm/commands/base.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { AutoDisposable } from
|
|
2
|
-
import type { Adb } from
|
|
3
|
-
export declare class AdbCommandBase extends AutoDisposable {
|
|
4
|
-
protected adb: Adb;
|
|
5
|
-
constructor(adb: Adb);
|
|
6
|
-
}
|
|
1
|
+
import { AutoDisposable } from "@yume-chan/event";
|
|
2
|
+
import type { Adb } from "../adb.js";
|
|
3
|
+
export declare class AdbCommandBase extends AutoDisposable {
|
|
4
|
+
protected adb: Adb;
|
|
5
|
+
constructor(adb: Adb);
|
|
6
|
+
}
|
|
7
7
|
//# sourceMappingURL=base.d.ts.map
|
package/esm/commands/base.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { AutoDisposable } from
|
|
2
|
-
export class AdbCommandBase extends AutoDisposable {
|
|
3
|
-
adb;
|
|
4
|
-
constructor(adb) {
|
|
5
|
-
super();
|
|
6
|
-
this.adb = adb;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
1
|
+
import { AutoDisposable } from "@yume-chan/event";
|
|
2
|
+
export class AdbCommandBase extends AutoDisposable {
|
|
3
|
+
adb;
|
|
4
|
+
constructor(adb) {
|
|
5
|
+
super();
|
|
6
|
+
this.adb = adb;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
9
|
//# sourceMappingURL=base.js.map
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import Struct from
|
|
2
|
-
import type { Adb } from
|
|
3
|
-
export declare const AdbFrameBufferV1: Struct<{
|
|
4
|
-
bpp: number;
|
|
5
|
-
size: number;
|
|
6
|
-
width: number;
|
|
7
|
-
height: number;
|
|
8
|
-
red_offset: number;
|
|
9
|
-
red_length: number;
|
|
10
|
-
blue_offset: number;
|
|
11
|
-
blue_length: number;
|
|
12
|
-
green_offset: number;
|
|
13
|
-
green_length: number;
|
|
14
|
-
alpha_offset: number;
|
|
15
|
-
alpha_length: number;
|
|
16
|
-
data: Uint8Array;
|
|
17
|
-
}, "size",
|
|
18
|
-
export
|
|
19
|
-
export declare const AdbFrameBufferV2: Struct<{
|
|
20
|
-
bpp: number;
|
|
21
|
-
colorSpace: number;
|
|
22
|
-
size: number;
|
|
23
|
-
width: number;
|
|
24
|
-
height: number;
|
|
25
|
-
red_offset: number;
|
|
26
|
-
red_length: number;
|
|
27
|
-
blue_offset: number;
|
|
28
|
-
blue_length: number;
|
|
29
|
-
green_offset: number;
|
|
30
|
-
green_length: number;
|
|
31
|
-
alpha_offset: number;
|
|
32
|
-
alpha_length: number;
|
|
33
|
-
data: Uint8Array;
|
|
34
|
-
}, "size",
|
|
35
|
-
export
|
|
36
|
-
/**
|
|
37
|
-
* ADB uses 8 int32 fields to describe bit depths
|
|
38
|
-
*
|
|
39
|
-
* The only combination I have seen is RGBA8888, which is
|
|
40
|
-
*
|
|
41
|
-
* red_offset: 0
|
|
42
|
-
* red_length: 8
|
|
43
|
-
* blue_offset: 16
|
|
44
|
-
* blue_length: 8
|
|
45
|
-
* green_offset: 8
|
|
46
|
-
* green_length: 8
|
|
47
|
-
* alpha_offset: 24
|
|
48
|
-
* alpha_length: 8
|
|
49
|
-
*
|
|
50
|
-
* But it doesn't mean that other combinations are not possible.
|
|
51
|
-
*/
|
|
52
|
-
export
|
|
53
|
-
export declare function framebuffer(adb: Adb): Promise<AdbFrameBuffer>;
|
|
1
|
+
import Struct from "@yume-chan/struct";
|
|
2
|
+
import type { Adb } from "../adb.js";
|
|
3
|
+
export declare const AdbFrameBufferV1: Struct<{
|
|
4
|
+
bpp: number;
|
|
5
|
+
size: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
red_offset: number;
|
|
9
|
+
red_length: number;
|
|
10
|
+
blue_offset: number;
|
|
11
|
+
blue_length: number;
|
|
12
|
+
green_offset: number;
|
|
13
|
+
green_length: number;
|
|
14
|
+
alpha_offset: number;
|
|
15
|
+
alpha_length: number;
|
|
16
|
+
data: Uint8Array;
|
|
17
|
+
}, "size", Record<never, never>, undefined>;
|
|
18
|
+
export type AdbFrameBufferV1 = (typeof AdbFrameBufferV1)["TDeserializeResult"];
|
|
19
|
+
export declare const AdbFrameBufferV2: Struct<{
|
|
20
|
+
bpp: number;
|
|
21
|
+
colorSpace: number;
|
|
22
|
+
size: number;
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
red_offset: number;
|
|
26
|
+
red_length: number;
|
|
27
|
+
blue_offset: number;
|
|
28
|
+
blue_length: number;
|
|
29
|
+
green_offset: number;
|
|
30
|
+
green_length: number;
|
|
31
|
+
alpha_offset: number;
|
|
32
|
+
alpha_length: number;
|
|
33
|
+
data: Uint8Array;
|
|
34
|
+
}, "size", Record<never, never>, undefined>;
|
|
35
|
+
export type AdbFrameBufferV2 = (typeof AdbFrameBufferV2)["TDeserializeResult"];
|
|
36
|
+
/**
|
|
37
|
+
* ADB uses 8 int32 fields to describe bit depths
|
|
38
|
+
*
|
|
39
|
+
* The only combination I have seen is RGBA8888, which is
|
|
40
|
+
*
|
|
41
|
+
* red_offset: 0
|
|
42
|
+
* red_length: 8
|
|
43
|
+
* blue_offset: 16
|
|
44
|
+
* blue_length: 8
|
|
45
|
+
* green_offset: 8
|
|
46
|
+
* green_length: 8
|
|
47
|
+
* alpha_offset: 24
|
|
48
|
+
* alpha_length: 8
|
|
49
|
+
*
|
|
50
|
+
* But it doesn't mean that other combinations are not possible.
|
|
51
|
+
*/
|
|
52
|
+
export type AdbFrameBuffer = AdbFrameBufferV1 | AdbFrameBufferV2;
|
|
53
|
+
export declare function framebuffer(adb: Adb): Promise<AdbFrameBuffer>;
|
|
54
54
|
//# sourceMappingURL=framebuffer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framebuffer.d.ts","sourceRoot":"","sources":["../../src/commands/framebuffer.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"framebuffer.d.ts","sourceRoot":"","sources":["../../src/commands/framebuffer.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAIrC,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;2CAamB,CAAC;AAEjD,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,oBAAoB,CAAC,CAAC;AAE/E,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;2CAcmB,CAAC;AAEjD,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,oBAAoB,CAAC,CAAC;AAE/E;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,cAAc,GAAG,gBAAgB,GAAG,gBAAgB,CAAC;AAEjE,wBAAsB,WAAW,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,cAAc,CAAC,CAanE"}
|
|
@@ -1,48 +1,47 @@
|
|
|
1
|
-
import { BufferedReadableStream } from
|
|
2
|
-
import Struct from
|
|
3
|
-
const Version = new Struct({ littleEndian: true })
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
.uint32(
|
|
7
|
-
.uint32(
|
|
8
|
-
.uint32(
|
|
9
|
-
.uint32(
|
|
10
|
-
.uint32(
|
|
11
|
-
.uint32(
|
|
12
|
-
.uint32(
|
|
13
|
-
.uint32(
|
|
14
|
-
.uint32(
|
|
15
|
-
.uint32(
|
|
16
|
-
.uint32(
|
|
17
|
-
.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
.uint32(
|
|
21
|
-
.uint32(
|
|
22
|
-
.uint32(
|
|
23
|
-
.uint32(
|
|
24
|
-
.uint32(
|
|
25
|
-
.uint32(
|
|
26
|
-
.uint32(
|
|
27
|
-
.uint32(
|
|
28
|
-
.uint32(
|
|
29
|
-
.uint32(
|
|
30
|
-
.uint32(
|
|
31
|
-
.uint32(
|
|
32
|
-
.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
1
|
+
import { BufferedReadableStream } from "@yume-chan/stream-extra";
|
|
2
|
+
import Struct from "@yume-chan/struct";
|
|
3
|
+
const Version = new Struct({ littleEndian: true }).uint32("version");
|
|
4
|
+
export const AdbFrameBufferV1 = new Struct({ littleEndian: true })
|
|
5
|
+
.uint32("bpp")
|
|
6
|
+
.uint32("size")
|
|
7
|
+
.uint32("width")
|
|
8
|
+
.uint32("height")
|
|
9
|
+
.uint32("red_offset")
|
|
10
|
+
.uint32("red_length")
|
|
11
|
+
.uint32("blue_offset")
|
|
12
|
+
.uint32("blue_length")
|
|
13
|
+
.uint32("green_offset")
|
|
14
|
+
.uint32("green_length")
|
|
15
|
+
.uint32("alpha_offset")
|
|
16
|
+
.uint32("alpha_length")
|
|
17
|
+
.uint8Array("data", { lengthField: "size" });
|
|
18
|
+
export const AdbFrameBufferV2 = new Struct({ littleEndian: true })
|
|
19
|
+
.uint32("bpp")
|
|
20
|
+
.uint32("colorSpace")
|
|
21
|
+
.uint32("size")
|
|
22
|
+
.uint32("width")
|
|
23
|
+
.uint32("height")
|
|
24
|
+
.uint32("red_offset")
|
|
25
|
+
.uint32("red_length")
|
|
26
|
+
.uint32("blue_offset")
|
|
27
|
+
.uint32("blue_length")
|
|
28
|
+
.uint32("green_offset")
|
|
29
|
+
.uint32("green_length")
|
|
30
|
+
.uint32("alpha_offset")
|
|
31
|
+
.uint32("alpha_length")
|
|
32
|
+
.uint8Array("data", { lengthField: "size" });
|
|
33
|
+
export async function framebuffer(adb) {
|
|
34
|
+
const socket = await adb.createSocket("framebuffer:");
|
|
35
|
+
const stream = new BufferedReadableStream(socket.readable);
|
|
36
|
+
const { version } = await Version.deserialize(stream);
|
|
37
|
+
switch (version) {
|
|
38
|
+
case 1:
|
|
39
|
+
// TODO: AdbFrameBuffer: does all v1 responses uses the same color space? Add it so the command returns same format for all versions.
|
|
40
|
+
return AdbFrameBufferV1.deserialize(stream);
|
|
41
|
+
case 2:
|
|
42
|
+
return AdbFrameBufferV2.deserialize(stream);
|
|
43
|
+
default:
|
|
44
|
+
throw new Error("Unsupported FrameBuffer version");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
48
47
|
//# sourceMappingURL=framebuffer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"framebuffer.js","sourceRoot":"","sources":["../../src/commands/framebuffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAIvC,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"framebuffer.js","sourceRoot":"","sources":["../../src/commands/framebuffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAIvC,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAErE,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,MAAM,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;KAC7D,MAAM,CAAC,KAAK,CAAC;KACb,MAAM,CAAC,MAAM,CAAC;KACd,MAAM,CAAC,OAAO,CAAC;KACf,MAAM,CAAC,QAAQ,CAAC;KAChB,MAAM,CAAC,YAAY,CAAC;KACpB,MAAM,CAAC,YAAY,CAAC;KACpB,MAAM,CAAC,aAAa,CAAC;KACrB,MAAM,CAAC,aAAa,CAAC;KACrB,MAAM,CAAC,cAAc,CAAC;KACtB,MAAM,CAAC,cAAc,CAAC;KACtB,MA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m/commands/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
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.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/commands/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","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"}
|
package/esm/commands/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
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,
|
|
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 {
|
|
2
|
-
import type { Adb } from
|
|
3
|
-
|
|
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,
|
|
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"}
|
package/esm/commands/install.js
CHANGED
|
@@ -1,23 +1,29 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import { escapeArg } from "./subprocess/index.js";
|
|
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
|
+
}
|
|
22
28
|
}
|
|
23
29
|
//# sourceMappingURL=install.js.map
|