mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
User specific motd seen
This commit is contained in:
@@ -135,6 +135,14 @@ function GetApp() {
|
||||
}
|
||||
}
|
||||
|
||||
function userSpecificMotdSeenBy(id) {
|
||||
if (!userSpecificMotd[id].seen) {
|
||||
logger.Log(`User #${id}'s user specific motd is now seen.`)
|
||||
userSpecificMotd[id].seen = true
|
||||
utils.WriteFile(JSON.stringify(userSpecificMotd), userSpecificMotdFile)
|
||||
}
|
||||
}
|
||||
|
||||
function Load() {
|
||||
utils.WatchFile(userSpecificMotdFile, (newData) => {
|
||||
logger.Log(`User Specific Motd changed: ${newData.replace(/\/n/g, '')}`)
|
||||
@@ -153,6 +161,7 @@ function GetApp() {
|
||||
LoadTestUsers()
|
||||
})
|
||||
|
||||
LoadUserSpecificMOTD()
|
||||
LoadTestUsers()
|
||||
LoadVersion()
|
||||
LoadMOTD()
|
||||
@@ -618,13 +627,13 @@ function GetApp() {
|
||||
next(fn)
|
||||
})
|
||||
fstream.on('error', function(err) {
|
||||
console.log(err)
|
||||
console.error(err)
|
||||
res.end('something bad happened :s')
|
||||
})
|
||||
})
|
||||
} catch (err) {
|
||||
logger.Log(`Unable to upload file!`, logger.GetColor('redbg'))
|
||||
console.log(err)
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -873,6 +882,7 @@ function GetApp() {
|
||||
result: 'success',
|
||||
uid: user.id,
|
||||
}
|
||||
|
||||
if (req.query.subjinfo) {
|
||||
result.subjinfo = getSimplreRes()
|
||||
}
|
||||
@@ -881,7 +891,10 @@ function GetApp() {
|
||||
}
|
||||
if (req.query.motd) {
|
||||
result.motd = motd
|
||||
result.userSpecificMotd = userSpecificMotd[user.id]
|
||||
if (userSpecificMotd[user.id]) {
|
||||
result.userSpecificMotd = userSpecificMotd[user.id].msg
|
||||
userSpecificMotdSeenBy(user.id)
|
||||
}
|
||||
}
|
||||
res.json(result)
|
||||
})
|
||||
|
Reference in New Issue
Block a user