diff --git a/src/modules/api/api.js b/src/modules/api/api.js index 10f7f47..b27e2d1 100644 --- a/src/modules/api/api.js +++ b/src/modules/api/api.js @@ -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) }) diff --git a/submodules/qmining-page b/submodules/qmining-page index 96a44e3..0906bdb 160000 --- a/submodules/qmining-page +++ b/submodules/qmining-page @@ -1 +1 @@ -Subproject commit 96a44e3171943f97c8308327670357c4cf2d69b2 +Subproject commit 0906bdb253eaeb87131e285d040dd463a7b9d791