From 5d95765ee7bf13ca563be39e3462bca8b146d4f4 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 23 Jun 2023 15:25:00 -0400 Subject: [PATCH] fix: bugs, more prep to start making calls to self --- src/activitypub/index.js | 4 ++-- src/controllers/activitypub/profiles.js | 3 +-- src/controllers/well-known.js | 8 ++++---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/activitypub/index.js b/src/activitypub/index.js index 6edb7ae19e..4994e344e9 100644 --- a/src/activitypub/index.js +++ b/src/activitypub/index.js @@ -185,8 +185,8 @@ ActivityPub.send = async (uid, targets, payload) => { date, digest, signature, - 'content-type': 'application/ld+json; profile="http://www.w3.org/ns/activitystreams', - accept: 'application/ld+json; profile="http://www.w3.org/ns/activitystreams', + 'content-type': 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"', + accept: 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"', }, json: true, body: payload, diff --git a/src/controllers/activitypub/profiles.js b/src/controllers/activitypub/profiles.js index 5f0e484645..bc466048b6 100644 --- a/src/controllers/activitypub/profiles.js +++ b/src/controllers/activitypub/profiles.js @@ -10,7 +10,6 @@ controller.get = async function (req, res, next) { if (!actor) { return next(); } - const { preferredUsername, published, icon, image, name, summary, hostname } = actor; const payload = { uid, @@ -20,7 +19,7 @@ controller.get = async function (req, res, next) { joindate: new Date(published).getTime(), picture: typeof icon === 'string' ? icon : icon.url, uploadedpicture: typeof icon === 'string' ? icon : icon.url, - 'cover:url': typeof image === 'string' ? image : image.url, + 'cover:url': !image || typeof image === 'string' ? image : image.url, 'cover:position': '50% 50%', aboutme: summary, aboutmeParsed: summary, diff --git a/src/controllers/well-known.js b/src/controllers/well-known.js index 86caae4173..590f546b04 100644 --- a/src/controllers/well-known.js +++ b/src/controllers/well-known.js @@ -9,9 +9,9 @@ const Controller = module.exports; Controller.webfinger = async (req, res) => { const { resource } = req.query; - const { hostname } = nconf.get('url_parsed'); + const { host } = nconf.get('url_parsed'); - if (!resource || !resource.startsWith('acct:') || !resource.endsWith(hostname)) { + if (!resource || !resource.startsWith('acct:') || !resource.endsWith(host)) { return res.sendStatus(400); } @@ -21,7 +21,7 @@ Controller.webfinger = async (req, res) => { } // Get the slug - const slug = resource.slice(5, resource.length - (hostname.length + 1)); + const slug = resource.slice(5, resource.length - (host.length + 1)); const uid = await user.getUidByUserslug(slug); if (!uid) { @@ -29,7 +29,7 @@ Controller.webfinger = async (req, res) => { } const response = { - subject: `acct:${slug}@${hostname}`, + subject: `acct:${slug}@${host}`, aliases: [ `${nconf.get('url')}/uid/${uid}`, `${nconf.get('url')}/user/${slug}`,