mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-28 09:36:16 +01:00
fix: revert home page routing change and moved instance actor endpoint to
This commit is contained in:
@@ -128,7 +128,7 @@ ActivityPub.sign = async (uid, url, payload) => {
|
||||
const date = new Date().toUTCString();
|
||||
const key = await ActivityPub.getPrivateKey(uid);
|
||||
const userslug = await user.getUserField(uid, 'userslug');
|
||||
const keyId = `${nconf.get('url')}${uid > 0 ? `/user/${userslug}` : ''}#key`;
|
||||
const keyId = `${nconf.get('url')}${uid > 0 ? `/user/${userslug}` : '/actor'}#key`;
|
||||
let digest = null;
|
||||
|
||||
let headers = '(request-target) host date';
|
||||
|
||||
@@ -17,8 +17,8 @@ Actors.application = async function (req, res) {
|
||||
'https://www.w3.org/ns/activitystreams',
|
||||
'https://w3id.org/security/v1',
|
||||
],
|
||||
id: `${nconf.get('url')}`,
|
||||
url: `${nconf.get('url')}`,
|
||||
id: `${nconf.get('url')}/actor`,
|
||||
url: `${nconf.get('url')}/actor`,
|
||||
inbox: `${nconf.get('url')}/inbox`,
|
||||
outbox: `${nconf.get('url')}/outbox`,
|
||||
|
||||
@@ -27,8 +27,8 @@ Actors.application = async function (req, res) {
|
||||
preferredUsername: nconf.get('url_parsed').hostname,
|
||||
|
||||
publicKey: {
|
||||
id: `${nconf.get('url')}#key`,
|
||||
owner: nconf.get('url'),
|
||||
id: `${nconf.get('url')}/actor#key`,
|
||||
owner: `${nconf.get('url')}/actor`,
|
||||
publicKeyPem: publicKey,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ module.exports = function (app, middleware, controllers) {
|
||||
|
||||
const middlewares = [middleware.activitypub.enabled, middleware.activitypub.assertS2S, middleware.exposeUid];
|
||||
|
||||
app.get('/', middlewares, controllers.activitypub.actors.application);
|
||||
app.get('/actor', middlewares, controllers.activitypub.actors.application);
|
||||
app.get('/user/:userslug', middlewares, controllers.activitypub.actors.user);
|
||||
|
||||
app.get('/user/:userslug/inbox', middlewares, controllers.activitypub.getInbox);
|
||||
|
||||
@@ -137,17 +137,17 @@ module.exports = async function (app, middleware) {
|
||||
|
||||
app.use(middleware.stripLeadingSlashes);
|
||||
|
||||
await plugins.reloadRoutes({ router: router });
|
||||
await authRoutes.reloadRoutes({ router: router });
|
||||
await writeRoutes.reload({ router: router });
|
||||
addCoreRoutes(app, router, middleware, mounts);
|
||||
|
||||
// handle custom homepage routes
|
||||
router.use('/', controllers.home.rewrite);
|
||||
|
||||
// homepage handled by `action:homepage.get:[route]`
|
||||
setupPageRoute(router, '/', [], controllers.home.pluginHook);
|
||||
|
||||
await plugins.reloadRoutes({ router: router });
|
||||
await authRoutes.reloadRoutes({ router: router });
|
||||
await writeRoutes.reload({ router: router });
|
||||
addCoreRoutes(app, router, middleware, mounts);
|
||||
|
||||
winston.info('[router] Routes added');
|
||||
};
|
||||
|
||||
|
||||
@@ -221,7 +221,7 @@ describe('ActivityPub integration', () => {
|
||||
let body;
|
||||
|
||||
before(async () => {
|
||||
({ response, body } = await request.get(nconf.get('url'), {
|
||||
({ response, body } = await request.get(`${nconf.get('url')}/actor`, {
|
||||
headers: {
|
||||
Accept: 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
|
||||
},
|
||||
@@ -328,7 +328,7 @@ describe('ActivityPub integration', () => {
|
||||
const [keyId] = signature.split(',');
|
||||
|
||||
assert(signature);
|
||||
assert.strictEqual(keyId, `keyId="${nconf.get('url')}#key"`);
|
||||
assert.strictEqual(keyId, `keyId="${nconf.get('url')}/actor#key"`);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user