Skip to content

Node.js based forum software built for the modern web

fix: bugs, more prep to start making calls to self

Julian Lam5d95765ee7bf
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}`,