diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-17 15:45:42 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-27 09:41:54 +0200 |
commit | 8a19bee1a1ee39f973bb37429e4f73c3f2873cdb (patch) | |
tree | 33c93ef19451d7e46d4be74ce0681359d2dcc70e /server/controllers | |
parent | 965c4b22d0e4d2f853501e844e6ebbb861bd389d (diff) | |
download | PeerTube-8a19bee1a1ee39f973bb37429e4f73c3f2873cdb.tar.gz PeerTube-8a19bee1a1ee39f973bb37429e4f73c3f2873cdb.tar.zst PeerTube-8a19bee1a1ee39f973bb37429e4f73c3f2873cdb.zip |
Add ability to set a name to a channel
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/activitypub/client.ts | 16 | ||||
-rw-r--r-- | server/controllers/api/accounts.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/video-channel.ts | 19 |
3 files changed, 18 insertions, 19 deletions
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts index c90c3f931..54cf44419 100644 --- a/server/controllers/activitypub/client.ts +++ b/server/controllers/activitypub/client.ts | |||
@@ -6,8 +6,8 @@ import { CONFIG, ROUTE_CACHE_LIFETIME } from '../../initializers' | |||
6 | import { buildVideoAnnounce } from '../../lib/activitypub/send' | 6 | import { buildVideoAnnounce } from '../../lib/activitypub/send' |
7 | import { audiencify, getAudience } from '../../lib/activitypub/audience' | 7 | import { audiencify, getAudience } from '../../lib/activitypub/audience' |
8 | import { createActivityData } from '../../lib/activitypub/send/send-create' | 8 | import { createActivityData } from '../../lib/activitypub/send/send-create' |
9 | import { asyncMiddleware, executeIfActivityPub, localAccountValidator } from '../../middlewares' | 9 | import { asyncMiddleware, executeIfActivityPub, localAccountValidator, localVideoChannelValidator } from '../../middlewares' |
10 | import { videoChannelsGetValidator, videosGetValidator, videosShareValidator } from '../../middlewares/validators' | 10 | import { videosGetValidator, videosShareValidator } from '../../middlewares/validators' |
11 | import { videoCommentGetValidator } from '../../middlewares/validators/video-comments' | 11 | import { videoCommentGetValidator } from '../../middlewares/validators/video-comments' |
12 | import { AccountModel } from '../../models/account/account' | 12 | import { AccountModel } from '../../models/account/account' |
13 | import { ActorModel } from '../../models/activitypub/actor' | 13 | import { ActorModel } from '../../models/activitypub/actor' |
@@ -80,16 +80,16 @@ activityPubClientRouter.get('/videos/watch/:videoId/comments/:commentId/activity | |||
80 | executeIfActivityPub(asyncMiddleware(videoCommentController)) | 80 | executeIfActivityPub(asyncMiddleware(videoCommentController)) |
81 | ) | 81 | ) |
82 | 82 | ||
83 | activityPubClientRouter.get('/video-channels/:id', | 83 | activityPubClientRouter.get('/video-channels/:name', |
84 | executeIfActivityPub(asyncMiddleware(videoChannelsGetValidator)), | 84 | executeIfActivityPub(asyncMiddleware(localVideoChannelValidator)), |
85 | executeIfActivityPub(asyncMiddleware(videoChannelController)) | 85 | executeIfActivityPub(asyncMiddleware(videoChannelController)) |
86 | ) | 86 | ) |
87 | activityPubClientRouter.get('/video-channels/:id/followers', | 87 | activityPubClientRouter.get('/video-channels/:name/followers', |
88 | executeIfActivityPub(asyncMiddleware(videoChannelsGetValidator)), | 88 | executeIfActivityPub(asyncMiddleware(localVideoChannelValidator)), |
89 | executeIfActivityPub(asyncMiddleware(videoChannelFollowersController)) | 89 | executeIfActivityPub(asyncMiddleware(videoChannelFollowersController)) |
90 | ) | 90 | ) |
91 | activityPubClientRouter.get('/video-channels/:id/following', | 91 | activityPubClientRouter.get('/video-channels/:name/following', |
92 | executeIfActivityPub(asyncMiddleware(videoChannelsGetValidator)), | 92 | executeIfActivityPub(asyncMiddleware(localVideoChannelValidator)), |
93 | executeIfActivityPub(asyncMiddleware(videoChannelFollowingController)) | 93 | executeIfActivityPub(asyncMiddleware(videoChannelFollowingController)) |
94 | ) | 94 | ) |
95 | 95 | ||
diff --git a/server/controllers/api/accounts.ts b/server/controllers/api/accounts.ts index 308970abc..7b7e5e740 100644 --- a/server/controllers/api/accounts.ts +++ b/server/controllers/api/accounts.ts | |||
@@ -78,7 +78,7 @@ async function listAccountVideos (req: express.Request, res: express.Response, n | |||
78 | start: req.query.start, | 78 | start: req.query.start, |
79 | count: req.query.count, | 79 | count: req.query.count, |
80 | sort: req.query.sort, | 80 | sort: req.query.sort, |
81 | includeLocalVideos: false, | 81 | includeLocalVideos: true, |
82 | categoryOneOf: req.query.categoryOneOf, | 82 | categoryOneOf: req.query.categoryOneOf, |
83 | licenceOneOf: req.query.licenceOneOf, | 83 | licenceOneOf: req.query.licenceOneOf, |
84 | languageOneOf: req.query.languageOneOf, | 84 | languageOneOf: req.query.languageOneOf, |
diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts index 6ffc09f87..3f51f03f4 100644 --- a/server/controllers/api/video-channel.ts +++ b/server/controllers/api/video-channel.ts | |||
@@ -10,13 +10,12 @@ import { | |||
10 | setDefaultPagination, | 10 | setDefaultPagination, |
11 | setDefaultSort, | 11 | setDefaultSort, |
12 | videoChannelsAddValidator, | 12 | videoChannelsAddValidator, |
13 | videoChannelsGetValidator, | ||
14 | videoChannelsRemoveValidator, | 13 | videoChannelsRemoveValidator, |
15 | videoChannelsSortValidator, | 14 | videoChannelsSortValidator, |
16 | videoChannelsUpdateValidator | 15 | videoChannelsUpdateValidator |
17 | } from '../../middlewares' | 16 | } from '../../middlewares' |
18 | import { VideoChannelModel } from '../../models/video/video-channel' | 17 | import { VideoChannelModel } from '../../models/video/video-channel' |
19 | import { videosSortValidator } from '../../middlewares/validators' | 18 | import { videoChannelsNameWithHostValidator, videosSortValidator } from '../../middlewares/validators' |
20 | import { sendUpdateActor } from '../../lib/activitypub/send' | 19 | import { sendUpdateActor } from '../../lib/activitypub/send' |
21 | import { VideoChannelCreate, VideoChannelUpdate } from '../../../shared' | 20 | import { VideoChannelCreate, VideoChannelUpdate } from '../../../shared' |
22 | import { createVideoChannel } from '../../lib/video-channel' | 21 | import { createVideoChannel } from '../../lib/video-channel' |
@@ -50,7 +49,7 @@ videoChannelRouter.post('/', | |||
50 | asyncRetryTransactionMiddleware(addVideoChannel) | 49 | asyncRetryTransactionMiddleware(addVideoChannel) |
51 | ) | 50 | ) |
52 | 51 | ||
53 | videoChannelRouter.post('/:id/avatar/pick', | 52 | videoChannelRouter.post('/:nameWithHost/avatar/pick', |
54 | authenticate, | 53 | authenticate, |
55 | reqAvatarFile, | 54 | reqAvatarFile, |
56 | // Check the rights | 55 | // Check the rights |
@@ -59,25 +58,25 @@ videoChannelRouter.post('/:id/avatar/pick', | |||
59 | asyncMiddleware(updateVideoChannelAvatar) | 58 | asyncMiddleware(updateVideoChannelAvatar) |
60 | ) | 59 | ) |
61 | 60 | ||
62 | videoChannelRouter.put('/:id', | 61 | videoChannelRouter.put('/:nameWithHost', |
63 | authenticate, | 62 | authenticate, |
64 | asyncMiddleware(videoChannelsUpdateValidator), | 63 | asyncMiddleware(videoChannelsUpdateValidator), |
65 | asyncRetryTransactionMiddleware(updateVideoChannel) | 64 | asyncRetryTransactionMiddleware(updateVideoChannel) |
66 | ) | 65 | ) |
67 | 66 | ||
68 | videoChannelRouter.delete('/:id', | 67 | videoChannelRouter.delete('/:nameWithHost', |
69 | authenticate, | 68 | authenticate, |
70 | asyncMiddleware(videoChannelsRemoveValidator), | 69 | asyncMiddleware(videoChannelsRemoveValidator), |
71 | asyncRetryTransactionMiddleware(removeVideoChannel) | 70 | asyncRetryTransactionMiddleware(removeVideoChannel) |
72 | ) | 71 | ) |
73 | 72 | ||
74 | videoChannelRouter.get('/:id', | 73 | videoChannelRouter.get('/:nameWithHost', |
75 | asyncMiddleware(videoChannelsGetValidator), | 74 | asyncMiddleware(videoChannelsNameWithHostValidator), |
76 | asyncMiddleware(getVideoChannel) | 75 | asyncMiddleware(getVideoChannel) |
77 | ) | 76 | ) |
78 | 77 | ||
79 | videoChannelRouter.get('/:id/videos', | 78 | videoChannelRouter.get('/:nameWithHost/videos', |
80 | asyncMiddleware(videoChannelsGetValidator), | 79 | asyncMiddleware(videoChannelsNameWithHostValidator), |
81 | paginationValidator, | 80 | paginationValidator, |
82 | videosSortValidator, | 81 | videosSortValidator, |
83 | setDefaultSort, | 82 | setDefaultSort, |
@@ -215,7 +214,7 @@ async function listVideoChannelVideos (req: express.Request, res: express.Respon | |||
215 | start: req.query.start, | 214 | start: req.query.start, |
216 | count: req.query.count, | 215 | count: req.query.count, |
217 | sort: req.query.sort, | 216 | sort: req.query.sort, |
218 | includeLocalVideos: false, | 217 | includeLocalVideos: true, |
219 | categoryOneOf: req.query.categoryOneOf, | 218 | categoryOneOf: req.query.categoryOneOf, |
220 | licenceOneOf: req.query.licenceOneOf, | 219 | licenceOneOf: req.query.licenceOneOf, |
221 | languageOneOf: req.query.languageOneOf, | 220 | languageOneOf: req.query.languageOneOf, |