Changed some https stuff

This commit is contained in:
YourFriendlyNeighborhoodDealer 2019-03-04 10:25:10 +01:00
parent cfe9706e31
commit c53c181a5b

View file

@ -18,7 +18,7 @@
------------------------------------------------------------------------- */
const startHTTPS = false;
const startHTTPS = true;
const siteUrl = "https://qmining.tk"; // http(s)//asd.basd
const ircURL = "https://kiwiirc.com/nextclient/irc.sub.fm/#qmining";
@ -48,21 +48,26 @@ const logFile = "stats/logs";
const allLogFile = "/nlogs/log";
// https://certbot.eff.org/
const privkeyFile = "/etc/letsencrypt/live/questionmining.tk/privkey.pem";
const fullchainFile = "/etc/letsencrypt/live/questionmining.tk/fullchain.pem";
const chainFile = "/etc/letsencrypt/live/questionmining.tk/chain.pem";
const privkeyFile = "/etc/letsencrypt/live/qmining.tk/privkey.pem";
const fullchainFile = "/etc/letsencrypt/live/qmining.tk/fullchain.pem";
const chainFile = "/etc/letsencrypt/live/qmining.tk/chain.pem";
var certsLoaded = false;
if (startHTTPS && utils.FileExists(privkeyFile) && utils.FileExists(fullchainFile) && utils.FileExists(chainFile)) {
const key = fs.readFileSync(privkeyFile, "utf8");
const cert = fs.readFileSync(fullchainFile, "utf8");
const ca = fs.readFileSync(chainFile, "utf8");
var certs = {
key: key,
cert: cert,
ca: ca
};
certsLoaded = true;
try {
const key = fs.readFileSync(privkeyFile, "utf8");
const cert = fs.readFileSync(fullchainFile, "utf8");
const ca = fs.readFileSync(chainFile, "utf8");
var certs = {
key: key,
cert: cert,
ca: ca
};
certsLoaded = true;
} catch (e) {
logger.Log("Error loading cert files!", logger.GetColor("redbg"));
}
}
const port = 8080;
@ -73,13 +78,6 @@ var highlights = ["public", "static", "manual", "isgetting", "postfeedback",
];
app.set('view engine', 'ejs');
//app.all('*', function(req, res, next) {
// if(req.secure) {
// next();
// } else {
// res.redirect('https://' + req.hostname + req.url);
// }
//});
app.use(function(req, res, next) {
res.on('finish', function() {
Log(req, true, res.statusCode);