fix: StorySeedling (#1857)

* Story seedling beginning

* Font decoding

* Bump version number

* Remove spam

* Remove story seedling ad

* Live update nonce

* add error for captcha

* JSON instead of text compare

* Fix proxy crashing on error

* Fix captcha error

* Fix updatedNonce check

* Compression headers should only be forwarded by proxy's that keep the content compressed

* Revert index.ts change
This commit is contained in:
Soopyboo32
2025-12-23 18:56:31 +08:00
committed by GitHub
parent a4168018f0
commit 2443d8f7fc
2 changed files with 79 additions and 30 deletions
+20 -13
View File
@@ -21,13 +21,7 @@ const settings: ServerSetting = {
'sec-fetch-dest',
'pragma',
],
disAllowResponseHeaders: [
'link',
'set-cookie',
'set-cookie2',
'content-encoding',
'content-length',
],
disAllowResponseHeaders: ['link', 'set-cookie', 'set-cookie2'],
useUserAgent: true,
};
@@ -173,7 +167,11 @@ const proxyRequest: Connect.SimpleHandleFunction = (req, res) => {
.then(([res2, text]) => {
res.statusCode = res2.status;
res2.headers.forEach((val, key) => {
if (!settings.disAllowResponseHeaders.includes(key)) {
if (
!settings.disAllowResponseHeaders.includes(key) &&
key !== 'content-encoding' &&
key !== 'content-length'
) {
res.setHeader(key, val);
}
});
@@ -186,11 +184,20 @@ const proxyRequest: Connect.SimpleHandleFunction = (req, res) => {
res.end();
});
} else if (settings.fetchMode === FetchMode.PROXY) {
proxy.web(req, res, {
target: _url.origin,
selfHandleResponse: true,
followRedirects: true,
});
proxy.web(
req,
res,
{
target: _url.origin,
selfHandleResponse: true,
followRedirects: true,
},
err => {
console.error(err);
res.statusCode = 500;
res.end();
},
);
}
};