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.

37 lines
917 B

6 years ago
6 years ago
6 years ago
6 years ago
  1. const express = require("express")
  2. const router = express.Router()
  3. const {logHeaderApi, eventNames} = require("../../rpdata/api/LogHeader")
  4. const {charactersApi} = require("../../rpdata/api/Character")
  5. const listTemplate = require("../../marko/page/logs/list.marko")
  6. router.get("/", async(req, res) => {
  7. const filter = {limit: 0}
  8. if (req.query.characters) {
  9. filter.characters = req.query.characters.split(",")
  10. }
  11. if (req.query.channels) {
  12. filter.channels = req.query.channels.split(",")
  13. }
  14. if (req.query.events) {
  15. filter.events = req.query.events.split(",")
  16. }
  17. if (req.query.search) {
  18. filter.search = req.query.search
  19. }
  20. try {
  21. res.markoAsync(listTemplate, {
  22. filter: filter,
  23. logs: logHeaderApi.list(filter),
  24. characters: charactersApi.listHeaders(),
  25. selected: {index: true},
  26. })
  27. } catch(err) {
  28. console.error(err)
  29. }
  30. })
  31. module.exports = router