mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Fix for logging in on site and with script
This commit is contained in:
parent
a6d260f6af
commit
fa4b29efe6
6 changed files with 26 additions and 9 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue