diff options
author | lowercasename <raphaelkabo@gmail.com> | 2020-06-12 18:12:39 +0100 |
---|---|---|
committer | lowercasename <raphaelkabo@gmail.com> | 2020-06-12 18:12:39 +0100 |
commit | 07da80f044f9d3a305df6d96ee38913f1c36be87 (patch) | |
tree | 154a17ff938e1a181e3b208324b5abc43670b706 /activitypub.js | |
parent | 2ae20b09e6369202b4235b7fced87cc0daf6dff5 (diff) |
Switch over shortid to nanoid
Diffstat (limited to 'activitypub.js')
-rw-r--r-- | activitypub.js | 7 |
1 files changed, 5 insertions, 2 deletions
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, |