mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
fix: bugs, more prep to start making calls to self
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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}`,
|
||||
|
||||
Reference in New Issue
Block a user