From 26ee852336ef9dc2e7c3918eadc9d06aa51ecd82 Mon Sep 17 00:00:00 2001 From: CountBleck Date: Sat, 27 Aug 2022 20:02:17 -0700 Subject: [PATCH 1/2] Fix error reporting in Cyclone custom bare console.log(e) is a bad idea in general. Moreover, errors cannot be written to streams, since they are neither strings nor Buffers. --- static/customBare.mjs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/static/customBare.mjs b/static/customBare.mjs index 8694c45..b132e07 100644 --- a/static/customBare.mjs +++ b/static/customBare.mjs @@ -90,11 +90,10 @@ async function fetchBare(url, res, req) { request.body.pipe(res) } } catch (e) { - console.log(e); res.writeHead(500, 'Error', { 'content-type': 'application/javascript' }) - res.end(e); + res.end(e.stack); } } @@ -143,4 +142,4 @@ export { route, routeSocket, isBare, -} \ No newline at end of file +} From 1e932d95186041b21abdee018ca127f20474ee56 Mon Sep 17 00:00:00 2001 From: CountBleck Date: Sat, 27 Aug 2022 20:57:02 -0700 Subject: [PATCH 2/2] Fix headers in Cyclone custom bare Referer is misspelled incorrectly. Also, the Cookie header name was incorrect, and `req.cookies` does not exist (as far as I know anyway). --- static/customBare.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/static/customBare.mjs b/static/customBare.mjs index b132e07..038dc38 100644 --- a/static/customBare.mjs +++ b/static/customBare.mjs @@ -45,9 +45,9 @@ async function fetchBare(url, res, req) { var options = { method: req.method, headers: { - "Refer": url.href, - "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36", - "cookies": req.cookies, + "Referer": url.href, + "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.63 Safari/537.36", + "Cookie": req.headers.cookie, }, }