From 5424e688fb03abb2027dff250c2a1e0aa97c54b8 Mon Sep 17 00:00:00 2001 From: Ashley Date: Fri, 13 Jan 2023 15:33:36 +0000 Subject: [PATCH] add enable always https --- server.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/server.js b/server.js index 89e978bd..28e66b22 100644 --- a/server.js +++ b/server.js @@ -96,6 +96,7 @@ this is our config file,you can change stuff here tubeApi: "https://api.poketube.fun/api/", invapi: "https://invidious.sethforprivacy.com/api/v1", dislikes: "https://returnyoutubedislikeapi.com/votes?videoId=", + enablealwayshttps: true, //enables always https on the server t_url: "https://t.poketube.fun/", // def matomo url }; @@ -109,10 +110,14 @@ this is our config file,you can change stuff here } next(); }); - + app.use(function (request, response, next) { - if (process.env.NODE_ENV != "development" && !request.secure) { - return response.redirect("https://" + request.headers.host + request.url); + if (config.enablealwayshttps == true) { + if (process.env.NODE_ENV != "development" && !request.secure) { + return response.redirect( + "https://" + request.headers.host + request.url + ); + } } next();