From 255ffce25faa2e9477be382fca712d0327613fdb Mon Sep 17 00:00:00 2001 From: "The Couch Potato (on Mars)" <116996397+martian-potato@users.noreply.github.com> Date: Mon, 17 Nov 2025 19:49:48 +0000 Subject: [PATCH] fix: Issues Around Plugin Debugger (#1885) * proxy: Add zstd compressed payload support Signed-off-by: Martian Potato <2260cse01024@manarat.ac.bd> * proxy: Import types for annotations Signed-off-by: Martian Potato <2260cse01024@manarat.ac.bd> * components: Load novel cover via proxy Browser blocks the image load due to CORS Signed-off-by: Martian Potato <2260cse01024@manarat.ac.bd> --------- Signed-off-by: Martian Potato <2260cse01024@manarat.ac.bd> --- proxy.ts | 14 ++++++++++++-- src/components/novel-card.tsx | 5 ++++- src/components/parse-novel.tsx | 3 ++- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/proxy.ts b/proxy.ts index db93a11..34751c7 100644 --- a/proxy.ts +++ b/proxy.ts @@ -1,8 +1,10 @@ +import process from 'node:process'; +import { Buffer } from 'buffer'; import { FetchMode, ServerSetting } from './src/types/types'; import { Connect } from 'vite'; import httpProxy from 'http-proxy'; import { exec } from 'child_process'; -import { brotliDecompressSync, gunzipSync } from 'zlib'; +import { brotliDecompressSync, gunzipSync, zstdDecompressSync } from 'zlib'; const proxy = httpProxy.createProxyServer({}); @@ -226,7 +228,13 @@ proxy.on('proxyRes', function (proxyRes, req, res) { ? contentEncoding.some(enc => enc.includes('gzip')) : contentEncoding.includes('gzip')); - if (isBrotli || isGzip) { + const isZstd = + contentEncoding && + (Array.isArray(contentEncoding) + ? contentEncoding.some(enc => enc.includes('zstd')) + : contentEncoding.includes('zstd')); + + if (isBrotli || isGzip || isZstd) { delete proxyRes.headers['content-encoding']; delete proxyRes.headers['content-length']; @@ -245,6 +253,8 @@ proxy.on('proxyRes', function (proxyRes, req, res) { if (isBrotli) { decompressed = brotliDecompressSync(buffer); + } else if (isZstd) { + decompressed = zstdDecompressSync(buffer); } else { decompressed = gunzipSync(buffer); } diff --git a/src/components/novel-card.tsx b/src/components/novel-card.tsx index bceae45..7e5ee74 100644 --- a/src/components/novel-card.tsx +++ b/src/components/novel-card.tsx @@ -25,7 +25,10 @@ export function NovelCard({ novel, onParse }: NovelCardProps) {
{novel.name} diff --git a/src/components/parse-novel.tsx b/src/components/parse-novel.tsx index 9fb451a..ceca2ea 100644 --- a/src/components/parse-novel.tsx +++ b/src/components/parse-novel.tsx @@ -213,7 +213,8 @@ export default function ParseNovelSection({ >