summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--activitypub.js4
-rwxr-xr-xroutes.js16
2 files changed, 10 insertions, 10 deletions
diff --git a/activitypub.js b/activitypub.js
index f49648b..1a67639 100644
--- a/activitypub.js
+++ b/activitypub.js
@@ -13,7 +13,6 @@ const EventGroup = mongoose.model('EventGroup');
var sanitizeHtml = require('sanitize-html');
function createActivityPubActor(eventID, domain, pubkey, description, name, location, imageFilename, startUTC, endUTC, timezone) {
- if (!isFederated) return {};
let actor = {
'@context': [
'https://www.w3.org/ns/activitystreams',
@@ -55,7 +54,6 @@ function createActivityPubActor(eventID, domain, pubkey, description, name, loca
}
function createActivityPubEvent(name, startUTC, endUTC, timezone, description, location) {
- if (!isFederated) return {};
const guid = crypto.randomBytes(16).toString('hex');
let eventObject = {
"@context": "https://www.w3.org/ns/activitystreams",
@@ -84,7 +82,6 @@ function createFeaturedPost(eventID, name, startUTC, endUTC, timezone, descripti
}
function updateActivityPubEvent(oldEvent, name, startUTC, endUTC, timezone, description, location) {
- if (!isFederated) return;
// we want to persist the old ID no matter what happens to the Event itself
const id = oldEvent.id;
let eventObject = {
@@ -102,7 +99,6 @@ function updateActivityPubEvent(oldEvent, name, startUTC, endUTC, timezone, desc
function updateActivityPubActor(actor, description, name, location, imageFilename, startUTC, endUTC, timezone) {
- if (!isFederated) return;
if (!actor) return;
actor.summary = `<p>${description}</p>`;
actor.name = name;
diff --git a/routes.js b/routes.js
index 4172ab7..5080cd0 100755
--- a/routes.js
+++ b/routes.js
@@ -28,7 +28,11 @@ const domain = require('./config/domain.js').domain;
const contactEmail = require('./config/domain.js').email;
const siteName = require('./config/domain.js').sitename;
const siteLogo = require('./config/domain.js').logo_url;
-const isFederated = require('./config/domain.js').isFederated;
+let isFederated = require('./config/domain.js').isFederated;
+// if the federation config isn't set, things are federated by default
+if (isFederated === undefined) {
+ isFederated = true;
+}
const ap = require('./activitypub.js');
// Extra marked renderer (used to render plaintext event description for page metadata)
@@ -667,9 +671,9 @@ router.post('/newevent', async (req, res) => {
usersCanComment: req.body.interactionCheckbox ? true : false,
maxAttendees: req.body.maxAttendees,
firstLoad: true,
- activityPubActor: isFederated ? ap.createActivityPubActor(eventID, domain, pair.public, marked(req.body.eventDescription), req.body.eventName, req.body.eventLocation, eventImageFilename, startUTC, endUTC, req.body.timezone) : null,
- activityPubEvent: isFederated ? ap.createActivityPubEvent(req.body.eventName, startUTC, endUTC, req.body.timezone, req.body.eventDescription, req.body.eventLocation) : null,
- activityPubMessages: isFederated ? [ { id: `https://${domain}/${eventID}/m/featuredPost`, content: JSON.stringify(ap.createFeaturedPost(eventID, req.body.eventName, startUTC, endUTC, req.body.timezone, req.body.eventDescription, req.body.eventLocation)) } ] : [],
+ activityPubActor: ap.createActivityPubActor(eventID, domain, pair.public, marked(req.body.eventDescription), req.body.eventName, req.body.eventLocation, eventImageFilename, startUTC, endUTC, req.body.timezone),
+ activityPubEvent: ap.createActivityPubEvent(req.body.eventName, startUTC, endUTC, req.body.timezone, req.body.eventDescription, req.body.eventLocation),
+ activityPubMessages: [ { id: `https://${domain}/${eventID}/m/featuredPost`, content: JSON.stringify(ap.createFeaturedPost(eventID, req.body.eventName, startUTC, endUTC, req.body.timezone, req.body.eventDescription, req.body.eventLocation)) } ],
publicKey: pair.public,
privateKey: pair.private
});
@@ -881,8 +885,8 @@ router.post('/editevent/:eventID/:editToken', (req, res) => {
usersCanComment: req.body.interactionCheckbox ? true : false,
maxAttendees: req.body.maxAttendeesCheckbox ? req.body.maxAttendees : null,
eventGroup: isPartOfEventGroup ? eventGroup._id : null,
- activityPubActor: isFederated ? ap.updateActivityPubActor(JSON.parse(event.activityPubActor), req.body.eventDescription, req.body.eventName, req.body.eventLocation, eventImageFilename, startUTC, endUTC, req.body.timezone) : null,
- activityPubEvent: isFederated ? ap.updateActivityPubEvent(JSON.parse(event.activityPubEvent), req.body.eventName, req.body.startUTC, req.body.endUTC, req.body.timezone) : null,
+ activityPubActor: ap.updateActivityPubActor(JSON.parse(event.activityPubActor), req.body.eventDescription, req.body.eventName, req.body.eventLocation, eventImageFilename, startUTC, endUTC, req.body.timezone),
+ activityPubEvent: ap.updateActivityPubEvent(JSON.parse(event.activityPubEvent), req.body.eventName, req.body.startUTC, req.body.endUTC, req.body.timezone),
}
let diffText = '<p>This event was just updated with new information.</p><ul>';
let displayDate;