mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-06 03:50:26 +02:00
Move config in its own file
This commit is contained in:
parent
2c3abc4fa7
commit
6dd9de95df
79 changed files with 523 additions and 458 deletions
|
@ -2,7 +2,7 @@
|
|||
import * as express from 'express'
|
||||
import { VideoPrivacy, VideoRateType } from '../../../shared/models/videos'
|
||||
import { activityPubCollectionPagination, activityPubContextify } from '../../helpers/activitypub'
|
||||
import { CONFIG, ROUTE_CACHE_LIFETIME } from '../../initializers'
|
||||
import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../../initializers'
|
||||
import { buildAnnounceWithVideoAudience, buildLikeActivity } from '../../lib/activitypub/send'
|
||||
import { audiencify, getAudience } from '../../lib/activitypub/audience'
|
||||
import { buildCreateActivity } from '../../lib/activitypub/send/send-create'
|
||||
|
@ -19,7 +19,6 @@ import { AccountModel } from '../../models/account/account'
|
|||
import { ActorModel } from '../../models/activitypub/actor'
|
||||
import { ActorFollowModel } from '../../models/activitypub/actor-follow'
|
||||
import { VideoModel } from '../../models/video/video'
|
||||
import { VideoChannelModel } from '../../models/video/video-channel'
|
||||
import { VideoCommentModel } from '../../models/video/video-comment'
|
||||
import { VideoShareModel } from '../../models/video/video-share'
|
||||
import { cacheRoute } from '../../middlewares/cache'
|
||||
|
@ -35,11 +34,9 @@ import {
|
|||
import { VideoCaptionModel } from '../../models/video/video-caption'
|
||||
import { videoFileRedundancyGetValidator, videoPlaylistRedundancyGetValidator } from '../../middlewares/validators/redundancy'
|
||||
import { getServerActor } from '../../helpers/utils'
|
||||
import { VideoRedundancyModel } from '../../models/redundancy/video-redundancy'
|
||||
import { buildDislikeActivity } from '../../lib/activitypub/send/send-dislike'
|
||||
import { videoPlaylistElementAPGetValidator, videoPlaylistsGetValidator } from '../../middlewares/validators/videos/video-playlists'
|
||||
import { VideoPlaylistModel } from '../../models/video/video-playlist'
|
||||
import { VideoPlaylistElementModel } from '../../models/video/video-playlist-element'
|
||||
import { VideoPlaylistPrivacy } from '../../../shared/models/videos/playlist/video-playlist-privacy.model'
|
||||
|
||||
const activityPubClientRouter = express.Router()
|
||||
|
@ -213,7 +210,7 @@ async function videoController (req: express.Request, res: express.Response) {
|
|||
// We need more attributes
|
||||
const video = await VideoModel.loadForGetAPI(res.locals.video.id)
|
||||
|
||||
if (video.url.startsWith(CONFIG.WEBSERVER.URL) === false) return res.redirect(video.url)
|
||||
if (video.url.startsWith(WEBSERVER.URL) === false) return res.redirect(video.url)
|
||||
|
||||
// We need captions to render AP object
|
||||
video.VideoCaptions = await VideoCaptionModel.listVideoCaptions(video.id)
|
||||
|
@ -232,7 +229,7 @@ async function videoController (req: express.Request, res: express.Response) {
|
|||
async function videoAnnounceController (req: express.Request, res: express.Response) {
|
||||
const share = res.locals.videoShare
|
||||
|
||||
if (share.url.startsWith(CONFIG.WEBSERVER.URL) === false) return res.redirect(share.url)
|
||||
if (share.url.startsWith(WEBSERVER.URL) === false) return res.redirect(share.url)
|
||||
|
||||
const { activity } = await buildAnnounceWithVideoAudience(share.Actor, share, res.locals.video, undefined)
|
||||
|
||||
|
@ -306,7 +303,7 @@ async function videoChannelFollowingController (req: express.Request, res: expre
|
|||
async function videoCommentController (req: express.Request, res: express.Response) {
|
||||
const videoComment = res.locals.videoComment
|
||||
|
||||
if (videoComment.url.startsWith(CONFIG.WEBSERVER.URL) === false) return res.redirect(videoComment.url)
|
||||
if (videoComment.url.startsWith(WEBSERVER.URL) === false) return res.redirect(videoComment.url)
|
||||
|
||||
const threadParentComments = await VideoCommentModel.listThreadParentComments(videoComment, undefined)
|
||||
const isPublic = true // Comments are always public
|
||||
|
@ -324,7 +321,7 @@ async function videoCommentController (req: express.Request, res: express.Respon
|
|||
|
||||
async function videoRedundancyController (req: express.Request, res: express.Response) {
|
||||
const videoRedundancy = res.locals.videoRedundancy
|
||||
if (videoRedundancy.url.startsWith(CONFIG.WEBSERVER.URL) === false) return res.redirect(videoRedundancy.url)
|
||||
if (videoRedundancy.url.startsWith(WEBSERVER.URL) === false) return res.redirect(videoRedundancy.url)
|
||||
|
||||
const serverActor = await getServerActor()
|
||||
|
||||
|
@ -366,7 +363,7 @@ async function actorFollowing (req: express.Request, actor: ActorModel) {
|
|||
return ActorFollowModel.listAcceptedFollowingUrlsForApi([ actor.id ], undefined, start, count)
|
||||
}
|
||||
|
||||
return activityPubCollectionPagination(CONFIG.WEBSERVER.URL + req.path, handler, req.query.page)
|
||||
return activityPubCollectionPagination(WEBSERVER.URL + req.path, handler, req.query.page)
|
||||
}
|
||||
|
||||
async function actorFollowers (req: express.Request, actor: ActorModel) {
|
||||
|
@ -374,7 +371,7 @@ async function actorFollowers (req: express.Request, actor: ActorModel) {
|
|||
return ActorFollowModel.listAcceptedFollowerUrlsForAP([ actor.id ], undefined, start, count)
|
||||
}
|
||||
|
||||
return activityPubCollectionPagination(CONFIG.WEBSERVER.URL + req.path, handler, req.query.page)
|
||||
return activityPubCollectionPagination(WEBSERVER.URL + req.path, handler, req.query.page)
|
||||
}
|
||||
|
||||
async function actorPlaylists (req: express.Request, account: AccountModel) {
|
||||
|
@ -382,7 +379,7 @@ async function actorPlaylists (req: express.Request, account: AccountModel) {
|
|||
return VideoPlaylistModel.listPublicUrlsOfForAP(account.id, start, count)
|
||||
}
|
||||
|
||||
return activityPubCollectionPagination(CONFIG.WEBSERVER.URL + req.path, handler, req.query.page)
|
||||
return activityPubCollectionPagination(WEBSERVER.URL + req.path, handler, req.query.page)
|
||||
}
|
||||
|
||||
function videoRates (req: express.Request, rateType: VideoRateType, video: VideoModel, url: string) {
|
||||
|
|
|
@ -4,7 +4,7 @@ import { ServerConfig, UserRight } from '../../../shared'
|
|||
import { About } from '../../../shared/models/server/about.model'
|
||||
import { CustomConfig } from '../../../shared/models/server/custom-config.model'
|
||||
import { isSignupAllowed, isSignupAllowedForCurrentIP } from '../../helpers/signup'
|
||||
import { CONFIG, CONSTRAINTS_FIELDS, reloadConfig } from '../../initializers'
|
||||
import { CONSTRAINTS_FIELDS } from '../../initializers'
|
||||
import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../middlewares'
|
||||
import { customConfigUpdateValidator } from '../../middlewares/validators/config'
|
||||
import { ClientHtml } from '../../lib/client-html'
|
||||
|
@ -14,6 +14,7 @@ import { getServerCommit } from '../../helpers/utils'
|
|||
import { Emailer } from '../../lib/emailer'
|
||||
import { isNumeric } from 'validator'
|
||||
import { objectConverter } from '../../helpers/core-utils'
|
||||
import { CONFIG, reloadConfig } from '../../initializers/config'
|
||||
|
||||
const packageJSON = require('../../../../package.json')
|
||||
const configRouter = express.Router()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as express from 'express'
|
||||
import { OAuthClientLocal } from '../../../shared'
|
||||
import { logger } from '../../helpers/logger'
|
||||
import { CONFIG } from '../../initializers'
|
||||
import { CONFIG } from '../../initializers/config'
|
||||
import { asyncMiddleware } from '../../middlewares'
|
||||
import { OAuthClientModel } from '../../models/oauth/oauth-client'
|
||||
|
||||
|
|
|
@ -3,10 +3,11 @@ import { UserRight } from '../../../../shared/models/users'
|
|||
import { asyncMiddleware, authenticate, ensureUserHasRight } from '../../../middlewares'
|
||||
import { mtimeSortFilesDesc } from '../../../../shared/utils/logs/logs'
|
||||
import { readdir, readFile } from 'fs-extra'
|
||||
import { CONFIG, MAX_LOGS_OUTPUT_CHARACTERS } from '../../../initializers'
|
||||
import { MAX_LOGS_OUTPUT_CHARACTERS } from '../../../initializers'
|
||||
import { join } from 'path'
|
||||
import { getLogsValidator } from '../../../middlewares/validators/logs'
|
||||
import { LogLevel } from '../../../../shared/models/server/log-level.type'
|
||||
import { CONFIG } from '../../../initializers/config'
|
||||
|
||||
const logsRouter = express.Router()
|
||||
|
||||
|
|
|
@ -6,9 +6,10 @@ import { ActorFollowModel } from '../../../models/activitypub/actor-follow'
|
|||
import { VideoModel } from '../../../models/video/video'
|
||||
import { VideoCommentModel } from '../../../models/video/video-comment'
|
||||
import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy'
|
||||
import { CONFIG, ROUTE_CACHE_LIFETIME } from '../../../initializers/constants'
|
||||
import { ROUTE_CACHE_LIFETIME } from '../../../initializers/constants'
|
||||
import { cacheRoute } from '../../../middlewares/cache'
|
||||
import { VideoFileModel } from '../../../models/video/video-file'
|
||||
import { CONFIG } from '../../../initializers/config'
|
||||
|
||||
const statsRouter = express.Router()
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import * as RateLimit from 'express-rate-limit'
|
|||
import { UserCreate, UserRight, UserRole, UserUpdate } from '../../../../shared'
|
||||
import { logger } from '../../../helpers/logger'
|
||||
import { getFormattedObjects } from '../../../helpers/utils'
|
||||
import { CONFIG, RATES_LIMIT, sequelizeTypescript } from '../../../initializers'
|
||||
import { RATES_LIMIT, sequelizeTypescript, WEBSERVER } from '../../../initializers'
|
||||
import { Emailer } from '../../../lib/emailer'
|
||||
import { Redis } from '../../../lib/redis'
|
||||
import { createUserAccountAndChannelAndPlaylist } from '../../../lib/user'
|
||||
|
@ -43,6 +43,7 @@ import { myVideosHistoryRouter } from './my-history'
|
|||
import { myNotificationsRouter } from './my-notifications'
|
||||
import { Notifier } from '../../../lib/notifier'
|
||||
import { mySubscriptionsRouter } from './my-subscriptions'
|
||||
import { CONFIG } from '../../../initializers/config'
|
||||
|
||||
const auditLogger = auditLoggerFactory('users')
|
||||
|
||||
|
@ -293,7 +294,7 @@ async function askResetUserPassword (req: express.Request, res: express.Response
|
|||
const user = res.locals.user
|
||||
|
||||
const verificationString = await Redis.Instance.setResetPasswordVerificationString(user.id)
|
||||
const url = CONFIG.WEBSERVER.URL + '/reset-password?userId=' + user.id + '&verificationString=' + verificationString
|
||||
const url = WEBSERVER.URL + '/reset-password?userId=' + user.id + '&verificationString=' + verificationString
|
||||
await Emailer.Instance.addPasswordResetEmailJob(user.email, url)
|
||||
|
||||
return res.status(204).end()
|
||||
|
@ -310,7 +311,7 @@ async function resetUserPassword (req: express.Request, res: express.Response) {
|
|||
|
||||
async function sendVerifyUserEmail (user: UserModel) {
|
||||
const verificationString = await Redis.Instance.setVerifyEmailVerificationString(user.id)
|
||||
const url = CONFIG.WEBSERVER.URL + '/verify-account/email?userId=' + user.id + '&verificationString=' + verificationString
|
||||
const url = WEBSERVER.URL + '/verify-account/email?userId=' + user.id + '&verificationString=' + verificationString
|
||||
await Emailer.Instance.addVerifyEmailJob(user.email, url)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import * as express from 'express'
|
|||
import 'multer'
|
||||
import { UserUpdateMe, UserVideoRate as FormattedUserVideoRate } from '../../../../shared'
|
||||
import { getFormattedObjects } from '../../../helpers/utils'
|
||||
import { CONFIG, MIMETYPES, sequelizeTypescript } from '../../../initializers'
|
||||
import { MIMETYPES, sequelizeTypescript } from '../../../initializers'
|
||||
import { sendUpdateActor } from '../../../lib/activitypub/send'
|
||||
import {
|
||||
asyncMiddleware,
|
||||
|
@ -26,6 +26,7 @@ import { updateActorAvatarFile } from '../../../lib/avatar'
|
|||
import { auditLoggerFactory, getAuditIdFromRes, UserAuditView } from '../../../helpers/audit-logger'
|
||||
import { VideoImportModel } from '../../../models/video/video-import'
|
||||
import { AccountModel } from '../../../models/account/account'
|
||||
import { CONFIG } from '../../../initializers/config'
|
||||
|
||||
const auditLogger = auditLoggerFactory('users-me')
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as express from 'express'
|
||||
import 'multer'
|
||||
import { getFormattedObjects } from '../../../helpers/utils'
|
||||
import { CONFIG, sequelizeTypescript } from '../../../initializers'
|
||||
import { sequelizeTypescript, WEBSERVER } from '../../../initializers'
|
||||
import {
|
||||
asyncMiddleware,
|
||||
asyncRetryTransactionMiddleware,
|
||||
|
@ -80,7 +80,7 @@ async function areSubscriptionsExist (req: express.Request, res: express.Respons
|
|||
|
||||
const handles = uris.map(u => {
|
||||
let [ name, host ] = u.split('@')
|
||||
if (host === CONFIG.WEBSERVER.HOST) host = null
|
||||
if (host === WEBSERVER.HOST) host = null
|
||||
|
||||
return { name, host, uri: u }
|
||||
})
|
||||
|
|
|
@ -23,7 +23,7 @@ import { createVideoChannel } from '../../lib/video-channel'
|
|||
import { buildNSFWFilter, createReqFiles, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
|
||||
import { setAsyncActorKeys } from '../../lib/activitypub'
|
||||
import { AccountModel } from '../../models/account/account'
|
||||
import { CONFIG, MIMETYPES, sequelizeTypescript } from '../../initializers'
|
||||
import { MIMETYPES, sequelizeTypescript } from '../../initializers'
|
||||
import { logger } from '../../helpers/logger'
|
||||
import { VideoModel } from '../../models/video/video'
|
||||
import { updateAvatarValidator } from '../../middlewares/validators/avatar'
|
||||
|
@ -33,6 +33,7 @@ import { resetSequelizeInstance } from '../../helpers/database-utils'
|
|||
import { JobQueue } from '../../lib/job-queue'
|
||||
import { VideoPlaylistModel } from '../../models/video/video-playlist'
|
||||
import { commonVideoPlaylistFiltersValidator } from '../../middlewares/validators/videos/video-playlists'
|
||||
import { CONFIG } from '../../initializers/config'
|
||||
|
||||
const auditLogger = auditLoggerFactory('channels')
|
||||
const reqAvatarFile = createReqFiles([ 'avatarfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { avatarfile: CONFIG.STORAGE.TMP_DIR })
|
||||
|
|
|
@ -12,7 +12,7 @@ import {
|
|||
} from '../../middlewares'
|
||||
import { videoPlaylistsSortValidator } from '../../middlewares/validators'
|
||||
import { buildNSFWFilter, createReqFiles, isUserAbleToSearchRemoteURI } from '../../helpers/express-utils'
|
||||
import { CONFIG, MIMETYPES, sequelizeTypescript, THUMBNAILS_SIZE, VIDEO_PLAYLIST_PRIVACIES } from '../../initializers'
|
||||
import { MIMETYPES, sequelizeTypescript, THUMBNAILS_SIZE, VIDEO_PLAYLIST_PRIVACIES } from '../../initializers'
|
||||
import { logger } from '../../helpers/logger'
|
||||
import { resetSequelizeInstance } from '../../helpers/database-utils'
|
||||
import { VideoPlaylistModel } from '../../models/video/video-playlist'
|
||||
|
@ -41,6 +41,7 @@ import { copy, pathExists } from 'fs-extra'
|
|||
import { AccountModel } from '../../models/account/account'
|
||||
import { VideoPlaylistReorder } from '../../../shared/models/videos/playlist/video-playlist-reorder.model'
|
||||
import { JobQueue } from '../../lib/job-queue'
|
||||
import { CONFIG } from '../../initializers/config'
|
||||
|
||||
const reqThumbnailFile = createReqFiles([ 'thumbnailfile' ], MIMETYPES.IMAGE.MIMETYPE_EXT, { thumbnailfile: CONFIG.STORAGE.TMP_DIR })
|
||||
|
||||
|
|
|
@ -2,12 +2,13 @@ import * as express from 'express'
|
|||
import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate } from '../../../middlewares'
|
||||
import { addVideoCaptionValidator, deleteVideoCaptionValidator, listVideoCaptionsValidator } from '../../../middlewares/validators'
|
||||
import { createReqFiles } from '../../../helpers/express-utils'
|
||||
import { CONFIG, MIMETYPES, sequelizeTypescript } from '../../../initializers'
|
||||
import { MIMETYPES, sequelizeTypescript } from '../../../initializers'
|
||||
import { getFormattedObjects } from '../../../helpers/utils'
|
||||
import { VideoCaptionModel } from '../../../models/video/video-caption'
|
||||
import { logger } from '../../../helpers/logger'
|
||||
import { federateVideoIfNeeded } from '../../../lib/activitypub'
|
||||
import { moveAndProcessCaptionFile } from '../../../helpers/captions-utils'
|
||||
import { CONFIG } from '../../../initializers/config'
|
||||
|
||||
const reqVideoCaptionAdd = createReqFiles(
|
||||
[ 'captionfile' ],
|
||||
|
|
|
@ -3,7 +3,7 @@ import * as magnetUtil from 'magnet-uri'
|
|||
import 'multer'
|
||||
import { auditLoggerFactory, getAuditIdFromRes, VideoImportAuditView } from '../../../helpers/audit-logger'
|
||||
import { asyncMiddleware, asyncRetryTransactionMiddleware, authenticate, videoImportAddValidator } from '../../../middlewares'
|
||||
import { CONFIG, MIMETYPES, PREVIEWS_SIZE, sequelizeTypescript, THUMBNAILS_SIZE } from '../../../initializers'
|
||||
import { MIMETYPES, PREVIEWS_SIZE, sequelizeTypescript, THUMBNAILS_SIZE } from '../../../initializers'
|
||||
import { getYoutubeDLInfo, YoutubeDLInfo } from '../../../helpers/youtube-dl'
|
||||
import { createReqFiles } from '../../../helpers/express-utils'
|
||||
import { logger } from '../../../helpers/logger'
|
||||
|
@ -22,8 +22,9 @@ import { UserModel } from '../../../models/account/user'
|
|||
import * as Bluebird from 'bluebird'
|
||||
import * as parseTorrent from 'parse-torrent'
|
||||
import { getSecureTorrentName } from '../../../helpers/utils'
|
||||
import { readFile, move } from 'fs-extra'
|
||||
import { move, readFile } from 'fs-extra'
|
||||
import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist'
|
||||
import { CONFIG } from '../../../initializers/config'
|
||||
|
||||
const auditLogger = auditLoggerFactory('video-imports')
|
||||
const videoImportsRouter = express.Router()
|
||||
|
|
|
@ -8,7 +8,6 @@ import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../
|
|||
import { getFormattedObjects, getServerActor } from '../../../helpers/utils'
|
||||
import { autoBlacklistVideoIfNeeded } from '../../../lib/video-blacklist'
|
||||
import {
|
||||
CONFIG,
|
||||
MIMETYPES,
|
||||
PREVIEWS_SIZE,
|
||||
sequelizeTypescript,
|
||||
|
@ -61,6 +60,7 @@ import { move } from 'fs-extra'
|
|||
import { watchingRouter } from './watching'
|
||||
import { Notifier } from '../../../lib/notifier'
|
||||
import { sendView } from '../../../lib/activitypub/send/send-view'
|
||||
import { CONFIG } from '../../../initializers/config'
|
||||
|
||||
const auditLogger = auditLoggerFactory('videos')
|
||||
const videosRouter = express.Router()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import * as express from 'express'
|
||||
import { asyncMiddleware } from '../middlewares'
|
||||
import { CONFIG, ROUTE_CACHE_LIFETIME } from '../initializers'
|
||||
import { ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers'
|
||||
import * as sitemapModule from 'sitemap'
|
||||
import { logger } from '../helpers/logger'
|
||||
import { VideoModel } from '../models/video/video'
|
||||
|
@ -35,7 +35,7 @@ async function getSitemap (req: express.Request, res: express.Response) {
|
|||
urls = urls.concat(await getSitemapAccountUrls())
|
||||
|
||||
const sitemap = sitemapModule.createSitemap({
|
||||
hostname: CONFIG.WEBSERVER.URL,
|
||||
hostname: WEBSERVER.URL,
|
||||
urls: urls
|
||||
})
|
||||
|
||||
|
@ -54,7 +54,7 @@ async function getSitemapVideoChannelUrls () {
|
|||
const rows = await VideoChannelModel.listLocalsForSitemap('createdAt')
|
||||
|
||||
return rows.map(channel => ({
|
||||
url: CONFIG.WEBSERVER.URL + '/video-channels/' + channel.Actor.preferredUsername
|
||||
url: WEBSERVER.URL + '/video-channels/' + channel.Actor.preferredUsername
|
||||
}))
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ async function getSitemapAccountUrls () {
|
|||
const rows = await AccountModel.listLocalsForSitemap('createdAt')
|
||||
|
||||
return rows.map(channel => ({
|
||||
url: CONFIG.WEBSERVER.URL + '/accounts/' + channel.Actor.preferredUsername
|
||||
url: WEBSERVER.URL + '/accounts/' + channel.Actor.preferredUsername
|
||||
}))
|
||||
}
|
||||
|
||||
|
@ -78,14 +78,14 @@ async function getSitemapLocalVideoUrls () {
|
|||
})
|
||||
|
||||
return resultList.data.map(v => ({
|
||||
url: CONFIG.WEBSERVER.URL + '/videos/watch/' + v.uuid,
|
||||
url: WEBSERVER.URL + '/videos/watch/' + v.uuid,
|
||||
video: [
|
||||
{
|
||||
title: v.name,
|
||||
// Sitemap description should be < 2000 characters
|
||||
description: truncate(v.description || v.name, { length: 2000, omission: '...' }),
|
||||
player_loc: CONFIG.WEBSERVER.URL + '/videos/embed/' + v.uuid,
|
||||
thumbnail_loc: CONFIG.WEBSERVER.URL + v.getThumbnailStaticPath()
|
||||
player_loc: WEBSERVER.URL + '/videos/embed/' + v.uuid,
|
||||
thumbnail_loc: WEBSERVER.URL + v.getThumbnailStaticPath()
|
||||
}
|
||||
]
|
||||
}))
|
||||
|
@ -97,5 +97,5 @@ function getSitemapBasicUrls () {
|
|||
'/videos/local'
|
||||
]
|
||||
|
||||
return paths.map(p => ({ url: CONFIG.WEBSERVER.URL + p }))
|
||||
return paths.map(p => ({ url: WEBSERVER.URL + p }))
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as express from 'express'
|
||||
import { CONFIG, FEEDS, ROUTE_CACHE_LIFETIME } from '../initializers/constants'
|
||||
import { FEEDS, ROUTE_CACHE_LIFETIME, WEBSERVER } from '../initializers/constants'
|
||||
import { THUMBNAILS_SIZE } from '../initializers'
|
||||
import {
|
||||
asyncMiddleware,
|
||||
|
@ -14,6 +14,7 @@ import * as Feed from 'pfeed'
|
|||
import { cacheRoute } from '../middlewares/cache'
|
||||
import { VideoCommentModel } from '../models/video/video-comment'
|
||||
import { buildNSFWFilter } from '../helpers/express-utils'
|
||||
import { CONFIG } from '../initializers/config'
|
||||
|
||||
const feedsRouter = express.Router()
|
||||
|
||||
|
@ -54,7 +55,7 @@ async function generateVideoCommentsFeed (req: express.Request, res: express.Res
|
|||
|
||||
// Adding video items to the feed, one at a time
|
||||
comments.forEach(comment => {
|
||||
const link = CONFIG.WEBSERVER.URL + comment.getCommentStaticPath()
|
||||
const link = WEBSERVER.URL + comment.getCommentStaticPath()
|
||||
|
||||
feed.addItem({
|
||||
title: `${comment.Video.name} - ${comment.Account.getDisplayName()}`,
|
||||
|
@ -122,7 +123,7 @@ async function generateVideoFeed (req: express.Request, res: express.Response) {
|
|||
feed.addItem({
|
||||
title: video.name,
|
||||
id: video.url,
|
||||
link: CONFIG.WEBSERVER.URL + '/videos/watch/' + video.uuid,
|
||||
link: WEBSERVER.URL + '/videos/watch/' + video.uuid,
|
||||
description: video.getTruncatedDescription(),
|
||||
content: video.description,
|
||||
author: [
|
||||
|
@ -137,7 +138,7 @@ async function generateVideoFeed (req: express.Request, res: express.Response) {
|
|||
torrent: torrents,
|
||||
thumbnail: [
|
||||
{
|
||||
url: CONFIG.WEBSERVER.URL + video.getThumbnailStaticPath(),
|
||||
url: WEBSERVER.URL + video.getThumbnailStaticPath(),
|
||||
height: THUMBNAILS_SIZE.height,
|
||||
width: THUMBNAILS_SIZE.width
|
||||
}
|
||||
|
@ -150,7 +151,7 @@ async function generateVideoFeed (req: express.Request, res: express.Response) {
|
|||
}
|
||||
|
||||
function initFeed (name: string, description: string) {
|
||||
const webserverUrl = CONFIG.WEBSERVER.URL
|
||||
const webserverUrl = WEBSERVER.URL
|
||||
|
||||
return new Feed({
|
||||
title: name,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as express from 'express'
|
||||
import { CONFIG, EMBED_SIZE, PREVIEWS_SIZE } from '../initializers'
|
||||
import { EMBED_SIZE, PREVIEWS_SIZE, WEBSERVER } from '../initializers'
|
||||
import { asyncMiddleware, oembedValidator } from '../middlewares'
|
||||
import { accountNameWithHostGetValidator } from '../middlewares/validators'
|
||||
import { VideoModel } from '../models/video/video'
|
||||
import { CONFIG } from '../initializers/config'
|
||||
|
||||
const servicesRouter = express.Router()
|
||||
|
||||
|
@ -25,7 +25,7 @@ export {
|
|||
|
||||
function generateOEmbed (req: express.Request, res: express.Response) {
|
||||
const video = res.locals.video
|
||||
const webserverUrl = CONFIG.WEBSERVER.URL
|
||||
const webserverUrl = WEBSERVER.URL
|
||||
const maxHeight = parseInt(req.query.maxheight, 10)
|
||||
const maxWidth = parseInt(req.query.maxwidth, 10)
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import * as cors from 'cors'
|
||||
import * as express from 'express'
|
||||
import {
|
||||
CONFIG,
|
||||
HLS_STREAMING_PLAYLIST_DIRECTORY,
|
||||
ROUTE_CACHE_LIFETIME,
|
||||
STATIC_DOWNLOAD_PATHS,
|
||||
STATIC_MAX_AGE,
|
||||
STATIC_PATHS
|
||||
STATIC_PATHS,
|
||||
WEBSERVER
|
||||
} from '../initializers'
|
||||
import { VideosCaptionCache, VideosPreviewCache } from '../lib/files-cache'
|
||||
import { cacheRoute } from '../middlewares/cache'
|
||||
|
@ -17,6 +17,7 @@ import { VideoCommentModel } from '../models/video/video-comment'
|
|||
import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo'
|
||||
import { join } from 'path'
|
||||
import { root } from '../helpers/core-utils'
|
||||
import { CONFIG } from '../initializers/config'
|
||||
|
||||
const packageJSON = require('../../../package.json')
|
||||
const staticRouter = express.Router()
|
||||
|
@ -121,7 +122,7 @@ staticRouter.use('/.well-known/nodeinfo',
|
|||
links: [
|
||||
{
|
||||
rel: 'http://nodeinfo.diaspora.software/ns/schema/2.0',
|
||||
href: CONFIG.WEBSERVER.URL + '/nodeinfo/2.0.json'
|
||||
href: WEBSERVER.URL + '/nodeinfo/2.0.json'
|
||||
}
|
||||
]
|
||||
})
|
||||
|
|
|
@ -4,10 +4,11 @@ import * as http from 'http'
|
|||
import * as bitTorrentTracker from 'bittorrent-tracker'
|
||||
import * as proxyAddr from 'proxy-addr'
|
||||
import { Server as WebSocketServer } from 'ws'
|
||||
import { CONFIG, TRACKER_RATE_LIMITS } from '../initializers/constants'
|
||||
import { TRACKER_RATE_LIMITS } from '../initializers/constants'
|
||||
import { VideoFileModel } from '../models/video/video-file'
|
||||
import { parse } from 'url'
|
||||
import { VideoStreamingPlaylistModel } from '../models/video/video-streaming-playlist'
|
||||
import { CONFIG } from '../initializers/config'
|
||||
|
||||
const TrackerServer = bitTorrentTracker.Server
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue