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() {
|
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)
|
||||||
})
|
})
|
||||||
|
Submodule submodules/qmining-page updated: 96a44e3171...0906bdb253
Reference in New Issue
Block a user