mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-05 07:10:30 +01:00
chore: minor re-shuffling of code
This commit is contained in:
@@ -13,7 +13,6 @@ const ActivityPub = module.exports;
|
||||
|
||||
ActivityPub.helpers = require('./helpers');
|
||||
ActivityPub.inbox = require('./inbox');
|
||||
ActivityPub.outbox = require('./outbox');
|
||||
|
||||
ActivityPub.getActor = async (id) => {
|
||||
if (actorCache.has(id)) {
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
const db = require('../database');
|
||||
|
||||
const outbox = module.exports;
|
||||
|
||||
outbox.isFollowing = async (uid, actorId) => {
|
||||
if (parseInt(uid, 10) <= 0 || actorId.indexOf('@') === -1) {
|
||||
return false;
|
||||
}
|
||||
return await db.isSortedSetMember(`followingRemote:${uid}`, actorId);
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const { getActor, outbox } = require('../../activitypub');
|
||||
const db = require('../../database');
|
||||
const { getActor } = require('../../activitypub');
|
||||
|
||||
const controller = module.exports;
|
||||
|
||||
@@ -11,7 +12,7 @@ controller.get = async function (req, res, next) {
|
||||
return next();
|
||||
}
|
||||
const { preferredUsername, published, icon, image, name, summary, hostname } = actor;
|
||||
const isFollowing = await outbox.isFollowing(req.uid, uid);
|
||||
const isFollowing = await db.isSortedSetMember(`followingRemote:${req.uid}`, uid);
|
||||
|
||||
const payload = {
|
||||
uid,
|
||||
|
||||
@@ -5,12 +5,12 @@ module.exports = function (app, middleware, controllers) {
|
||||
|
||||
app.get('/user/:userslug', middlewares, controllers.activitypub.getActor);
|
||||
|
||||
app.get('/user/:userslug/following', middlewares, controllers.activitypub.getFollowing);
|
||||
app.get('/user/:userslug/followers', middlewares, controllers.activitypub.getFollowers);
|
||||
app.get('/user/:userslug/inbox', middlewares, controllers.activitypub.getInbox);
|
||||
app.post('/user/:userslug/inbox', [...middlewares, middleware.validateActivity], controllers.activitypub.postInbox);
|
||||
|
||||
app.get('/user/:userslug/outbox', middlewares, controllers.activitypub.getOutbox);
|
||||
app.post('/user/:userslug/outbox', middlewares, controllers.activitypub.postOutbox);
|
||||
|
||||
app.get('/user/:userslug/inbox', middlewares, controllers.activitypub.getInbox);
|
||||
app.post('/user/:userslug/inbox', [...middlewares, middleware.validateActivity], controllers.activitypub.postInbox);
|
||||
app.get('/user/:userslug/following', middlewares, controllers.activitypub.getFollowing);
|
||||
app.get('/user/:userslug/followers', middlewares, controllers.activitypub.getFollowers);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user