From 012580d98f489e599d44a9a2a0bdc892b9455a90 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 28 May 2021 10:21:39 +0200 Subject: Cleanup We must not expose private actor objects to clients Just make 2 GET requests on channel/accounts instead --- server/controllers/api/actor.ts | 37 ------------------------------------- server/controllers/api/index.ts | 2 -- 2 files changed, 39 deletions(-) delete mode 100644 server/controllers/api/actor.ts (limited to 'server/controllers') diff --git a/server/controllers/api/actor.ts b/server/controllers/api/actor.ts deleted file mode 100644 index da7f2eb91..000000000 --- a/server/controllers/api/actor.ts +++ /dev/null @@ -1,37 +0,0 @@ -import * as express from 'express' -import { JobQueue } from '../../lib/job-queue' -import { asyncMiddleware } from '../../middlewares' -import { actorNameWithHostGetValidator } from '../../middlewares/validators' - -const actorRouter = express.Router() - -actorRouter.get('/:actorName', - asyncMiddleware(actorNameWithHostGetValidator), - getActor -) - -// --------------------------------------------------------------------------- - -export { - actorRouter -} - -// --------------------------------------------------------------------------- - -function getActor (req: express.Request, res: express.Response) { - let accountOrVideoChannel - - if (res.locals.account) { - accountOrVideoChannel = res.locals.account - } - - if (res.locals.videoChannel) { - accountOrVideoChannel = res.locals.videoChannel - } - - if (accountOrVideoChannel.isOutdated()) { - JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'actor', url: accountOrVideoChannel.Actor.url } }) - } - - return res.json(accountOrVideoChannel.toFormattedJSON()) -} diff --git a/server/controllers/api/index.ts b/server/controllers/api/index.ts index 9ffcf1337..28378654a 100644 --- a/server/controllers/api/index.ts +++ b/server/controllers/api/index.ts @@ -16,7 +16,6 @@ import { pluginRouter } from './plugins' import { searchRouter } from './search' import { serverRouter } from './server' import { usersRouter } from './users' -import { actorRouter } from './actor' import { videoChannelRouter } from './video-channel' import { videoPlaylistRouter } from './video-playlist' import { videosRouter } from './videos' @@ -41,7 +40,6 @@ apiRouter.use('/bulk', bulkRouter) apiRouter.use('/oauth-clients', oauthClientsRouter) apiRouter.use('/config', configRouter) apiRouter.use('/users', usersRouter) -apiRouter.use('/actors', actorRouter) apiRouter.use('/accounts', accountsRouter) apiRouter.use('/video-channels', videoChannelRouter) apiRouter.use('/video-playlists', videoPlaylistRouter) -- cgit v1.2.3