diff options
Diffstat (limited to 'routes.js')
-rwxr-xr-x | routes.js | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -6,8 +6,8 @@ const mongoose = require('mongoose'); // This alphabet (used to generate all event, group, etc. IDs) is missing '-' // because ActivityPub doesn't like it in IDs -const nanoid = require('nanoid/generate'); -const alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'; +const { customAlphabet } = require('nanoid'); +const nanoid = customAlphabet('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_', 21); const randomstring = require("randomstring"); @@ -626,9 +626,8 @@ router.get('/exportevent/:eventID', (req, res) => { // failureFlash: true }) //); - router.post('/newevent', async (req, res) => { - let eventID = nanoid(alphabet, 21); + let eventID = nanoid(); let editToken = randomstring.generate(); let eventImageFilename = ""; let isPartOfEventGroup = false; @@ -717,7 +716,7 @@ router.post('/newevent', async (req, res) => { }); router.post('/importevent', (req, res) => { - let eventID = nanoid(alphabet, 21); + let eventID = nanoid(); let editToken = randomstring.generate(); if (req.files && Object.keys(req.files).length !== 0) { let iCalObject = ical.parseICS(req.files.icsImportControl.data.toString('utf8')); @@ -788,7 +787,7 @@ router.post('/importevent', (req, res) => { }); router.post('/neweventgroup', (req, res) => { - let eventGroupID = nanoid(alphabet, 21); + let eventGroupID = nanoid(); let editToken = randomstring.generate(); let eventGroupImageFilename = ""; if (req.files && Object.keys(req.files).length !== 0) { @@ -1395,7 +1394,7 @@ router.post('/removeattendee/:eventID/:attendeeID', (req, res) => { }); router.post('/post/comment/:eventID', (req, res) => { - let commentID = nanoid(alphabet, 21); + let commentID = nanoid(); const newComment = { id: commentID, author: req.body.commentAuthor, @@ -1459,7 +1458,7 @@ router.post('/post/comment/:eventID', (req, res) => { }); router.post('/post/reply/:eventID/:commentID', (req, res) => { - let replyID = nanoid(alphabet, 21); + let replyID = nanoid(); let commentID = req.params.commentID; const newReply = { id: replyID, |