diff options
Diffstat (limited to 'server/controllers/api')
27 files changed, 117 insertions, 74 deletions
diff --git a/server/controllers/api/abuse.ts b/server/controllers/api/abuse.ts index 25d6e2ab0..0ab74bdff 100644 --- a/server/controllers/api/abuse.ts +++ b/server/controllers/api/abuse.ts | |||
@@ -6,6 +6,7 @@ import { AbuseModel } from '@server/models/abuse/abuse' | |||
6 | import { AbuseMessageModel } from '@server/models/abuse/abuse-message' | 6 | import { AbuseMessageModel } from '@server/models/abuse/abuse-message' |
7 | import { getServerActor } from '@server/models/application/application' | 7 | import { getServerActor } from '@server/models/application/application' |
8 | import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse' | 8 | import { abusePredefinedReasonsMap } from '@shared/core-utils/abuse' |
9 | import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' | ||
9 | import { AbuseCreate, AbuseState, UserRight } from '../../../shared' | 10 | import { AbuseCreate, AbuseState, UserRight } from '../../../shared' |
10 | import { getFormattedObjects } from '../../helpers/utils' | 11 | import { getFormattedObjects } from '../../helpers/utils' |
11 | import { sequelizeTypescript } from '../../initializers/database' | 12 | import { sequelizeTypescript } from '../../initializers/database' |
@@ -141,7 +142,7 @@ async function updateAbuse (req: express.Request, res: express.Response) { | |||
141 | 142 | ||
142 | // Do not send the delete to other instances, we updated OUR copy of this abuse | 143 | // Do not send the delete to other instances, we updated OUR copy of this abuse |
143 | 144 | ||
144 | return res.sendStatus(204) | 145 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
145 | } | 146 | } |
146 | 147 | ||
147 | async function deleteAbuse (req: express.Request, res: express.Response) { | 148 | async function deleteAbuse (req: express.Request, res: express.Response) { |
@@ -153,7 +154,7 @@ async function deleteAbuse (req: express.Request, res: express.Response) { | |||
153 | 154 | ||
154 | // Do not send the delete to other instances, we delete OUR copy of this abuse | 155 | // Do not send the delete to other instances, we delete OUR copy of this abuse |
155 | 156 | ||
156 | return res.sendStatus(204) | 157 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
157 | } | 158 | } |
158 | 159 | ||
159 | async function reportAbuse (req: express.Request, res: express.Response) { | 160 | async function reportAbuse (req: express.Request, res: express.Response) { |
@@ -243,5 +244,5 @@ async function deleteAbuseMessage (req: express.Request, res: express.Response) | |||
243 | return abuseMessage.destroy({ transaction: t }) | 244 | return abuseMessage.destroy({ transaction: t }) |
244 | }) | 245 | }) |
245 | 246 | ||
246 | return res.sendStatus(204) | 247 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
247 | } | 248 | } |
diff --git a/server/controllers/api/bulk.ts b/server/controllers/api/bulk.ts index 1fe139c92..649351029 100644 --- a/server/controllers/api/bulk.ts +++ b/server/controllers/api/bulk.ts | |||
@@ -2,8 +2,9 @@ import * as express from 'express' | |||
2 | import { asyncMiddleware, authenticate } from '../../middlewares' | 2 | import { asyncMiddleware, authenticate } from '../../middlewares' |
3 | import { bulkRemoveCommentsOfValidator } from '@server/middlewares/validators/bulk' | 3 | import { bulkRemoveCommentsOfValidator } from '@server/middlewares/validators/bulk' |
4 | import { VideoCommentModel } from '@server/models/video/video-comment' | 4 | import { VideoCommentModel } from '@server/models/video/video-comment' |
5 | import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model' | ||
6 | import { removeComment } from '@server/lib/video-comment' | 5 | import { removeComment } from '@server/lib/video-comment' |
6 | import { BulkRemoveCommentsOfBody } from '@shared/models/bulk/bulk-remove-comments-of-body.model' | ||
7 | import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' | ||
7 | 8 | ||
8 | const bulkRouter = express.Router() | 9 | const bulkRouter = express.Router() |
9 | 10 | ||
@@ -33,7 +34,7 @@ async function bulkRemoveCommentsOf (req: express.Request, res: express.Response | |||
33 | const comments = await VideoCommentModel.listForBulkDelete(account, filter) | 34 | const comments = await VideoCommentModel.listForBulkDelete(account, filter) |
34 | 35 | ||
35 | // Don't wait result | 36 | // Don't wait result |
36 | res.sendStatus(204) | 37 | res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
37 | 38 | ||
38 | for (const comment of comments) { | 39 | for (const comment of comments) { |
39 | await removeComment(comment) | 40 | await removeComment(comment) |
diff --git a/server/controllers/api/index.ts b/server/controllers/api/index.ts index eda9e04d1..7ade1df3a 100644 --- a/server/controllers/api/index.ts +++ b/server/controllers/api/index.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import * as cors from 'cors' | 1 | import * as cors from 'cors' |
2 | import * as express from 'express' | 2 | import * as express from 'express' |
3 | import * as RateLimit from 'express-rate-limit' | 3 | import * as RateLimit from 'express-rate-limit' |
4 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
4 | import { badRequest } from '../../helpers/express-utils' | 5 | import { badRequest } from '../../helpers/express-utils' |
5 | import { CONFIG } from '../../initializers/config' | 6 | import { CONFIG } from '../../initializers/config' |
6 | import { abuseRouter } from './abuse' | 7 | import { abuseRouter } from './abuse' |
@@ -56,5 +57,5 @@ export { apiRouter } | |||
56 | // --------------------------------------------------------------------------- | 57 | // --------------------------------------------------------------------------- |
57 | 58 | ||
58 | function pong (req: express.Request, res: express.Response) { | 59 | function pong (req: express.Request, res: express.Response) { |
59 | return res.send('pong').status(200).end() | 60 | return res.send('pong').status(HttpStatusCode.OK_200).end() |
60 | } | 61 | } |
diff --git a/server/controllers/api/oauth-clients.ts b/server/controllers/api/oauth-clients.ts index b2de8bcf5..c21e2298d 100644 --- a/server/controllers/api/oauth-clients.ts +++ b/server/controllers/api/oauth-clients.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { OAuthClientLocal } from '../../../shared' | 2 | import { OAuthClientLocal } from '../../../shared' |
3 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
3 | import { logger } from '../../helpers/logger' | 4 | import { logger } from '../../helpers/logger' |
4 | import { CONFIG } from '../../initializers/config' | 5 | import { CONFIG } from '../../initializers/config' |
5 | import { asyncMiddleware } from '../../middlewares' | 6 | import { asyncMiddleware } from '../../middlewares' |
@@ -23,7 +24,7 @@ async function getLocalClient (req: express.Request, res: express.Response, next | |||
23 | // Don't make this check if this is a test instance | 24 | // Don't make this check if this is a test instance |
24 | if (process.env.NODE_ENV !== 'test' && req.get('host') !== headerHostShouldBe) { | 25 | if (process.env.NODE_ENV !== 'test' && req.get('host') !== headerHostShouldBe) { |
25 | logger.info('Getting client tokens for host %s is forbidden (expected %s).', req.get('host'), headerHostShouldBe) | 26 | logger.info('Getting client tokens for host %s is forbidden (expected %s).', req.get('host'), headerHostShouldBe) |
26 | return res.type('json').status(403).end() | 27 | return res.type('json').status(HttpStatusCode.FORBIDDEN_403).end() |
27 | } | 28 | } |
28 | 29 | ||
29 | const client = await OAuthClientModel.loadFirstClient() | 30 | const client = await OAuthClientModel.loadFirstClient() |
diff --git a/server/controllers/api/plugins.ts b/server/controllers/api/plugins.ts index f8a0d19ca..1c0b5edb1 100644 --- a/server/controllers/api/plugins.ts +++ b/server/controllers/api/plugins.ts | |||
@@ -27,6 +27,7 @@ import { listAvailablePluginsFromIndex } from '../../lib/plugins/plugin-index' | |||
27 | import { PeertubePluginIndexList } from '../../../shared/models/plugins/peertube-plugin-index-list.model' | 27 | import { PeertubePluginIndexList } from '../../../shared/models/plugins/peertube-plugin-index-list.model' |
28 | import { RegisteredServerSettings } from '../../../shared/models/plugins/register-server-setting.model' | 28 | import { RegisteredServerSettings } from '../../../shared/models/plugins/register-server-setting.model' |
29 | import { PublicServerSetting } from '../../../shared/models/plugins/public-server.setting' | 29 | import { PublicServerSetting } from '../../../shared/models/plugins/public-server.setting' |
30 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
30 | 31 | ||
31 | const pluginRouter = express.Router() | 32 | const pluginRouter = express.Router() |
32 | 33 | ||
@@ -140,7 +141,7 @@ async function installPlugin (req: express.Request, res: express.Response) { | |||
140 | return res.json(plugin.toFormattedJSON()) | 141 | return res.json(plugin.toFormattedJSON()) |
141 | } catch (err) { | 142 | } catch (err) { |
142 | logger.warn('Cannot install plugin %s.', toInstall, { err }) | 143 | logger.warn('Cannot install plugin %s.', toInstall, { err }) |
143 | return res.sendStatus(400) | 144 | return res.sendStatus(HttpStatusCode.BAD_REQUEST_400) |
144 | } | 145 | } |
145 | } | 146 | } |
146 | 147 | ||
@@ -155,7 +156,7 @@ async function updatePlugin (req: express.Request, res: express.Response) { | |||
155 | return res.json(plugin.toFormattedJSON()) | 156 | return res.json(plugin.toFormattedJSON()) |
156 | } catch (err) { | 157 | } catch (err) { |
157 | logger.warn('Cannot update plugin %s.', toUpdate, { err }) | 158 | logger.warn('Cannot update plugin %s.', toUpdate, { err }) |
158 | return res.sendStatus(400) | 159 | return res.sendStatus(HttpStatusCode.BAD_REQUEST_400) |
159 | } | 160 | } |
160 | } | 161 | } |
161 | 162 | ||
@@ -164,7 +165,7 @@ async function uninstallPlugin (req: express.Request, res: express.Response) { | |||
164 | 165 | ||
165 | await PluginManager.Instance.uninstall(body.npmName) | 166 | await PluginManager.Instance.uninstall(body.npmName) |
166 | 167 | ||
167 | return res.sendStatus(204) | 168 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
168 | } | 169 | } |
169 | 170 | ||
170 | function getPublicPluginSettings (req: express.Request, res: express.Response) { | 171 | function getPublicPluginSettings (req: express.Request, res: express.Response) { |
@@ -193,7 +194,7 @@ async function updatePluginSettings (req: express.Request, res: express.Response | |||
193 | 194 | ||
194 | await PluginManager.Instance.onSettingsChanged(plugin.name, plugin.settings) | 195 | await PluginManager.Instance.onSettingsChanged(plugin.name, plugin.settings) |
195 | 196 | ||
196 | return res.sendStatus(204) | 197 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
197 | } | 198 | } |
198 | 199 | ||
199 | async function listAvailablePlugins (req: express.Request, res: express.Response) { | 200 | async function listAvailablePlugins (req: express.Request, res: express.Response) { |
@@ -202,7 +203,7 @@ async function listAvailablePlugins (req: express.Request, res: express.Response | |||
202 | const resultList = await listAvailablePluginsFromIndex(query) | 203 | const resultList = await listAvailablePluginsFromIndex(query) |
203 | 204 | ||
204 | if (!resultList) { | 205 | if (!resultList) { |
205 | return res.status(503) | 206 | return res.status(HttpStatusCode.SERVICE_UNAVAILABLE_503) |
206 | .json({ error: 'Plugin index unavailable. Please retry later' }) | 207 | .json({ error: 'Plugin index unavailable. Please retry later' }) |
207 | .end() | 208 | .end() |
208 | } | 209 | } |
diff --git a/server/controllers/api/search.ts b/server/controllers/api/search.ts index 6e2d11d93..353fd171b 100644 --- a/server/controllers/api/search.ts +++ b/server/controllers/api/search.ts | |||
@@ -6,6 +6,7 @@ import { getOrCreateVideoAndAccountAndChannel } from '@server/lib/activitypub/vi | |||
6 | import { AccountBlocklistModel } from '@server/models/account/account-blocklist' | 6 | import { AccountBlocklistModel } from '@server/models/account/account-blocklist' |
7 | import { getServerActor } from '@server/models/application/application' | 7 | import { getServerActor } from '@server/models/application/application' |
8 | import { ServerBlocklistModel } from '@server/models/server/server-blocklist' | 8 | import { ServerBlocklistModel } from '@server/models/server/server-blocklist' |
9 | import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' | ||
9 | import { ResultList, Video, VideoChannel } from '@shared/models' | 10 | import { ResultList, Video, VideoChannel } from '@shared/models' |
10 | import { SearchTargetQuery } from '@shared/models/search/search-target-query.model' | 11 | import { SearchTargetQuery } from '@shared/models/search/search-target-query.model' |
11 | import { VideoChannelsSearchQuery, VideosSearchQuery } from '../../../shared/models/search' | 12 | import { VideoChannelsSearchQuery, VideosSearchQuery } from '../../../shared/models/search' |
@@ -99,7 +100,7 @@ async function searchVideoChannelsIndex (query: VideoChannelsSearchQuery, res: e | |||
99 | } catch (err) { | 100 | } catch (err) { |
100 | logger.warn('Cannot use search index to make video channels search.', { err }) | 101 | logger.warn('Cannot use search index to make video channels search.', { err }) |
101 | 102 | ||
102 | return res.sendStatus(500) | 103 | return res.sendStatus(HttpStatusCode.INTERNAL_SERVER_ERROR_500) |
103 | } | 104 | } |
104 | } | 105 | } |
105 | 106 | ||
@@ -191,7 +192,7 @@ async function searchVideosIndex (query: VideosSearchQuery, res: express.Respons | |||
191 | } catch (err) { | 192 | } catch (err) { |
192 | logger.warn('Cannot use search index to make video search.', { err }) | 193 | logger.warn('Cannot use search index to make video search.', { err }) |
193 | 194 | ||
194 | return res.sendStatus(500) | 195 | return res.sendStatus(HttpStatusCode.INTERNAL_SERVER_ERROR_500) |
195 | } | 196 | } |
196 | } | 197 | } |
197 | 198 | ||
diff --git a/server/controllers/api/server/contact.ts b/server/controllers/api/server/contact.ts index de02ffc0b..caddc0909 100644 --- a/server/controllers/api/server/contact.ts +++ b/server/controllers/api/server/contact.ts | |||
@@ -3,6 +3,7 @@ import { asyncMiddleware, contactAdministratorValidator } from '../../../middlew | |||
3 | import { Redis } from '../../../lib/redis' | 3 | import { Redis } from '../../../lib/redis' |
4 | import { Emailer } from '../../../lib/emailer' | 4 | import { Emailer } from '../../../lib/emailer' |
5 | import { ContactForm } from '../../../../shared/models/server' | 5 | import { ContactForm } from '../../../../shared/models/server' |
6 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
6 | 7 | ||
7 | const contactRouter = express.Router() | 8 | const contactRouter = express.Router() |
8 | 9 | ||
@@ -18,7 +19,7 @@ async function contactAdministrator (req: express.Request, res: express.Response | |||
18 | 19 | ||
19 | await Redis.Instance.setContactFormIp(req.ip) | 20 | await Redis.Instance.setContactFormIp(req.ip) |
20 | 21 | ||
21 | return res.status(204).end() | 22 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
22 | } | 23 | } |
23 | 24 | ||
24 | // --------------------------------------------------------------------------- | 25 | // --------------------------------------------------------------------------- |
diff --git a/server/controllers/api/server/follows.ts b/server/controllers/api/server/follows.ts index 517d1897e..80025bc5b 100644 --- a/server/controllers/api/server/follows.ts +++ b/server/controllers/api/server/follows.ts | |||
@@ -28,6 +28,7 @@ import { removeRedundanciesOfServer } from '../../../lib/redundancy' | |||
28 | import { sequelizeTypescript } from '../../../initializers/database' | 28 | import { sequelizeTypescript } from '../../../initializers/database' |
29 | import { autoFollowBackIfNeeded } from '../../../lib/activitypub/follow' | 29 | import { autoFollowBackIfNeeded } from '../../../lib/activitypub/follow' |
30 | import { getServerActor } from '@server/models/application/application' | 30 | import { getServerActor } from '@server/models/application/application' |
31 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
31 | 32 | ||
32 | const serverFollowsRouter = express.Router() | 33 | const serverFollowsRouter = express.Router() |
33 | serverFollowsRouter.get('/following', | 34 | serverFollowsRouter.get('/following', |
@@ -138,7 +139,7 @@ async function followInstance (req: express.Request, res: express.Response) { | |||
138 | JobQueue.Instance.createJob({ type: 'activitypub-follow', payload }) | 139 | JobQueue.Instance.createJob({ type: 'activitypub-follow', payload }) |
139 | } | 140 | } |
140 | 141 | ||
141 | return res.status(204).end() | 142 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
142 | } | 143 | } |
143 | 144 | ||
144 | async function removeFollowing (req: express.Request, res: express.Response) { | 145 | async function removeFollowing (req: express.Request, res: express.Response) { |
@@ -159,7 +160,7 @@ async function removeFollowing (req: express.Request, res: express.Response) { | |||
159 | await follow.destroy({ transaction: t }) | 160 | await follow.destroy({ transaction: t }) |
160 | }) | 161 | }) |
161 | 162 | ||
162 | return res.status(204).end() | 163 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
163 | } | 164 | } |
164 | 165 | ||
165 | async function removeOrRejectFollower (req: express.Request, res: express.Response) { | 166 | async function removeOrRejectFollower (req: express.Request, res: express.Response) { |
@@ -169,7 +170,7 @@ async function removeOrRejectFollower (req: express.Request, res: express.Respon | |||
169 | 170 | ||
170 | await follow.destroy() | 171 | await follow.destroy() |
171 | 172 | ||
172 | return res.status(204).end() | 173 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
173 | } | 174 | } |
174 | 175 | ||
175 | async function acceptFollower (req: express.Request, res: express.Response) { | 176 | async function acceptFollower (req: express.Request, res: express.Response) { |
@@ -182,5 +183,5 @@ async function acceptFollower (req: express.Request, res: express.Response) { | |||
182 | 183 | ||
183 | await autoFollowBackIfNeeded(follow) | 184 | await autoFollowBackIfNeeded(follow) |
184 | 185 | ||
185 | return res.status(204).end() | 186 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
186 | } | 187 | } |
diff --git a/server/controllers/api/server/redundancy.ts b/server/controllers/api/server/redundancy.ts index 1ced0759e..7c13dc21b 100644 --- a/server/controllers/api/server/redundancy.ts +++ b/server/controllers/api/server/redundancy.ts | |||
@@ -19,6 +19,7 @@ import { removeRedundanciesOfServer, removeVideoRedundancy } from '../../../lib/ | |||
19 | import { logger } from '../../../helpers/logger' | 19 | import { logger } from '../../../helpers/logger' |
20 | import { VideoRedundancyModel } from '@server/models/redundancy/video-redundancy' | 20 | import { VideoRedundancyModel } from '@server/models/redundancy/video-redundancy' |
21 | import { JobQueue } from '@server/lib/job-queue' | 21 | import { JobQueue } from '@server/lib/job-queue' |
22 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
22 | 23 | ||
23 | const serverRedundancyRouter = express.Router() | 24 | const serverRedundancyRouter = express.Router() |
24 | 25 | ||
@@ -89,13 +90,13 @@ async function addVideoRedundancy (req: express.Request, res: express.Response) | |||
89 | payload | 90 | payload |
90 | }) | 91 | }) |
91 | 92 | ||
92 | return res.sendStatus(204) | 93 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
93 | } | 94 | } |
94 | 95 | ||
95 | async function removeVideoRedundancyController (req: express.Request, res: express.Response) { | 96 | async function removeVideoRedundancyController (req: express.Request, res: express.Response) { |
96 | await removeVideoRedundancy(res.locals.videoRedundancy) | 97 | await removeVideoRedundancy(res.locals.videoRedundancy) |
97 | 98 | ||
98 | return res.sendStatus(204) | 99 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
99 | } | 100 | } |
100 | 101 | ||
101 | async function updateRedundancy (req: express.Request, res: express.Response) { | 102 | async function updateRedundancy (req: express.Request, res: express.Response) { |
@@ -109,5 +110,5 @@ async function updateRedundancy (req: express.Request, res: express.Response) { | |||
109 | removeRedundanciesOfServer(server.id) | 110 | removeRedundanciesOfServer(server.id) |
110 | .catch(err => logger.error('Cannot remove redundancy of %s.', server.host, { err })) | 111 | .catch(err => logger.error('Cannot remove redundancy of %s.', server.host, { err })) |
111 | 112 | ||
112 | return res.sendStatus(204) | 113 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
113 | } | 114 | } |
diff --git a/server/controllers/api/server/server-blocklist.ts b/server/controllers/api/server/server-blocklist.ts index 78e8a7e09..6e341c0fb 100644 --- a/server/controllers/api/server/server-blocklist.ts +++ b/server/controllers/api/server/server-blocklist.ts | |||
@@ -25,6 +25,7 @@ import { | |||
25 | } from '../../../middlewares/validators' | 25 | } from '../../../middlewares/validators' |
26 | import { AccountBlocklistModel } from '../../../models/account/account-blocklist' | 26 | import { AccountBlocklistModel } from '../../../models/account/account-blocklist' |
27 | import { ServerBlocklistModel } from '../../../models/server/server-blocklist' | 27 | import { ServerBlocklistModel } from '../../../models/server/server-blocklist' |
28 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
28 | 29 | ||
29 | const serverBlocklistRouter = express.Router() | 30 | const serverBlocklistRouter = express.Router() |
30 | 31 | ||
@@ -108,7 +109,7 @@ async function blockAccount (req: express.Request, res: express.Response) { | |||
108 | forUserId: null // For all users | 109 | forUserId: null // For all users |
109 | }).catch(err => logger.error('Cannot remove notifications after an account mute.', { err })) | 110 | }).catch(err => logger.error('Cannot remove notifications after an account mute.', { err })) |
110 | 111 | ||
111 | return res.status(204).end() | 112 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
112 | } | 113 | } |
113 | 114 | ||
114 | async function unblockAccount (req: express.Request, res: express.Response) { | 115 | async function unblockAccount (req: express.Request, res: express.Response) { |
@@ -116,7 +117,7 @@ async function unblockAccount (req: express.Request, res: express.Response) { | |||
116 | 117 | ||
117 | await removeAccountFromBlocklist(accountBlock) | 118 | await removeAccountFromBlocklist(accountBlock) |
118 | 119 | ||
119 | return res.status(204).end() | 120 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
120 | } | 121 | } |
121 | 122 | ||
122 | async function listBlockedServers (req: express.Request, res: express.Response) { | 123 | async function listBlockedServers (req: express.Request, res: express.Response) { |
@@ -145,7 +146,7 @@ async function blockServer (req: express.Request, res: express.Response) { | |||
145 | forUserId: null // For all users | 146 | forUserId: null // For all users |
146 | }).catch(err => logger.error('Cannot remove notifications after a server mute.', { err })) | 147 | }).catch(err => logger.error('Cannot remove notifications after a server mute.', { err })) |
147 | 148 | ||
148 | return res.status(204).end() | 149 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
149 | } | 150 | } |
150 | 151 | ||
151 | async function unblockServer (req: express.Request, res: express.Response) { | 152 | async function unblockServer (req: express.Request, res: express.Response) { |
@@ -153,5 +154,5 @@ async function unblockServer (req: express.Request, res: express.Response) { | |||
153 | 154 | ||
154 | await removeServerFromBlocklist(serverBlock) | 155 | await removeServerFromBlocklist(serverBlock) |
155 | 156 | ||
156 | return res.status(204).end() | 157 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
157 | } | 158 | } |
diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts index 5b113feac..d743a9912 100644 --- a/server/controllers/api/users/index.ts +++ b/server/controllers/api/users/index.ts | |||
@@ -52,6 +52,7 @@ import { myVideosHistoryRouter } from './my-history' | |||
52 | import { myNotificationsRouter } from './my-notifications' | 52 | import { myNotificationsRouter } from './my-notifications' |
53 | import { mySubscriptionsRouter } from './my-subscriptions' | 53 | import { mySubscriptionsRouter } from './my-subscriptions' |
54 | import { myVideoPlaylistsRouter } from './my-video-playlists' | 54 | import { myVideoPlaylistsRouter } from './my-video-playlists' |
55 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
55 | 56 | ||
56 | const auditLogger = auditLoggerFactory('users') | 57 | const auditLogger = auditLoggerFactory('users') |
57 | 58 | ||
@@ -255,7 +256,7 @@ async function registerUser (req: express.Request, res: express.Response) { | |||
255 | 256 | ||
256 | Hooks.runAction('action:api.user.registered', { body, user, account, videoChannel }) | 257 | Hooks.runAction('action:api.user.registered', { body, user, account, videoChannel }) |
257 | 258 | ||
258 | return res.type('json').status(204).end() | 259 | return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end() |
259 | } | 260 | } |
260 | 261 | ||
261 | async function unblockUser (req: express.Request, res: express.Response) { | 262 | async function unblockUser (req: express.Request, res: express.Response) { |
@@ -265,7 +266,7 @@ async function unblockUser (req: express.Request, res: express.Response) { | |||
265 | 266 | ||
266 | Hooks.runAction('action:api.user.unblocked', { user }) | 267 | Hooks.runAction('action:api.user.unblocked', { user }) |
267 | 268 | ||
268 | return res.status(204).end() | 269 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
269 | } | 270 | } |
270 | 271 | ||
271 | async function blockUser (req: express.Request, res: express.Response) { | 272 | async function blockUser (req: express.Request, res: express.Response) { |
@@ -276,7 +277,7 @@ async function blockUser (req: express.Request, res: express.Response) { | |||
276 | 277 | ||
277 | Hooks.runAction('action:api.user.blocked', { user }) | 278 | Hooks.runAction('action:api.user.blocked', { user }) |
278 | 279 | ||
279 | return res.status(204).end() | 280 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
280 | } | 281 | } |
281 | 282 | ||
282 | function getUser (req: express.Request, res: express.Response) { | 283 | function getUser (req: express.Request, res: express.Response) { |
@@ -310,7 +311,7 @@ async function removeUser (req: express.Request, res: express.Response) { | |||
310 | 311 | ||
311 | Hooks.runAction('action:api.user.deleted', { user }) | 312 | Hooks.runAction('action:api.user.deleted', { user }) |
312 | 313 | ||
313 | return res.sendStatus(204) | 314 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
314 | } | 315 | } |
315 | 316 | ||
316 | async function updateUser (req: express.Request, res: express.Response) { | 317 | async function updateUser (req: express.Request, res: express.Response) { |
@@ -338,7 +339,7 @@ async function updateUser (req: express.Request, res: express.Response) { | |||
338 | 339 | ||
339 | // Don't need to send this update to followers, these attributes are not federated | 340 | // Don't need to send this update to followers, these attributes are not federated |
340 | 341 | ||
341 | return res.sendStatus(204) | 342 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
342 | } | 343 | } |
343 | 344 | ||
344 | async function askResetUserPassword (req: express.Request, res: express.Response) { | 345 | async function askResetUserPassword (req: express.Request, res: express.Response) { |
@@ -348,7 +349,7 @@ async function askResetUserPassword (req: express.Request, res: express.Response | |||
348 | const url = WEBSERVER.URL + '/reset-password?userId=' + user.id + '&verificationString=' + verificationString | 349 | const url = WEBSERVER.URL + '/reset-password?userId=' + user.id + '&verificationString=' + verificationString |
349 | await Emailer.Instance.addPasswordResetEmailJob(user.username, user.email, url) | 350 | await Emailer.Instance.addPasswordResetEmailJob(user.username, user.email, url) |
350 | 351 | ||
351 | return res.status(204).end() | 352 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
352 | } | 353 | } |
353 | 354 | ||
354 | async function resetUserPassword (req: express.Request, res: express.Response) { | 355 | async function resetUserPassword (req: express.Request, res: express.Response) { |
@@ -358,7 +359,7 @@ async function resetUserPassword (req: express.Request, res: express.Response) { | |||
358 | await user.save() | 359 | await user.save() |
359 | await Redis.Instance.removePasswordVerificationString(user.id) | 360 | await Redis.Instance.removePasswordVerificationString(user.id) |
360 | 361 | ||
361 | return res.status(204).end() | 362 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
362 | } | 363 | } |
363 | 364 | ||
364 | async function reSendVerifyUserEmail (req: express.Request, res: express.Response) { | 365 | async function reSendVerifyUserEmail (req: express.Request, res: express.Response) { |
@@ -366,7 +367,7 @@ async function reSendVerifyUserEmail (req: express.Request, res: express.Respons | |||
366 | 367 | ||
367 | await sendVerifyUserEmail(user) | 368 | await sendVerifyUserEmail(user) |
368 | 369 | ||
369 | return res.status(204).end() | 370 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
370 | } | 371 | } |
371 | 372 | ||
372 | async function verifyUserEmail (req: express.Request, res: express.Response) { | 373 | async function verifyUserEmail (req: express.Request, res: express.Response) { |
@@ -380,7 +381,7 @@ async function verifyUserEmail (req: express.Request, res: express.Response) { | |||
380 | 381 | ||
381 | await user.save() | 382 | await user.save() |
382 | 383 | ||
383 | return res.status(204).end() | 384 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
384 | } | 385 | } |
385 | 386 | ||
386 | async function changeUserBlock (res: express.Response, user: MUserAccountDefault, block: boolean, reason?: string) { | 387 | async function changeUserBlock (res: express.Response, user: MUserAccountDefault, block: boolean, reason?: string) { |
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts index b490518fc..3d2a325fe 100644 --- a/server/controllers/api/users/me.ts +++ b/server/controllers/api/users/me.ts | |||
@@ -28,6 +28,7 @@ import { AccountVideoRateModel } from '../../../models/account/account-video-rat | |||
28 | import { UserModel } from '../../../models/account/user' | 28 | import { UserModel } from '../../../models/account/user' |
29 | import { VideoModel } from '../../../models/video/video' | 29 | import { VideoModel } from '../../../models/video/video' |
30 | import { VideoImportModel } from '../../../models/video/video-import' | 30 | import { VideoImportModel } from '../../../models/video/video-import' |
31 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
31 | 32 | ||
32 | const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.TMP_DIR }) | 33 | const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.TMP_DIR }) |
33 | 34 | ||
@@ -162,7 +163,7 @@ async function deleteMe (req: express.Request, res: express.Response) { | |||
162 | 163 | ||
163 | await user.destroy() | 164 | await user.destroy() |
164 | 165 | ||
165 | return res.sendStatus(204) | 166 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
166 | } | 167 | } |
167 | 168 | ||
168 | async function updateMe (req: express.Request, res: express.Response) { | 169 | async function updateMe (req: express.Request, res: express.Response) { |
@@ -210,7 +211,7 @@ async function updateMe (req: express.Request, res: express.Response) { | |||
210 | await sendVerifyUserEmail(user, true) | 211 | await sendVerifyUserEmail(user, true) |
211 | } | 212 | } |
212 | 213 | ||
213 | return res.sendStatus(204) | 214 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
214 | } | 215 | } |
215 | 216 | ||
216 | async function updateMyAvatar (req: express.Request, res: express.Response) { | 217 | async function updateMyAvatar (req: express.Request, res: express.Response) { |
diff --git a/server/controllers/api/users/my-blocklist.ts b/server/controllers/api/users/my-blocklist.ts index 6eba22d52..faaef3ac0 100644 --- a/server/controllers/api/users/my-blocklist.ts +++ b/server/controllers/api/users/my-blocklist.ts | |||
@@ -22,6 +22,7 @@ import { addAccountInBlocklist, addServerInBlocklist, removeAccountFromBlocklist | |||
22 | import { ServerBlocklistModel } from '../../../models/server/server-blocklist' | 22 | import { ServerBlocklistModel } from '../../../models/server/server-blocklist' |
23 | import { UserNotificationModel } from '@server/models/account/user-notification' | 23 | import { UserNotificationModel } from '@server/models/account/user-notification' |
24 | import { logger } from '@server/helpers/logger' | 24 | import { logger } from '@server/helpers/logger' |
25 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
25 | 26 | ||
26 | const myBlocklistRouter = express.Router() | 27 | const myBlocklistRouter = express.Router() |
27 | 28 | ||
@@ -99,7 +100,7 @@ async function blockAccount (req: express.Request, res: express.Response) { | |||
99 | forUserId: user.id | 100 | forUserId: user.id |
100 | }).catch(err => logger.error('Cannot remove notifications after an account mute.', { err })) | 101 | }).catch(err => logger.error('Cannot remove notifications after an account mute.', { err })) |
101 | 102 | ||
102 | return res.status(204).end() | 103 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
103 | } | 104 | } |
104 | 105 | ||
105 | async function unblockAccount (req: express.Request, res: express.Response) { | 106 | async function unblockAccount (req: express.Request, res: express.Response) { |
@@ -107,7 +108,7 @@ async function unblockAccount (req: express.Request, res: express.Response) { | |||
107 | 108 | ||
108 | await removeAccountFromBlocklist(accountBlock) | 109 | await removeAccountFromBlocklist(accountBlock) |
109 | 110 | ||
110 | return res.status(204).end() | 111 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
111 | } | 112 | } |
112 | 113 | ||
113 | async function listBlockedServers (req: express.Request, res: express.Response) { | 114 | async function listBlockedServers (req: express.Request, res: express.Response) { |
@@ -136,7 +137,7 @@ async function blockServer (req: express.Request, res: express.Response) { | |||
136 | forUserId: user.id | 137 | forUserId: user.id |
137 | }).catch(err => logger.error('Cannot remove notifications after a server mute.', { err })) | 138 | }).catch(err => logger.error('Cannot remove notifications after a server mute.', { err })) |
138 | 139 | ||
139 | return res.status(204).end() | 140 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
140 | } | 141 | } |
141 | 142 | ||
142 | async function unblockServer (req: express.Request, res: express.Response) { | 143 | async function unblockServer (req: express.Request, res: express.Response) { |
@@ -144,5 +145,5 @@ async function unblockServer (req: express.Request, res: express.Response) { | |||
144 | 145 | ||
145 | await removeServerFromBlocklist(serverBlock) | 146 | await removeServerFromBlocklist(serverBlock) |
146 | 147 | ||
147 | return res.status(204).end() | 148 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
148 | } | 149 | } |
diff --git a/server/controllers/api/users/my-history.ts b/server/controllers/api/users/my-history.ts index dc915977f..80d4dc748 100644 --- a/server/controllers/api/users/my-history.ts +++ b/server/controllers/api/users/my-history.ts | |||
@@ -10,6 +10,7 @@ import { | |||
10 | import { getFormattedObjects } from '../../../helpers/utils' | 10 | import { getFormattedObjects } from '../../../helpers/utils' |
11 | import { UserVideoHistoryModel } from '../../../models/account/user-video-history' | 11 | import { UserVideoHistoryModel } from '../../../models/account/user-video-history' |
12 | import { sequelizeTypescript } from '../../../initializers/database' | 12 | import { sequelizeTypescript } from '../../../initializers/database' |
13 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
13 | 14 | ||
14 | const myVideosHistoryRouter = express.Router() | 15 | const myVideosHistoryRouter = express.Router() |
15 | 16 | ||
@@ -50,5 +51,7 @@ async function removeUserHistory (req: express.Request, res: express.Response) { | |||
50 | return UserVideoHistoryModel.removeUserHistoryBefore(user, beforeDate, t) | 51 | return UserVideoHistoryModel.removeUserHistoryBefore(user, beforeDate, t) |
51 | }) | 52 | }) |
52 | 53 | ||
53 | return res.type('json').status(204).end() | 54 | return res.type('json') |
55 | .status(HttpStatusCode.NO_CONTENT_204) | ||
56 | .end() | ||
54 | } | 57 | } |
diff --git a/server/controllers/api/users/my-notifications.ts b/server/controllers/api/users/my-notifications.ts index 050866960..5f5e4c5e6 100644 --- a/server/controllers/api/users/my-notifications.ts +++ b/server/controllers/api/users/my-notifications.ts | |||
@@ -19,6 +19,7 @@ import { | |||
19 | } from '../../../middlewares/validators/user-notifications' | 19 | } from '../../../middlewares/validators/user-notifications' |
20 | import { UserNotificationSetting } from '../../../../shared/models/users' | 20 | import { UserNotificationSetting } from '../../../../shared/models/users' |
21 | import { UserNotificationSettingModel } from '../../../models/account/user-notification-setting' | 21 | import { UserNotificationSettingModel } from '../../../models/account/user-notification-setting' |
22 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
22 | 23 | ||
23 | const myNotificationsRouter = express.Router() | 24 | const myNotificationsRouter = express.Router() |
24 | 25 | ||
@@ -84,7 +85,7 @@ async function updateNotificationSettings (req: express.Request, res: express.Re | |||
84 | 85 | ||
85 | await UserNotificationSettingModel.update(values, query) | 86 | await UserNotificationSettingModel.update(values, query) |
86 | 87 | ||
87 | return res.status(204).end() | 88 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
88 | } | 89 | } |
89 | 90 | ||
90 | async function listUserNotifications (req: express.Request, res: express.Response) { | 91 | async function listUserNotifications (req: express.Request, res: express.Response) { |
@@ -100,7 +101,7 @@ async function markAsReadUserNotifications (req: express.Request, res: express.R | |||
100 | 101 | ||
101 | await UserNotificationModel.markAsRead(user.id, req.body.ids) | 102 | await UserNotificationModel.markAsRead(user.id, req.body.ids) |
102 | 103 | ||
103 | return res.status(204).end() | 104 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
104 | } | 105 | } |
105 | 106 | ||
106 | async function markAsReadAllUserNotifications (req: express.Request, res: express.Response) { | 107 | async function markAsReadAllUserNotifications (req: express.Request, res: express.Response) { |
@@ -108,5 +109,5 @@ async function markAsReadAllUserNotifications (req: express.Request, res: expres | |||
108 | 109 | ||
109 | await UserNotificationModel.markAllAsRead(user.id) | 110 | await UserNotificationModel.markAllAsRead(user.id) |
110 | 111 | ||
111 | return res.status(204).end() | 112 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
112 | } | 113 | } |
diff --git a/server/controllers/api/users/my-subscriptions.ts b/server/controllers/api/users/my-subscriptions.ts index 66b33c477..ec77ddd7a 100644 --- a/server/controllers/api/users/my-subscriptions.ts +++ b/server/controllers/api/users/my-subscriptions.ts | |||
@@ -27,6 +27,7 @@ import { | |||
27 | import { ActorFollowModel } from '../../../models/activitypub/actor-follow' | 27 | import { ActorFollowModel } from '../../../models/activitypub/actor-follow' |
28 | import { VideoModel } from '../../../models/video/video' | 28 | import { VideoModel } from '../../../models/video/video' |
29 | import { sendUndoFollow } from '@server/lib/activitypub/send' | 29 | import { sendUndoFollow } from '@server/lib/activitypub/send' |
30 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
30 | 31 | ||
31 | const mySubscriptionsRouter = express.Router() | 32 | const mySubscriptionsRouter = express.Router() |
32 | 33 | ||
@@ -126,7 +127,7 @@ function addUserSubscription (req: express.Request, res: express.Response) { | |||
126 | 127 | ||
127 | JobQueue.Instance.createJob({ type: 'activitypub-follow', payload }) | 128 | JobQueue.Instance.createJob({ type: 'activitypub-follow', payload }) |
128 | 129 | ||
129 | return res.status(204).end() | 130 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
130 | } | 131 | } |
131 | 132 | ||
132 | function getUserSubscription (req: express.Request, res: express.Response) { | 133 | function getUserSubscription (req: express.Request, res: express.Response) { |
@@ -144,7 +145,9 @@ async function deleteUserSubscription (req: express.Request, res: express.Respon | |||
144 | return subscription.destroy({ transaction: t }) | 145 | return subscription.destroy({ transaction: t }) |
145 | }) | 146 | }) |
146 | 147 | ||
147 | return res.type('json').status(204).end() | 148 | return res.type('json') |
149 | .status(HttpStatusCode.NO_CONTENT_204) | ||
150 | .end() | ||
148 | } | 151 | } |
149 | 152 | ||
150 | async function getUserSubscriptions (req: express.Request, res: express.Response) { | 153 | async function getUserSubscriptions (req: express.Request, res: express.Response) { |
diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts index 45c936978..5c96950c5 100644 --- a/server/controllers/api/video-channel.ts +++ b/server/controllers/api/video-channel.ts | |||
@@ -38,6 +38,7 @@ import { AccountModel } from '../../models/account/account' | |||
38 | import { VideoModel } from '../../models/video/video' | 38 | import { VideoModel } from '../../models/video/video' |
39 | import { VideoChannelModel } from '../../models/video/video-channel' | 39 | import { VideoChannelModel } from '../../models/video/video-channel' |
40 | import { VideoPlaylistModel } from '../../models/video/video-playlist' | 40 | import { VideoPlaylistModel } from '../../models/video/video-playlist' |
41 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
41 | 42 | ||
42 | const auditLogger = auditLoggerFactory('channels') | 43 | const auditLogger = auditLoggerFactory('channels') |
43 | const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.TMP_DIR }) | 44 | const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.TMP_DIR }) |
@@ -212,7 +213,7 @@ async function updateVideoChannel (req: express.Request, res: express.Response) | |||
212 | throw err | 213 | throw err |
213 | } | 214 | } |
214 | 215 | ||
215 | res.type('json').status(204).end() | 216 | res.type('json').status(HttpStatusCode.NO_CONTENT_204).end() |
216 | 217 | ||
217 | // Don't process in a transaction, and after the response because it could be long | 218 | // Don't process in a transaction, and after the response because it could be long |
218 | if (doBulkVideoUpdate) { | 219 | if (doBulkVideoUpdate) { |
@@ -232,7 +233,7 @@ async function removeVideoChannel (req: express.Request, res: express.Response) | |||
232 | logger.info('Video channel %s deleted.', videoChannelInstance.Actor.url) | 233 | logger.info('Video channel %s deleted.', videoChannelInstance.Actor.url) |
233 | }) | 234 | }) |
234 | 235 | ||
235 | return res.type('json').status(204).end() | 236 | return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end() |
236 | } | 237 | } |
237 | 238 | ||
238 | async function getVideoChannel (req: express.Request, res: express.Response) { | 239 | async function getVideoChannel (req: express.Request, res: express.Response) { |
diff --git a/server/controllers/api/video-playlist.ts b/server/controllers/api/video-playlist.ts index fb08a63b2..f3dc8b2a9 100644 --- a/server/controllers/api/video-playlist.ts +++ b/server/controllers/api/video-playlist.ts | |||
@@ -42,6 +42,7 @@ import { | |||
42 | import { AccountModel } from '../../models/account/account' | 42 | import { AccountModel } from '../../models/account/account' |
43 | import { VideoPlaylistModel } from '../../models/video/video-playlist' | 43 | import { VideoPlaylistModel } from '../../models/video/video-playlist' |
44 | import { VideoPlaylistElementModel } from '../../models/video/video-playlist-element' | 44 | import { VideoPlaylistElementModel } from '../../models/video/video-playlist-element' |
45 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | ||
45 | 46 | ||
46 | const reqThumbnailFile = createReqFiles([ 'thumbnailfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { thumbnailfile: CONFIG.STORAGE.TMP_DIR }) | 47 | const reqThumbnailFile = createReqFiles([ 'thumbnailfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { thumbnailfile: CONFIG.STORAGE.TMP_DIR }) |
47 | 48 | ||
@@ -271,7 +272,7 @@ async function updateVideoPlaylist (req: express.Request, res: express.Response) | |||
271 | throw err | 272 | throw err |
272 | } | 273 | } |
273 | 274 | ||
274 | return res.type('json').status(204).end() | 275 | return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end() |
275 | } | 276 | } |
276 | 277 | ||
277 | async function removeVideoPlaylist (req: express.Request, res: express.Response) { | 278 | async function removeVideoPlaylist (req: express.Request, res: express.Response) { |
@@ -285,7 +286,7 @@ async function removeVideoPlaylist (req: express.Request, res: express.Response) | |||
285 | logger.info('Video playlist %s deleted.', videoPlaylistInstance.uuid) | 286 | logger.info('Video playlist %s deleted.', videoPlaylistInstance.uuid) |
286 | }) | 287 | }) |
287 | 288 | ||
288 | return res.type('json').status(204).end() | 289 | return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end() |
289 | } | 290 | } |
290 | 291 | ||
291 | async function addVideoInPlaylist (req: express.Request, res: express.Response) { | 292 | async function addVideoInPlaylist (req: express.Request, res: express.Response) { |
@@ -351,7 +352,7 @@ async function updateVideoPlaylistElement (req: express.Request, res: express.Re | |||
351 | 352 | ||
352 | logger.info('Element of position %d of playlist %s updated.', playlistElement.position, videoPlaylist.uuid) | 353 | logger.info('Element of position %d of playlist %s updated.', playlistElement.position, videoPlaylist.uuid) |
353 | 354 | ||
354 | return res.type('json').status(204).end() | 355 | return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end() |
355 | } | 356 | } |
356 | 357 | ||
357 | async function removeVideoFromPlaylist (req: express.Request, res: express.Response) { | 358 | async function removeVideoFromPlaylist (req: express.Request, res: express.Response) { |
@@ -379,7 +380,7 @@ async function removeVideoFromPlaylist (req: express.Request, res: express.Respo | |||
379 | sendUpdateVideoPlaylist(videoPlaylist, undefined) | 380 | sendUpdateVideoPlaylist(videoPlaylist, undefined) |
380 | .catch(err => logger.error('Cannot send video playlist update.', { err })) | 381 | .catch(err => logger.error('Cannot send video playlist update.', { err })) |
381 | 382 | ||
382 | return res.type('json').status(204).end() | 383 | return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end() |
383 | } | 384 | } |
384 | 385 | ||
385 | async function reorderVideosPlaylist (req: express.Request, res: express.Response) { | 386 | async function reorderVideosPlaylist (req: express.Request, res: express.Response) { |
@@ -391,7 +392,7 @@ async function reorderVideosPlaylist (req: express.Request, res: express.Respons | |||
391 | const reorderLength: number = body.reorderLength || 1 | 392 | const reorderLength: number = body.reorderLength || 1 |
392 | 393 | ||
393 | if (start === insertAfter) { | 394 | if (start === insertAfter) { |
394 | return res.status(204).end() | 395 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
395 | } | 396 | } |
396 | 397 | ||
397 | // Example: if we reorder position 2 and insert after position 5 (so at position 6): # 1 2 3 4 5 6 7 8 9 | 398 | // Example: if we reorder position 2 and insert after position 5 (so at position 6): # 1 2 3 4 5 6 7 8 9 |
@@ -432,7 +433,7 @@ async function reorderVideosPlaylist (req: express.Request, res: express.Respons | |||
432 | videoPlaylist.uuid, insertAfter, start, start + reorderLength - 1 | 433 | videoPlaylist.uuid, insertAfter, start, start + reorderLength - 1 |
433 | ) | 434 | ) |
434 | 435 | ||
435 | return res.type('json').status(204).end() | 436 | return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end() |
436 | } | 437 | } |
437 | 438 | ||
438 | async function getVideoPlaylistVideos (req: express.Request, res: express.Response) { | 439 | async function getVideoPlaylistVideos (req: express.Request, res: express.Response) { |
diff --git a/server/controllers/api/videos/blacklist.ts b/server/controllers/api/videos/blacklist.ts index 3b25ceea2..fa8448c86 100644 --- a/server/controllers/api/videos/blacklist.ts +++ b/server/controllers/api/videos/blacklist.ts | |||
@@ -18,6 +18,7 @@ import { | |||
18 | videosBlacklistUpdateValidator | 18 | videosBlacklistUpdateValidator |
19 | } from '../../../middlewares' | 19 | } from '../../../middlewares' |
20 | import { VideoBlacklistModel } from '../../../models/video/video-blacklist' | 20 | import { VideoBlacklistModel } from '../../../models/video/video-blacklist' |
21 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
21 | 22 | ||
22 | const blacklistRouter = express.Router() | 23 | const blacklistRouter = express.Router() |
23 | 24 | ||
@@ -69,7 +70,7 @@ async function addVideoToBlacklistController (req: express.Request, res: express | |||
69 | 70 | ||
70 | logger.info('Video %s blacklisted.', videoInstance.uuid) | 71 | logger.info('Video %s blacklisted.', videoInstance.uuid) |
71 | 72 | ||
72 | return res.type('json').sendStatus(204) | 73 | return res.type('json').sendStatus(HttpStatusCode.NO_CONTENT_204) |
73 | } | 74 | } |
74 | 75 | ||
75 | async function updateVideoBlacklistController (req: express.Request, res: express.Response) { | 76 | async function updateVideoBlacklistController (req: express.Request, res: express.Response) { |
@@ -81,7 +82,7 @@ async function updateVideoBlacklistController (req: express.Request, res: expres | |||
81 | return videoBlacklist.save({ transaction: t }) | 82 | return videoBlacklist.save({ transaction: t }) |
82 | }) | 83 | }) |
83 | 84 | ||
84 | return res.type('json').sendStatus(204) | 85 | return res.type('json').sendStatus(HttpStatusCode.NO_CONTENT_204) |
85 | } | 86 | } |
86 | 87 | ||
87 | async function listBlacklist (req: express.Request, res: express.Response) { | 88 | async function listBlacklist (req: express.Request, res: express.Response) { |
@@ -104,5 +105,5 @@ async function removeVideoFromBlacklistController (req: express.Request, res: ex | |||
104 | 105 | ||
105 | logger.info('Video %s removed from blacklist.', video.uuid) | 106 | logger.info('Video %s removed from blacklist.', video.uuid) |
106 | 107 | ||
107 | return res.type('json').sendStatus(204) | 108 | return res.type('json').sendStatus(HttpStatusCode.NO_CONTENT_204) |
108 | } | 109 | } |
diff --git a/server/controllers/api/videos/captions.ts b/server/controllers/api/videos/captions.ts index c4e2ee72c..bf82e2c19 100644 --- a/server/controllers/api/videos/captions.ts +++ b/server/controllers/api/videos/captions.ts | |||
@@ -11,6 +11,7 @@ import { moveAndProcessCaptionFile } from '../../../helpers/captions-utils' | |||
11 | import { CONFIG } from '../../../initializers/config' | 11 | import { CONFIG } from '../../../initializers/config' |
12 | import { sequelizeTypescript } from '../../../initializers/database' | 12 | import { sequelizeTypescript } from '../../../initializers/database' |
13 | import { MVideoCaptionVideo } from '@server/types/models' | 13 | import { MVideoCaptionVideo } from '@server/types/models' |
14 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
14 | 15 | ||
15 | const reqVideoCaptionAdd = createReqFiles( | 16 | const reqVideoCaptionAdd = createReqFiles( |
16 | [ 'captionfile' ], | 17 | [ 'captionfile' ], |
@@ -72,7 +73,7 @@ async function addVideoCaption (req: express.Request, res: express.Response) { | |||
72 | await federateVideoIfNeeded(video, false, t) | 73 | await federateVideoIfNeeded(video, false, t) |
73 | }) | 74 | }) |
74 | 75 | ||
75 | return res.status(204).end() | 76 | return res.status(HttpStatusCode.NO_CONTENT_204).end() |
76 | } | 77 | } |
77 | 78 | ||
78 | async function deleteVideoCaption (req: express.Request, res: express.Response) { | 79 | async function deleteVideoCaption (req: express.Request, res: express.Response) { |
@@ -88,5 +89,5 @@ async function deleteVideoCaption (req: express.Request, res: express.Response) | |||
88 | 89 | ||
89 | logger.info('Video caption %s of video %s deleted.', videoCaption.language, video.uuid) | 90 | logger.info('Video caption %s of video %s deleted.', videoCaption.language, video.uuid) |
90 | 91 | ||
91 | return res.type('json').status(204).end() | 92 | return res.type('json').status(HttpStatusCode.NO_CONTENT_204).end() |
92 | } | 93 | } |
diff --git a/server/controllers/api/videos/comment.ts b/server/controllers/api/videos/comment.ts index 020d0b104..752a33596 100644 --- a/server/controllers/api/videos/comment.ts +++ b/server/controllers/api/videos/comment.ts | |||
@@ -29,6 +29,7 @@ import { | |||
29 | } from '../../../middlewares/validators' | 29 | } from '../../../middlewares/validators' |
30 | import { AccountModel } from '../../../models/account/account' | 30 | import { AccountModel } from '../../../models/account/account' |
31 | import { VideoCommentModel } from '../../../models/video/video-comment' | 31 | import { VideoCommentModel } from '../../../models/video/video-comment' |
32 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
32 | 33 | ||
33 | const auditLogger = auditLoggerFactory('comments') | 34 | const auditLogger = auditLoggerFactory('comments') |
34 | const videoCommentRouter = express.Router() | 35 | const videoCommentRouter = express.Router() |
@@ -161,7 +162,7 @@ async function listVideoThreadComments (req: express.Request, res: express.Respo | |||
161 | } | 162 | } |
162 | 163 | ||
163 | if (resultList.data.length === 0) { | 164 | if (resultList.data.length === 0) { |
164 | return res.sendStatus(404) | 165 | return res.sendStatus(HttpStatusCode.NOT_FOUND_404) |
165 | } | 166 | } |
166 | 167 | ||
167 | return res.json(buildFormattedCommentTree(resultList)) | 168 | return res.json(buildFormattedCommentTree(resultList)) |
@@ -218,5 +219,7 @@ async function removeVideoComment (req: express.Request, res: express.Response) | |||
218 | 219 | ||
219 | auditLogger.delete(getAuditIdFromRes(res), new CommentAuditView(videoCommentInstance.toFormattedJSON())) | 220 | auditLogger.delete(getAuditIdFromRes(res), new CommentAuditView(videoCommentInstance.toFormattedJSON())) |
220 | 221 | ||
221 | return res.type('json').status(204).end() | 222 | return res.type('json') |
223 | .status(HttpStatusCode.NO_CONTENT_204) | ||
224 | .end() | ||
222 | } | 225 | } |
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts index bc5fea7aa..cd9ba046d 100644 --- a/server/controllers/api/videos/import.ts +++ b/server/controllers/api/videos/import.ts | |||
@@ -36,6 +36,7 @@ import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoIm | |||
36 | import { VideoModel } from '../../../models/video/video' | 36 | import { VideoModel } from '../../../models/video/video' |
37 | import { VideoCaptionModel } from '../../../models/video/video-caption' | 37 | import { VideoCaptionModel } from '../../../models/video/video-caption' |
38 | import { VideoImportModel } from '../../../models/video/video-import' | 38 | import { VideoImportModel } from '../../../models/video/video-import' |
39 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
39 | 40 | ||
40 | const auditLogger = auditLoggerFactory('video-imports') | 41 | const auditLogger = auditLoggerFactory('video-imports') |
41 | const videoImportsRouter = express.Router() | 42 | const videoImportsRouter = express.Router() |
@@ -146,7 +147,7 @@ async function addYoutubeDLImport (req: express.Request, res: express.Response) | |||
146 | } catch (err) { | 147 | } catch (err) { |
147 | logger.info('Cannot fetch information from import for URL %s.', targetUrl, { err }) | 148 | logger.info('Cannot fetch information from import for URL %s.', targetUrl, { err }) |
148 | 149 | ||
149 | return res.status(400).json({ | 150 | return res.status(HttpStatusCode.BAD_REQUEST_400).json({ |
150 | error: 'Cannot fetch remote information of this URL.' | 151 | error: 'Cannot fetch remote information of this URL.' |
151 | }).end() | 152 | }).end() |
152 | } | 153 | } |
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 71a0f97e2..e1c775180 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -66,6 +66,7 @@ import { liveRouter } from './live' | |||
66 | import { ownershipVideoRouter } from './ownership' | 66 | import { ownershipVideoRouter } from './ownership' |
67 | import { rateVideoRouter } from './rate' | 67 | import { rateVideoRouter } from './rate' |
68 | import { watchingRouter } from './watching' | 68 | import { watchingRouter } from './watching' |
69 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
69 | 70 | ||
70 | const auditLogger = auditLoggerFactory('videos') | 71 | const auditLogger = auditLoggerFactory('videos') |
71 | const videosRouter = express.Router() | 72 | const videosRouter = express.Router() |
@@ -178,7 +179,7 @@ async function addVideo (req: express.Request, res: express.Response) { | |||
178 | // Set timeout to 10 minutes, as Express's default is 2 minutes | 179 | // Set timeout to 10 minutes, as Express's default is 2 minutes |
179 | req.setTimeout(1000 * 60 * 10, () => { | 180 | req.setTimeout(1000 * 60 * 10, () => { |
180 | logger.error('Upload video has timed out.') | 181 | logger.error('Upload video has timed out.') |
181 | return res.sendStatus(408) | 182 | return res.sendStatus(HttpStatusCode.REQUEST_TIMEOUT_408) |
182 | }) | 183 | }) |
183 | 184 | ||
184 | const videoPhysicalFile = req.files['videofile'][0] | 185 | const videoPhysicalFile = req.files['videofile'][0] |
@@ -394,7 +395,9 @@ async function updateVideo (req: express.Request, res: express.Response) { | |||
394 | throw err | 395 | throw err |
395 | } | 396 | } |
396 | 397 | ||
397 | return res.type('json').status(204).end() | 398 | return res.type('json') |
399 | .status(HttpStatusCode.NO_CONTENT_204) | ||
400 | .end() | ||
398 | } | 401 | } |
399 | 402 | ||
400 | async function getVideo (req: express.Request, res: express.Response) { | 403 | async function getVideo (req: express.Request, res: express.Response) { |
@@ -421,7 +424,7 @@ async function viewVideo (req: express.Request, res: express.Response) { | |||
421 | const exists = await Redis.Instance.doesVideoIPViewExist(ip, immutableVideoAttrs.uuid) | 424 | const exists = await Redis.Instance.doesVideoIPViewExist(ip, immutableVideoAttrs.uuid) |
422 | if (exists) { | 425 | if (exists) { |
423 | logger.debug('View for ip %s and video %s already exists.', ip, immutableVideoAttrs.uuid) | 426 | logger.debug('View for ip %s and video %s already exists.', ip, immutableVideoAttrs.uuid) |
424 | return res.sendStatus(204) | 427 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
425 | } | 428 | } |
426 | 429 | ||
427 | const video = await VideoModel.load(immutableVideoAttrs.id) | 430 | const video = await VideoModel.load(immutableVideoAttrs.id) |
@@ -454,7 +457,7 @@ async function viewVideo (req: express.Request, res: express.Response) { | |||
454 | 457 | ||
455 | Hooks.runAction('action:api.video.viewed', { video, ip }) | 458 | Hooks.runAction('action:api.video.viewed', { video, ip }) |
456 | 459 | ||
457 | return res.sendStatus(204) | 460 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
458 | } | 461 | } |
459 | 462 | ||
460 | async function getVideoDescription (req: express.Request, res: express.Response) { | 463 | async function getVideoDescription (req: express.Request, res: express.Response) { |
@@ -517,5 +520,7 @@ async function removeVideo (req: express.Request, res: express.Response) { | |||
517 | 520 | ||
518 | Hooks.runAction('action:api.video.deleted', { video: videoInstance }) | 521 | Hooks.runAction('action:api.video.deleted', { video: videoInstance }) |
519 | 522 | ||
520 | return res.type('json').status(204).end() | 523 | return res.type('json') |
524 | .status(HttpStatusCode.NO_CONTENT_204) | ||
525 | .end() | ||
521 | } | 526 | } |
diff --git a/server/controllers/api/videos/live.ts b/server/controllers/api/videos/live.ts index e67d89612..04d2494ce 100644 --- a/server/controllers/api/videos/live.ts +++ b/server/controllers/api/videos/live.ts | |||
@@ -16,6 +16,7 @@ import { sequelizeTypescript } from '../../../initializers/database' | |||
16 | import { createVideoMiniatureFromExisting } from '../../../lib/thumbnail' | 16 | import { createVideoMiniatureFromExisting } from '../../../lib/thumbnail' |
17 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares' | 17 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares' |
18 | import { VideoModel } from '../../../models/video/video' | 18 | import { VideoModel } from '../../../models/video/video' |
19 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
19 | 20 | ||
20 | const liveRouter = express.Router() | 21 | const liveRouter = express.Router() |
21 | 22 | ||
@@ -75,7 +76,7 @@ async function updateLiveVideo (req: express.Request, res: express.Response) { | |||
75 | 76 | ||
76 | await federateVideoIfNeeded(video, false) | 77 | await federateVideoIfNeeded(video, false) |
77 | 78 | ||
78 | return res.sendStatus(204) | 79 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
79 | } | 80 | } |
80 | 81 | ||
81 | async function addLiveVideo (req: express.Request, res: express.Response) { | 82 | async function addLiveVideo (req: express.Request, res: express.Response) { |
diff --git a/server/controllers/api/videos/ownership.ts b/server/controllers/api/videos/ownership.ts index d76fee51d..86adb6c69 100644 --- a/server/controllers/api/videos/ownership.ts +++ b/server/controllers/api/videos/ownership.ts | |||
@@ -19,6 +19,7 @@ import { changeVideoChannelShare } from '../../../lib/activitypub/share' | |||
19 | import { sendUpdateVideo } from '../../../lib/activitypub/send' | 19 | import { sendUpdateVideo } from '../../../lib/activitypub/send' |
20 | import { VideoModel } from '../../../models/video/video' | 20 | import { VideoModel } from '../../../models/video/video' |
21 | import { MVideoFullLight } from '@server/types/models' | 21 | import { MVideoFullLight } from '@server/types/models' |
22 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
22 | 23 | ||
23 | const ownershipVideoRouter = express.Router() | 24 | const ownershipVideoRouter = express.Router() |
24 | 25 | ||
@@ -80,7 +81,9 @@ async function giveVideoOwnership (req: express.Request, res: express.Response) | |||
80 | }) | 81 | }) |
81 | 82 | ||
82 | logger.info('Ownership change for video %s created.', videoInstance.name) | 83 | logger.info('Ownership change for video %s created.', videoInstance.name) |
83 | return res.type('json').status(204).end() | 84 | return res.type('json') |
85 | .status(HttpStatusCode.NO_CONTENT_204) | ||
86 | .end() | ||
84 | } | 87 | } |
85 | 88 | ||
86 | async function listVideoOwnership (req: express.Request, res: express.Response) { | 89 | async function listVideoOwnership (req: express.Request, res: express.Response) { |
@@ -119,7 +122,7 @@ async function acceptOwnership (req: express.Request, res: express.Response) { | |||
119 | videoChangeOwnership.status = VideoChangeOwnershipStatus.ACCEPTED | 122 | videoChangeOwnership.status = VideoChangeOwnershipStatus.ACCEPTED |
120 | await videoChangeOwnership.save({ transaction: t }) | 123 | await videoChangeOwnership.save({ transaction: t }) |
121 | 124 | ||
122 | return res.sendStatus(204) | 125 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
123 | }) | 126 | }) |
124 | } | 127 | } |
125 | 128 | ||
@@ -130,6 +133,6 @@ async function refuseOwnership (req: express.Request, res: express.Response) { | |||
130 | videoChangeOwnership.status = VideoChangeOwnershipStatus.REFUSED | 133 | videoChangeOwnership.status = VideoChangeOwnershipStatus.REFUSED |
131 | await videoChangeOwnership.save({ transaction: t }) | 134 | await videoChangeOwnership.save({ transaction: t }) |
132 | 135 | ||
133 | return res.sendStatus(204) | 136 | return res.sendStatus(HttpStatusCode.NO_CONTENT_204) |
134 | }) | 137 | }) |
135 | } | 138 | } |
diff --git a/server/controllers/api/videos/rate.ts b/server/controllers/api/videos/rate.ts index df1eddb4f..520932c63 100644 --- a/server/controllers/api/videos/rate.ts +++ b/server/controllers/api/videos/rate.ts | |||
@@ -7,6 +7,7 @@ import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoUp | |||
7 | import { AccountModel } from '../../../models/account/account' | 7 | import { AccountModel } from '../../../models/account/account' |
8 | import { AccountVideoRateModel } from '../../../models/account/account-video-rate' | 8 | import { AccountVideoRateModel } from '../../../models/account/account-video-rate' |
9 | import { sequelizeTypescript } from '../../../initializers/database' | 9 | import { sequelizeTypescript } from '../../../initializers/database' |
10 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
10 | 11 | ||
11 | const rateVideoRouter = express.Router() | 12 | const rateVideoRouter = express.Router() |
12 | 13 | ||
@@ -78,5 +79,7 @@ async function rateVideo (req: express.Request, res: express.Response) { | |||
78 | logger.info('Account video rate for video %s of account %s updated.', videoInstance.name, accountInstance.name) | 79 | logger.info('Account video rate for video %s of account %s updated.', videoInstance.name, accountInstance.name) |
79 | }) | 80 | }) |
80 | 81 | ||
81 | return res.type('json').status(204).end() | 82 | return res.type('json') |
83 | .status(HttpStatusCode.NO_CONTENT_204) | ||
84 | .end() | ||
82 | } | 85 | } |
diff --git a/server/controllers/api/videos/watching.ts b/server/controllers/api/videos/watching.ts index 036e16f3a..627f12aa9 100644 --- a/server/controllers/api/videos/watching.ts +++ b/server/controllers/api/videos/watching.ts | |||
@@ -2,6 +2,7 @@ import * as express from 'express' | |||
2 | import { UserWatchingVideo } from '../../../../shared' | 2 | import { UserWatchingVideo } from '../../../../shared' |
3 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoWatchingValidator } from '../../../middlewares' | 3 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoWatchingValidator } from '../../../middlewares' |
4 | import { UserVideoHistoryModel } from '../../../models/account/user-video-history' | 4 | import { UserVideoHistoryModel } from '../../../models/account/user-video-history' |
5 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
5 | 6 | ||
6 | const watchingRouter = express.Router() | 7 | const watchingRouter = express.Router() |
7 | 8 | ||
@@ -31,5 +32,7 @@ async function userWatchVideo (req: express.Request, res: express.Response) { | |||
31 | currentTime: body.currentTime | 32 | currentTime: body.currentTime |
32 | }) | 33 | }) |
33 | 34 | ||
34 | return res.type('json').status(204).end() | 35 | return res.type('json') |
36 | .status(HttpStatusCode.NO_CONTENT_204) | ||
37 | .end() | ||
35 | } | 38 | } |