diff options
author | Raphael <raphaelkabo@gmail.com> | 2020-06-13 12:59:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-13 12:59:42 +0100 |
commit | 030e2b3575a856c6fae65848b82626dde888a8c8 (patch) | |
tree | 963307a87e9f49a7956eed105ebafaf67aed5071 /activitypub.js | |
parent | 2ae20b09e6369202b4235b7fced87cc0daf6dff5 (diff) | |
parent | 335103a7f94e94f05b656e0193a30e12790a8d38 (diff) |
Merge pull request #48 from lowercasename/nanoid
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..8272b72 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 { customAlphabet } = require('nanoid'); +const nanoid = customAlphabet('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_', 21); 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(); // get the actor for the commenter request({ url: req.body.actor, |