aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-05-28 10:21:39 +0200
committerChocobozzz <me@florianbigard.com>2021-05-28 10:22:50 +0200
commit012580d98f489e599d44a9a2a0bdc892b9455a90 (patch)
treecd6d4abdbf43f4cd1c051ac49682b97c7b6dca92 /server/controllers
parentd6d96bed80700830063c6055969d2d2ff46c63c6 (diff)
downloadPeerTube-012580d98f489e599d44a9a2a0bdc892b9455a90.tar.gz
PeerTube-012580d98f489e599d44a9a2a0bdc892b9455a90.tar.zst
PeerTube-012580d98f489e599d44a9a2a0bdc892b9455a90.zip
Cleanup
We must not expose private actor objects to clients Just make 2 GET requests on channel/accounts instead
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/actor.ts37
-rw-r--r--server/controllers/api/index.ts2
2 files changed, 0 insertions, 39 deletions
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 @@
1import * as express from 'express'
2import { JobQueue } from '../../lib/job-queue'
3import { asyncMiddleware } from '../../middlewares'
4import { actorNameWithHostGetValidator } from '../../middlewares/validators'
5
6const actorRouter = express.Router()
7
8actorRouter.get('/:actorName',
9 asyncMiddleware(actorNameWithHostGetValidator),
10 getActor
11)
12
13// ---------------------------------------------------------------------------
14
15export {
16 actorRouter
17}
18
19// ---------------------------------------------------------------------------
20
21function getActor (req: express.Request, res: express.Response) {
22 let accountOrVideoChannel
23
24 if (res.locals.account) {
25 accountOrVideoChannel = res.locals.account
26 }
27
28 if (res.locals.videoChannel) {
29 accountOrVideoChannel = res.locals.videoChannel
30 }
31
32 if (accountOrVideoChannel.isOutdated()) {
33 JobQueue.Instance.createJob({ type: 'activitypub-refresher', payload: { type: 'actor', url: accountOrVideoChannel.Actor.url } })
34 }
35
36 return res.json(accountOrVideoChannel.toFormattedJSON())
37}
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'
16import { searchRouter } from './search' 16import { searchRouter } from './search'
17import { serverRouter } from './server' 17import { serverRouter } from './server'
18import { usersRouter } from './users' 18import { usersRouter } from './users'
19import { actorRouter } from './actor'
20import { videoChannelRouter } from './video-channel' 19import { videoChannelRouter } from './video-channel'
21import { videoPlaylistRouter } from './video-playlist' 20import { videoPlaylistRouter } from './video-playlist'
22import { videosRouter } from './videos' 21import { videosRouter } from './videos'
@@ -41,7 +40,6 @@ apiRouter.use('/bulk', bulkRouter)
41apiRouter.use('/oauth-clients', oauthClientsRouter) 40apiRouter.use('/oauth-clients', oauthClientsRouter)
42apiRouter.use('/config', configRouter) 41apiRouter.use('/config', configRouter)
43apiRouter.use('/users', usersRouter) 42apiRouter.use('/users', usersRouter)
44apiRouter.use('/actors', actorRouter)
45apiRouter.use('/accounts', accountsRouter) 43apiRouter.use('/accounts', accountsRouter)
46apiRouter.use('/video-channels', videoChannelRouter) 44apiRouter.use('/video-channels', videoChannelRouter)
47apiRouter.use('/video-playlists', videoPlaylistRouter) 45apiRouter.use('/video-playlists', videoPlaylistRouter)