1
0
Fork 0
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:
Michael Hollister 2025-07-21 09:13:40 -05:00
parent 8a1d8afe6a
commit 144c3e17f5

View file

@ -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;