From 07da80f044f9d3a305df6d96ee38913f1c36be87 Mon Sep 17 00:00:00 2001 From: lowercasename Date: Fri, 12 Jun 2020 18:12:39 +0100 Subject: Switch over shortid to nanoid --- activitypub.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'activitypub.js') diff --git a/activitypub.js b/activitypub.js index 765bee1..8ec2ee5 100644 --- a/activitypub.js +++ b/activitypub.js @@ -5,7 +5,10 @@ const isFederated = require('./config/domain.js').isFederated; const request = require('request'); const addToLog = require('./helpers.js').addToLog; const crypto = require('crypto'); -const shortid = require('shortid'); +// 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'; var moment = require('moment-timezone'); const mongoose = require('mongoose'); const Event = mongoose.model('Event'); @@ -802,7 +805,7 @@ function _handleCreateNoteComment(req, res) { if (ourEvents.length === 1) { let eventID = ourEvents[0]; // add comment - let commentID = shortid.generate(); + let commentID = nanoid(alphabet, 21); // get the actor for the commenter request({ url: req.body.actor, -- cgit v1.2.3