added getEntry endpoint to forum

This commit is contained in:
mrfry 2022-04-01 08:56:23 +02:00
parent 01446274d0
commit 832a8f263b
2 changed files with 23 additions and 1 deletions

View file

@ -247,6 +247,28 @@ function setup(data: SubmoduleData): void {
})
})
app.get('/forumEntry', (req: Request, res) => {
logger.LogReq(req)
const forumName: string = req.query.forumName
const postKey: string = req.query.postKey
if (!forumName || !postKey) {
res.json({
success: false,
msg: `ForumName or postKey is not specified!`,
})
return
}
const { forumPath } = getForumData(forumName, forumDir)
res.json({
entry: utils.ReadJSON(
forumPath + '/' + postKey.replace(/\./g, '').replace(/\/+/g, '')
),
success: true,
})
})
app.get('/forumRanklist', (req: Request, res) => {
const forumName: string = req.query.forumName
if (!forumName) {

@ -1 +1 @@
Subproject commit 4748c23769d16450731562bb9ffd1553ce2eb704
Subproject commit ce63911b68e5604c02f5761dd4b5388272b76c6f