mirror of
https://github.com/yume-chan/ya-webadb.git
synced 2025-10-02 17:29:17 +02:00
feat(scrcpy): add client version 3.3.2 (#799)
This commit is contained in:
parent
29de3e4842
commit
b2512856be
31 changed files with 397 additions and 302 deletions
|
@ -41,7 +41,7 @@
|
|||
"source-map-support": "^0.5.21"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.3.0",
|
||||
"@types/node": "^24.3.1",
|
||||
"@yume-chan/eslint-config": "workspace:^",
|
||||
"@yume-chan/tsconfig": "workspace:^",
|
||||
"prettier": "^3.6.2",
|
||||
|
|
|
@ -32,14 +32,14 @@
|
|||
"test": "run-test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/w3c-web-usb": "^1.0.10",
|
||||
"@types/w3c-web-usb": "^1.0.12",
|
||||
"@yume-chan/adb": "workspace:^",
|
||||
"@yume-chan/event": "workspace:^",
|
||||
"@yume-chan/stream-extra": "workspace:^",
|
||||
"@yume-chan/struct": "workspace:^"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.3.0",
|
||||
"@types/node": "^24.3.1",
|
||||
"@yume-chan/eslint-config": "workspace:^",
|
||||
"@yume-chan/test-runner": "workspace:^",
|
||||
"@yume-chan/tsconfig": "workspace:^",
|
||||
|
|
|
@ -6,6 +6,7 @@ import type {
|
|||
import {
|
||||
AdbPacketHeader,
|
||||
AdbPacketSerializeStream,
|
||||
toLocalUint8Array,
|
||||
unreachable,
|
||||
} from "@yume-chan/adb";
|
||||
import type {
|
||||
|
@ -154,9 +155,9 @@ export class AdbDaemonWebUsbConnection
|
|||
|
||||
await device.raw.transferOut(
|
||||
outEndpoint.endpointNumber,
|
||||
// Already checked `chunk` has a non-shared ArrayBuffer
|
||||
// WebUSB doesn't support SharedArrayBuffer
|
||||
// https://github.com/WICG/webusb/issues/243
|
||||
chunk as Uint8Array<ArrayBuffer>,
|
||||
toLocalUint8Array(chunk),
|
||||
);
|
||||
|
||||
// In USB protocol, a not-full packet indicates the end of a transfer.
|
||||
|
|
|
@ -17,8 +17,10 @@ class MockUsb implements USB {
|
|||
serialNumber: options?.filters?.[0]?.serialNumber ?? "abcdefgh",
|
||||
vendorId: options?.filters?.[0]?.vendorId ?? 0x18d1,
|
||||
productId: options?.filters?.[0]?.productId ?? 0x4e49,
|
||||
configuration: null,
|
||||
configurations: [
|
||||
{
|
||||
configurationName: null,
|
||||
configurationValue: 1,
|
||||
interfaces: [
|
||||
{
|
||||
|
@ -30,6 +32,7 @@ class MockUsb implements USB {
|
|||
AdbDefaultInterfaceFilter.classCode,
|
||||
interfaceSubclass:
|
||||
AdbDefaultInterfaceFilter.subclassCode,
|
||||
interfaceName: null,
|
||||
interfaceProtocol:
|
||||
AdbDefaultInterfaceFilter.protocolCode,
|
||||
endpoints: [],
|
||||
|
@ -41,6 +44,7 @@ class MockUsb implements USB {
|
|||
AdbDefaultInterfaceFilter.classCode,
|
||||
interfaceSubclass:
|
||||
AdbDefaultInterfaceFilter.subclassCode,
|
||||
interfaceName: null,
|
||||
interfaceProtocol:
|
||||
AdbDefaultInterfaceFilter.protocolCode,
|
||||
endpoints: [],
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
# Change Log - @yume-chan/adb-scrcpy
|
||||
|
||||
## 2.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- f34724f: Add support for Scrcpy server version 3.3.2 (no protocol changes)
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Updated dependencies [f34724f]
|
||||
- @yume-chan/scrcpy@2.2.0
|
||||
|
||||
## 2.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@yume-chan/adb-scrcpy",
|
||||
"version": "2.1.1",
|
||||
"version": "2.2.0",
|
||||
"description": "Use `@yume-chan/adb` to bootstrap `@yume-chan/scrcpy`.",
|
||||
"keywords": [
|
||||
"adb",
|
||||
|
@ -42,7 +42,7 @@
|
|||
"@yume-chan/struct": "workspace:^"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.3.0",
|
||||
"@types/node": "^24.3.1",
|
||||
"@yume-chan/eslint-config": "workspace:^",
|
||||
"@yume-chan/test-runner": "workspace:^",
|
||||
"@yume-chan/tsconfig": "workspace:^",
|
||||
|
|
50
libraries/adb-scrcpy/src/3_3_2.ts
Normal file
50
libraries/adb-scrcpy/src/3_3_2.ts
Normal file
|
@ -0,0 +1,50 @@
|
|||
import type { Adb, AdbNoneProtocolSpawner } from "@yume-chan/adb";
|
||||
import type { ScrcpyDisplay, ScrcpyEncoder } from "@yume-chan/scrcpy";
|
||||
import { ScrcpyOptions3_3_2 } from "@yume-chan/scrcpy";
|
||||
|
||||
import {
|
||||
createConnection,
|
||||
getDisplays,
|
||||
getEncoders,
|
||||
} from "./2_1/impl/index.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
import type { AdbScrcpyConnection } from "./connection.js";
|
||||
import type { AdbScrcpyOptions, AdbScrcpyOptionsGetEncoders } from "./types.js";
|
||||
|
||||
export class AdbScrcpyOptions3_3_2<TVideo extends boolean>
|
||||
extends ScrcpyOptions3_3_2<TVideo>
|
||||
implements
|
||||
AdbScrcpyOptions<ScrcpyOptions3_3_2.Init<TVideo>>,
|
||||
AdbScrcpyOptionsGetEncoders
|
||||
{
|
||||
readonly version: string;
|
||||
|
||||
readonly spawner: AdbNoneProtocolSpawner | undefined;
|
||||
|
||||
constructor(
|
||||
init: ScrcpyOptions3_3_2.Init<TVideo>,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(init);
|
||||
|
||||
this.version = clientOptions?.version ?? "3.3.1";
|
||||
this.spawner = clientOptions?.spawner;
|
||||
}
|
||||
|
||||
getEncoders(adb: Adb, path: string): Promise<ScrcpyEncoder[]> {
|
||||
return getEncoders(adb, path, this);
|
||||
}
|
||||
|
||||
getDisplays(adb: Adb, path: string): Promise<ScrcpyDisplay[]> {
|
||||
return getDisplays(adb, path, this);
|
||||
}
|
||||
|
||||
createConnection(adb: Adb): AdbScrcpyConnection {
|
||||
return createConnection(adb, this.value);
|
||||
}
|
||||
}
|
||||
|
||||
export namespace AdbScrcpyOptions3_3_2 {
|
||||
export type Init<TVideo extends boolean = boolean> =
|
||||
ScrcpyOptions3_3_2.Init<TVideo>;
|
||||
}
|
|
@ -25,6 +25,7 @@ export * from "./3_1.js";
|
|||
export * from "./3_2.js";
|
||||
export * from "./3_3.js";
|
||||
export * from "./3_3_1.js";
|
||||
export * from "./3_3_2.js";
|
||||
export * from "./client-options.js";
|
||||
export * from "./client.js";
|
||||
export * from "./connection.js";
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { AdbScrcpyOptions3_3_1 } from "./3_3_1.js";
|
||||
import { AdbScrcpyOptions3_3_2 } from "./3_3_2.js";
|
||||
import type { AdbScrcpyClientOptions } from "./client-options.js";
|
||||
|
||||
export class AdbScrcpyOptionsLatest<
|
||||
TVideo extends boolean,
|
||||
> extends AdbScrcpyOptions3_3_1<TVideo> {
|
||||
> extends AdbScrcpyOptions3_3_2<TVideo> {
|
||||
constructor(
|
||||
init: AdbScrcpyOptions3_3_1.Init<TVideo>,
|
||||
init: AdbScrcpyOptions3_3_2.Init<TVideo>,
|
||||
clientOptions?: AdbScrcpyClientOptions,
|
||||
) {
|
||||
super(init, clientOptions);
|
||||
|
@ -14,5 +14,5 @@ export class AdbScrcpyOptionsLatest<
|
|||
|
||||
export namespace AdbScrcpyOptionsLatest {
|
||||
export type Init<TVideo extends boolean = boolean> =
|
||||
AdbScrcpyOptions3_3_1.Init<TVideo>;
|
||||
AdbScrcpyOptions3_3_2.Init<TVideo>;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
"@yume-chan/struct": "workspace:^"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.3.0",
|
||||
"@types/node": "^24.3.1",
|
||||
"@yume-chan/eslint-config": "workspace:^",
|
||||
"@yume-chan/tsconfig": "workspace:^",
|
||||
"prettier": "^3.6.2",
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
"@yume-chan/struct": "workspace:^"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.3.0",
|
||||
"@types/node": "^24.3.1",
|
||||
"@yume-chan/eslint-config": "workspace:^",
|
||||
"@yume-chan/test-runner": "workspace:^",
|
||||
"@yume-chan/tsconfig": "workspace:^",
|
||||
|
|
9
libraries/adb/src/utils/array-buffer.ts
Normal file
9
libraries/adb/src/utils/array-buffer.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
export function toLocalUint8Array(value: Uint8Array): Uint8Array<ArrayBuffer> {
|
||||
if (value.buffer instanceof ArrayBuffer) {
|
||||
return value as Uint8Array<ArrayBuffer>;
|
||||
}
|
||||
|
||||
const copy = new Uint8Array(value.length);
|
||||
copy.set(value);
|
||||
return copy;
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
export { decodeUtf8, encodeUtf8 } from "@yume-chan/struct";
|
||||
export * from "./array-buffer.js";
|
||||
export * from "./auto-reset-event.js";
|
||||
export * from "./base64.js";
|
||||
export * from "./hex.js";
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
"@yume-chan/struct": "workspace:^"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.3.0",
|
||||
"@types/node": "^24.3.1",
|
||||
"@yume-chan/eslint-config": "workspace:^",
|
||||
"@yume-chan/test-runner": "workspace:^",
|
||||
"@yume-chan/tsconfig": "workspace:^",
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/w3c-web-usb": "^1.0.10"
|
||||
"@types/w3c-web-usb": "^1.0.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@yume-chan/eslint-config": "workspace:^",
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
"@yume-chan/async": "^4.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.3.0",
|
||||
"@types/node": "^24.3.1",
|
||||
"@yume-chan/eslint-config": "workspace:^",
|
||||
"@yume-chan/test-runner": "workspace:^",
|
||||
"@yume-chan/tsconfig": "workspace:^",
|
||||
|
|
|
@ -31,6 +31,6 @@
|
|||
"gh-release-fetch": "^4.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.3.0"
|
||||
"@types/node": "^24.3.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,12 +30,12 @@
|
|||
"test": "run-test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.3.0",
|
||||
"@types/node": "^24.3.1",
|
||||
"@yume-chan/eslint-config": "workspace:^",
|
||||
"@yume-chan/test-runner": "workspace:^",
|
||||
"@yume-chan/tsconfig": "workspace:^",
|
||||
"prettier": "^3.6.2",
|
||||
"tinybench": "^5.0.0",
|
||||
"tinybench": "^5.0.1",
|
||||
"typescript": "^5.9.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/audioworklet": "^0.0.82",
|
||||
"@types/audioworklet": "^0.0.83",
|
||||
"@yume-chan/eslint-config": "workspace:^",
|
||||
"@yume-chan/tsconfig": "workspace:^",
|
||||
"prettier": "^3.6.2",
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
# Change Log - @yume-chan/scrcpy
|
||||
|
||||
## 2.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- f34724f: Add support for Scrcpy server version 3.3.2 (no protocol changes)
|
||||
|
||||
## 2.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@yume-chan/scrcpy",
|
||||
"version": "2.1.1",
|
||||
"version": "2.2.0",
|
||||
"description": "TypeScript implementation of Scrcpy client.",
|
||||
"keywords": [
|
||||
"adb",
|
||||
|
@ -40,7 +40,7 @@
|
|||
"@yume-chan/struct": "workspace:^"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.3.0",
|
||||
"@types/node": "^24.3.1",
|
||||
"@yume-chan/eslint-config": "workspace:^",
|
||||
"@yume-chan/test-runner": "workspace:^",
|
||||
"@yume-chan/tsconfig": "workspace:^",
|
||||
|
|
14
libraries/scrcpy/src/3_3_2.ts
Normal file
14
libraries/scrcpy/src/3_3_2.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { ScrcpyOptions3_3_1 } from "./3_3_1/index.js";
|
||||
|
||||
export class ScrcpyOptions3_3_2<
|
||||
TVideo extends boolean,
|
||||
> extends ScrcpyOptions3_3_1<TVideo> {
|
||||
constructor(init: ScrcpyOptions3_3_1.Init<TVideo>) {
|
||||
super(init);
|
||||
}
|
||||
}
|
||||
|
||||
export namespace ScrcpyOptions3_3_2 {
|
||||
export type Init<TVideo extends boolean = boolean> =
|
||||
ScrcpyOptions3_3_1.Init<TVideo>;
|
||||
}
|
|
@ -28,6 +28,7 @@ export * from "./3_1/index.js";
|
|||
export * from "./3_2/index.js";
|
||||
export * from "./3_3.js";
|
||||
export * from "./3_3_1/index.js";
|
||||
export * from "./3_3_2.js";
|
||||
export * from "./android/index.js";
|
||||
export * from "./base/index.js";
|
||||
export * from "./control/index.js";
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import { ScrcpyOptions3_3_1 } from "./3_3_1/index.js";
|
||||
import { ScrcpyOptions3_3_2 } from "./3_3_2.js";
|
||||
|
||||
export class ScrcpyOptionsLatest<
|
||||
TVideo extends boolean,
|
||||
> extends ScrcpyOptions3_3_1<TVideo> {
|
||||
constructor(init: ScrcpyOptions3_3_1.Init<TVideo>) {
|
||||
> extends ScrcpyOptions3_3_2<TVideo> {
|
||||
constructor(init: ScrcpyOptions3_3_2.Init<TVideo>) {
|
||||
super(init);
|
||||
}
|
||||
}
|
||||
|
||||
export namespace ScrcpyOptionsLatest {
|
||||
export type Init<TVideo extends boolean = boolean> =
|
||||
ScrcpyOptions3_3_1.Init<TVideo>;
|
||||
ScrcpyOptions3_3_2.Init<TVideo>;
|
||||
}
|
||||
|
||||
export {
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
"@yume-chan/struct": "workspace:^"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.3.0",
|
||||
"@types/node": "^24.3.1",
|
||||
"@yume-chan/eslint-config": "workspace:^",
|
||||
"@yume-chan/test-runner": "workspace:^",
|
||||
"@yume-chan/tsconfig": "workspace:^",
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
"@yume-chan/no-data-view": "workspace:^"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.3.0",
|
||||
"@types/node": "^24.3.1",
|
||||
"@yume-chan/eslint-config": "workspace:^",
|
||||
"@yume-chan/test-runner": "workspace:^",
|
||||
"@yume-chan/tsconfig": "workspace:^",
|
||||
|
|
531
pnpm-lock.yaml
generated
531
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load diff
|
@ -8,12 +8,12 @@
|
|||
"run-eslint": "run-eslint.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@eslint/js": "^9.33.0",
|
||||
"@types/node": "^24.3.0",
|
||||
"eslint": "^9.33.0",
|
||||
"@eslint/js": "^9.35.0",
|
||||
"@types/node": "^24.3.1",
|
||||
"eslint": "^9.35.0",
|
||||
"eslint-plugin-import-x": "^4.16.1",
|
||||
"typescript": "^5.9.2",
|
||||
"typescript-eslint": "^8.40.0"
|
||||
"typescript-eslint": "^8.43.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"prettier": "^3.6.2"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"scripts": {},
|
||||
"keywords": [],
|
||||
"dependencies": {
|
||||
"@types/node": "^24.3.0",
|
||||
"@types/node": "^24.3.1",
|
||||
"json5": "^2.2.3"
|
||||
},
|
||||
"author": "",
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
"@rollup/plugin-node-resolve": "^16.0.1",
|
||||
"@rollup/plugin-terser": "^0.4.4",
|
||||
"@rollup/plugin-typescript": "^12.1.4",
|
||||
"rollup": "^4.47.0",
|
||||
"rollup": "^4.50.1",
|
||||
"tslib": "^2.8.1"
|
||||
},
|
||||
"dependencies": {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"run-test": "wrapper.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.3.0",
|
||||
"@types/node": "^24.3.1",
|
||||
"typescript": "^5.9.2"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue