mirror of
https://gitlab.com/futo-org/fcast.git
synced 2025-08-15 20:02:49 +00:00
webOS: Revert packet endianess workaround since webpack uses correct nodejs version
This commit is contained in:
parent
8a1d8afe6a
commit
144c3e17f5
1 changed files with 1 additions and 25 deletions
|
@ -61,31 +61,7 @@ export class FCastSession {
|
|||
|
||||
const size = 1 + data.length;
|
||||
const header = Buffer.alloc(4 + 1);
|
||||
|
||||
// webOS 22 and earlier node versions do not support `writeUint32LE`,
|
||||
// so manually checking endianness and writing as LE
|
||||
// @ts-ignore
|
||||
if (TARGET === 'webOS') {
|
||||
let uInt32 = new Uint32Array([0x11223344]);
|
||||
let uInt8 = new Uint8Array(uInt32.buffer);
|
||||
|
||||
if(uInt8[0] === 0x44) {
|
||||
// LE
|
||||
header[0] = size & 0xFF;
|
||||
header[1] = size & 0xFF00;
|
||||
header[2] = size & 0xFF0000;
|
||||
header[3] = size & 0xFF000000;
|
||||
} else if (uInt8[0] === 0x11) {
|
||||
// BE
|
||||
header[0] = size & 0xFF000000;
|
||||
header[1] = size & 0xFF0000;
|
||||
header[2] = size & 0xFF00;
|
||||
header[3] = size & 0xFF;
|
||||
}
|
||||
} else {
|
||||
header.writeUint32LE(size, 0);
|
||||
}
|
||||
|
||||
header.writeUint32LE(size, 0);
|
||||
header[4] = opcode;
|
||||
|
||||
let packet: Buffer;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue