From 07be4b49b50d7fb338150695f9676ac04a3d8eac Mon Sep 17 00:00:00 2001 From: ronny Date: Sat, 23 Nov 2024 00:07:38 +0100 Subject: [PATCH] provide correct buffer object for image type detection --- web/src/engine/websites/KadoComi.ts | 2 +- web/src/engine/websites/MangaParkPublisher.ts | 2 +- web/src/engine/websites/NicoNicoSeiga.ts | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/web/src/engine/websites/KadoComi.ts b/web/src/engine/websites/KadoComi.ts index d9395b6bc2..355d9744df 100644 --- a/web/src/engine/websites/KadoComi.ts +++ b/web/src/engine/websites/KadoComi.ts @@ -147,6 +147,6 @@ export default class extends DecoratableMangaScraper { for (let a = 0; a < r; a += 1) o[a] = t[a] ^ e[a % i]; - return o; + return o.buffer; } } \ No newline at end of file diff --git a/web/src/engine/websites/MangaParkPublisher.ts b/web/src/engine/websites/MangaParkPublisher.ts index d8143ae6a6..0928ed522b 100644 --- a/web/src/engine/websites/MangaParkPublisher.ts +++ b/web/src/engine/websites/MangaParkPublisher.ts @@ -71,6 +71,6 @@ export default class extends DecoratableMangaScraper { for (let a = 0; a < r; a += 1) o[a] = sourceArray[a] ^ e[a % i]; - return o; + return o.buffer; } } \ No newline at end of file diff --git a/web/src/engine/websites/NicoNicoSeiga.ts b/web/src/engine/websites/NicoNicoSeiga.ts index 36f7752d8b..7692e7c5a8 100644 --- a/web/src/engine/websites/NicoNicoSeiga.ts +++ b/web/src/engine/websites/NicoNicoSeiga.ts @@ -88,10 +88,10 @@ export default class extends DecoratableMangaScraper { } private async DecryptImage(blob: Blob, key: string): Promise { - const buffer = new Uint8Array(await blob.arrayBuffer()); + const bytes = new Uint8Array(await blob.arrayBuffer()); const xorkey = new Uint8Array(key.slice(0, 16).match(/.{1,2}/g).map(e => parseInt(e, 16))); - for (let n = 0; n < buffer.length; n++) - buffer[n] = buffer[n] ^ xorkey[n % 8]; - return Common.GetTypedData(buffer); + for (let n = 0; n < bytes.length; n++) + bytes[n] = bytes[n] ^ xorkey[n % 8]; + return Common.GetTypedData(bytes.buffer); } } \ No newline at end of file