diff options
Diffstat (limited to 'server/controllers/api/videos')
-rw-r--r-- | server/controllers/api/videos/index.ts | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 6e8601fa1..61b6c5826 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -6,7 +6,7 @@ import { retryTransactionWrapper } from '../../../helpers/database-utils' | |||
6 | import { getVideoFileResolution } from '../../../helpers/ffmpeg-utils' | 6 | import { getVideoFileResolution } from '../../../helpers/ffmpeg-utils' |
7 | import { processImage } from '../../../helpers/image-utils' | 7 | import { processImage } from '../../../helpers/image-utils' |
8 | import { logger } from '../../../helpers/logger' | 8 | import { logger } from '../../../helpers/logger' |
9 | import { createReqFiles, getFormattedObjects, getServerActor, resetSequelizeInstance } from '../../../helpers/utils' | 9 | import { getFormattedObjects, getServerActor, resetSequelizeInstance } from '../../../helpers/utils' |
10 | import { | 10 | import { |
11 | CONFIG, | 11 | CONFIG, |
12 | IMAGE_MIMETYPE_EXT, | 12 | IMAGE_MIMETYPE_EXT, |
@@ -19,11 +19,7 @@ import { | |||
19 | VIDEO_MIMETYPE_EXT, | 19 | VIDEO_MIMETYPE_EXT, |
20 | VIDEO_PRIVACIES | 20 | VIDEO_PRIVACIES |
21 | } from '../../../initializers' | 21 | } from '../../../initializers' |
22 | import { | 22 | import { fetchRemoteVideoDescription, getVideoActivityPubUrl, shareVideoByServerAndChannel } from '../../../lib/activitypub' |
23 | fetchRemoteVideoDescription, | ||
24 | getVideoActivityPubUrl, | ||
25 | shareVideoByServerAndChannel | ||
26 | } from '../../../lib/activitypub' | ||
27 | import { sendCreateVideo, sendCreateView, sendUpdateVideo } from '../../../lib/activitypub/send' | 23 | import { sendCreateVideo, sendCreateView, sendUpdateVideo } from '../../../lib/activitypub/send' |
28 | import { JobQueue } from '../../../lib/job-queue' | 24 | import { JobQueue } from '../../../lib/job-queue' |
29 | import { Redis } from '../../../lib/redis' | 25 | import { Redis } from '../../../lib/redis' |
@@ -49,9 +45,9 @@ import { blacklistRouter } from './blacklist' | |||
49 | import { videoChannelRouter } from './channel' | 45 | import { videoChannelRouter } from './channel' |
50 | import { videoCommentRouter } from './comment' | 46 | import { videoCommentRouter } from './comment' |
51 | import { rateVideoRouter } from './rate' | 47 | import { rateVideoRouter } from './rate' |
52 | import { User } from '../../../../shared/models/users' | ||
53 | import { VideoFilter } from '../../../../shared/models/videos/video-query.type' | 48 | import { VideoFilter } from '../../../../shared/models/videos/video-query.type' |
54 | import { VideoSortField } from '../../../../client/src/app/shared/video/sort-field.type' | 49 | import { VideoSortField } from '../../../../client/src/app/shared/video/sort-field.type' |
50 | import { isNSFWHidden, createReqFiles } from '../../../helpers/express-utils' | ||
55 | 51 | ||
56 | const videosRouter = express.Router() | 52 | const videosRouter = express.Router() |
57 | 53 | ||
@@ -444,12 +440,3 @@ async function searchVideos (req: express.Request, res: express.Response, next: | |||
444 | 440 | ||
445 | return res.json(getFormattedObjects(resultList.data, resultList.total)) | 441 | return res.json(getFormattedObjects(resultList.data, resultList.total)) |
446 | } | 442 | } |
447 | |||
448 | function isNSFWHidden (res: express.Response) { | ||
449 | if (res.locals.oauth) { | ||
450 | const user: User = res.locals.oauth.token.User | ||
451 | if (user) return user.nsfwPolicy === 'do_not_list' | ||
452 | } | ||
453 | |||
454 | return CONFIG.INSTANCE.DEFAULT_NSFW_POLICY === 'do_not_list' | ||
455 | } | ||