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:
parent
d4d727c3ba
commit
71eb4b1a03
2 changed files with 17 additions and 4 deletions
|
@ -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)
|
||||
})
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 96a44e3171943f97c8308327670357c4cf2d69b2
|
||||
Subproject commit 0906bdb253eaeb87131e285d040dd463a7b9d791
|
Loading…
Add table
Add a link
Reference in a new issue