mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Logging in main, old code removal
This commit is contained in:
parent
7a40666a8f
commit
0bf83b721b
3 changed files with 63 additions and 96 deletions
45
qmining.js
45
qmining.js
|
@ -18,9 +18,7 @@
|
|||
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
const startHTTPS = true
|
||||
const siteUrl = 'https://qmining.tk' // http(s)//asd.basd
|
||||
const ircURL = 'https://kiwiirc.com/nextclient/irc.sub.fm/#qmining'
|
||||
const siteUrl = 'https://frylabs.net' // http(s)//asd.basd
|
||||
|
||||
const express = require('express')
|
||||
const bodyParser = require('body-parser')
|
||||
|
@ -33,46 +31,14 @@ const app = express()
|
|||
const logger = require('./logger.js')
|
||||
const utils = require('./utils.js')
|
||||
const actions = require('./actions.js')
|
||||
const stat = require('./stat.js')
|
||||
|
||||
const listedFiles = './public/files'
|
||||
const recivedFiles = 'public/recivedfiles'
|
||||
const uloadFiles = 'public/f'
|
||||
const staticFile = 'public/data/static'
|
||||
const dataFile = 'public/data.json'
|
||||
const msgFile = 'stats/msgs'
|
||||
|
||||
// https://certbot.eff.org/
|
||||
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)) {
|
||||
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'))
|
||||
}
|
||||
}
|
||||
|
||||
app.set('view engine', 'ejs')
|
||||
app.use(function (req, res, next) {
|
||||
res.on('finish', function () {
|
||||
logger.LogReq(req, true, res.statusCode)
|
||||
if (res.statusCode !== 404) { stat.LogStat(req.url) }
|
||||
})
|
||||
next()
|
||||
})
|
||||
app.use(express.static('public'))
|
||||
app.use(busboy({
|
||||
limits: {
|
||||
|
@ -175,12 +141,6 @@ app.get('/menuClick', function (req, res) {
|
|||
logger.LogReq(req)
|
||||
})
|
||||
|
||||
app.get('/irc', function (req, res) {
|
||||
res.redirect(ircURL)
|
||||
res.end()
|
||||
logger.LogReq(req)
|
||||
})
|
||||
|
||||
// all questions readable
|
||||
app.get('/allqr', function (req, res) {
|
||||
var f = utils.ReadFile(dataFile)
|
||||
|
@ -257,9 +217,6 @@ app.post('*', function (req, res) {
|
|||
// utils.AppendToFile(logger.GetDateString() + ": " + "404 POST", logFile);
|
||||
})
|
||||
|
||||
var msg = ''
|
||||
stat.Load()
|
||||
|
||||
exports.app = app
|
||||
|
||||
logger.Log('Qmining module started', logger.GetColor('yellow'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue