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() {
|
function Load() {
|
||||||
utils.WatchFile(userSpecificMotdFile, (newData) => {
|
utils.WatchFile(userSpecificMotdFile, (newData) => {
|
||||||
logger.Log(`User Specific Motd changed: ${newData.replace(/\/n/g, '')}`)
|
logger.Log(`User Specific Motd changed: ${newData.replace(/\/n/g, '')}`)
|
||||||
|
@ -153,6 +161,7 @@ function GetApp() {
|
||||||
LoadTestUsers()
|
LoadTestUsers()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
LoadUserSpecificMOTD()
|
||||||
LoadTestUsers()
|
LoadTestUsers()
|
||||||
LoadVersion()
|
LoadVersion()
|
||||||
LoadMOTD()
|
LoadMOTD()
|
||||||
|
@ -618,13 +627,13 @@ function GetApp() {
|
||||||
next(fn)
|
next(fn)
|
||||||
})
|
})
|
||||||
fstream.on('error', function(err) {
|
fstream.on('error', function(err) {
|
||||||
console.log(err)
|
console.error(err)
|
||||||
res.end('something bad happened :s')
|
res.end('something bad happened :s')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.Log(`Unable to upload file!`, logger.GetColor('redbg'))
|
logger.Log(`Unable to upload file!`, logger.GetColor('redbg'))
|
||||||
console.log(err)
|
console.error(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -873,6 +882,7 @@ function GetApp() {
|
||||||
result: 'success',
|
result: 'success',
|
||||||
uid: user.id,
|
uid: user.id,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req.query.subjinfo) {
|
if (req.query.subjinfo) {
|
||||||
result.subjinfo = getSimplreRes()
|
result.subjinfo = getSimplreRes()
|
||||||
}
|
}
|
||||||
|
@ -881,7 +891,10 @@ function GetApp() {
|
||||||
}
|
}
|
||||||
if (req.query.motd) {
|
if (req.query.motd) {
|
||||||
result.motd = 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)
|
res.json(result)
|
||||||
})
|
})
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 96a44e3171943f97c8308327670357c4cf2d69b2
|
Subproject commit 0906bdb253eaeb87131e285d040dd463a7b9d791
|
Loading…
Add table
Add a link
Reference in a new issue