diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-15 11:00:25 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:51 +0100 |
commit | 608624252466acf9f1d9ee1c1170bd4fe4d18d18 (patch) | |
tree | 47eab55bb5421b7fe88e0b2ac743a436fd9561cf /server/controllers | |
parent | 51548b31815c6f96f314ae96588a9adca150519d (diff) | |
download | PeerTube-608624252466acf9f1d9ee1c1170bd4fe4d18d18.tar.gz PeerTube-608624252466acf9f1d9ee1c1170bd4fe4d18d18.tar.zst PeerTube-608624252466acf9f1d9ee1c1170bd4fe4d18d18.zip |
Rename Pod -> Server
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/activitypub/pods.ts | 69 | ||||
-rw-r--r-- | server/controllers/activitypub/videos.ts | 278 | ||||
-rw-r--r-- | server/controllers/api/index.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/server/follows.ts (renamed from server/controllers/api/application/follows.ts) | 4 | ||||
-rw-r--r-- | server/controllers/api/server/index.ts (renamed from server/controllers/api/application/index.ts) | 0 | ||||
-rw-r--r-- | server/controllers/api/videos/abuse.ts | 6 | ||||
-rw-r--r-- | server/controllers/api/videos/index.ts | 6 | ||||
-rw-r--r-- | server/controllers/api/videos/rate.ts | 2 | ||||
-rw-r--r-- | server/controllers/client.ts | 4 | ||||
-rw-r--r-- | server/controllers/static.ts | 2 |
10 files changed, 13 insertions, 360 deletions
diff --git a/server/controllers/activitypub/pods.ts b/server/controllers/activitypub/pods.ts deleted file mode 100644 index 6cce57c1c..000000000 --- a/server/controllers/activitypub/pods.ts +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | // import * as express from 'express' | ||
2 | // | ||
3 | // import { database as db } from '../../../initializers/database' | ||
4 | // import { | ||
5 | // checkSignature, | ||
6 | // signatureValidator, | ||
7 | // setBodyHostPort, | ||
8 | // remotePodsAddValidator, | ||
9 | // asyncMiddleware | ||
10 | // } from '../../../middlewares' | ||
11 | // import { sendOwnedDataToPod } from '../../../lib' | ||
12 | // import { getMyPublicCert, getFormattedObjects } from '../../../helpers' | ||
13 | // import { CONFIG } from '../../../initializers' | ||
14 | // import { PodInstance } from '../../../models' | ||
15 | // import { PodSignature, Pod as FormattedPod } from '../../../../shared' | ||
16 | // | ||
17 | // const remotePodsRouter = express.Router() | ||
18 | // | ||
19 | // remotePodsRouter.post('/remove', | ||
20 | // signatureValidator, | ||
21 | // checkSignature, | ||
22 | // asyncMiddleware(removePods) | ||
23 | // ) | ||
24 | // | ||
25 | // remotePodsRouter.post('/list', | ||
26 | // asyncMiddleware(remotePodsList) | ||
27 | // ) | ||
28 | // | ||
29 | // remotePodsRouter.post('/add', | ||
30 | // setBodyHostPort, // We need to modify the host before running the validator! | ||
31 | // remotePodsAddValidator, | ||
32 | // asyncMiddleware(addPods) | ||
33 | // ) | ||
34 | // | ||
35 | // // --------------------------------------------------------------------------- | ||
36 | // | ||
37 | // export { | ||
38 | // remotePodsRouter | ||
39 | // } | ||
40 | // | ||
41 | // // --------------------------------------------------------------------------- | ||
42 | // | ||
43 | // async function addPods (req: express.Request, res: express.Response, next: express.NextFunction) { | ||
44 | // const information = req.body | ||
45 | // | ||
46 | // const pod = db.Pod.build(information) | ||
47 | // const podCreated = await pod.save() | ||
48 | // | ||
49 | // await sendOwnedDataToPod(podCreated.id) | ||
50 | // | ||
51 | // const cert = await getMyPublicCert() | ||
52 | // return res.json({ cert, email: CONFIG.ADMIN.EMAIL }) | ||
53 | // } | ||
54 | // | ||
55 | // async function remotePodsList (req: express.Request, res: express.Response, next: express.NextFunction) { | ||
56 | // const pods = await db.Pod.list() | ||
57 | // | ||
58 | // return res.json(getFormattedObjects<FormattedPod, PodInstance>(pods, pods.length)) | ||
59 | // } | ||
60 | // | ||
61 | // async function removePods (req: express.Request, res: express.Response, next: express.NextFunction) { | ||
62 | // const signature: PodSignature = req.body.signature | ||
63 | // const host = signature.host | ||
64 | // | ||
65 | // const pod = await db.Pod.loadByHost(host) | ||
66 | // await pod.destroy() | ||
67 | // | ||
68 | // return res.type('json').status(204).end() | ||
69 | // } | ||
diff --git a/server/controllers/activitypub/videos.ts b/server/controllers/activitypub/videos.ts deleted file mode 100644 index 98894379f..000000000 --- a/server/controllers/activitypub/videos.ts +++ /dev/null | |||
@@ -1,278 +0,0 @@ | |||
1 | // import * as express from 'express' | ||
2 | // import * as Bluebird from 'bluebird' | ||
3 | // import * as Sequelize from 'sequelize' | ||
4 | // | ||
5 | // import { database as db } from '../../../initializers/database' | ||
6 | // import { | ||
7 | // REQUEST_ENDPOINT_ACTIONS, | ||
8 | // REQUEST_ENDPOINTS, | ||
9 | // REQUEST_VIDEO_EVENT_TYPES, | ||
10 | // REQUEST_VIDEO_QADU_TYPES | ||
11 | // } from '../../../initializers' | ||
12 | // import { | ||
13 | // checkSignature, | ||
14 | // signatureValidator, | ||
15 | // remoteVideosValidator, | ||
16 | // remoteQaduVideosValidator, | ||
17 | // remoteEventsVideosValidator | ||
18 | // } from '../../../middlewares' | ||
19 | // import { logger, retryTransactionWrapper, resetSequelizeInstance } from '../../../helpers' | ||
20 | // import { quickAndDirtyUpdatesVideoToFriends, fetchVideoChannelByHostAndUUID } from '../../../lib' | ||
21 | // import { PodInstance, VideoFileInstance } from '../../../models' | ||
22 | // import { | ||
23 | // RemoteVideoRequest, | ||
24 | // RemoteVideoCreateData, | ||
25 | // RemoteVideoUpdateData, | ||
26 | // RemoteVideoRemoveData, | ||
27 | // RemoteVideoReportAbuseData, | ||
28 | // RemoteQaduVideoRequest, | ||
29 | // RemoteQaduVideoData, | ||
30 | // RemoteVideoEventRequest, | ||
31 | // RemoteVideoEventData, | ||
32 | // RemoteVideoChannelCreateData, | ||
33 | // RemoteVideoChannelUpdateData, | ||
34 | // RemoteVideoChannelRemoveData, | ||
35 | // RemoteVideoAccountRemoveData, | ||
36 | // RemoteVideoAccountCreateData | ||
37 | // } from '../../../../shared' | ||
38 | // import { VideoInstance } from '../../../models/video/video-interface' | ||
39 | // | ||
40 | // const ENDPOINT_ACTIONS = REQUEST_ENDPOINT_ACTIONS[REQUEST_ENDPOINTS.VIDEOS] | ||
41 | // | ||
42 | // // Functions to call when processing a remote request | ||
43 | // // FIXME: use RemoteVideoRequestType as id type | ||
44 | // const functionsHash: { [ id: string ]: (...args) => Promise<any> } = {} | ||
45 | // functionsHash[ENDPOINT_ACTIONS.ADD_VIDEO] = addRemoteVideoRetryWrapper | ||
46 | // functionsHash[ENDPOINT_ACTIONS.UPDATE_VIDEO] = updateRemoteVideoRetryWrapper | ||
47 | // functionsHash[ENDPOINT_ACTIONS.REMOVE_VIDEO] = removeRemoteVideoRetryWrapper | ||
48 | // functionsHash[ENDPOINT_ACTIONS.ADD_CHANNEL] = addRemoteVideoChannelRetryWrapper | ||
49 | // functionsHash[ENDPOINT_ACTIONS.UPDATE_CHANNEL] = updateRemoteVideoChannelRetryWrapper | ||
50 | // functionsHash[ENDPOINT_ACTIONS.REMOVE_CHANNEL] = removeRemoteVideoChannelRetryWrapper | ||
51 | // functionsHash[ENDPOINT_ACTIONS.REPORT_ABUSE] = reportAbuseRemoteVideoRetryWrapper | ||
52 | // functionsHash[ENDPOINT_ACTIONS.ADD_ACCOUNT] = addRemoteVideoAccountRetryWrapper | ||
53 | // functionsHash[ENDPOINT_ACTIONS.REMOVE_ACCOUNT] = removeRemoteVideoAccountRetryWrapper | ||
54 | // | ||
55 | // const remoteVideosRouter = express.Router() | ||
56 | // | ||
57 | // remoteVideosRouter.post('/', | ||
58 | // signatureValidator, | ||
59 | // checkSignature, | ||
60 | // remoteVideosValidator, | ||
61 | // remoteVideos | ||
62 | // ) | ||
63 | // | ||
64 | // remoteVideosRouter.post('/qadu', | ||
65 | // signatureValidator, | ||
66 | // checkSignature, | ||
67 | // remoteQaduVideosValidator, | ||
68 | // remoteVideosQadu | ||
69 | // ) | ||
70 | // | ||
71 | // remoteVideosRouter.post('/events', | ||
72 | // signatureValidator, | ||
73 | // checkSignature, | ||
74 | // remoteEventsVideosValidator, | ||
75 | // remoteVideosEvents | ||
76 | // ) | ||
77 | // | ||
78 | // // --------------------------------------------------------------------------- | ||
79 | // | ||
80 | // export { | ||
81 | // remoteVideosRouter | ||
82 | // } | ||
83 | // | ||
84 | // // --------------------------------------------------------------------------- | ||
85 | // | ||
86 | // function remoteVideos (req: express.Request, res: express.Response, next: express.NextFunction) { | ||
87 | // const requests: RemoteVideoRequest[] = req.body.data | ||
88 | // const fromPod = res.locals.secure.pod | ||
89 | // | ||
90 | // // We need to process in the same order to keep consistency | ||
91 | // Bluebird.each(requests, request => { | ||
92 | // const data = request.data | ||
93 | // | ||
94 | // // Get the function we need to call in order to process the request | ||
95 | // const fun = functionsHash[request.type] | ||
96 | // if (fun === undefined) { | ||
97 | // logger.error('Unknown remote request type %s.', request.type) | ||
98 | // return | ||
99 | // } | ||
100 | // | ||
101 | // return fun.call(this, data, fromPod) | ||
102 | // }) | ||
103 | // .catch(err => logger.error('Error managing remote videos.', err)) | ||
104 | // | ||
105 | // // Don't block the other pod | ||
106 | // return res.type('json').status(204).end() | ||
107 | // } | ||
108 | // | ||
109 | // function remoteVideosQadu (req: express.Request, res: express.Response, next: express.NextFunction) { | ||
110 | // const requests: RemoteQaduVideoRequest[] = req.body.data | ||
111 | // const fromPod = res.locals.secure.pod | ||
112 | // | ||
113 | // Bluebird.each(requests, request => { | ||
114 | // const videoData = request.data | ||
115 | // | ||
116 | // return quickAndDirtyUpdateVideoRetryWrapper(videoData, fromPod) | ||
117 | // }) | ||
118 | // .catch(err => logger.error('Error managing remote videos.', err)) | ||
119 | // | ||
120 | // return res.type('json').status(204).end() | ||
121 | // } | ||
122 | // | ||
123 | // function remoteVideosEvents (req: express.Request, res: express.Response, next: express.NextFunction) { | ||
124 | // const requests: RemoteVideoEventRequest[] = req.body.data | ||
125 | // const fromPod = res.locals.secure.pod | ||
126 | // | ||
127 | // Bluebird.each(requests, request => { | ||
128 | // const eventData = request.data | ||
129 | // | ||
130 | // return processVideosEventsRetryWrapper(eventData, fromPod) | ||
131 | // }) | ||
132 | // .catch(err => logger.error('Error managing remote videos.', err)) | ||
133 | // | ||
134 | // return res.type('json').status(204).end() | ||
135 | // } | ||
136 | // | ||
137 | // async function processVideosEventsRetryWrapper (eventData: RemoteVideoEventData, fromPod: PodInstance) { | ||
138 | // const options = { | ||
139 | // arguments: [ eventData, fromPod ], | ||
140 | // errorMessage: 'Cannot process videos events with many retries.' | ||
141 | // } | ||
142 | // | ||
143 | // await retryTransactionWrapper(processVideosEvents, options) | ||
144 | // } | ||
145 | // | ||
146 | // async function processVideosEvents (eventData: RemoteVideoEventData, fromPod: PodInstance) { | ||
147 | // await db.sequelize.transaction(async t => { | ||
148 | // const sequelizeOptions = { transaction: t } | ||
149 | // const videoInstance = await fetchLocalVideoByUUID(eventData.uuid, t) | ||
150 | // | ||
151 | // let columnToUpdate | ||
152 | // let qaduType | ||
153 | // | ||
154 | // switch (eventData.eventType) { | ||
155 | // case REQUEST_VIDEO_EVENT_TYPES.VIEWS: | ||
156 | // columnToUpdate = 'views' | ||
157 | // qaduType = REQUEST_VIDEO_QADU_TYPES.VIEWS | ||
158 | // break | ||
159 | // | ||
160 | // case REQUEST_VIDEO_EVENT_TYPES.LIKES: | ||
161 | // columnToUpdate = 'likes' | ||
162 | // qaduType = REQUEST_VIDEO_QADU_TYPES.LIKES | ||
163 | // break | ||
164 | // | ||
165 | // case REQUEST_VIDEO_EVENT_TYPES.DISLIKES: | ||
166 | // columnToUpdate = 'dislikes' | ||
167 | // qaduType = REQUEST_VIDEO_QADU_TYPES.DISLIKES | ||
168 | // break | ||
169 | // | ||
170 | // default: | ||
171 | // throw new Error('Unknown video event type.') | ||
172 | // } | ||
173 | // | ||
174 | // const query = {} | ||
175 | // query[columnToUpdate] = eventData.count | ||
176 | // | ||
177 | // await videoInstance.increment(query, sequelizeOptions) | ||
178 | // | ||
179 | // const qadusParams = [ | ||
180 | // { | ||
181 | // videoId: videoInstance.id, | ||
182 | // type: qaduType | ||
183 | // } | ||
184 | // ] | ||
185 | // await quickAndDirtyUpdatesVideoToFriends(qadusParams, t) | ||
186 | // }) | ||
187 | // | ||
188 | // logger.info('Remote video event processed for video with uuid %s.', eventData.uuid) | ||
189 | // } | ||
190 | // | ||
191 | // async function quickAndDirtyUpdateVideoRetryWrapper (videoData: RemoteQaduVideoData, fromPod: PodInstance) { | ||
192 | // const options = { | ||
193 | // arguments: [ videoData, fromPod ], | ||
194 | // errorMessage: 'Cannot update quick and dirty the remote video with many retries.' | ||
195 | // } | ||
196 | // | ||
197 | // await retryTransactionWrapper(quickAndDirtyUpdateVideo, options) | ||
198 | // } | ||
199 | // | ||
200 | // async function quickAndDirtyUpdateVideo (videoData: RemoteQaduVideoData, fromPod: PodInstance) { | ||
201 | // let videoUUID = '' | ||
202 | // | ||
203 | // await db.sequelize.transaction(async t => { | ||
204 | // const videoInstance = await fetchVideoByHostAndUUID(fromPod.host, videoData.uuid, t) | ||
205 | // const sequelizeOptions = { transaction: t } | ||
206 | // | ||
207 | // videoUUID = videoInstance.uuid | ||
208 | // | ||
209 | // if (videoData.views) { | ||
210 | // videoInstance.set('views', videoData.views) | ||
211 | // } | ||
212 | // | ||
213 | // if (videoData.likes) { | ||
214 | // videoInstance.set('likes', videoData.likes) | ||
215 | // } | ||
216 | // | ||
217 | // if (videoData.dislikes) { | ||
218 | // videoInstance.set('dislikes', videoData.dislikes) | ||
219 | // } | ||
220 | // | ||
221 | // await videoInstance.save(sequelizeOptions) | ||
222 | // }) | ||
223 | // | ||
224 | // logger.info('Remote video with uuid %s quick and dirty updated', videoUUID) | ||
225 | // } | ||
226 | // | ||
227 | // async function reportAbuseRemoteVideoRetryWrapper (reportData: RemoteVideoReportAbuseData, fromPod: PodInstance) { | ||
228 | // const options = { | ||
229 | // arguments: [ reportData, fromPod ], | ||
230 | // errorMessage: 'Cannot create remote abuse video with many retries.' | ||
231 | // } | ||
232 | // | ||
233 | // await retryTransactionWrapper(reportAbuseRemoteVideo, options) | ||
234 | // } | ||
235 | // | ||
236 | // async function reportAbuseRemoteVideo (reportData: RemoteVideoReportAbuseData, fromPod: PodInstance) { | ||
237 | // logger.debug('Reporting remote abuse for video %s.', reportData.videoUUID) | ||
238 | // | ||
239 | // await db.sequelize.transaction(async t => { | ||
240 | // const videoInstance = await fetchLocalVideoByUUID(reportData.videoUUID, t) | ||
241 | // const videoAbuseData = { | ||
242 | // reporterUsername: reportData.reporterUsername, | ||
243 | // reason: reportData.reportReason, | ||
244 | // reporterPodId: fromPod.id, | ||
245 | // videoId: videoInstance.id | ||
246 | // } | ||
247 | // | ||
248 | // await db.VideoAbuse.create(videoAbuseData) | ||
249 | // | ||
250 | // }) | ||
251 | // | ||
252 | // logger.info('Remote abuse for video uuid %s created', reportData.videoUUID) | ||
253 | // } | ||
254 | // | ||
255 | // async function fetchLocalVideoByUUID (id: string, t: Sequelize.Transaction) { | ||
256 | // try { | ||
257 | // const video = await db.Video.loadLocalVideoByUUID(id, t) | ||
258 | // | ||
259 | // if (!video) throw new Error('Video ' + id + ' not found') | ||
260 | // | ||
261 | // return video | ||
262 | // } catch (err) { | ||
263 | // logger.error('Cannot load owned video from id.', { error: err.stack, id }) | ||
264 | // throw err | ||
265 | // } | ||
266 | // } | ||
267 | // | ||
268 | // async function fetchVideoByHostAndUUID (podHost: string, uuid: string, t: Sequelize.Transaction) { | ||
269 | // try { | ||
270 | // const video = await db.Video.loadByHostAndUUID(podHost, uuid, t) | ||
271 | // if (!video) throw new Error('Video not found') | ||
272 | // | ||
273 | // return video | ||
274 | // } catch (err) { | ||
275 | // logger.error('Cannot load video from host and uuid.', { error: err.stack, podHost, uuid }) | ||
276 | // throw err | ||
277 | // } | ||
278 | // } | ||
diff --git a/server/controllers/api/index.ts b/server/controllers/api/index.ts index a22c78cce..876c911c7 100644 --- a/server/controllers/api/index.ts +++ b/server/controllers/api/index.ts | |||
@@ -4,7 +4,7 @@ import { badRequest } from '../../helpers' | |||
4 | 4 | ||
5 | import { oauthClientsRouter } from './oauth-clients' | 5 | import { oauthClientsRouter } from './oauth-clients' |
6 | import { configRouter } from './config' | 6 | import { configRouter } from './config' |
7 | import { applicationRouter } from './application' | 7 | import { applicationRouter } from './server' |
8 | import { usersRouter } from './users' | 8 | import { usersRouter } from './users' |
9 | import { videosRouter } from './videos' | 9 | import { videosRouter } from './videos' |
10 | 10 | ||
diff --git a/server/controllers/api/application/follows.ts b/server/controllers/api/server/follows.ts index 000bbd23e..c9775ad21 100644 --- a/server/controllers/api/application/follows.ts +++ b/server/controllers/api/server/follows.ts | |||
@@ -9,10 +9,10 @@ import { database as db } from '../../../initializers/database' | |||
9 | import { sendFollow } from '../../../lib/activitypub/send-request' | 9 | import { sendFollow } from '../../../lib/activitypub/send-request' |
10 | import { asyncMiddleware, paginationValidator, setFollowersSort, setPagination } from '../../../middlewares' | 10 | import { asyncMiddleware, paginationValidator, setFollowersSort, setPagination } from '../../../middlewares' |
11 | import { authenticate } from '../../../middlewares/oauth' | 11 | import { authenticate } from '../../../middlewares/oauth' |
12 | import { setBodyHostsPort } from '../../../middlewares/pods' | 12 | import { setBodyHostsPort } from '../../../middlewares/servers' |
13 | import { setFollowingSort } from '../../../middlewares/sort' | 13 | import { setFollowingSort } from '../../../middlewares/sort' |
14 | import { ensureUserHasRight } from '../../../middlewares/user-right' | 14 | import { ensureUserHasRight } from '../../../middlewares/user-right' |
15 | import { followValidator } from '../../../middlewares/validators/pods' | 15 | import { followValidator } from '../../../middlewares/validators/servers' |
16 | import { followersSortValidator, followingSortValidator } from '../../../middlewares/validators/sort' | 16 | import { followersSortValidator, followingSortValidator } from '../../../middlewares/validators/sort' |
17 | 17 | ||
18 | const applicationFollowsRouter = express.Router() | 18 | const applicationFollowsRouter = express.Router() |
diff --git a/server/controllers/api/application/index.ts b/server/controllers/api/server/index.ts index 011b971ed..011b971ed 100644 --- a/server/controllers/api/application/index.ts +++ b/server/controllers/api/server/index.ts | |||
diff --git a/server/controllers/api/videos/abuse.ts b/server/controllers/api/videos/abuse.ts index 7a3471116..29f901f60 100644 --- a/server/controllers/api/videos/abuse.ts +++ b/server/controllers/api/videos/abuse.ts | |||
@@ -70,12 +70,12 @@ async function reportVideoAbuse (req: express.Request, res: express.Response) { | |||
70 | reporterUsername, | 70 | reporterUsername, |
71 | reason: body.reason, | 71 | reason: body.reason, |
72 | videoId: videoInstance.id, | 72 | videoId: videoInstance.id, |
73 | reporterPodId: null // This is our pod that reported this abuse | 73 | reporterServerId: null // This is our server that reported this abuse |
74 | } | 74 | } |
75 | 75 | ||
76 | await db.sequelize.transaction(async t => { | 76 | await db.sequelize.transaction(async t => { |
77 | const abuse = await db.VideoAbuse.create(abuseToCreate, { transaction: t }) | 77 | const abuse = await db.VideoAbuse.create(abuseToCreate, { transaction: t }) |
78 | // We send the information to the destination pod | 78 | // We send the information to the destination server |
79 | if (videoInstance.isOwned() === false) { | 79 | if (videoInstance.isOwned() === false) { |
80 | const reportData = { | 80 | const reportData = { |
81 | reporterUsername, | 81 | reporterUsername, |
@@ -84,7 +84,7 @@ async function reportVideoAbuse (req: express.Request, res: express.Response) { | |||
84 | } | 84 | } |
85 | 85 | ||
86 | // await friends.reportAbuseVideoToFriend(reportData, videoInstance, t) | 86 | // await friends.reportAbuseVideoToFriend(reportData, videoInstance, t) |
87 | // TODO: send abuse to origin pod | 87 | // TODO: send abuse to origin server |
88 | } | 88 | } |
89 | }) | 89 | }) |
90 | 90 | ||
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 063839223..ebc07e179 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -233,7 +233,7 @@ async function addVideo (req: express.Request, res: express.Response, videoPhysi | |||
233 | 233 | ||
234 | // Let transcoding job send the video to friends because the video file extension might change | 234 | // Let transcoding job send the video to friends because the video file extension might change |
235 | if (CONFIG.TRANSCODING.ENABLED === true) return undefined | 235 | if (CONFIG.TRANSCODING.ENABLED === true) return undefined |
236 | // Don't send video to remote pods, it is private | 236 | // Don't send video to remote servers, it is private |
237 | if (video.privacy === VideoPrivacy.PRIVATE) return undefined | 237 | if (video.privacy === VideoPrivacy.PRIVATE) return undefined |
238 | 238 | ||
239 | await sendAddVideo(video, t) | 239 | await sendAddVideo(video, t) |
@@ -287,7 +287,7 @@ async function updateVideo (req: express.Request, res: express.Response) { | |||
287 | await sendUpdateVideoChannel(videoInstance, t) | 287 | await sendUpdateVideoChannel(videoInstance, t) |
288 | } | 288 | } |
289 | 289 | ||
290 | // Video is not private anymore, send a create action to remote pods | 290 | // Video is not private anymore, send a create action to remote servers |
291 | if (wasPrivateVideo === true && videoInstance.privacy !== VideoPrivacy.PRIVATE) { | 291 | if (wasPrivateVideo === true && videoInstance.privacy !== VideoPrivacy.PRIVATE) { |
292 | await sendAddVideo(videoInstance, t) | 292 | await sendAddVideo(videoInstance, t) |
293 | } | 293 | } |
@@ -365,7 +365,7 @@ async function removeVideo (req: express.Request, res: express.Response) { | |||
365 | } | 365 | } |
366 | 366 | ||
367 | async function searchVideos (req: express.Request, res: express.Response, next: express.NextFunction) { | 367 | async function searchVideos (req: express.Request, res: express.Response, next: express.NextFunction) { |
368 | const resultList = await db.Video.searchAndPopulateAccountAndPodAndTags( | 368 | const resultList = await db.Video.searchAndPopulateAccountAndServerAndTags( |
369 | req.params.value, | 369 | req.params.value, |
370 | req.query.field, | 370 | req.query.field, |
371 | req.query.start, | 371 | req.query.start, |
diff --git a/server/controllers/api/videos/rate.ts b/server/controllers/api/videos/rate.ts index 955277d25..8216dffd2 100644 --- a/server/controllers/api/videos/rate.ts +++ b/server/controllers/api/videos/rate.ts | |||
@@ -83,7 +83,7 @@ async function rateVideo (req: express.Request, res: express.Response) { | |||
83 | await videoInstance.increment(incrementQuery, sequelizeOptions) | 83 | await videoInstance.increment(incrementQuery, sequelizeOptions) |
84 | 84 | ||
85 | if (videoInstance.isOwned() === false) { | 85 | if (videoInstance.isOwned() === false) { |
86 | // TODO: Send a event to original pod | 86 | // TODO: Send a event to original server |
87 | } else { | 87 | } else { |
88 | // TODO: Send update to followers | 88 | // TODO: Send update to followers |
89 | } | 89 | } |
diff --git a/server/controllers/client.ts b/server/controllers/client.ts index 40dda7584..045a50ef0 100644 --- a/server/controllers/client.ts +++ b/server/controllers/client.ts | |||
@@ -110,9 +110,9 @@ async function generateWatchHtmlPage (req: express.Request, res: express.Respons | |||
110 | 110 | ||
111 | // Let Angular application handle errors | 111 | // Let Angular application handle errors |
112 | if (validator.isUUID(videoId, 4)) { | 112 | if (validator.isUUID(videoId, 4)) { |
113 | videoPromise = db.Video.loadByUUIDAndPopulateAccountAndPodAndTags(videoId) | 113 | videoPromise = db.Video.loadByUUIDAndPopulateAccountAndServerAndTags(videoId) |
114 | } else if (validator.isInt(videoId)) { | 114 | } else if (validator.isInt(videoId)) { |
115 | videoPromise = db.Video.loadAndPopulateAccountAndPodAndTags(+videoId) | 115 | videoPromise = db.Video.loadAndPopulateAccountAndServerAndTags(+videoId) |
116 | } else { | 116 | } else { |
117 | return res.sendFile(indexPath) | 117 | return res.sendFile(indexPath) |
118 | } | 118 | } |
diff --git a/server/controllers/static.ts b/server/controllers/static.ts index c7c952d6f..7425fd097 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts | |||
@@ -12,7 +12,7 @@ import { asyncMiddleware } from '../middlewares' | |||
12 | const staticRouter = express.Router() | 12 | const staticRouter = express.Router() |
13 | 13 | ||
14 | /* | 14 | /* |
15 | Cors is very important to let other pods access torrent and video files | 15 | Cors is very important to let other servers access torrent and video files |
16 | */ | 16 | */ |
17 | 17 | ||
18 | const torrentsPhysicalPath = CONFIG.STORAGE.TORRENTS_DIR | 18 | const torrentsPhysicalPath = CONFIG.STORAGE.TORRENTS_DIR |