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.

22 lines
603 B

  1. const express = require("express")
  2. const router = express.Router()
  3. const {generateToken} = require("../graphql")
  4. const {fileApi} = require("../../rpdata/api/File")
  5. const filesTemplate = require("../../marko/page/data/files.marko")
  6. router.get("/", async(req, res) => {
  7. let privates = []
  8. if (res.locals.user && res.locals.user.loggedIn) {
  9. privates = fileApi.list({public: false}, {token: generateToken(res.locals.user.name)})
  10. }
  11. res.markoAsync(filesTemplate, {
  12. privates: privates,
  13. publics: fileApi.list({public: true}),
  14. selected: {files: true},
  15. })
  16. })
  17. module.exports = router