mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
date string, admin comment, uploaded files save path
This commit is contained in:
parent
5d1ff649ce
commit
87df6638ed
1 changed files with 8 additions and 7 deletions
|
@ -75,6 +75,7 @@ const registeredScriptsFile = 'stats/registeredScripts.json'
|
||||||
const savedQuestionsFileName = 'savedQuestions.json'
|
const savedQuestionsFileName = 'savedQuestions.json'
|
||||||
const adminUsersFile = 'data/admins.json'
|
const adminUsersFile = 'data/admins.json'
|
||||||
const oldMotdFile = 'publicDirs/qminingPublic/oldMotd'
|
const oldMotdFile = 'publicDirs/qminingPublic/oldMotd'
|
||||||
|
const uloadFiles = 'data/f'
|
||||||
|
|
||||||
// other constants
|
// other constants
|
||||||
const line = '====================================================' // lol
|
const line = '====================================================' // lol
|
||||||
|
@ -101,7 +102,6 @@ function GetApp(): ModuleType {
|
||||||
const dbsFile = publicDir + 'questionDbs.json'
|
const dbsFile = publicDir + 'questionDbs.json'
|
||||||
const savedQuestionsDir = publicDir + 'savedQuestions'
|
const savedQuestionsDir = publicDir + 'savedQuestions'
|
||||||
const recivedFiles = publicDir + 'recivedfiles'
|
const recivedFiles = publicDir + 'recivedfiles'
|
||||||
const uloadFiles = publicDir + 'f'
|
|
||||||
const motdFile = publicDir + 'motd'
|
const motdFile = publicDir + 'motd'
|
||||||
const userSpecificMotdFile = publicDir + 'userSpecificMotd.json'
|
const userSpecificMotdFile = publicDir + 'userSpecificMotd.json'
|
||||||
const newsFile = publicDir + 'news.json'
|
const newsFile = publicDir + 'news.json'
|
||||||
|
@ -730,10 +730,10 @@ function GetApp(): ModuleType {
|
||||||
const { title, content } = req.body
|
const { title, content } = req.body
|
||||||
|
|
||||||
news[uuidv4()] = {
|
news[uuidv4()] = {
|
||||||
|
date: utils.GetDateString(),
|
||||||
|
user: user.id,
|
||||||
title: title,
|
title: title,
|
||||||
content: content,
|
content: content,
|
||||||
date: new Date().toLocaleString(),
|
|
||||||
user: user.id,
|
|
||||||
admin: admins.includes(user.id),
|
admin: admins.includes(user.id),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -775,7 +775,7 @@ function GetApp(): ModuleType {
|
||||||
res.json({ success: true })
|
res.json({ success: true })
|
||||||
})
|
})
|
||||||
|
|
||||||
function UploadFile(req: Request, res: any, path, next) {
|
function UploadFile(req: Request, res: any, path: string, next) {
|
||||||
try {
|
try {
|
||||||
req.pipe(req.busboy)
|
req.pipe(req.busboy)
|
||||||
req.busboy.on('file', function(fieldname, file, filename) {
|
req.busboy.on('file', function(fieldname, file, filename) {
|
||||||
|
@ -1337,9 +1337,10 @@ function GetApp(): ModuleType {
|
||||||
userSpecificMotd[user.id].seen = true
|
userSpecificMotd[user.id].seen = true
|
||||||
|
|
||||||
logger.Log(
|
logger.Log(
|
||||||
`User #${user.id}'s user specific motd is now seen.`,
|
`User #${user.id}'s user specific motd is now seen:`,
|
||||||
logger.GetColor('bluebg')
|
logger.GetColor('bluebg')
|
||||||
)
|
)
|
||||||
|
logger.Log(userSpecificMotd[user.id].msg)
|
||||||
utils.WriteFile(
|
utils.WriteFile(
|
||||||
JSON.stringify(userSpecificMotd, null, 2),
|
JSON.stringify(userSpecificMotd, null, 2),
|
||||||
userSpecificMotdFile
|
userSpecificMotdFile
|
||||||
|
@ -1473,10 +1474,10 @@ function GetApp(): ModuleType {
|
||||||
if (type === 'add') {
|
if (type === 'add') {
|
||||||
const { content } = req.body
|
const { content } = req.body
|
||||||
const comment = {
|
const comment = {
|
||||||
date: new Date().toLocaleString(),
|
date: utils.GetDateString(),
|
||||||
user: user.id,
|
user: user.id,
|
||||||
content: content,
|
content: content,
|
||||||
admin: admins.includes(user),
|
admin: admins.includes(user.id),
|
||||||
}
|
}
|
||||||
if (!news[newsKey].comments) {
|
if (!news[newsKey].comments) {
|
||||||
news[newsKey].comments = []
|
news[newsKey].comments = []
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue