diff options
Diffstat (limited to 'server/controllers/api')
-rw-r--r-- | server/controllers/api/users/token.ts | 4 | ||||
-rw-r--r-- | server/controllers/api/video-playlist.ts | 4 | ||||
-rw-r--r-- | server/controllers/api/videos/live.ts | 7 | ||||
-rw-r--r-- | server/controllers/api/videos/upload.ts | 2 |
4 files changed, 11 insertions, 6 deletions
diff --git a/server/controllers/api/users/token.ts b/server/controllers/api/users/token.ts index e636f44f6..b405ddbf4 100644 --- a/server/controllers/api/users/token.ts +++ b/server/controllers/api/users/token.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import * as RateLimit from 'express-rate-limit' | 2 | import * as RateLimit from 'express-rate-limit' |
3 | import { v4 as uuidv4 } from 'uuid' | ||
4 | import { logger } from '@server/helpers/logger' | 3 | import { logger } from '@server/helpers/logger' |
4 | import { buildUUID } from '@server/helpers/uuid' | ||
5 | import { CONFIG } from '@server/initializers/config' | 5 | import { CONFIG } from '@server/initializers/config' |
6 | import { getAuthNameFromRefreshGrant, getBypassFromExternalAuth, getBypassFromPasswordGrant } from '@server/lib/auth/external-auth' | 6 | import { getAuthNameFromRefreshGrant, getBypassFromExternalAuth, getBypassFromPasswordGrant } from '@server/lib/auth/external-auth' |
7 | import { handleOAuthToken } from '@server/lib/auth/oauth' | 7 | import { handleOAuthToken } from '@server/lib/auth/oauth' |
@@ -107,7 +107,7 @@ function getScopedTokens (req: express.Request, res: express.Response) { | |||
107 | async function renewScopedTokens (req: express.Request, res: express.Response) { | 107 | async function renewScopedTokens (req: express.Request, res: express.Response) { |
108 | const user = res.locals.oauth.token.user | 108 | const user = res.locals.oauth.token.user |
109 | 109 | ||
110 | user.feedToken = uuidv4() | 110 | user.feedToken = buildUUID() |
111 | await user.save() | 111 | await user.save() |
112 | 112 | ||
113 | return res.json({ | 113 | return res.json({ |
diff --git a/server/controllers/api/video-playlist.ts b/server/controllers/api/video-playlist.ts index 5c4aa50ac..87a6f6bbe 100644 --- a/server/controllers/api/video-playlist.ts +++ b/server/controllers/api/video-playlist.ts | |||
@@ -1,6 +1,8 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { join } from 'path' | 2 | import { join } from 'path' |
3 | import { uuidToShort } from '@server/helpers/uuid' | ||
3 | import { scheduleRefreshIfNeeded } from '@server/lib/activitypub/playlists' | 4 | import { scheduleRefreshIfNeeded } from '@server/lib/activitypub/playlists' |
5 | import { Hooks } from '@server/lib/plugins/hooks' | ||
4 | import { getServerActor } from '@server/models/application/application' | 6 | import { getServerActor } from '@server/models/application/application' |
5 | import { MVideoPlaylistFull, MVideoPlaylistThumbnail, MVideoThumbnail } from '@server/types/models' | 7 | import { MVideoPlaylistFull, MVideoPlaylistThumbnail, MVideoThumbnail } from '@server/types/models' |
6 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' | 8 | import { HttpStatusCode } from '../../../shared/core-utils/miscs/http-error-codes' |
@@ -43,7 +45,6 @@ import { | |||
43 | import { AccountModel } from '../../models/account/account' | 45 | import { AccountModel } from '../../models/account/account' |
44 | import { VideoPlaylistModel } from '../../models/video/video-playlist' | 46 | import { VideoPlaylistModel } from '../../models/video/video-playlist' |
45 | import { VideoPlaylistElementModel } from '../../models/video/video-playlist-element' | 47 | import { VideoPlaylistElementModel } from '../../models/video/video-playlist-element' |
46 | import { Hooks } from '@server/lib/plugins/hooks' | ||
47 | 48 | ||
48 | const reqThumbnailFile = createReqFiles([ 'thumbnailfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { thumbnailfile: CONFIG.STORAGE.TMP_DIR }) | 49 | const reqThumbnailFile = createReqFiles([ 'thumbnailfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { thumbnailfile: CONFIG.STORAGE.TMP_DIR }) |
49 | 50 | ||
@@ -199,6 +200,7 @@ async function addVideoPlaylist (req: express.Request, res: express.Response) { | |||
199 | return res.json({ | 200 | return res.json({ |
200 | videoPlaylist: { | 201 | videoPlaylist: { |
201 | id: videoPlaylistCreated.id, | 202 | id: videoPlaylistCreated.id, |
203 | shortUUID: uuidToShort(videoPlaylistCreated.uuid), | ||
202 | uuid: videoPlaylistCreated.uuid | 204 | uuid: videoPlaylistCreated.uuid |
203 | } | 205 | } |
204 | }) | 206 | }) |
diff --git a/server/controllers/api/videos/live.ts b/server/controllers/api/videos/live.ts index 61fa979c4..d8c51c2d4 100644 --- a/server/controllers/api/videos/live.ts +++ b/server/controllers/api/videos/live.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { v4 as uuidv4 } from 'uuid' | ||
3 | import { createReqFiles } from '@server/helpers/express-utils' | 2 | import { createReqFiles } from '@server/helpers/express-utils' |
3 | import { buildUUID, uuidToShort } from '@server/helpers/uuid' | ||
4 | import { CONFIG } from '@server/initializers/config' | 4 | import { CONFIG } from '@server/initializers/config' |
5 | import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants' | 5 | import { ASSETS_PATH, MIMETYPES } from '@server/initializers/constants' |
6 | import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' | 6 | import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' |
@@ -11,12 +11,12 @@ import { videoLiveAddValidator, videoLiveGetValidator, videoLiveUpdateValidator | |||
11 | import { VideoLiveModel } from '@server/models/video/video-live' | 11 | import { VideoLiveModel } from '@server/models/video/video-live' |
12 | import { MVideoDetails, MVideoFullLight } from '@server/types/models' | 12 | import { MVideoDetails, MVideoFullLight } from '@server/types/models' |
13 | import { LiveVideoCreate, LiveVideoUpdate, VideoState } from '../../../../shared' | 13 | import { LiveVideoCreate, LiveVideoUpdate, VideoState } from '../../../../shared' |
14 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
14 | import { logger } from '../../../helpers/logger' | 15 | import { logger } from '../../../helpers/logger' |
15 | import { sequelizeTypescript } from '../../../initializers/database' | 16 | import { sequelizeTypescript } from '../../../initializers/database' |
16 | import { updateVideoMiniatureFromExisting } from '../../../lib/thumbnail' | 17 | import { updateVideoMiniatureFromExisting } from '../../../lib/thumbnail' |
17 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares' | 18 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares' |
18 | import { VideoModel } from '../../../models/video/video' | 19 | import { VideoModel } from '../../../models/video/video' |
19 | import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' | ||
20 | 20 | ||
21 | const liveRouter = express.Router() | 21 | const liveRouter = express.Router() |
22 | 22 | ||
@@ -94,7 +94,7 @@ async function addLiveVideo (req: express.Request, res: express.Response) { | |||
94 | const videoLive = new VideoLiveModel() | 94 | const videoLive = new VideoLiveModel() |
95 | videoLive.saveReplay = videoInfo.saveReplay || false | 95 | videoLive.saveReplay = videoInfo.saveReplay || false |
96 | videoLive.permanentLive = videoInfo.permanentLive || false | 96 | videoLive.permanentLive = videoInfo.permanentLive || false |
97 | videoLive.streamKey = uuidv4() | 97 | videoLive.streamKey = buildUUID() |
98 | 98 | ||
99 | const [ thumbnailModel, previewModel ] = await buildVideoThumbnailsFromReq({ | 99 | const [ thumbnailModel, previewModel ] = await buildVideoThumbnailsFromReq({ |
100 | video, | 100 | video, |
@@ -138,6 +138,7 @@ async function addLiveVideo (req: express.Request, res: express.Response) { | |||
138 | return res.json({ | 138 | return res.json({ |
139 | video: { | 139 | video: { |
140 | id: videoCreated.id, | 140 | id: videoCreated.id, |
141 | shortUUID: uuidToShort(videoCreated.uuid), | ||
141 | uuid: videoCreated.uuid | 142 | uuid: videoCreated.uuid |
142 | } | 143 | } |
143 | }) | 144 | }) |
diff --git a/server/controllers/api/videos/upload.ts b/server/controllers/api/videos/upload.ts index e767492bc..bcd21ac99 100644 --- a/server/controllers/api/videos/upload.ts +++ b/server/controllers/api/videos/upload.ts | |||
@@ -2,6 +2,7 @@ import * as express from 'express' | |||
2 | import { move } from 'fs-extra' | 2 | import { move } from 'fs-extra' |
3 | import { getLowercaseExtension } from '@server/helpers/core-utils' | 3 | import { getLowercaseExtension } from '@server/helpers/core-utils' |
4 | import { deleteResumableUploadMetaFile, getResumableUploadPath } from '@server/helpers/upload' | 4 | import { deleteResumableUploadMetaFile, getResumableUploadPath } from '@server/helpers/upload' |
5 | import { uuidToShort } from '@server/helpers/uuid' | ||
5 | import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' | 6 | import { createTorrentAndSetInfoHash } from '@server/helpers/webtorrent' |
6 | import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' | 7 | import { getLocalVideoActivityPubUrl } from '@server/lib/activitypub/url' |
7 | import { addOptimizeOrMergeAudioJob, buildLocalVideoFromReq, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video' | 8 | import { addOptimizeOrMergeAudioJob, buildLocalVideoFromReq, buildVideoThumbnailsFromReq, setVideoTags } from '@server/lib/video' |
@@ -218,6 +219,7 @@ async function addVideo (options: { | |||
218 | return res.json({ | 219 | return res.json({ |
219 | video: { | 220 | video: { |
220 | id: videoCreated.id, | 221 | id: videoCreated.id, |
222 | shortUUID: uuidToShort(videoCreated.uuid), | ||
221 | uuid: videoCreated.uuid | 223 | uuid: videoCreated.uuid |
222 | } | 224 | } |
223 | }) | 225 | }) |