@yume-chan/adb 2.6.0 → 3.0.0-beta.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/LICENSE +1 -1
- package/README.md +1 -1
- package/esm/adb.d.ts +18 -15
- package/esm/adb.d.ts.map +1 -1
- package/esm/adb.js +18 -11
- package/esm/adb.js.map +1 -1
- package/esm/banner.d.ts +1 -1
- package/esm/banner.d.ts.map +1 -1
- package/esm/daemon/auth/authenticator.d.ts +28 -0
- package/esm/daemon/auth/authenticator.d.ts.map +1 -0
- package/esm/daemon/auth/authenticator.js +108 -0
- package/esm/daemon/auth/authenticator.js.map +1 -0
- package/esm/daemon/auth/index.d.ts +5 -0
- package/esm/daemon/auth/index.d.ts.map +1 -0
- package/esm/daemon/auth/index.js +5 -0
- package/esm/daemon/auth/index.js.map +1 -0
- package/esm/daemon/auth/packet-processor.d.ts +42 -0
- package/esm/daemon/auth/packet-processor.d.ts.map +1 -0
- package/esm/daemon/auth/packet-processor.js +129 -0
- package/esm/daemon/auth/packet-processor.js.map +1 -0
- package/esm/daemon/auth/public-key.d.ts +8 -0
- package/esm/daemon/auth/public-key.d.ts.map +1 -0
- package/esm/daemon/auth/public-key.js +74 -0
- package/esm/daemon/auth/public-key.js.map +1 -0
- package/esm/daemon/auth/type.d.ts +5 -0
- package/esm/daemon/auth/type.d.ts.map +1 -0
- package/esm/daemon/auth/type.js +2 -0
- package/esm/daemon/auth/type.js.map +1 -0
- package/esm/daemon/crypto.d.ts +6 -5
- package/esm/daemon/crypto.d.ts.map +1 -1
- package/esm/daemon/crypto.js +23 -73
- package/esm/daemon/crypto.js.map +1 -1
- package/esm/daemon/dispatcher.d.ts +3 -3
- package/esm/daemon/dispatcher.d.ts.map +1 -1
- package/esm/daemon/dispatcher.js +11 -4
- package/esm/daemon/dispatcher.js.map +1 -1
- package/esm/daemon/index.d.ts +1 -1
- package/esm/daemon/index.d.ts.map +1 -1
- package/esm/daemon/index.js +1 -1
- package/esm/daemon/index.js.map +1 -1
- package/esm/daemon/socket.d.ts +3 -3
- package/esm/daemon/socket.d.ts.map +1 -1
- package/esm/daemon/transport.d.ts +13 -65
- package/esm/daemon/transport.d.ts.map +1 -1
- package/esm/daemon/transport.js +18 -140
- package/esm/daemon/transport.js.map +1 -1
- package/esm/device-observer.d.ts +2 -3
- package/esm/device-observer.d.ts.map +1 -1
- package/esm/features-value.d.ts +40 -0
- package/esm/features-value.d.ts.map +1 -0
- package/esm/features-value.js +46 -0
- package/esm/features-value.js.map +1 -0
- package/esm/features.d.ts +4 -12
- package/esm/features.d.ts.map +1 -1
- package/esm/features.js +27 -13
- package/esm/features.js.map +1 -1
- package/esm/index.d.ts +1 -1
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -1
- package/esm/index.js.map +1 -1
- package/esm/server/client.d.ts +7 -7
- package/esm/server/client.d.ts.map +1 -1
- package/esm/server/client.js +69 -86
- package/esm/server/client.js.map +1 -1
- package/esm/server/commands/wireless.js +1 -1
- package/esm/server/commands/wireless.js.map +1 -1
- package/esm/server/{stream.d.ts → data-connection.d.ts} +5 -5
- package/esm/server/data-connection.d.ts.map +1 -0
- package/esm/server/{stream.js → data-connection.js} +4 -4
- package/esm/server/data-connection.js.map +1 -0
- package/esm/server/index.d.ts +1 -1
- package/esm/server/index.d.ts.map +1 -1
- package/esm/server/index.js +1 -1
- package/esm/server/index.js.map +1 -1
- package/esm/server/observer.d.ts.map +1 -1
- package/esm/server/observer.js +14 -13
- package/esm/server/observer.js.map +1 -1
- package/esm/server/transport.d.ts +4 -6
- package/esm/server/transport.d.ts.map +1 -1
- package/esm/server/transport.js +9 -24
- package/esm/server/transport.js.map +1 -1
- package/esm/service/framebuffer.d.ts.map +1 -0
- package/esm/service/framebuffer.js.map +1 -0
- package/esm/{commands → service}/index.d.ts +1 -2
- package/esm/service/index.d.ts.map +1 -0
- package/esm/{commands → service}/index.js +1 -2
- package/esm/service/index.js.map +1 -0
- package/esm/{commands → service}/power.d.ts +4 -2
- package/esm/service/power.d.ts.map +1 -0
- package/esm/{commands → service}/power.js +11 -5
- package/esm/service/power.js.map +1 -0
- package/esm/service/reverse/error.d.ts +14 -0
- package/esm/service/reverse/error.d.ts.map +1 -0
- package/esm/service/reverse/error.js +21 -0
- package/esm/service/reverse/error.js.map +1 -0
- package/esm/service/reverse/index.d.ts +3 -0
- package/esm/service/reverse/index.d.ts.map +1 -0
- package/esm/service/reverse/index.js +4 -0
- package/esm/service/reverse/index.js.map +1 -0
- package/esm/service/reverse/response.d.ts +2 -0
- package/esm/service/reverse/response.d.ts.map +1 -0
- package/esm/service/reverse/response.js +30 -0
- package/esm/service/reverse/response.js.map +1 -0
- package/esm/service/reverse/service.d.ts +59 -0
- package/esm/service/reverse/service.d.ts.map +1 -0
- package/esm/{commands/reverse.js → service/reverse/service.js} +16 -45
- package/esm/service/reverse/service.js.map +1 -0
- package/esm/{commands → service}/subprocess/index.d.ts +1 -0
- package/esm/service/subprocess/index.d.ts.map +1 -0
- package/esm/{commands → service}/subprocess/index.js +1 -0
- package/esm/service/subprocess/index.js.map +1 -0
- package/esm/service/subprocess/none/index.d.ts.map +1 -0
- package/esm/service/subprocess/none/index.js.map +1 -0
- package/esm/{commands → service}/subprocess/none/process.d.ts +2 -2
- package/esm/service/subprocess/none/process.d.ts.map +1 -0
- package/esm/service/subprocess/none/process.js.map +1 -0
- package/esm/{commands → service}/subprocess/none/pty.d.ts +4 -4
- package/esm/service/subprocess/none/pty.d.ts.map +1 -0
- package/esm/{commands → service}/subprocess/none/pty.js +1 -1
- package/esm/service/subprocess/none/pty.js.map +1 -0
- package/esm/service/subprocess/none/service.d.ts +10 -0
- package/esm/service/subprocess/none/service.d.ts.map +1 -0
- package/esm/service/subprocess/none/service.js +44 -0
- package/esm/service/subprocess/none/service.js.map +1 -0
- package/esm/service/subprocess/none/spawner.d.ts +15 -0
- package/esm/service/subprocess/none/spawner.d.ts.map +1 -0
- package/esm/service/subprocess/none/spawner.js +31 -0
- package/esm/service/subprocess/none/spawner.js.map +1 -0
- package/esm/{commands → service}/subprocess/pty.d.ts +1 -1
- package/esm/service/subprocess/pty.d.ts.map +1 -0
- package/esm/{commands → service}/subprocess/pty.js.map +1 -1
- package/esm/service/subprocess/service.d.ts.map +1 -0
- package/esm/{commands → service}/subprocess/service.js +1 -1
- package/esm/service/subprocess/service.js.map +1 -0
- package/esm/service/subprocess/shell/index.d.ts +5 -0
- package/esm/{commands/subprocess/none → service/subprocess/shell}/index.d.ts.map +1 -1
- package/esm/service/subprocess/shell/index.js +6 -0
- package/esm/{commands/subprocess/none → service/subprocess/shell}/index.js.map +1 -1
- package/esm/{commands → service}/subprocess/shell/process.d.ts +2 -2
- package/esm/service/subprocess/shell/process.d.ts.map +1 -0
- package/esm/{commands → service}/subprocess/shell/process.js +4 -6
- package/esm/service/subprocess/shell/process.js.map +1 -0
- package/esm/{commands → service}/subprocess/shell/pty.d.ts +4 -4
- package/esm/service/subprocess/shell/pty.d.ts.map +1 -0
- package/esm/{commands → service}/subprocess/shell/pty.js +11 -9
- package/esm/service/subprocess/shell/pty.js.map +1 -0
- package/esm/service/subprocess/shell/service.d.ts +34 -0
- package/esm/service/subprocess/shell/service.d.ts.map +1 -0
- package/esm/service/subprocess/shell/service.js +52 -0
- package/esm/service/subprocess/shell/service.js.map +1 -0
- package/esm/service/subprocess/shell/shared.d.ts +2 -0
- package/esm/service/subprocess/shell/shared.d.ts.map +1 -0
- package/esm/{commands → service}/subprocess/shell/shared.js +2 -0
- package/esm/service/subprocess/shell/shared.js.map +1 -0
- package/esm/{commands → service}/subprocess/shell/spawner.d.ts +3 -7
- package/esm/service/subprocess/shell/spawner.d.ts.map +1 -0
- package/esm/service/subprocess/shell/spawner.js +45 -0
- package/esm/service/subprocess/shell/spawner.js.map +1 -0
- package/esm/service/subprocess/types.d.ts +14 -0
- package/esm/service/subprocess/types.d.ts.map +1 -0
- package/esm/service/subprocess/types.js +2 -0
- package/esm/service/subprocess/types.js.map +1 -0
- package/esm/service/subprocess/utils.d.ts +39 -0
- package/esm/service/subprocess/utils.d.ts.map +1 -0
- package/esm/service/subprocess/utils.js +142 -0
- package/esm/service/subprocess/utils.js.map +1 -0
- package/esm/service/sync/android.d.ts +34 -0
- package/esm/service/sync/android.d.ts.map +1 -0
- package/esm/service/sync/android.js +34 -0
- package/esm/service/sync/android.js.map +1 -0
- package/esm/service/sync/compression/compression.d.ts +17 -0
- package/esm/service/sync/compression/compression.d.ts.map +1 -0
- package/esm/service/sync/compression/compression.js +92 -0
- package/esm/service/sync/compression/compression.js.map +1 -0
- package/esm/service/sync/compression/format-ns.d.ts +5 -0
- package/esm/service/sync/compression/format-ns.d.ts.map +1 -0
- package/esm/service/sync/compression/format-ns.js +5 -0
- package/esm/service/sync/compression/format-ns.js.map +1 -0
- package/esm/service/sync/compression/format.d.ts +4 -0
- package/esm/service/sync/compression/format.d.ts.map +1 -0
- package/esm/service/sync/compression/format.js +3 -0
- package/esm/service/sync/compression/format.js.map +1 -0
- package/esm/service/sync/compression/index.d.ts +2 -0
- package/esm/service/sync/compression/index.d.ts.map +1 -0
- package/esm/service/sync/compression/index.js +2 -0
- package/esm/service/sync/compression/index.js.map +1 -0
- package/esm/service/sync/id/common.d.ts +17 -0
- package/esm/service/sync/id/common.d.ts.map +1 -0
- package/esm/service/sync/id/common.js +29 -0
- package/esm/service/sync/id/common.js.map +1 -0
- package/esm/service/sync/id/index.d.ts +4 -0
- package/esm/service/sync/id/index.d.ts.map +1 -0
- package/esm/service/sync/id/index.js +6 -0
- package/esm/service/sync/id/index.js.map +1 -0
- package/esm/service/sync/id/request.d.ts +7 -0
- package/esm/service/sync/id/request.d.ts.map +1 -0
- package/esm/service/sync/id/request.js +9 -0
- package/esm/service/sync/id/request.js.map +1 -0
- package/esm/service/sync/id/response.d.ts +6 -0
- package/esm/service/sync/id/response.d.ts.map +1 -0
- package/esm/service/sync/id/response.js +8 -0
- package/esm/service/sync/id/response.js.map +1 -0
- package/esm/service/sync/index-ns.d.ts +7 -0
- package/esm/service/sync/index-ns.d.ts.map +1 -0
- package/esm/service/sync/index-ns.js +7 -0
- package/esm/service/sync/index-ns.js.map +1 -0
- package/esm/service/sync/index.d.ts +3 -0
- package/esm/service/sync/index.d.ts.map +1 -0
- package/esm/service/sync/index.js +3 -0
- package/esm/service/sync/index.js.map +1 -0
- package/esm/service/sync/request/index.d.ts +5 -0
- package/esm/service/sync/request/index.d.ts.map +1 -0
- package/esm/service/sync/request/index.js +5 -0
- package/esm/service/sync/request/index.js.map +1 -0
- package/esm/{commands/sync → service/sync/request}/list.d.ts +21 -19
- package/esm/service/sync/request/list.d.ts.map +1 -0
- package/esm/service/sync/request/list.js +77 -0
- package/esm/service/sync/request/list.js.map +1 -0
- package/esm/service/sync/request/pull.d.ts +12 -0
- package/esm/service/sync/request/pull.d.ts.map +1 -0
- package/esm/service/sync/request/pull.js +28 -0
- package/esm/service/sync/request/pull.js.map +1 -0
- package/esm/service/sync/request/push.d.ts +54 -0
- package/esm/service/sync/request/push.d.ts.map +1 -0
- package/esm/service/sync/request/push.js +95 -0
- package/esm/service/sync/request/push.js.map +1 -0
- package/esm/{commands/sync → service/sync/request}/stat.d.ts +40 -50
- package/esm/service/sync/request/stat.d.ts.map +1 -0
- package/esm/service/sync/request/stat.js +89 -0
- package/esm/service/sync/request/stat.js.map +1 -0
- package/esm/service/sync/service.d.ts +123 -0
- package/esm/service/sync/service.d.ts.map +1 -0
- package/esm/service/sync/service.js +170 -0
- package/esm/service/sync/service.js.map +1 -0
- package/esm/service/sync/socket-pool.d.ts +11 -0
- package/esm/service/sync/socket-pool.d.ts.map +1 -0
- package/esm/service/sync/socket-pool.js +80 -0
- package/esm/service/sync/socket-pool.js.map +1 -0
- package/esm/service/sync/socket.d.ts +40 -0
- package/esm/service/sync/socket.d.ts.map +1 -0
- package/esm/service/sync/socket.js +153 -0
- package/esm/service/sync/socket.js.map +1 -0
- package/esm/{commands → service}/tcpip.d.ts +4 -2
- package/esm/service/tcpip.d.ts.map +1 -0
- package/esm/{commands → service}/tcpip.js +10 -7
- package/esm/service/tcpip.js.map +1 -0
- package/esm/utils/array-buffer.d.ts.map +1 -1
- package/esm/utils/array-buffer.js +2 -3
- package/esm/utils/array-buffer.js.map +1 -1
- package/esm/utils/base64.d.ts.map +1 -1
- package/esm/utils/base64.js +22 -12
- package/esm/utils/base64.js.map +1 -1
- package/esm/utils/index.d.ts +1 -0
- package/esm/utils/index.d.ts.map +1 -1
- package/esm/utils/index.js +1 -0
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/md5.d.ts +8 -0
- package/esm/utils/md5.d.ts.map +1 -0
- package/esm/utils/md5.js +149 -0
- package/esm/utils/md5.js.map +1 -0
- package/package.json +10 -10
- package/src/adb.ts +44 -34
- package/src/daemon/auth/authenticator.ts +186 -0
- package/src/daemon/auth/index.ts +4 -0
- package/src/daemon/auth/packet-processor.ts +212 -0
- package/src/daemon/auth/public-key.ts +112 -0
- package/src/daemon/auth/type.ts +5 -0
- package/src/daemon/crypto.ts +36 -102
- package/src/daemon/dispatcher.ts +15 -8
- package/src/daemon/index.ts +1 -1
- package/src/daemon/socket.ts +3 -3
- package/src/daemon/transport.ts +35 -253
- package/src/device-observer.ts +3 -3
- package/src/features-value.ts +47 -0
- package/src/features.ts +31 -14
- package/src/index.ts +1 -1
- package/src/server/client.ts +96 -94
- package/src/server/commands/wireless.ts +1 -1
- package/src/server/{stream.ts → data-connection.ts} +4 -4
- package/src/server/index.ts +1 -1
- package/src/server/observer.ts +21 -19
- package/src/server/transport.ts +13 -34
- package/src/{commands → service}/index.ts +1 -2
- package/src/{commands → service}/power.ts +14 -5
- package/src/service/reverse/error.ts +35 -0
- package/src/service/reverse/index.ts +3 -0
- package/src/service/reverse/response.ts +38 -0
- package/src/{commands/reverse.ts → service/reverse/service.ts} +32 -72
- package/src/{commands → service}/subprocess/index.ts +1 -0
- package/src/{commands → service}/subprocess/none/process.ts +3 -3
- package/src/{commands → service}/subprocess/none/pty.ts +5 -5
- package/src/service/subprocess/none/service.ts +57 -0
- package/src/service/subprocess/none/spawner.ts +81 -0
- package/src/{commands → service}/subprocess/pty.ts +1 -1
- package/src/{commands → service}/subprocess/service.ts +1 -1
- package/src/{commands → service}/subprocess/shell/index.ts +1 -1
- package/src/{commands → service}/subprocess/shell/process.ts +6 -7
- package/src/{commands → service}/subprocess/shell/pty.ts +15 -13
- package/src/service/subprocess/shell/service.ts +75 -0
- package/src/{commands → service}/subprocess/shell/shared.ts +5 -0
- package/src/service/subprocess/shell/spawner.ts +109 -0
- package/src/service/subprocess/types.ts +19 -0
- package/src/service/subprocess/utils.ts +166 -0
- package/src/service/sync/android.ts +43 -0
- package/src/service/sync/compression/compression.ts +126 -0
- package/src/service/sync/compression/format-ns.ts +4 -0
- package/src/service/sync/compression/format.ts +5 -0
- package/src/service/sync/compression/index.ts +1 -0
- package/src/service/sync/id/common.ts +33 -0
- package/src/service/sync/id/index.ts +7 -0
- package/src/service/sync/id/request.ts +12 -0
- package/src/service/sync/id/response.ts +11 -0
- package/src/service/sync/index-ns.ts +6 -0
- package/src/service/sync/index.ts +2 -0
- package/src/service/sync/request/index.ts +4 -0
- package/src/service/sync/request/list.ts +110 -0
- package/src/service/sync/request/pull.ts +49 -0
- package/src/service/sync/request/push.ts +184 -0
- package/src/service/sync/request/stat.ts +127 -0
- package/src/service/sync/service.ts +255 -0
- package/src/service/sync/socket-pool.ts +97 -0
- package/src/service/sync/socket.ts +201 -0
- package/src/{commands → service}/tcpip.ts +13 -7
- package/src/utils/array-buffer.ts +2 -3
- package/src/utils/base64.ts +24 -12
- package/src/utils/index.ts +1 -0
- package/src/utils/md5.ts +185 -0
- package/yume-chan-adb-3.0.0-beta.0.tgz +0 -0
- package/CHANGELOG.md +0 -251
- package/esm/commands/base.d.ts +0 -8
- package/esm/commands/base.d.ts.map +0 -1
- package/esm/commands/base.js +0 -12
- package/esm/commands/base.js.map +0 -1
- package/esm/commands/framebuffer.d.ts.map +0 -1
- package/esm/commands/framebuffer.js.map +0 -1
- package/esm/commands/index.d.ts.map +0 -1
- package/esm/commands/index.js.map +0 -1
- package/esm/commands/power.d.ts.map +0 -1
- package/esm/commands/power.js.map +0 -1
- package/esm/commands/reverse.d.ts +0 -48
- package/esm/commands/reverse.d.ts.map +0 -1
- package/esm/commands/reverse.js.map +0 -1
- package/esm/commands/subprocess/index.d.ts.map +0 -1
- package/esm/commands/subprocess/index.js.map +0 -1
- package/esm/commands/subprocess/none/process.d.ts.map +0 -1
- package/esm/commands/subprocess/none/process.js.map +0 -1
- package/esm/commands/subprocess/none/pty.d.ts.map +0 -1
- package/esm/commands/subprocess/none/pty.js.map +0 -1
- package/esm/commands/subprocess/none/service.d.ts +0 -10
- package/esm/commands/subprocess/none/service.d.ts.map +0 -1
- package/esm/commands/subprocess/none/service.js +0 -34
- package/esm/commands/subprocess/none/service.js.map +0 -1
- package/esm/commands/subprocess/none/spawner.d.ts +0 -19
- package/esm/commands/subprocess/none/spawner.d.ts.map +0 -1
- package/esm/commands/subprocess/none/spawner.js +0 -26
- package/esm/commands/subprocess/none/spawner.js.map +0 -1
- package/esm/commands/subprocess/pty.d.ts.map +0 -1
- package/esm/commands/subprocess/service.d.ts.map +0 -1
- package/esm/commands/subprocess/service.js.map +0 -1
- package/esm/commands/subprocess/shell/index.d.ts +0 -6
- package/esm/commands/subprocess/shell/index.d.ts.map +0 -1
- package/esm/commands/subprocess/shell/index.js +0 -6
- package/esm/commands/subprocess/shell/index.js.map +0 -1
- package/esm/commands/subprocess/shell/process.d.ts.map +0 -1
- package/esm/commands/subprocess/shell/process.js.map +0 -1
- package/esm/commands/subprocess/shell/pty.d.ts.map +0 -1
- package/esm/commands/subprocess/shell/pty.js.map +0 -1
- package/esm/commands/subprocess/shell/service.d.ts +0 -14
- package/esm/commands/subprocess/shell/service.d.ts.map +0 -1
- package/esm/commands/subprocess/shell/service.js +0 -41
- package/esm/commands/subprocess/shell/service.js.map +0 -1
- package/esm/commands/subprocess/shell/shared.d.ts +0 -19
- package/esm/commands/subprocess/shell/shared.d.ts.map +0 -1
- package/esm/commands/subprocess/shell/shared.js.map +0 -1
- package/esm/commands/subprocess/shell/spawner.d.ts.map +0 -1
- package/esm/commands/subprocess/shell/spawner.js +0 -38
- package/esm/commands/subprocess/shell/spawner.js.map +0 -1
- package/esm/commands/subprocess/utils.d.ts +0 -3
- package/esm/commands/subprocess/utils.d.ts.map +0 -1
- package/esm/commands/subprocess/utils.js +0 -56
- package/esm/commands/subprocess/utils.js.map +0 -1
- package/esm/commands/sync/index.d.ts +0 -9
- package/esm/commands/sync/index.d.ts.map +0 -1
- package/esm/commands/sync/index.js +0 -9
- package/esm/commands/sync/index.js.map +0 -1
- package/esm/commands/sync/list.d.ts.map +0 -1
- package/esm/commands/sync/list.js +0 -64
- package/esm/commands/sync/list.js.map +0 -1
- package/esm/commands/sync/pull.d.ts +0 -12
- package/esm/commands/sync/pull.d.ts.map +0 -1
- package/esm/commands/sync/pull.js +0 -33
- package/esm/commands/sync/pull.js.map +0 -1
- package/esm/commands/sync/push.d.ts +0 -61
- package/esm/commands/sync/push.d.ts.map +0 -1
- package/esm/commands/sync/push.js +0 -83
- package/esm/commands/sync/push.js.map +0 -1
- package/esm/commands/sync/request.d.ts +0 -24
- package/esm/commands/sync/request.d.ts.map +0 -1
- package/esm/commands/sync/request.js +0 -32
- package/esm/commands/sync/request.js.map +0 -1
- package/esm/commands/sync/response.d.ts +0 -28
- package/esm/commands/sync/response.d.ts.map +0 -1
- package/esm/commands/sync/response.js +0 -81
- package/esm/commands/sync/response.js.map +0 -1
- package/esm/commands/sync/socket.d.ts +0 -22
- package/esm/commands/sync/socket.d.ts.map +0 -1
- package/esm/commands/sync/socket.js +0 -78
- package/esm/commands/sync/socket.js.map +0 -1
- package/esm/commands/sync/stat.d.ts.map +0 -1
- package/esm/commands/sync/stat.js +0 -121
- package/esm/commands/sync/stat.js.map +0 -1
- package/esm/commands/sync/sync.d.ts +0 -82
- package/esm/commands/sync/sync.d.ts.map +0 -1
- package/esm/commands/sync/sync.js +0 -138
- package/esm/commands/sync/sync.js.map +0 -1
- package/esm/commands/tcpip.d.ts.map +0 -1
- package/esm/commands/tcpip.js.map +0 -1
- package/esm/daemon/auth.d.ts +0 -54
- package/esm/daemon/auth.d.ts.map +0 -1
- package/esm/daemon/auth.js +0 -104
- package/esm/daemon/auth.js.map +0 -1
- package/esm/server/stream.d.ts.map +0 -1
- package/esm/server/stream.js.map +0 -1
- package/src/commands/base.ts +0 -15
- package/src/commands/subprocess/none/service.ts +0 -45
- package/src/commands/subprocess/none/spawner.ts +0 -68
- package/src/commands/subprocess/shell/service.ts +0 -58
- package/src/commands/subprocess/shell/spawner.ts +0 -90
- package/src/commands/subprocess/utils.ts +0 -61
- package/src/commands/sync/index.ts +0 -8
- package/src/commands/sync/list.ts +0 -99
- package/src/commands/sync/pull.ts +0 -55
- package/src/commands/sync/push.ts +0 -172
- package/src/commands/sync/request.ts +0 -53
- package/src/commands/sync/response.ts +0 -105
- package/src/commands/sync/socket.ts +0 -109
- package/src/commands/sync/stat.ts +0 -177
- package/src/commands/sync/sync.ts +0 -175
- package/src/daemon/auth.ts +0 -204
- package/tsconfig.build.tsbuildinfo +0 -1
- /package/esm/{commands → service}/framebuffer.d.ts +0 -0
- /package/esm/{commands → service}/framebuffer.js +0 -0
- /package/esm/{commands → service}/subprocess/none/index.d.ts +0 -0
- /package/esm/{commands → service}/subprocess/none/index.js +0 -0
- /package/esm/{commands → service}/subprocess/none/process.js +0 -0
- /package/esm/{commands → service}/subprocess/pty.js +0 -0
- /package/esm/{commands → service}/subprocess/service.d.ts +0 -0
- /package/src/{commands → service}/framebuffer.ts +0 -0
- /package/src/{commands → service}/subprocess/none/index.ts +0 -0
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { AdbFeature } from "../../features.js";
|
|
2
|
-
import { escapeArg } from "../subprocess/index.js";
|
|
3
|
-
import { adbSyncOpenDir } from "./list.js";
|
|
4
|
-
import { adbSyncPull } from "./pull.js";
|
|
5
|
-
import { adbSyncPush } from "./push.js";
|
|
6
|
-
import { AdbSyncSocket } from "./socket.js";
|
|
7
|
-
import { adbSyncLstat, adbSyncStat } from "./stat.js";
|
|
8
|
-
/**
|
|
9
|
-
* A simplified `dirname` function that only handles absolute unix paths.
|
|
10
|
-
* @param path an absolute unix path
|
|
11
|
-
* @returns the directory name of the input path
|
|
12
|
-
*/
|
|
13
|
-
export function dirname(path) {
|
|
14
|
-
const end = path.lastIndexOf("/");
|
|
15
|
-
if (end === -1) {
|
|
16
|
-
throw new Error(`Invalid path`);
|
|
17
|
-
}
|
|
18
|
-
if (end === 0) {
|
|
19
|
-
return "/";
|
|
20
|
-
}
|
|
21
|
-
return path.substring(0, end);
|
|
22
|
-
}
|
|
23
|
-
export class AdbSync {
|
|
24
|
-
_adb;
|
|
25
|
-
_socket;
|
|
26
|
-
#supportsStat;
|
|
27
|
-
#supportsListV2;
|
|
28
|
-
#fixedPushMkdir;
|
|
29
|
-
#supportsSendReceiveV2;
|
|
30
|
-
#needPushMkdirWorkaround;
|
|
31
|
-
get supportsStat() {
|
|
32
|
-
return this.#supportsStat;
|
|
33
|
-
}
|
|
34
|
-
get supportsListV2() {
|
|
35
|
-
return this.#supportsListV2;
|
|
36
|
-
}
|
|
37
|
-
get fixedPushMkdir() {
|
|
38
|
-
return this.#fixedPushMkdir;
|
|
39
|
-
}
|
|
40
|
-
get supportsSendReceiveV2() {
|
|
41
|
-
return this.#supportsSendReceiveV2;
|
|
42
|
-
}
|
|
43
|
-
get needPushMkdirWorkaround() {
|
|
44
|
-
return this.#needPushMkdirWorkaround;
|
|
45
|
-
}
|
|
46
|
-
constructor(adb, socket) {
|
|
47
|
-
this._adb = adb;
|
|
48
|
-
this._socket = new AdbSyncSocket(socket, adb.maxPayloadSize);
|
|
49
|
-
this.#supportsStat = adb.canUseFeature(AdbFeature.StatV2);
|
|
50
|
-
this.#supportsListV2 = adb.canUseFeature(AdbFeature.ListV2);
|
|
51
|
-
this.#fixedPushMkdir = adb.canUseFeature(AdbFeature.FixedPushMkdir);
|
|
52
|
-
this.#supportsSendReceiveV2 = adb.canUseFeature(AdbFeature.SendReceiveV2);
|
|
53
|
-
// https://android.googlesource.com/platform/packages/modules/adb/+/91768a57b7138166e0a3d11f79cd55909dda7014/client/file_sync_client.cpp#1361
|
|
54
|
-
this.#needPushMkdirWorkaround =
|
|
55
|
-
this._adb.canUseFeature(AdbFeature.ShellV2) && !this.fixedPushMkdir;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Gets information of a file or folder.
|
|
59
|
-
*
|
|
60
|
-
* If `path` points to a symbolic link, the returned information is about the link itself (with `type` being `LinuxFileType.Link`).
|
|
61
|
-
*/
|
|
62
|
-
async lstat(path) {
|
|
63
|
-
return await adbSyncLstat(this._socket, path, this.#supportsStat);
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Gets the information of a file or folder.
|
|
67
|
-
*
|
|
68
|
-
* If `path` points to a symbolic link, it will be resolved and the returned information is about the target (with `type` being `LinuxFileType.File` or `LinuxFileType.Directory`).
|
|
69
|
-
*/
|
|
70
|
-
async stat(path) {
|
|
71
|
-
if (!this.#supportsStat) {
|
|
72
|
-
throw new Error("Not supported");
|
|
73
|
-
}
|
|
74
|
-
return await adbSyncStat(this._socket, path);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Checks if `path` is a directory, or a symbolic link to a directory.
|
|
78
|
-
*
|
|
79
|
-
* This uses `lstat` internally, thus works on all Android versions.
|
|
80
|
-
*/
|
|
81
|
-
async isDirectory(path) {
|
|
82
|
-
try {
|
|
83
|
-
await this.lstat(path + "/");
|
|
84
|
-
return true;
|
|
85
|
-
}
|
|
86
|
-
catch {
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
opendir(path) {
|
|
91
|
-
return adbSyncOpenDir(this._socket, path, this.supportsListV2);
|
|
92
|
-
}
|
|
93
|
-
async readdir(path) {
|
|
94
|
-
const results = [];
|
|
95
|
-
for await (const entry of this.opendir(path)) {
|
|
96
|
-
results.push(entry);
|
|
97
|
-
}
|
|
98
|
-
return results;
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Reads the content of a file on device.
|
|
102
|
-
*
|
|
103
|
-
* @param filename The full path of the file on device to read.
|
|
104
|
-
* @returns A `ReadableStream` that contains the file content.
|
|
105
|
-
*/
|
|
106
|
-
read(filename) {
|
|
107
|
-
return adbSyncPull(this._socket, filename);
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Writes a file on device. If the file name already exists, it will be overwritten.
|
|
111
|
-
*
|
|
112
|
-
* @param options The content and options of the file to write.
|
|
113
|
-
*/
|
|
114
|
-
async write(options) {
|
|
115
|
-
if (this.needPushMkdirWorkaround) {
|
|
116
|
-
// It may fail if `filename` already exists.
|
|
117
|
-
// Ignore the result.
|
|
118
|
-
// TODO: sync: test push mkdir workaround (need an Android 8 device)
|
|
119
|
-
await this._adb.subprocess.noneProtocol.spawnWait([
|
|
120
|
-
"mkdir",
|
|
121
|
-
"-p",
|
|
122
|
-
escapeArg(dirname(options.filename)),
|
|
123
|
-
]);
|
|
124
|
-
}
|
|
125
|
-
await adbSyncPush({
|
|
126
|
-
v2: this.supportsSendReceiveV2,
|
|
127
|
-
socket: this._socket,
|
|
128
|
-
...options,
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
lockSocket() {
|
|
132
|
-
return this._socket.lock();
|
|
133
|
-
}
|
|
134
|
-
dispose() {
|
|
135
|
-
return this._socket.close();
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
//# sourceMappingURL=sync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sync.js","sourceRoot":"","sources":["../../../src/commands/sync/sync.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGn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AAW,EAAE,SAAS,CAAC,WAAW,CAAC;YACnC,WAAW,EAAE,SAAS,CAAC,WAAW,CAAC;SACtC,CAAC;IACN,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAAY;QACtB,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;YACZ,MAAM,IAAI,SAAS,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC;QAChD,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;QACnE,IAAI,MAAM,KAAK,gCAAgC,IAAI,IAAI,EAAE,CAAC;YACtD,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,OAAO;QACT,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;QAC1D,IAAI,MAAM,KAAK,0BAA0B,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;QAC5B,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ"}
|
package/esm/daemon/auth.d.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import type { MaybePromiseLike } from "@yume-chan/async";
|
|
2
|
-
import type { Disposable } from "@yume-chan/event";
|
|
3
|
-
import type { AdbPacketData } from "./packet.js";
|
|
4
|
-
export interface AdbPrivateKey {
|
|
5
|
-
/**
|
|
6
|
-
* The private key in PKCS #8 format.
|
|
7
|
-
*/
|
|
8
|
-
buffer: Uint8Array;
|
|
9
|
-
name?: string | undefined;
|
|
10
|
-
}
|
|
11
|
-
export type AdbKeyIterable = Iterable<AdbPrivateKey> | AsyncIterable<AdbPrivateKey>;
|
|
12
|
-
export interface AdbCredentialStore {
|
|
13
|
-
/**
|
|
14
|
-
* Generates and stores a RSA private key with modulus length `2048` and public exponent `65537`.
|
|
15
|
-
*/
|
|
16
|
-
generateKey(): MaybePromiseLike<AdbPrivateKey>;
|
|
17
|
-
/**
|
|
18
|
-
* Synchronously or asynchronously iterates through all stored RSA private keys.
|
|
19
|
-
*
|
|
20
|
-
* Each call to `iterateKeys` must return a different iterator that iterate through all stored keys.
|
|
21
|
-
*/
|
|
22
|
-
iterateKeys(): AdbKeyIterable;
|
|
23
|
-
}
|
|
24
|
-
export declare const AdbAuthType: {
|
|
25
|
-
readonly Token: 1;
|
|
26
|
-
readonly Signature: 2;
|
|
27
|
-
readonly PublicKey: 3;
|
|
28
|
-
};
|
|
29
|
-
export type AdbAuthType = (typeof AdbAuthType)[keyof typeof AdbAuthType];
|
|
30
|
-
export interface AdbAuthenticator {
|
|
31
|
-
/**
|
|
32
|
-
* @param getNextRequest
|
|
33
|
-
*
|
|
34
|
-
* Call this function to get the next authentication request packet from device.
|
|
35
|
-
*
|
|
36
|
-
* After calling `getNextRequest`, authenticator can `yield` a packet as response, or `return` to indicate its incapability of handling the request.
|
|
37
|
-
*
|
|
38
|
-
* After `return`, the `AdbAuthenticatorHandler` will move on to next authenticator and never go back.
|
|
39
|
-
*
|
|
40
|
-
* Calling `getNextRequest` multiple times without `yield` or `return` will always return the same request.
|
|
41
|
-
*/
|
|
42
|
-
(credentialStore: AdbCredentialStore, getNextRequest: () => Promise<AdbPacketData>): AsyncIterable<AdbPacketData>;
|
|
43
|
-
}
|
|
44
|
-
export declare const AdbSignatureAuthenticator: AdbAuthenticator;
|
|
45
|
-
export declare const AdbPublicKeyAuthenticator: AdbAuthenticator;
|
|
46
|
-
export declare const ADB_DEFAULT_AUTHENTICATORS: readonly AdbAuthenticator[];
|
|
47
|
-
export declare class AdbAuthenticationProcessor implements Disposable {
|
|
48
|
-
#private;
|
|
49
|
-
readonly authenticators: readonly AdbAuthenticator[];
|
|
50
|
-
constructor(authenticators: readonly AdbAuthenticator[], credentialStore: AdbCredentialStore);
|
|
51
|
-
process(packet: AdbPacketData): Promise<AdbPacketData>;
|
|
52
|
-
dispose(): void;
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=auth.d.ts.map
|
package/esm/daemon/auth.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/daemon/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAcnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,MAAM,EAAE,UAAU,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B;AAED,MAAM,MAAM,cAAc,GACpB,QAAQ,CAAC,aAAa,CAAC,GACvB,aAAa,CAAC,aAAa,CAAC,CAAC;AAEnC,MAAM,WAAW,kBAAkB;IAC/B;;OAEG;IACH,WAAW,IAAI,gBAAgB,CAAC,aAAa,CAAC,CAAC;IAE/C;;;;OAIG;IACH,WAAW,IAAI,cAAc,CAAC;CACjC;AAED,eAAO,MAAM,WAAW;;;;CAId,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAEzE,MAAM,WAAW,gBAAgB;IAC7B;;;;;;;;;;OAUG;IACH,CACI,eAAe,EAAE,kBAAkB,EACnC,cAAc,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,GAC7C,aAAa,CAAC,aAAa,CAAC,CAAC;CACnC;AAED,eAAO,MAAM,yBAAyB,EAAE,gBAmBvC,CAAC;AAEF,eAAO,MAAM,yBAAyB,EAAE,gBA+CvC,CAAC;AAEF,eAAO,MAAM,0BAA0B,EAAE,SAAS,gBAAgB,EAGjE,CAAC;AAEF,qBAAa,0BAA2B,YAAW,UAAU;;IACzD,QAAQ,CAAC,cAAc,EAAE,SAAS,gBAAgB,EAAE,CAAC;gBAQjD,cAAc,EAAE,SAAS,gBAAgB,EAAE,EAC3C,eAAe,EAAE,kBAAkB;IA6BjC,OAAO,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;IAe5D,OAAO;CAGV"}
|
package/esm/daemon/auth.js
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { PromiseResolver } from "@yume-chan/async";
|
|
2
|
-
import { EmptyUint8Array } from "@yume-chan/struct";
|
|
3
|
-
import { calculateBase64EncodedLength, encodeBase64, encodeUtf8, } from "../utils/index.js";
|
|
4
|
-
import { adbGeneratePublicKey, adbGetPublicKeySize, rsaSign, } from "./crypto.js";
|
|
5
|
-
import { AdbCommand } from "./packet.js";
|
|
6
|
-
export const AdbAuthType = {
|
|
7
|
-
Token: 1,
|
|
8
|
-
Signature: 2,
|
|
9
|
-
PublicKey: 3,
|
|
10
|
-
};
|
|
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 = rsaSign(key.buffer, packet.payload);
|
|
18
|
-
yield {
|
|
19
|
-
command: AdbCommand.Auth,
|
|
20
|
-
arg0: AdbAuthType.Signature,
|
|
21
|
-
arg1: 0,
|
|
22
|
-
payload: 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 = adbGetPublicKeySize();
|
|
40
|
-
const [publicKeyBase64Length] = calculateBase64EncodedLength(publicKeyLength);
|
|
41
|
-
const nameBuffer = privateKey.name?.length
|
|
42
|
-
? encodeUtf8(privateKey.name)
|
|
43
|
-
: EmptyUint8Array;
|
|
44
|
-
const publicKeyBuffer = new Uint8Array(publicKeyBase64Length +
|
|
45
|
-
(nameBuffer.length ? nameBuffer.length + 1 : 0) + // Space character + name
|
|
46
|
-
1);
|
|
47
|
-
adbGeneratePublicKey(privateKey.buffer, publicKeyBuffer);
|
|
48
|
-
encodeBase64(publicKeyBuffer.subarray(0, publicKeyLength), publicKeyBuffer);
|
|
49
|
-
if (nameBuffer.length) {
|
|
50
|
-
publicKeyBuffer[publicKeyBase64Length] = 0x20;
|
|
51
|
-
publicKeyBuffer.set(nameBuffer, publicKeyBase64Length + 1);
|
|
52
|
-
}
|
|
53
|
-
yield {
|
|
54
|
-
command: AdbCommand.Auth,
|
|
55
|
-
arg0: AdbAuthType.PublicKey,
|
|
56
|
-
arg1: 0,
|
|
57
|
-
payload: publicKeyBuffer,
|
|
58
|
-
};
|
|
59
|
-
};
|
|
60
|
-
export const ADB_DEFAULT_AUTHENTICATORS = [
|
|
61
|
-
AdbSignatureAuthenticator,
|
|
62
|
-
AdbPublicKeyAuthenticator,
|
|
63
|
-
];
|
|
64
|
-
export class AdbAuthenticationProcessor {
|
|
65
|
-
authenticators;
|
|
66
|
-
#credentialStore;
|
|
67
|
-
#pendingRequest = new PromiseResolver();
|
|
68
|
-
#iterator;
|
|
69
|
-
constructor(authenticators, credentialStore) {
|
|
70
|
-
this.authenticators = authenticators;
|
|
71
|
-
this.#credentialStore = credentialStore;
|
|
72
|
-
}
|
|
73
|
-
#getNextRequest = () => {
|
|
74
|
-
return this.#pendingRequest.promise;
|
|
75
|
-
};
|
|
76
|
-
async *#invokeAuthenticator() {
|
|
77
|
-
for (const authenticator of this.authenticators) {
|
|
78
|
-
for await (const packet of authenticator(this.#credentialStore, this.#getNextRequest)) {
|
|
79
|
-
// If the authenticator yielded a response
|
|
80
|
-
// Prepare `nextRequest` for next authentication request
|
|
81
|
-
this.#pendingRequest = new PromiseResolver();
|
|
82
|
-
// Yield the response to outer layer
|
|
83
|
-
yield packet;
|
|
84
|
-
}
|
|
85
|
-
// If the authenticator returned,
|
|
86
|
-
// Next authenticator will be given the same `pendingRequest`
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
async process(packet) {
|
|
90
|
-
if (!this.#iterator) {
|
|
91
|
-
this.#iterator = this.#invokeAuthenticator();
|
|
92
|
-
}
|
|
93
|
-
this.#pendingRequest.resolve(packet);
|
|
94
|
-
const result = await this.#iterator.next();
|
|
95
|
-
if (result.done) {
|
|
96
|
-
throw new Error("No authenticator can handle the request");
|
|
97
|
-
}
|
|
98
|
-
return result.value;
|
|
99
|
-
}
|
|
100
|
-
dispose() {
|
|
101
|
-
void this.#iterator?.return?.();
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
//# sourceMappingURL=auth.js.map
|
package/esm/daemon/auth.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/daemon/auth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EACH,4BAA4B,EAC5B,YAAY,EACZ,UAAU,GACb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACH,oBAAoB,EACpB,mBAAmB,EACnB,OAAO,GACV,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA4BzC,MAAM,CA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|
|
4
|
-
|
|
5
|
-
export class AdbServiceBase extends AutoDisposable {
|
|
6
|
-
readonly #adb: Adb;
|
|
7
|
-
get adb() {
|
|
8
|
-
return this.#adb;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
constructor(adb: Adb) {
|
|
12
|
-
super();
|
|
13
|
-
this.#adb = adb;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { Adb } from "../../../adb.js";
|
|
2
|
-
|
|
3
|
-
import { AdbNoneProtocolProcessImpl } from "./process.js";
|
|
4
|
-
import { AdbNoneProtocolPtyProcess } from "./pty.js";
|
|
5
|
-
import { AdbNoneProtocolSpawner } from "./spawner.js";
|
|
6
|
-
|
|
7
|
-
export class AdbNoneProtocolSubprocessService extends AdbNoneProtocolSpawner {
|
|
8
|
-
readonly #adb: Adb;
|
|
9
|
-
get adb(): Adb {
|
|
10
|
-
return this.#adb;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
constructor(adb: Adb) {
|
|
14
|
-
super(async (command, signal) => {
|
|
15
|
-
// `shell,raw:${command}` also triggers raw mode,
|
|
16
|
-
// But is not supported on Android version <7.
|
|
17
|
-
const socket = await this.#adb.createSocket(
|
|
18
|
-
`exec:${command.join(" ")}`,
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
if (signal?.aborted) {
|
|
22
|
-
await socket.close();
|
|
23
|
-
throw signal.reason;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return new AdbNoneProtocolProcessImpl(socket, signal);
|
|
27
|
-
});
|
|
28
|
-
this.#adb = adb;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
async pty(
|
|
32
|
-
command?: string | readonly string[],
|
|
33
|
-
): Promise<AdbNoneProtocolPtyProcess> {
|
|
34
|
-
if (command === undefined) {
|
|
35
|
-
command = "";
|
|
36
|
-
} else if (Array.isArray(command)) {
|
|
37
|
-
command = command.join(" ");
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return new AdbNoneProtocolPtyProcess(
|
|
41
|
-
// https://github.com/microsoft/typescript/issues/17002
|
|
42
|
-
await this.#adb.createSocket(`shell:${command as string}`),
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import type { MaybePromiseLike } from "@yume-chan/async";
|
|
2
|
-
import type {
|
|
3
|
-
AbortSignal,
|
|
4
|
-
MaybeConsumable,
|
|
5
|
-
ReadableStream,
|
|
6
|
-
WritableStream,
|
|
7
|
-
} from "@yume-chan/stream-extra";
|
|
8
|
-
import {
|
|
9
|
-
ConcatBufferStream,
|
|
10
|
-
ConcatStringStream,
|
|
11
|
-
TextDecoderStream,
|
|
12
|
-
} from "@yume-chan/stream-extra";
|
|
13
|
-
|
|
14
|
-
import { splitCommand } from "../utils.js";
|
|
15
|
-
|
|
16
|
-
export interface AdbNoneProtocolProcess {
|
|
17
|
-
get stdin(): WritableStream<MaybeConsumable<Uint8Array>>;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Mix of stdout and stderr
|
|
21
|
-
*/
|
|
22
|
-
get output(): ReadableStream<Uint8Array>;
|
|
23
|
-
|
|
24
|
-
get exited(): Promise<void>;
|
|
25
|
-
|
|
26
|
-
kill(): MaybePromiseLike<void>;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export class AdbNoneProtocolSpawner {
|
|
30
|
-
readonly #spawn: (
|
|
31
|
-
command: readonly string[],
|
|
32
|
-
signal: AbortSignal | undefined,
|
|
33
|
-
) => Promise<AdbNoneProtocolProcess>;
|
|
34
|
-
|
|
35
|
-
constructor(
|
|
36
|
-
spawn: (
|
|
37
|
-
command: readonly string[],
|
|
38
|
-
signal: AbortSignal | undefined,
|
|
39
|
-
) => Promise<AdbNoneProtocolProcess>,
|
|
40
|
-
) {
|
|
41
|
-
this.#spawn = spawn;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
spawn(
|
|
45
|
-
command: string | readonly string[],
|
|
46
|
-
signal?: AbortSignal,
|
|
47
|
-
): Promise<AdbNoneProtocolProcess> {
|
|
48
|
-
signal?.throwIfAborted();
|
|
49
|
-
|
|
50
|
-
if (typeof command === "string") {
|
|
51
|
-
command = splitCommand(command);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return this.#spawn(command, signal);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async spawnWait(command: string | readonly string[]): Promise<Uint8Array> {
|
|
58
|
-
const process = await this.spawn(command);
|
|
59
|
-
return await process.output.pipeThrough(new ConcatBufferStream());
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
async spawnWaitText(command: string | readonly string[]): Promise<string> {
|
|
63
|
-
const process = await this.spawn(command);
|
|
64
|
-
return await process.output
|
|
65
|
-
.pipeThrough(new TextDecoderStream())
|
|
66
|
-
.pipeThrough(new ConcatStringStream());
|
|
67
|
-
}
|
|
68
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import type { Adb } from "../../../adb.js";
|
|
2
|
-
import { AdbFeature } from "../../../features.js";
|
|
3
|
-
|
|
4
|
-
import { AdbShellProtocolProcessImpl } from "./process.js";
|
|
5
|
-
import { AdbShellProtocolPtyProcess } from "./pty.js";
|
|
6
|
-
import { AdbShellProtocolSpawner } from "./spawner.js";
|
|
7
|
-
|
|
8
|
-
export class AdbShellProtocolSubprocessService extends AdbShellProtocolSpawner {
|
|
9
|
-
readonly #adb: Adb;
|
|
10
|
-
get adb() {
|
|
11
|
-
return this.#adb;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
get isSupported() {
|
|
15
|
-
return this.#adb.canUseFeature(AdbFeature.ShellV2);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
constructor(adb: Adb) {
|
|
19
|
-
super(async (command, signal) => {
|
|
20
|
-
const socket = await this.#adb.createSocket(
|
|
21
|
-
`shell,v2,raw:${command.join(" ")}`,
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
if (signal?.aborted) {
|
|
25
|
-
await socket.close();
|
|
26
|
-
throw signal.reason;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return new AdbShellProtocolProcessImpl(socket, signal);
|
|
30
|
-
});
|
|
31
|
-
this.#adb = adb;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
async pty(options?: {
|
|
35
|
-
command?: string | readonly string[] | undefined;
|
|
36
|
-
terminalType?: string;
|
|
37
|
-
}): Promise<AdbShellProtocolPtyProcess> {
|
|
38
|
-
let service = "shell,v2,pty";
|
|
39
|
-
|
|
40
|
-
if (options?.terminalType) {
|
|
41
|
-
service += `,TERM=` + options.terminalType;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
service += ":";
|
|
45
|
-
|
|
46
|
-
if (options) {
|
|
47
|
-
if (typeof options.command === "string") {
|
|
48
|
-
service += options.command;
|
|
49
|
-
} else if (Array.isArray(options.command)) {
|
|
50
|
-
service += options.command.join(" ");
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return new AdbShellProtocolPtyProcess(
|
|
55
|
-
await this.#adb.createSocket(service),
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import type { MaybePromiseLike } from "@yume-chan/async";
|
|
2
|
-
import type {
|
|
3
|
-
AbortSignal,
|
|
4
|
-
MaybeConsumable,
|
|
5
|
-
ReadableStream,
|
|
6
|
-
WritableStream,
|
|
7
|
-
} from "@yume-chan/stream-extra";
|
|
8
|
-
import {
|
|
9
|
-
ConcatBufferStream,
|
|
10
|
-
ConcatStringStream,
|
|
11
|
-
TextDecoderStream,
|
|
12
|
-
} from "@yume-chan/stream-extra";
|
|
13
|
-
|
|
14
|
-
import { splitCommand } from "../utils.js";
|
|
15
|
-
|
|
16
|
-
export interface AdbShellProtocolProcess {
|
|
17
|
-
get stdin(): WritableStream<MaybeConsumable<Uint8Array>>;
|
|
18
|
-
|
|
19
|
-
get stdout(): ReadableStream<Uint8Array>;
|
|
20
|
-
get stderr(): ReadableStream<Uint8Array>;
|
|
21
|
-
|
|
22
|
-
get exited(): Promise<number>;
|
|
23
|
-
|
|
24
|
-
kill(): MaybePromiseLike<void>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export class AdbShellProtocolSpawner {
|
|
28
|
-
readonly #spawn: (
|
|
29
|
-
command: readonly string[],
|
|
30
|
-
signal: AbortSignal | undefined,
|
|
31
|
-
) => Promise<AdbShellProtocolProcess>;
|
|
32
|
-
|
|
33
|
-
constructor(
|
|
34
|
-
spawn: (
|
|
35
|
-
command: readonly string[],
|
|
36
|
-
signal: AbortSignal | undefined,
|
|
37
|
-
) => Promise<AdbShellProtocolProcess>,
|
|
38
|
-
) {
|
|
39
|
-
this.#spawn = spawn;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
spawn(
|
|
43
|
-
command: string | readonly string[],
|
|
44
|
-
signal?: AbortSignal,
|
|
45
|
-
): Promise<AdbShellProtocolProcess> {
|
|
46
|
-
signal?.throwIfAborted();
|
|
47
|
-
|
|
48
|
-
if (typeof command === "string") {
|
|
49
|
-
command = splitCommand(command);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return this.#spawn(command, signal);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
async spawnWait(
|
|
56
|
-
command: string | readonly string[],
|
|
57
|
-
): Promise<AdbShellProtocolSpawner.WaitResult<Uint8Array>> {
|
|
58
|
-
const process = await this.spawn(command);
|
|
59
|
-
const [stdout, stderr, exitCode] = await Promise.all([
|
|
60
|
-
process.stdout.pipeThrough(new ConcatBufferStream()),
|
|
61
|
-
process.stderr.pipeThrough(new ConcatBufferStream()),
|
|
62
|
-
process.exited,
|
|
63
|
-
]);
|
|
64
|
-
return { stdout, stderr, exitCode };
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
async spawnWaitText(
|
|
68
|
-
command: string | readonly string[],
|
|
69
|
-
): Promise<AdbShellProtocolSpawner.WaitResult<string>> {
|
|
70
|
-
const process = await this.spawn(command);
|
|
71
|
-
const [stdout, stderr, exitCode] = await Promise.all([
|
|
72
|
-
process.stdout
|
|
73
|
-
.pipeThrough(new TextDecoderStream())
|
|
74
|
-
.pipeThrough(new ConcatStringStream()),
|
|
75
|
-
process.stderr
|
|
76
|
-
.pipeThrough(new TextDecoderStream())
|
|
77
|
-
.pipeThrough(new ConcatStringStream()),
|
|
78
|
-
process.exited,
|
|
79
|
-
]);
|
|
80
|
-
return { stdout, stderr, exitCode };
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export namespace AdbShellProtocolSpawner {
|
|
85
|
-
export interface WaitResult<T> {
|
|
86
|
-
stdout: T;
|
|
87
|
-
stderr: T;
|
|
88
|
-
exitCode: number;
|
|
89
|
-
}
|
|
90
|
-
}
|