Skip to content

Commit

Permalink
Improve compatibility of device scanning
Browse files Browse the repository at this point in the history
Previously this worked on Linux, but seems to be rejected by Mac without
this change, despite the public docs I can see saying the opposite.
  • Loading branch information
pimterry committed Jun 14, 2024
1 parent a1a1352 commit 1acf896
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function plistSerialize(value: any) {
const plistBuffer = Buffer.from(plistString, 'utf8');

const length = 16 + plistBuffer.byteLength; // Header always 16 bytes
const version = 0; // Also called 'reserved'? Always 0
const version = 1; // Also called 'reserved' - some docs say 0, but only 1 seems to work
const messageType = 8; // 8 is 'plist' message type
const tag = 1; // Echoed in responses, not used for now

Expand Down
2 changes: 1 addition & 1 deletion test/unit-tests.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { delay } from '@httptoolkit/util';

// Various Base64 encoded messages we expect or use as test data:
const MESSAGES = {
LISTEN_REQUEST: "hwEAAAAAAAAIAAAAAQAAADw/eG1sIHZlcnNpb249IjEuMCIgZW5jb2Rpbmc9IlVURi04Ij8+CjwhRE9DVFlQRSBwbGlzdCBQVUJMSUMgIi0vL0FwcGxlLy9EVEQgUExJU1QgMS4wLy9FTiIgImh0dHA6Ly93d3cuYXBwbGUuY29tL0RURHMvUHJvcGVydHlMaXN0LTEuMC5kdGQiPgo8cGxpc3QgdmVyc2lvbj0iMS4wIj4KICA8ZGljdD4KICAgIDxrZXk+TWVzc2FnZVR5cGU8L2tleT4KICAgIDxzdHJpbmc+TGlzdGVuPC9zdHJpbmc+CiAgICA8a2V5PkNsaWVudFZlcnNpb25TdHJpbmc8L2tleT4KICAgIDxzdHJpbmc+dXNibXV4LWNsaWVudDwvc3RyaW5nPgogICAgPGtleT5Qcm9nTmFtZTwva2V5PgogICAgPHN0cmluZz51c2JtdXgtY2xpZW50PC9zdHJpbmc+CiAgPC9kaWN0Pgo8L3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