diff options
author | Chocobozzz <me@florianbigard.com> | 2019-04-11 11:33:44 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-04-11 13:45:39 +0200 |
commit | 6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0 (patch) | |
tree | b47de7efb8c6c611c63a15a971c6125a278f547a /server/controllers | |
parent | 2c3abc4fa796555eb7d25f416c4f41ab3e3ad8ca (diff) | |
download | PeerTube-6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0.tar.gz PeerTube-6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0.tar.zst PeerTube-6dd9de95dfa39bd5c1faed00d1dbd52cd112bae0.zip |
Move config in its own file
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/activitypub/client.ts | 19 | ||||
-rw-r--r-- | server/controllers/api/config.ts | 3 | ||||
-rw-r--r-- | server/controllers/api/oauth-clients.ts | 2 | ||||
-rw-r--r-- | server/controllers/api/server/logs.ts | 3 | ||||
-rw-r--r-- | server/controllers/api/server/stats.ts | 3 | ||||
-rw-r--r-- | server/controllers/api/users/index.ts | 7 | ||||
-rw-r--r-- | server/controllers/api/users/me.ts | 3 | ||||
-rw-r--r-- | server/controllers/api/users/my-subscriptions.ts | 4 | ||||
-rw-r--r-- | server/controllers/api/video-channel.ts | 3 | ||||
-rw-r--r-- | server/controllers/api/video-playlist.ts | 3 | ||||
-rw-r--r-- | server/controllers/api/videos/captions.ts | 3 | ||||
-rw-r--r-- | server/controllers/api/videos/import.ts | 5 | ||||
-rw-r--r-- | server/controllers/api/videos/index.ts | 2 | ||||
-rw-r--r-- | server/controllers/bots.ts | 16 | ||||
-rw-r--r-- | server/controllers/feeds.ts | 11 | ||||
-rw-r--r-- | server/controllers/services.ts | 6 | ||||
-rw-r--r-- | server/controllers/static.ts | 7 | ||||
-rw-r--r-- | server/controllers/tracker.ts | 3 |
18 files changed, 56 insertions, 47 deletions
diff --git a/server/controllers/activitypub/client.ts b/server/controllers/activitypub/client.ts index e06aa35f4..f47fae766 100644 --- a/server/controllers/activitypub/client.ts +++ b/server/controllers/activitypub/client.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | import * as express from 'express' | 2 | import * as express from 'express' |
3 | import { VideoPrivacy, VideoRateType } from '../../../shared/models/videos' | 3 | import { VideoPrivacy, VideoRateType } from '../../../shared/models/videos' |
4 | import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub' | 4 | import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub' |
5 | import { CONFIG, ROUTE_CACHE_LIFETIME } from '../../initializers' | 5 | import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../../initializers' |
6 | import { buildAnnounceWithVideoAudience, buildLikeActivity } from '../../lib/activitypub/send' | 6 | import { buildAnnounceWithVideoAudience, buildLikeActivity } from '../../lib/activitypub/send' |
7 | import { audiencify, getAudience } from '../../lib/activitypub/audience' | 7 | import { audiencify, getAudience } from '../../lib/activitypub/audience' |
8 | import { buildCreateActivity } from '../../lib/activitypub/send/send-create' | 8 | import { buildCreateActivity } from '../../lib/activitypub/send/send-create' |
@@ -19,7 +19,6 @@ import { AccountModel } from '../../models/account/account' | |||
19 | import { ActorModel } from '../../models/activitypub/actor' | 19 | import { ActorModel } from '../../models/activitypub/actor' |
20 | import { ActorFollowModel } from '../../models/activitypub/actor-follow' | 20 | import { ActorFollowModel } from '../../models/activitypub/actor-follow' |
21 | import { VideoModel } from '../../models/video/video' | 21 | import { VideoModel } from '../../models/video/video' |
22 | import { VideoChannelModel } from '../../models/video/video-channel' | ||
23 | import { VideoCommentModel } from '../../models/video/video-comment' | 22 | import { VideoCommentModel } from '../../models/video/video-comment' |
24 | import { VideoShareModel } from '../../models/video/video-share' | 23 | import { VideoShareModel } from '../../models/video/video-share' |
25 | import { cacheRoute } from '../../middlewares/cache' | 24 | import { cacheRoute } from '../../middlewares/cache' |
@@ -35,11 +34,9 @@ import { | |||
35 | import { VideoCaptionModel } from '../../models/video/video-caption' | 34 | import { VideoCaptionModel } from '../../models/video/video-caption' |
36 | import { videoFileRedundancyGetValidator, videoPlaylistRedundancyGetValidator } from '../../middlewares/validators/redundancy' | 35 | import { videoFileRedundancyGetValidator, videoPlaylistRedundancyGetValidator } from '../../middlewares/validators/redundancy' |
37 | import { getServerActor } from '../../helpers/utils' | 36 | import { getServerActor } from '../../helpers/utils' |
38 | import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy' | ||
39 | import { buildDislikeActivity } from '../../lib/activitypub/send/send-dislike' | 37 | import { buildDislikeActivity } from '../../lib/activitypub/send/send-dislike' |
40 | import { videoPlaylistElementAPGetValidator, videoPlaylistsGetValidator } from '../../middlewares/validators/videos/video-playlists' | 38 | import { videoPlaylistElementAPGetValidator, videoPlaylistsGetValidator } from '../../middlewares/validators/videos/video-playlists' |
41 | import { VideoPlaylistModel } from '../../models/video/video-playlist' | 39 | import { VideoPlaylistModel } from '../../models/video/video-playlist' |
42 | import { VideoPlaylistElementModel } from '../../models/video/video-playlist-element' | ||
43 | import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model' | 40 | import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model' |
44 | 41 | ||
45 | const activityPubClientRouter = express.Router() | 42 | const activityPubClientRouter = express.Router() |
@@ -213,7 +210,7 @@ async function videoController (req: express.Request, res: express.Response) { | |||
213 | // We need more attributes | 210 | // We need more attributes |
214 | const video = await VideoModel.loadForGetAPI(res.locals.video.id) | 211 | const video = await VideoModel.loadForGetAPI(res.locals.video.id) |
215 | 212 | ||
216 | if (video.url.startsWith(CONFIG.WEBSERVER.URL) === false) return res.redirect(video.url) | 213 | if (video.url.startsWith(WEBSERVER.URL) === false) return res.redirect(video.url) |
217 | 214 | ||
218 | // We need captions to render AP object | 215 | // We need captions to render AP object |
219 | video.VideoCaptions = await VideoCaptionModel.listVideoCaptions(video.id) | 216 | video.VideoCaptions = await VideoCaptionModel.listVideoCaptions(video.id) |
@@ -232,7 +229,7 @@ async function videoController (req: express.Request, res: express.Response) { | |||
232 | async function videoAnnounceController (req: express.Request, res: express.Response) { | 229 | async function videoAnnounceController (req: express.Request, res: express.Response) { |
233 | const share = res.locals.videoShare | 230 | const share = res.locals.videoShare |
234 | 231 | ||
235 | if (share.url.startsWith(CONFIG.WEBSERVER.URL) === false) return res.redirect(share.url) | 232 | if (share.url.startsWith(WEBSERVER.URL) === false) return res.redirect(share.url) |
236 | 233 | ||
237 | const { activity } = await buildAnnounceWithVideoAudience(share.Actor, share, res.locals.video, undefined) | 234 | const { activity } = await buildAnnounceWithVideoAudience(share.Actor, share, res.locals.video, undefined) |
238 | 235 | ||
@@ -306,7 +303,7 @@ async function videoChannelFollowingController (req: express.Request, res: expre | |||
306 | async function videoCommentController (req: express.Request, res: express.Response) { | 303 | async function videoCommentController (req: express.Request, res: express.Response) { |
307 | const videoComment = res.locals.videoComment | 304 | const videoComment = res.locals.videoComment |
308 | 305 | ||
309 | if (videoComment.url.startsWith(CONFIG.WEBSERVER.URL) === false) return res.redirect(videoComment.url) | 306 | if (videoComment.url.startsWith(WEBSERVER.URL) === false) return res.redirect(videoComment.url) |
310 | 307 | ||
311 | const threadParentComments = await VideoCommentModel.listThreadParentComments(videoComment, undefined) | 308 | const threadParentComments = await VideoCommentModel.listThreadParentComments(videoComment, undefined) |
312 | const isPublic = true // Comments are always public | 309 | const isPublic = true // Comments are always public |
@@ -324,7 +321,7 @@ async function videoCommentController (req: express.Request, res: express.Respon | |||
324 | 321 | ||
325 | async function videoRedundancyController (req: express.Request, res: express.Response) { | 322 | async function videoRedundancyController (req: express.Request, res: express.Response) { |
326 | const videoRedundancy = res.locals.videoRedundancy | 323 | const videoRedundancy = res.locals.videoRedundancy |
327 | if (videoRedundancy.url.startsWith(CONFIG.WEBSERVER.URL) === false) return res.redirect(videoRedundancy.url) | 324 | if (videoRedundancy.url.startsWith(WEBSERVER.URL) === false) return res.redirect(videoRedundancy.url) |
328 | 325 | ||
329 | const serverActor = await getServerActor() | 326 | const serverActor = await getServerActor() |
330 | 327 | ||
@@ -366,7 +363,7 @@ async function actorFollowing (req: express.Request, actor: ActorModel) { | |||
366 | return ActorFollowModel.listAcceptedFollowingUrlsForApi([ actor.id ], undefined, start, count) | 363 | return ActorFollowModel.listAcceptedFollowingUrlsForApi([ actor.id ], undefined, start, count) |
367 | } | 364 | } |
368 | 365 | ||
369 | return activityPubCollectionPagination(CONFIG.WEBSERVER.URL + req.path, handler, req.query.page) | 366 | return activityPubCollectionPagination(WEBSERVER.URL + req.path, handler, req.query.page) |
370 | } | 367 | } |
371 | 368 | ||
372 | async function actorFollowers (req: express.Request, actor: ActorModel) { | 369 | async function actorFollowers (req: express.Request, actor: ActorModel) { |
@@ -374,7 +371,7 @@ async function actorFollowers (req: express.Request, actor: ActorModel) { | |||
374 | return ActorFollowModel.listAcceptedFollowerUrlsForAP([ actor.id ], undefined, start, count) | 371 | return ActorFollowModel.listAcceptedFollowerUrlsForAP([ actor.id ], undefined, start, count) |
375 | } | 372 | } |
376 | 373 | ||
377 | return activityPubCollectionPagination(CONFIG.WEBSERVER.URL + req.path, handler, req.query.page) | 374 | return activityPubCollectionPagination(WEBSERVER.URL + req.path, handler, req.query.page) |
378 | } | 375 | } |
379 | 376 | ||
380 | async function actorPlaylists (req: express.Request, account: AccountModel) { | 377 | async function actorPlaylists (req: express.Request, account: AccountModel) { |
@@ -382,7 +379,7 @@ async function actorPlaylists (req: express.Request, account: AccountModel) { | |||
382 | return VideoPlaylistModel.listPublicUrlsOfForAP(account.id, start, count) | 379 | return VideoPlaylistModel.listPublicUrlsOfForAP(account.id, start, count) |
383 | } | 380 | } |
384 | 381 | ||
385 | return activityPubCollectionPagination(CONFIG.WEBSERVER.URL + req.path, handler, req.query.page) | 382 | return activityPubCollectionPagination(WEBSERVER.URL + req.path, handler, req.query.page) |
386 | } | 383 | } |
387 | 384 | ||
388 | function videoRates (req: express.Request, rateType: VideoRateType, video: VideoModel, url: string) { | 385 | function videoRates (req: express.Request, rateType: VideoRateType, video: VideoModel, url: string) { |
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts index 0d7fc8625..cdbccaa7d 100644 --- a/server/controllers/api/config.ts +++ b/server/controllers/api/config.ts | |||
@@ -4,7 +4,7 @@ import { ServerConfig, UserRight } from '../../../shared' | |||
4 | import { About } from '../../../shared/models/server/about.model' | 4 | import { About } from '../../../shared/models/server/about.model' |
5 | import { CustomConfig } from '../../../shared/models/server/custom-config.model' | 5 | import { CustomConfig } from '../../../shared/models/server/custom-config.model' |
6 | import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup' | 6 | import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup' |
7 | import { CONFIG, CONSTRAINTS_FIELDS, reloadConfig } from '../../initializers' | 7 | import { CONSTRAINTS_FIELDS } from '../../initializers' |
8 | import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares' | 8 | import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares' |
9 | import { customConfigUpdateValidator } from '../../middlewares/validators/config' | 9 | import { customConfigUpdateValidator } from '../../middlewares/validators/config' |
10 | import { ClientHtml } from '../../lib/client-html' | 10 | import { ClientHtml } from '../../lib/client-html' |
@@ -14,6 +14,7 @@ import { getServerCommit } from '../../helpers/utils' | |||
14 | import { Emailer } from '../../lib/emailer' | 14 | import { Emailer } from '../../lib/emailer' |
15 | import { isNumeric } from 'validator' | 15 | import { isNumeric } from 'validator' |
16 | import { objectConverter } from '../../helpers/core-utils' | 16 | import { objectConverter } from '../../helpers/core-utils' |
17 | import { CONFIG, reloadConfig } from '../../initializers/config' | ||
17 | 18 | ||
18 | const packageJSON = require('../../../../package.json') | 19 | const packageJSON = require('../../../../package.json') |
19 | const configRouter = express.Router() | 20 | const configRouter = express.Router() |
diff --git a/server/controllers/api/oauth-clients.ts b/server/controllers/api/oauth-clients.ts index 3dcc023e6..b2de8bcf5 100644 --- a/server/controllers/api/oauth-clients.ts +++ b/server/controllers/api/oauth-clients.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { OAuthClientLocal } from '../../../shared' | 2 | import { OAuthClientLocal } from '../../../shared' |
3 | import { logger } from '../../helpers/logger' | 3 | import { logger } from '../../helpers/logger' |
4 | import { CONFIG } from '../../initializers' | 4 | import { CONFIG } from '../../initializers/config' |
5 | import { asyncMiddleware } from '../../middlewares' | 5 | import { asyncMiddleware } from '../../middlewares' |
6 | import { OAuthClientModel } from '../../models/oauth/oauth-client' | 6 | import { OAuthClientModel } from '../../models/oauth/oauth-client' |
7 | 7 | ||
diff --git a/server/controllers/api/server/logs.ts b/server/controllers/api/server/logs.ts index 5fa3c8787..bbbfa1d80 100644 --- a/server/controllers/api/server/logs.ts +++ b/server/controllers/api/server/logs.ts | |||
@@ -3,10 +3,11 @@ import { UserRight } from '../../../../shared/models/users' | |||
3 | import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../../middlewares' | 3 | import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../../middlewares' |
4 | import { mtimeSortFilesDesc } from '../../../../shared/utils/logs/logs' | 4 | import { mtimeSortFilesDesc } from '../../../../shared/utils/logs/logs' |
5 | import { readdir, readFile } from 'fs-extra' | 5 | import { readdir, readFile } from 'fs-extra' |
6 | import { CONFIG, MAX_LOGS_OUTPUT_CHARACTERS } from '../../../initializers' | 6 | import { MAX_LOGS_OUTPUT_CHARACTERS } from '../../../initializers' |
7 | import { join } from 'path' | 7 | import { join } from 'path' |
8 | import { getLogsValidator } from '../../../middlewares/validators/logs' | 8 | import { getLogsValidator } from '../../../middlewares/validators/logs' |
9 | import { LogLevel } from '../../../../shared/models/server/log-level.type' | 9 | import { LogLevel } from '../../../../shared/models/server/log-level.type' |
10 | import { CONFIG } from '../../../initializers/config' | ||
10 | 11 | ||
11 | const logsRouter = express.Router() | 12 | const logsRouter = express.Router() |
12 | 13 | ||
diff --git a/server/controllers/api/server/stats.ts b/server/controllers/api/server/stats.ts index 89ffd1717..951b98209 100644 --- a/server/controllers/api/server/stats.ts +++ b/server/controllers/api/server/stats.ts | |||
@@ -6,9 +6,10 @@ import { ActorFollowModel } from '../../../models/activitypub/actor-follow' | |||
6 | import { VideoModel } from '../../../models/video/video' | 6 | import { VideoModel } from '../../../models/video/video' |
7 | import { VideoCommentModel } from '../../../models/video/video-comment' | 7 | import { VideoCommentModel } from '../../../models/video/video-comment' |
8 | import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy' | 8 | import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy' |
9 | import { CONFIG, ROUTE_CACHE_LIFETIME } from '../../../initializers/constants' | 9 | import { ROUTE_CACHE_LIFETIME } from '../../../initializers/constants' |
10 | import { cacheRoute } from '../../../middlewares/cache' | 10 | import { cacheRoute } from '../../../middlewares/cache' |
11 | import { VideoFileModel } from '../../../models/video/video-file' | 11 | import { VideoFileModel } from '../../../models/video/video-file' |
12 | import { CONFIG } from '../../../initializers/config' | ||
12 | 13 | ||
13 | const statsRouter = express.Router() | 14 | const statsRouter = express.Router() |
14 | 15 | ||
diff --git a/server/controllers/api/users/index.ts b/server/controllers/api/users/index.ts index 2117bdfeb..a049e23e4 100644 --- a/server/controllers/api/users/index.ts +++ b/server/controllers/api/users/index.ts | |||
@@ -3,7 +3,7 @@ import * as RateLimit from 'express-rate-limit' | |||
3 | import { UserCreate, UserRight, UserRole, UserUpdate } from '../../../../shared' | 3 | import { UserCreate, UserRight, UserRole, UserUpdate } from '../../../../shared' |
4 | import { logger } from '../../../helpers/logger' | 4 | import { logger } from '../../../helpers/logger' |
5 | import { getFormattedObjects } from '../../../helpers/utils' | 5 | import { getFormattedObjects } from '../../../helpers/utils' |
6 | import { CONFIG, RATES_LIMIT, sequelizeTypescript } from '../../../initializers' | 6 | import { RATES_LIMIT, sequelizeTypescript, WEBSERVER } from '../../../initializers' |
7 | import { Emailer } from '../../../lib/emailer' | 7 | import { Emailer } from '../../../lib/emailer' |
8 | import { Redis } from '../../../lib/redis' | 8 | import { Redis } from '../../../lib/redis' |
9 | import { createUserAccountAndChannelAndPlaylist } from '../../../lib/user' | 9 | import { createUserAccountAndChannelAndPlaylist } from '../../../lib/user' |
@@ -43,6 +43,7 @@ import { myVideosHistoryRouter } from './my-history' | |||
43 | import { myNotificationsRouter } from './my-notifications' | 43 | import { myNotificationsRouter } from './my-notifications' |
44 | import { Notifier } from '../../../lib/notifier' | 44 | import { Notifier } from '../../../lib/notifier' |
45 | import { mySubscriptionsRouter } from './my-subscriptions' | 45 | import { mySubscriptionsRouter } from './my-subscriptions' |
46 | import { CONFIG } from '../../../initializers/config' | ||
46 | 47 | ||
47 | const auditLogger = auditLoggerFactory('users') | 48 | const auditLogger = auditLoggerFactory('users') |
48 | 49 | ||
@@ -293,7 +294,7 @@ async function askResetUserPassword (req: express.Request, res: express.Response | |||
293 | const user = res.locals.user | 294 | const user = res.locals.user |
294 | 295 | ||
295 | const verificationString = await Redis.Instance.setResetPasswordVerificationString(user.id) | 296 | const verificationString = await Redis.Instance.setResetPasswordVerificationString(user.id) |
296 | const url = CONFIG.WEBSERVER.URL + '/reset-password?userId=' + user.id + '&verificationString=' + verificationString | 297 | const url = WEBSERVER.URL + '/reset-password?userId=' + user.id + '&verificationString=' + verificationString |
297 | await Emailer.Instance.addPasswordResetEmailJob(user.email, url) | 298 | await Emailer.Instance.addPasswordResetEmailJob(user.email, url) |
298 | 299 | ||
299 | return res.status(204).end() | 300 | return res.status(204).end() |
@@ -310,7 +311,7 @@ async function resetUserPassword (req: express.Request, res: express.Response) { | |||
310 | 311 | ||
311 | async function sendVerifyUserEmail (user: UserModel) { | 312 | async function sendVerifyUserEmail (user: UserModel) { |
312 | const verificationString = await Redis.Instance.setVerifyEmailVerificationString(user.id) | 313 | const verificationString = await Redis.Instance.setVerifyEmailVerificationString(user.id) |
313 | const url = CONFIG.WEBSERVER.URL + '/verify-account/email?userId=' + user.id + '&verificationString=' + verificationString | 314 | const url = WEBSERVER.URL + '/verify-account/email?userId=' + user.id + '&verificationString=' + verificationString |
314 | await Emailer.Instance.addVerifyEmailJob(user.email, url) | 315 | await Emailer.Instance.addVerifyEmailJob(user.email, url) |
315 | return | 316 | return |
316 | } | 317 | } |
diff --git a/server/controllers/api/users/me.ts b/server/controllers/api/users/me.ts index 3533499be..1d1588eca 100644 --- a/server/controllers/api/users/me.ts +++ b/server/controllers/api/users/me.ts | |||
@@ -2,7 +2,7 @@ import * as express from 'express' | |||
2 | import 'multer' | 2 | import 'multer' |
3 | import { UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../../shared' | 3 | import { UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../../shared' |
4 | import { getFormattedObjects } from '../../../helpers/utils' | 4 | import { getFormattedObjects } from '../../../helpers/utils' |
5 | import { CONFIG, MIMETYPES, sequelizeTypescript } from '../../../initializers' | 5 | import { MIMETYPES, sequelizeTypescript } from '../../../initializers' |
6 | import { sendUpdateActor } from '../../../lib/activitypub/send' | 6 | import { sendUpdateActor } from '../../../lib/activitypub/send' |
7 | import { | 7 | import { |
8 | asyncMiddleware, | 8 | asyncMiddleware, |
@@ -26,6 +26,7 @@ import { updateActorAvatarFile } from '../../../lib/avatar' | |||
26 | import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '../../../helpers/audit-logger' | 26 | import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '../../../helpers/audit-logger' |
27 | import { VideoImportModel } from '../../../models/video/video-import' | 27 | import { VideoImportModel } from '../../../models/video/video-import' |
28 | import { AccountModel } from '../../../models/account/account' | 28 | import { AccountModel } from '../../../models/account/account' |
29 | import { CONFIG } from '../../../initializers/config' | ||
29 | 30 | ||
30 | const auditLogger = auditLoggerFactory('users-me') | 31 | const auditLogger = auditLoggerFactory('users-me') |
31 | 32 | ||
diff --git a/server/controllers/api/users/my-subscriptions.ts b/server/controllers/api/users/my-subscriptions.ts index a173adfd0..59b906a8b 100644 --- a/server/controllers/api/users/my-subscriptions.ts +++ b/server/controllers/api/users/my-subscriptions.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import 'multer' | 2 | import 'multer' |
3 | import { getFormattedObjects } from '../../../helpers/utils' | 3 | import { getFormattedObjects } from '../../../helpers/utils' |
4 | import { CONFIG, sequelizeTypescript } from '../../../initializers' | 4 | import { sequelizeTypescript, WEBSERVER } from '../../../initializers' |
5 | import { | 5 | import { |
6 | asyncMiddleware, | 6 | asyncMiddleware, |
7 | asyncRetryTransactionMiddleware, | 7 | asyncRetryTransactionMiddleware, |
@@ -80,7 +80,7 @@ async function areSubscriptionsExist (req: express.Request, res: express.Respons | |||
80 | 80 | ||
81 | const handles = uris.map(u => { | 81 | const handles = uris.map(u => { |
82 | let [ name, host ] = u.split('@') | 82 | let [ name, host ] = u.split('@') |
83 | if (host === CONFIG.WEBSERVER.HOST) host = null | 83 | if (host === WEBSERVER.HOST) host = null |
84 | 84 | ||
85 | return { name, host, uri: u } | 85 | return { name, host, uri: u } |
86 | }) | 86 | }) |
diff --git a/server/controllers/api/video-channel.ts b/server/controllers/api/video-channel.ts index 5881cab41..b79ce9cec 100644 --- a/server/controllers/api/video-channel.ts +++ b/server/controllers/api/video-channel.ts | |||
@@ -23,7 +23,7 @@ import { createVideoChannel } from '../../lib/video-channel' | |||
23 | import { buildNSFWFilter, createReqFiles, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' | 23 | import { buildNSFWFilter, createReqFiles, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' |
24 | import { setAsyncActorKeys } from '../../lib/activitypub' | 24 | import { setAsyncActorKeys } from '../../lib/activitypub' |
25 | import { AccountModel } from '../../models/account/account' | 25 | import { AccountModel } from '../../models/account/account' |
26 | import { CONFIG, MIMETYPES, sequelizeTypescript } from '../../initializers' | 26 | import { MIMETYPES, sequelizeTypescript } from '../../initializers' |
27 | import { logger } from '../../helpers/logger' | 27 | import { logger } from '../../helpers/logger' |
28 | import { VideoModel } from '../../models/video/video' | 28 | import { VideoModel } from '../../models/video/video' |
29 | import { updateAvatarValidator } from '../../middlewares/validators/avatar' | 29 | import { updateAvatarValidator } from '../../middlewares/validators/avatar' |
@@ -33,6 +33,7 @@ import { resetSequelizeInstance } from '../../helpers/database-utils' | |||
33 | import { JobQueue } from '../../lib/job-queue' | 33 | import { JobQueue } from '../../lib/job-queue' |
34 | import { VideoPlaylistModel } from '../../models/video/video-playlist' | 34 | import { VideoPlaylistModel } from '../../models/video/video-playlist' |
35 | import { commonVideoPlaylistFiltersValidator } from '../../middlewares/validators/videos/video-playlists' | 35 | import { commonVideoPlaylistFiltersValidator } from '../../middlewares/validators/videos/video-playlists' |
36 | import { CONFIG } from '../../initializers/config' | ||
36 | 37 | ||
37 | const auditLogger = auditLoggerFactory('channels') | 38 | const auditLogger = auditLoggerFactory('channels') |
38 | const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.TMP_DIR }) | 39 | const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.TMP_DIR }) |
diff --git a/server/controllers/api/video-playlist.ts b/server/controllers/api/video-playlist.ts index feba30564..5a3d6a29d 100644 --- a/server/controllers/api/video-playlist.ts +++ b/server/controllers/api/video-playlist.ts | |||
@@ -12,7 +12,7 @@ import { | |||
12 | } from '../../middlewares' | 12 | } from '../../middlewares' |
13 | import { videoPlaylistsSortValidator } from '../../middlewares/validators' | 13 | import { videoPlaylistsSortValidator } from '../../middlewares/validators' |
14 | import { buildNSFWFilter, createReqFiles, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' | 14 | import { buildNSFWFilter, createReqFiles, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils' |
15 | import { CONFIG, MIMETYPES, sequelizeTypescript, THUMBNAILS_SIZE, VIDEO_PLAYLIST_PRIVACIES } from '../../initializers' | 15 | import { MIMETYPES, sequelizeTypescript, THUMBNAILS_SIZE, VIDEO_PLAYLIST_PRIVACIES } from '../../initializers' |
16 | import { logger } from '../../helpers/logger' | 16 | import { logger } from '../../helpers/logger' |
17 | import { resetSequelizeInstance } from '../../helpers/database-utils' | 17 | import { resetSequelizeInstance } from '../../helpers/database-utils' |
18 | import { VideoPlaylistModel } from '../../models/video/video-playlist' | 18 | import { VideoPlaylistModel } from '../../models/video/video-playlist' |
@@ -41,6 +41,7 @@ import { copy, pathExists } from 'fs-extra' | |||
41 | import { AccountModel } from '../../models/account/account' | 41 | import { AccountModel } from '../../models/account/account' |
42 | import { VideoPlaylistReorder } from '../../../shared/models/videos/playlist/video-playlist-reorder.model' | 42 | import { VideoPlaylistReorder } from '../../../shared/models/videos/playlist/video-playlist-reorder.model' |
43 | import { JobQueue } from '../../lib/job-queue' | 43 | import { JobQueue } from '../../lib/job-queue' |
44 | import { CONFIG } from '../../initializers/config' | ||
44 | 45 | ||
45 | const reqThumbnailFile = createReqFiles([ 'thumbnailfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { thumbnailfile: CONFIG.STORAGE.TMP_DIR }) | 46 | const reqThumbnailFile = createReqFiles([ 'thumbnailfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { thumbnailfile: CONFIG.STORAGE.TMP_DIR }) |
46 | 47 | ||
diff --git a/server/controllers/api/videos/captions.ts b/server/controllers/api/videos/captions.ts index 2694577d8..7dd36e368 100644 --- a/server/controllers/api/videos/captions.ts +++ b/server/controllers/api/videos/captions.ts | |||
@@ -2,12 +2,13 @@ import * as express from 'express' | |||
2 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares' | 2 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares' |
3 | import { addVideoCaptionValidator, deleteVideoCaptionValidator, listVideoCaptionsValidator } from '../../../middlewares/validators' | 3 | import { addVideoCaptionValidator, deleteVideoCaptionValidator, listVideoCaptionsValidator } from '../../../middlewares/validators' |
4 | import { createReqFiles } from '../../../helpers/express-utils' | 4 | import { createReqFiles } from '../../../helpers/express-utils' |
5 | import { CONFIG, MIMETYPES, sequelizeTypescript } from '../../../initializers' | 5 | import { MIMETYPES, sequelizeTypescript } from '../../../initializers' |
6 | import { getFormattedObjects } from '../../../helpers/utils' | 6 | import { getFormattedObjects } from '../../../helpers/utils' |
7 | import { VideoCaptionModel } from '../../../models/video/video-caption' | 7 | import { VideoCaptionModel } from '../../../models/video/video-caption' |
8 | import { logger } from '../../../helpers/logger' | 8 | import { logger } from '../../../helpers/logger' |
9 | import { federateVideoIfNeeded } from '../../../lib/activitypub' | 9 | import { federateVideoIfNeeded } from '../../../lib/activitypub' |
10 | import { moveAndProcessCaptionFile } from '../../../helpers/captions-utils' | 10 | import { moveAndProcessCaptionFile } from '../../../helpers/captions-utils' |
11 | import { CONFIG } from '../../../initializers/config' | ||
11 | 12 | ||
12 | const reqVideoCaptionAdd = createReqFiles( | 13 | const reqVideoCaptionAdd = createReqFiles( |
13 | [ 'captionfile' ], | 14 | [ 'captionfile' ], |
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts index c234a1391..5a8cd703e 100644 --- a/server/controllers/api/videos/import.ts +++ b/server/controllers/api/videos/import.ts | |||
@@ -3,7 +3,7 @@ import * as magnetUtil from 'magnet-uri' | |||
3 | import 'multer' | 3 | import 'multer' |
4 | import { auditLoggerFactory, getAuditIdFromRes, VideoImportAuditView } from '../../../helpers/audit-logger' | 4 | import { auditLoggerFactory, getAuditIdFromRes, VideoImportAuditView } from '../../../helpers/audit-logger' |
5 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoImportAddValidator } from '../../../middlewares' | 5 | import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoImportAddValidator } from '../../../middlewares' |
6 | import { CONFIG, MIMETYPES, PREVIEWS_SIZE, sequelizeTypescript, THUMBNAILS_SIZE } from '../../../initializers' | 6 | import { MIMETYPES, PREVIEWS_SIZE, sequelizeTypescript, THUMBNAILS_SIZE } from '../../../initializers' |
7 | import { getYoutubeDLInfo, YoutubeDLInfo } from '../../../helpers/youtube-dl' | 7 | import { getYoutubeDLInfo, YoutubeDLInfo } from '../../../helpers/youtube-dl' |
8 | import { createReqFiles } from '../../../helpers/express-utils' | 8 | import { createReqFiles } from '../../../helpers/express-utils' |
9 | import { logger } from '../../../helpers/logger' | 9 | import { logger } from '../../../helpers/logger' |
@@ -22,8 +22,9 @@ import { UserModel } from '../../../models/account/user' | |||
22 | import * as Bluebird from 'bluebird' | 22 | import * as Bluebird from 'bluebird' |
23 | import * as parseTorrent from 'parse-torrent' | 23 | import * as parseTorrent from 'parse-torrent' |
24 | import { getSecureTorrentName } from '../../../helpers/utils' | 24 | import { getSecureTorrentName } from '../../../helpers/utils' |
25 | import { readFile, move } from 'fs-extra' | 25 | import { move, readFile } from 'fs-extra' |
26 | import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist' | 26 | import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist' |
27 | import { CONFIG } from '../../../initializers/config' | ||
27 | 28 | ||
28 | const auditLogger = auditLoggerFactory('video-imports') | 29 | const auditLogger = auditLoggerFactory('video-imports') |
29 | const videoImportsRouter = express.Router() | 30 | const videoImportsRouter = express.Router() |
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts index 393324819..9470afabf 100644 --- a/server/controllers/api/videos/index.ts +++ b/server/controllers/api/videos/index.ts | |||
@@ -8,7 +8,6 @@ import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../ | |||
8 | import { getFormattedObjects, getServerActor } from '../../../helpers/utils' | 8 | import { getFormattedObjects, getServerActor } from '../../../helpers/utils' |
9 | import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist' | 9 | import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist' |
10 | import { | 10 | import { |
11 | CONFIG, | ||
12 | MIMETYPES, | 11 | MIMETYPES, |
13 | PREVIEWS_SIZE, | 12 | PREVIEWS_SIZE, |
14 | sequelizeTypescript, | 13 | sequelizeTypescript, |
@@ -61,6 +60,7 @@ import { move } from 'fs-extra' | |||
61 | import { watchingRouter } from './watching' | 60 | import { watchingRouter } from './watching' |
62 | import { Notifier } from '../../../lib/notifier' | 61 | import { Notifier } from '../../../lib/notifier' |
63 | import { sendView } from '../../../lib/activitypub/send/send-view' | 62 | import { sendView } from '../../../lib/activitypub/send/send-view' |
63 | import { CONFIG } from '../../../initializers/config' | ||
64 | 64 | ||
65 | const auditLogger = auditLoggerFactory('videos') | 65 | const auditLogger = auditLoggerFactory('videos') |
66 | const videosRouter = express.Router() | 66 | const videosRouter = express.Router() |
diff --git a/server/controllers/bots.ts b/server/controllers/bots.ts index 2db86a2d8..58ead4799 100644 --- a/server/controllers/bots.ts +++ b/server/controllers/bots.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { asyncMiddleware } from '../middlewares' | 2 | import { asyncMiddleware } from '../middlewares' |
3 | import { CONFIG, ROUTE_CACHE_LIFETIME } from '../initializers' | 3 | import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers' |
4 | import * as sitemapModule from 'sitemap' | 4 | import * as sitemapModule from 'sitemap' |
5 | import { logger } from '../helpers/logger' | 5 | import { logger } from '../helpers/logger' |
6 | import { VideoModel } from '../models/video/video' | 6 | import { VideoModel } from '../models/video/video' |
@@ -35,7 +35,7 @@ async function getSitemap (req: express.Request, res: express.Response) { | |||
35 | urls = urls.concat(await getSitemapAccountUrls()) | 35 | urls = urls.concat(await getSitemapAccountUrls()) |
36 | 36 | ||
37 | const sitemap = sitemapModule.createSitemap({ | 37 | const sitemap = sitemapModule.createSitemap({ |
38 | hostname: CONFIG.WEBSERVER.URL, | 38 | hostname: WEBSERVER.URL, |
39 | urls: urls | 39 | urls: urls |
40 | }) | 40 | }) |
41 | 41 | ||
@@ -54,7 +54,7 @@ async function getSitemapVideoChannelUrls () { | |||
54 | const rows = await VideoChannelModel.listLocalsForSitemap('createdAt') | 54 | const rows = await VideoChannelModel.listLocalsForSitemap('createdAt') |
55 | 55 | ||
56 | return rows.map(channel => ({ | 56 | return rows.map(channel => ({ |
57 | url: CONFIG.WEBSERVER.URL + '/video-channels/' + channel.Actor.preferredUsername | 57 | url: WEBSERVER.URL + '/video-channels/' + channel.Actor.preferredUsername |
58 | })) | 58 | })) |
59 | } | 59 | } |
60 | 60 | ||
@@ -62,7 +62,7 @@ async function getSitemapAccountUrls () { | |||
62 | const rows = await AccountModel.listLocalsForSitemap('createdAt') | 62 | const rows = await AccountModel.listLocalsForSitemap('createdAt') |
63 | 63 | ||
64 | return rows.map(channel => ({ | 64 | return rows.map(channel => ({ |
65 | url: CONFIG.WEBSERVER.URL + '/accounts/' + channel.Actor.preferredUsername | 65 | url: WEBSERVER.URL + '/accounts/' + channel.Actor.preferredUsername |
66 | })) | 66 | })) |
67 | } | 67 | } |
68 | 68 | ||
@@ -78,14 +78,14 @@ async function getSitemapLocalVideoUrls () { | |||
78 | }) | 78 | }) |
79 | 79 | ||
80 | return resultList.data.map(v => ({ | 80 | return resultList.data.map(v => ({ |
81 | url: CONFIG.WEBSERVER.URL + '/videos/watch/' + v.uuid, | 81 | url: WEBSERVER.URL + '/videos/watch/' + v.uuid, |
82 | video: [ | 82 | video: [ |
83 | { | 83 | { |
84 | title: v.name, | 84 | title: v.name, |
85 | // Sitemap description should be < 2000 characters | 85 | // Sitemap description should be < 2000 characters |
86 | description: truncate(v.description || v.name, { length: 2000, omission: '...' }), | 86 | description: truncate(v.description || v.name, { length: 2000, omission: '...' }), |
87 | player_loc: CONFIG.WEBSERVER.URL + '/videos/embed/' + v.uuid, | 87 | player_loc: WEBSERVER.URL + '/videos/embed/' + v.uuid, |
88 | thumbnail_loc: CONFIG.WEBSERVER.URL + v.getThumbnailStaticPath() | 88 | thumbnail_loc: WEBSERVER.URL + v.getThumbnailStaticPath() |
89 | } | 89 | } |
90 | ] | 90 | ] |
91 | })) | 91 | })) |
@@ -97,5 +97,5 @@ function getSitemapBasicUrls () { | |||
97 | '/videos/local' | 97 | '/videos/local' |
98 | ] | 98 | ] |
99 | 99 | ||
100 | return paths.map(p => ({ url: CONFIG.WEBSERVER.URL + p })) | 100 | return paths.map(p => ({ url: WEBSERVER.URL + p })) |
101 | } | 101 | } |
diff --git a/server/controllers/feeds.ts b/server/controllers/feeds.ts index cd46b6e0f..24c41d946 100644 --- a/server/controllers/feeds.ts +++ b/server/controllers/feeds.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { CONFIG, FEEDS, ROUTE_CACHE_LIFETIME } from '../initializers/constants' | 2 | import { FEEDS, ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants' |
3 | import { THUMBNAILS_SIZE } from '../initializers' | 3 | import { THUMBNAILS_SIZE } from '../initializers' |
4 | import { | 4 | import { |
5 | asyncMiddleware, | 5 | asyncMiddleware, |
@@ -14,6 +14,7 @@ import * as Feed from 'pfeed' | |||
14 | import { cacheRoute } from '../middlewares/cache' | 14 | import { cacheRoute } from '../middlewares/cache' |
15 | import { VideoCommentModel } from '../models/video/video-comment' | 15 | import { VideoCommentModel } from '../models/video/video-comment' |
16 | import { buildNSFWFilter } from '../helpers/express-utils' | 16 | import { buildNSFWFilter } from '../helpers/express-utils' |
17 | import { CONFIG } from '../initializers/config' | ||
17 | 18 | ||
18 | const feedsRouter = express.Router() | 19 | const feedsRouter = express.Router() |
19 | 20 | ||
@@ -54,7 +55,7 @@ async function generateVideoCommentsFeed (req: express.Request, res: express.Res | |||
54 | 55 | ||
55 | // Adding video items to the feed, one at a time | 56 | // Adding video items to the feed, one at a time |
56 | comments.forEach(comment => { | 57 | comments.forEach(comment => { |
57 | const link = CONFIG.WEBSERVER.URL + comment.getCommentStaticPath() | 58 | const link = WEBSERVER.URL + comment.getCommentStaticPath() |
58 | 59 | ||
59 | feed.addItem({ | 60 | feed.addItem({ |
60 | title: `${comment.Video.name} - ${comment.Account.getDisplayName()}`, | 61 | title: `${comment.Video.name} - ${comment.Account.getDisplayName()}`, |
@@ -122,7 +123,7 @@ async function generateVideoFeed (req: express.Request, res: express.Response) { | |||
122 | feed.addItem({ | 123 | feed.addItem({ |
123 | title: video.name, | 124 | title: video.name, |
124 | id: video.url, | 125 | id: video.url, |
125 | link: CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid, | 126 | link: WEBSERVER.URL + '/videos/watch/' + video.uuid, |
126 | description: video.getTruncatedDescription(), | 127 | description: video.getTruncatedDescription(), |
127 | content: video.description, | 128 | content: video.description, |
128 | author: [ | 129 | author: [ |
@@ -137,7 +138,7 @@ async function generateVideoFeed (req: express.Request, res: express.Response) { | |||
137 | torrent: torrents, | 138 | torrent: torrents, |
138 | thumbnail: [ | 139 | thumbnail: [ |
139 | { | 140 | { |
140 | url: CONFIG.WEBSERVER.URL + video.getThumbnailStaticPath(), | 141 | url: WEBSERVER.URL + video.getThumbnailStaticPath(), |
141 | height: THUMBNAILS_SIZE.height, | 142 | height: THUMBNAILS_SIZE.height, |
142 | width: THUMBNAILS_SIZE.width | 143 | width: THUMBNAILS_SIZE.width |
143 | } | 144 | } |
@@ -150,7 +151,7 @@ async function generateVideoFeed (req: express.Request, res: express.Response) { | |||
150 | } | 151 | } |
151 | 152 | ||
152 | function initFeed (name: string, description: string) { | 153 | function initFeed (name: string, description: string) { |
153 | const webserverUrl = CONFIG.WEBSERVER.URL | 154 | const webserverUrl = WEBSERVER.URL |
154 | 155 | ||
155 | return new Feed({ | 156 | return new Feed({ |
156 | title: name, | 157 | title: name, |
diff --git a/server/controllers/services.ts b/server/controllers/services.ts index cf7a513af..83b01b475 100644 --- a/server/controllers/services.ts +++ b/server/controllers/services.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { CONFIG, EMBED_SIZE, PREVIEWS_SIZE } from '../initializers' | 2 | import { EMBED_SIZE, PREVIEWS_SIZE, WEBSERVER } from '../initializers' |
3 | import { asyncMiddleware, oembedValidator } from '../middlewares' | 3 | import { asyncMiddleware, oembedValidator } from '../middlewares' |
4 | import { accountNameWithHostGetValidator } from '../middlewares/validators' | 4 | import { accountNameWithHostGetValidator } from '../middlewares/validators' |
5 | import { VideoModel } from '../models/video/video' | 5 | import { CONFIG } from '../initializers/config' |
6 | 6 | ||
7 | const servicesRouter = express.Router() | 7 | const servicesRouter = express.Router() |
8 | 8 | ||
@@ -25,7 +25,7 @@ export { | |||
25 | 25 | ||
26 | function generateOEmbed (req: express.Request, res: express.Response) { | 26 | function generateOEmbed (req: express.Request, res: express.Response) { |
27 | const video = res.locals.video | 27 | const video = res.locals.video |
28 | const webserverUrl = CONFIG.WEBSERVER.URL | 28 | const webserverUrl = WEBSERVER.URL |
29 | const maxHeight = parseInt(req.query.maxheight, 10) | 29 | const maxHeight = parseInt(req.query.maxheight, 10) |
30 | const maxWidth = parseInt(req.query.maxwidth, 10) | 30 | const maxWidth = parseInt(req.query.maxwidth, 10) |
31 | 31 | ||
diff --git a/server/controllers/static.ts b/server/controllers/static.ts index e65c7afd3..be5fcc8ed 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts | |||
@@ -1,12 +1,12 @@ | |||
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 { | 3 | import { |
4 | CONFIG, | ||
5 | HLS_STREAMING_PLAYLIST_DIRECTORY, | 4 | HLS_STREAMING_PLAYLIST_DIRECTORY, |
6 | ROUTE_CACHE_LIFETIME, | 5 | ROUTE_CACHE_LIFETIME, |
7 | STATIC_DOWNLOAD_PATHS, | 6 | STATIC_DOWNLOAD_PATHS, |
8 | STATIC_MAX_AGE, | 7 | STATIC_MAX_AGE, |
9 | STATIC_PATHS | 8 | STATIC_PATHS, |
9 | WEBSERVER | ||
10 | } from '../initializers' | 10 | } from '../initializers' |
11 | import { VideosCaptionCache, VideosPreviewCache } from '../lib/files-cache' | 11 | import { VideosCaptionCache, VideosPreviewCache } from '../lib/files-cache' |
12 | import { cacheRoute } from '../middlewares/cache' | 12 | import { cacheRoute } from '../middlewares/cache' |
@@ -17,6 +17,7 @@ import { VideoCommentModel } from '../models/video/video-comment' | |||
17 | import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo' | 17 | import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo' |
18 | import { join } from 'path' | 18 | import { join } from 'path' |
19 | import { root } from '../helpers/core-utils' | 19 | import { root } from '../helpers/core-utils' |
20 | import { CONFIG } from '../initializers/config' | ||
20 | 21 | ||
21 | const packageJSON = require('../../../package.json') | 22 | const packageJSON = require('../../../package.json') |
22 | const staticRouter = express.Router() | 23 | const staticRouter = express.Router() |
@@ -121,7 +122,7 @@ staticRouter.use('/.well-known/nodeinfo', | |||
121 | links: [ | 122 | links: [ |
122 | { | 123 | { |
123 | rel: 'http://nodeinfo.diaspora.software/ns/schema/2.0', | 124 | rel: 'http://nodeinfo.diaspora.software/ns/schema/2.0', |
124 | href: CONFIG.WEBSERVER.URL + '/nodeinfo/2.0.json' | 125 | href: WEBSERVER.URL + '/nodeinfo/2.0.json' |
125 | } | 126 | } |
126 | ] | 127 | ] |
127 | }) | 128 | }) |
diff --git a/server/controllers/tracker.ts b/server/controllers/tracker.ts index 56a3424a3..912f82b86 100644 --- a/server/controllers/tracker.ts +++ b/server/controllers/tracker.ts | |||
@@ -4,10 +4,11 @@ import * as http from 'http' | |||
4 | import * as bitTorrentTracker from 'bittorrent-tracker' | 4 | import * as bitTorrentTracker from 'bittorrent-tracker' |
5 | import * as proxyAddr from 'proxy-addr' | 5 | import * as proxyAddr from 'proxy-addr' |
6 | import { Server as WebSocketServer } from 'ws' | 6 | import { Server as WebSocketServer } from 'ws' |
7 | import { CONFIG, TRACKER_RATE_LIMITS } from '../initializers/constants' | 7 | import { TRACKER_RATE_LIMITS } from '../initializers/constants' |
8 | import { VideoFileModel } from '../models/video/video-file' | 8 | import { VideoFileModel } from '../models/video/video-file' |
9 | import { parse } from 'url' | 9 | import { parse } from 'url' |
10 | import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist' | 10 | import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist' |
11 | import { CONFIG } from '../initializers/config' | ||
11 | 12 | ||
12 | const TrackerServer = bitTorrentTracker.Server | 13 | const TrackerServer = bitTorrentTracker.Server |
13 | 14 | ||