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/lib/client-html.ts | |
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/lib/client-html.ts')
-rw-r--r-- | server/lib/client-html.ts | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts index 217f6a437..f8e1e456f 100644 --- a/server/lib/client-html.ts +++ b/server/lib/client-html.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import { buildFileLocale, getDefaultLocale, is18nLocale, POSSIBLE_LOCALES } from '../../shared/models/i18n/i18n' | 2 | import { buildFileLocale, getDefaultLocale, is18nLocale, POSSIBLE_LOCALES } from '../../shared/models/i18n/i18n' |
3 | import { CONFIG, CUSTOM_HTML_TAG_COMMENTS, EMBED_SIZE } from '../initializers' | 3 | import { CUSTOM_HTML_TAG_COMMENTS, EMBED_SIZE, WEBSERVER } from '../initializers' |
4 | import { join } from 'path' | 4 | import { join } from 'path' |
5 | import { escapeHTML } from '../helpers/core-utils' | 5 | import { escapeHTML } from '../helpers/core-utils' |
6 | import { VideoModel } from '../models/video/video' | 6 | import { VideoModel } from '../models/video/video' |
@@ -11,6 +11,7 @@ import { getActivityStreamDuration } from '../models/video/video-format-utils' | |||
11 | import { AccountModel } from '../models/account/account' | 11 | import { AccountModel } from '../models/account/account' |
12 | import { VideoChannelModel } from '../models/video/video-channel' | 12 | import { VideoChannelModel } from '../models/video/video-channel' |
13 | import * as Bluebird from 'bluebird' | 13 | import * as Bluebird from 'bluebird' |
14 | import { CONFIG } from '../initializers/config' | ||
14 | 15 | ||
15 | export class ClientHtml { | 16 | export class ClientHtml { |
16 | 17 | ||
@@ -106,7 +107,7 @@ export class ClientHtml { | |||
106 | 107 | ||
107 | // Save locale in cookies | 108 | // Save locale in cookies |
108 | res.cookie('clientLanguage', lang, { | 109 | res.cookie('clientLanguage', lang, { |
109 | secure: CONFIG.WEBSERVER.SCHEME === 'https', | 110 | secure: WEBSERVER.SCHEME === 'https', |
110 | sameSite: true, | 111 | sameSite: true, |
111 | maxAge: 1000 * 3600 * 24 * 90 // 3 months | 112 | maxAge: 1000 * 3600 * 24 * 90 // 3 months |
112 | }) | 113 | }) |
@@ -143,12 +144,12 @@ export class ClientHtml { | |||
143 | } | 144 | } |
144 | 145 | ||
145 | private static addVideoOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoModel) { | 146 | private static addVideoOpenGraphAndOEmbedTags (htmlStringPage: string, video: VideoModel) { |
146 | const previewUrl = CONFIG.WEBSERVER.URL + video.getPreviewStaticPath() | 147 | const previewUrl = WEBSERVER.URL + video.getPreviewStaticPath() |
147 | const videoUrl = CONFIG.WEBSERVER.URL + video.getWatchStaticPath() | 148 | const videoUrl = WEBSERVER.URL + video.getWatchStaticPath() |
148 | 149 | ||
149 | const videoNameEscaped = escapeHTML(video.name) | 150 | const videoNameEscaped = escapeHTML(video.name) |
150 | const videoDescriptionEscaped = escapeHTML(video.description) | 151 | const videoDescriptionEscaped = escapeHTML(video.description) |
151 | const embedUrl = CONFIG.WEBSERVER.URL + video.getEmbedStaticPath() | 152 | const embedUrl = WEBSERVER.URL + video.getEmbedStaticPath() |
152 | 153 | ||
153 | const openGraphMetaTags = { | 154 | const openGraphMetaTags = { |
154 | 'og:type': 'video', | 155 | 'og:type': 'video', |
@@ -180,7 +181,7 @@ export class ClientHtml { | |||
180 | const oembedLinkTags = [ | 181 | const oembedLinkTags = [ |
181 | { | 182 | { |
182 | type: 'application/json+oembed', | 183 | type: 'application/json+oembed', |
183 | href: CONFIG.WEBSERVER.URL + '/services/oembed?url=' + encodeURIComponent(videoUrl), | 184 | href: WEBSERVER.URL + '/services/oembed?url=' + encodeURIComponent(videoUrl), |
184 | title: videoNameEscaped | 185 | title: videoNameEscaped |
185 | } | 186 | } |
186 | ] | 187 | ] |