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

This commit is contained in:
Julian Lam
2023-06-23 15:25:00 -04:00
parent 9f94653b3f
commit 5d95765ee7
3 changed files with 7 additions and 8 deletions

View File

@@ -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,

View File

@@ -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,

View File

@@ -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}`,