From 65d42eda6f8b6b2cd496c55f7e4e013b79b2707b Mon Sep 17 00:00:00 2001 From: Ashley Date: Thu, 30 Nov 2023 09:30:48 +0000 Subject: [PATCH] add 403 lol --- src/libpoketube/init/superinit.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/libpoketube/init/superinit.js b/src/libpoketube/init/superinit.js index 63ac3996..c647bf16 100644 --- a/src/libpoketube/init/superinit.js +++ b/src/libpoketube/init/superinit.js @@ -24,12 +24,25 @@ function init(app, config, rendertemplate) { initlog("wait a few mins... pt on timeout rn"); - app.get("/*", function (req, res, next) { - if (didstart) return next(); + function isChromeOS(userAgent) { + return userAgent.includes('CrOS'); +} - return rendertemplate(res, req, "timeout.ejs"); - }); +// Middleware to handle the Chrome OS check +function checkChromeOS(req, res, next) { + if (isChromeOS(req.headers['user-agent'])) { + res.status(403).send('Forbidden for Chrome OS'); + } else { + next(); + } +} +// Your existing route with the Chrome OS check +app.get("/*", checkChromeOS, (req, res, next) => { + if (didstart) return next(); + + return rendertemplate(res, req, "timeout.ejs"); +}); setTimeout(function () { didstart = true;