mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Merge branch 'master' of gitlab.com:MrFry/mrfrys-node-server
This commit is contained in:
commit
e284e18822
5 changed files with 26 additions and 14 deletions
|
@ -358,8 +358,20 @@ function GetApp () {
|
|||
|
||||
app.post('/postfeedback', function (req, res) {
|
||||
logger.LogReq(req)
|
||||
logger.Log('New feedback message', logger.GetColor('bluebg'), true)
|
||||
utils.AppendToFile(utils.GetDateString() + ':\n' + JSON.stringify(req.body), msgFile)
|
||||
if (req.body.fromLogin) {
|
||||
logger.Log('New feedback message from Login page', logger.GetColor('bluebg'), true)
|
||||
} else {
|
||||
logger.Log('New feedback message from feedback page', logger.GetColor('bluebg'), true)
|
||||
}
|
||||
|
||||
const ip = req.headers['cf-connecting-ip'] || req.connection.remoteAddress
|
||||
const user = req.session.user
|
||||
|
||||
utils.AppendToFile(utils.GetDateString() + ':\n' + JSON.stringify({
|
||||
...req.body,
|
||||
userID: user ? user.id : 'no user',
|
||||
ip: ip
|
||||
}), msgFile)
|
||||
res.json({ success: true })
|
||||
})
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
</p>
|
||||
|
||||
<h2>
|
||||
<a href="http://qmining.frylabs.net">
|
||||
<a href="https://qmining.frylabs.net">
|
||||
<pre>
|
||||
____ __ __
|
||||
/ __/_____ __ / /__ _/ / ___
|
||||
|
|
|
@ -39,7 +39,7 @@ function GetApp () {
|
|||
}
|
||||
|
||||
// files in public dirs
|
||||
const listedFiles = p + 'files'
|
||||
const listedFiles = './' + p + 'files'
|
||||
|
||||
app.set('view engine', 'ejs')
|
||||
app.set('views', [
|
||||
|
@ -76,7 +76,7 @@ function GetApp () {
|
|||
fp.pop()
|
||||
fp = fp.join('/')
|
||||
}
|
||||
const fpath = './public/files' + fp
|
||||
const fpath = listedFiles + fp
|
||||
if (!fs.existsSync(fpath)) {
|
||||
res.render('nofile', {
|
||||
missingFile: fpath,
|
||||
|
@ -151,7 +151,7 @@ function GetApp () {
|
|||
app.get('/*', function (req, res) {
|
||||
let parsedUrl = decodeURI(req.url)
|
||||
let curr = listedFiles + '/' + parsedUrl.substring('/'.length, parsedUrl.length).split('?')[0]
|
||||
let relPath = curr.substring('./public/files'.length, curr.length)
|
||||
let relPath = curr.substring(listedFiles.length, curr.length)
|
||||
|
||||
if (relPath[relPath.length - 1] !== '/') { relPath += '/' }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue