Fix for logging in on site and with script

This commit is contained in:
MrFry 2020-04-09 12:33:29 +02:00
parent a6d260f6af
commit fa4b29efe6
6 changed files with 26 additions and 9 deletions

View file

@ -20,7 +20,8 @@
console.clear()
const startHTTPS = true
const port = 80
const isRoot = process.getuid && process.getuid() === 0
const port = isRoot ? 80 : 8080
const httpsport = 5001
const express = require('express')
@ -91,6 +92,7 @@ function exit (reason) {
}
const app = express()
// https://github.com/expressjs/cors#configuration-options
app.use(cors({
credentials: true,
origin: true
@ -198,6 +200,9 @@ function LogTimerAction () {
logger.Log('Node version: ' + process.version)
logger.Log('Current working directory: ' + process.cwd())
logger.Log('Listening on port: ' + port)
if (isRoot) {
logger.Log('Running as root', logger.GetColor('red'))
}
const httpServer = http.createServer(app)
httpServer.listen(port)