From f480ab79a57101e47fd33eb0dfac96ff8bf5c335 Mon Sep 17 00:00:00 2001 From: CaramelKat <32065563+caramelkat@users.noreply.github.com> Date: Sun, 10 May 2020 04:55:48 -0500 Subject: [PATCH] rolled back some web.olv changes to fix authentication --- src/services/miiverse-api/routes/post.js | 5 ++++- src/util/authentication.js | 20 -------------------- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/src/services/miiverse-api/routes/post.js b/src/services/miiverse-api/routes/post.js index ca11e06..eb2963a 100644 --- a/src/services/miiverse-api/routes/post.js +++ b/src/services/miiverse-api/routes/post.js @@ -26,7 +26,7 @@ router.post('/', upload.none(), async function (req, res, next) { let painting_uri = ""; if (req.body.painting) { painting = req.body.painting.replace(/\0/g, "").trim(); - painting_uri = util.data.processPainting(painting); + //painting_uri = util.data.processPainting(painting); } let screenshot = ""; if (req.body.screenshot) { @@ -65,6 +65,9 @@ router.post('/', upload.none(), async function (req, res, next) { catch (e) { console.error(e); + } + finally + { res.set("Content-Type", "application/xml"); res.statusCode = 400; response = { diff --git a/src/util/authentication.js b/src/util/authentication.js index e6ffece..4077ad3 100644 --- a/src/util/authentication.js +++ b/src/util/authentication.js @@ -122,25 +122,5 @@ let methods = { return decryptedBody; }, - processPainting: function (painting) { - let paintingBuffer = Buffer.from(painting, 'base64'); - let output = ''; - try - { - output = pako.inflate(paintingBuffer); - } - catch (err) - { - console.log(err); - } - let tga = new TGA(Buffer.from(output)); - let png = new PNG({ - width: tga.width, - height: tga.height - }); - png.data = tga.pixels; - let pngBuffer = PNG.sync.write(png); - return `data:image/png;base64,${pngBuffer.toString('base64')}`; - }, }; exports.data = methods;