From 335103a7f94e94f05b656e0193a30e12790a8d38 Mon Sep 17 00:00:00 2001 From: lowercasename Date: Fri, 12 Jun 2020 18:30:42 +0100 Subject: Fixed nanoid generation --- activitypub.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'activitypub.js') diff --git a/activitypub.js b/activitypub.js index 8ec2ee5..8272b72 100644 --- a/activitypub.js +++ b/activitypub.js @@ -7,8 +7,8 @@ const addToLog = require('./helpers.js').addToLog; const crypto = require('crypto'); // 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); var moment = require('moment-timezone'); const mongoose = require('mongoose'); const Event = mongoose.model('Event'); @@ -805,7 +805,7 @@ function _handleCreateNoteComment(req, res) { if (ourEvents.length === 1) { let eventID = ourEvents[0]; // add comment - let commentID = nanoid(alphabet, 21); + let commentID = nanoid(); // get the actor for the commenter request({ url: req.body.actor, -- cgit v1.2.3