diff options
author | Mark Powers <markppowers0@gmail.com> | 2020-10-20 21:30:56 -0500 |
---|---|---|
committer | Mark Powers <markppowers0@gmail.com> | 2020-10-20 21:30:56 -0500 |
commit | 6c51b69aa24678c96044e55942a96a17cad38b4d (patch) | |
tree | 7c837844ecbd82868fd570ef465308867ce1e28b /src/server.js | |
parent | 9ea4b4d3287d0253deb45a4404702009e38ace5c (diff) |
Update mobile styles
Diffstat (limited to 'src/server.js')
-rw-r--r-- | src/server.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/server.js b/src/server.js index 025c087..81b2393 100644 --- a/src/server.js +++ b/src/server.js @@ -41,6 +41,9 @@ function consumeMessage(res){ return undefined } } +function dateToString(d){ + return `${d.getFullYear().toString()}/${d.getMonth().toString()}/${d.getDate().toString()}` +} function setUpRoutes(models, jwtFunctions, database, templates) { // Authentication routine @@ -53,6 +56,10 @@ function setUpRoutes(models, jwtFunctions, database, templates) { res.locals.id = session_cookie; let path = req.path.toLowerCase(); + if(path.startsWith("/static")){ + next(); + return; + } if (!path.startsWith("/login")) { let cookie = req.cookies.authorization if (!cookie) { @@ -111,7 +118,7 @@ function setUpRoutes(models, jwtFunctions, database, templates) { server.get('/ledger', async (req, res) => { var ledger = await database.query(`SELECT * FROM transactions WHERE username = '${res.locals.user.username}' ORDER BY \`when\` DESC`, { type: database.QueryTypes.SELECT }) ledger.forEach((element, i) => { - element.when = element.when.toString().substring(0, 10); + element.when = dateToString(element.when); element.index = i + 1 }); let name = res.locals.user.username |