The frontend/UI server, written in JS using the MarkoJS library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

47 lines
1.2 KiB

const express = require("express")
const router = express.Router()
const {logHeaderApi, eventNames} = require("../../rpdata/api/LogHeader")
const {charactersApi} = require("../../rpdata/api/Character")
const {channelApi} = require("../../rpdata/api/Channel")
const listTemplate = require("../../marko/page/logs/list.marko")
router.get("/", async(req, res) => {
const filter = {limit: 75}
if (req.query.characters) {
filter.characters = req.query.characters.split(",")
filter.limit = 0
}
if (req.query.channels) {
filter.channels = req.query.channels.split(",")
filter.limit = 0
}
if (req.query.events) {
filter.events = req.query.events.split(",")
filter.limit = 0
}
if (req.query.search) {
filter.search = req.query.search
filter.limit = 0
}
if (req.query.limit) {
filter.limit = parseInt(req.query.limit)
}
try {
res.markoAsync(listTemplate, {
filter: filter,
logs: logHeaderApi.list(filter),
characters: charactersApi.listHeaders(),
channels: channelApi.list(),
eventNames: logHeaderApi.eventNames(),
selected: {index: true},
})
} catch(err) {
console.error(err)
}
})
module.exports = router