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
22 lines
603 B
const express = require("express")
|
|
const router = express.Router()
|
|
|
|
const {generateToken} = require("../graphql")
|
|
const {fileApi} = require("../../rpdata/api/File")
|
|
|
|
const filesTemplate = require("../../marko/page/data/files.marko")
|
|
|
|
router.get("/", async(req, res) => {
|
|
let privates = []
|
|
if (res.locals.user && res.locals.user.loggedIn) {
|
|
privates = fileApi.list({public: false}, {token: generateToken(res.locals.user.name)})
|
|
}
|
|
|
|
res.markoAsync(filesTemplate, {
|
|
privates: privates,
|
|
publics: fileApi.list({public: true}),
|
|
selected: {files: true},
|
|
})
|
|
})
|
|
|
|
module.exports = router
|