aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/static.ts
diff options
context:
space:
mode:
authorRigel Kent <sendmemail@rigelk.eu>2019-12-17 13:07:50 +0100
committerRigel Kent <sendmemail@rigelk.eu>2019-12-17 13:07:50 +0100
commit174e0855873d7086ad8240599101c2f717ebbd59 (patch)
tree4b698eb1dddb5e94dd2808871da0c6e538344ef8 /server/controllers/static.ts
parent208c7e92e9337a01ac2915a2e2d9c3067af32377 (diff)
downloadPeerTube-174e0855873d7086ad8240599101c2f717ebbd59.tar.gz
PeerTube-174e0855873d7086ad8240599101c2f717ebbd59.tar.zst
PeerTube-174e0855873d7086ad8240599101c2f717ebbd59.zip
(nodeinfo) add server config to the nodeinfo metadata
Diffstat (limited to 'server/controllers/static.ts')
-rw-r--r--server/controllers/static.ts89
1 files changed, 87 insertions, 2 deletions
diff --git a/server/controllers/static.ts b/server/controllers/static.ts
index 0aab12756..f86a0cb5b 100644
--- a/server/controllers/static.ts
+++ b/server/controllers/static.ts
@@ -7,7 +7,9 @@ import {
7 STATIC_DOWNLOAD_PATHS, 7 STATIC_DOWNLOAD_PATHS,
8 STATIC_MAX_AGE, 8 STATIC_MAX_AGE,
9 STATIC_PATHS, 9 STATIC_PATHS,
10 WEBSERVER 10 WEBSERVER,
11 CONSTRAINTS_FIELDS,
12 DEFAULT_THEME_NAME
11} from '../initializers/constants' 13} from '../initializers/constants'
12import { cacheRoute } from '../middlewares/cache' 14import { cacheRoute } from '../middlewares/cache'
13import { asyncMiddleware, videosDownloadValidator } from '../middlewares' 15import { asyncMiddleware, videosDownloadValidator } from '../middlewares'
@@ -18,10 +20,13 @@ import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/node
18import { join } from 'path' 20import { join } from 'path'
19import { root } from '../helpers/core-utils' 21import { root } from '../helpers/core-utils'
20import { CONFIG } from '../initializers/config' 22import { CONFIG } from '../initializers/config'
23import { Emailer } from '../lib/emailer'
21import { getPreview, getVideoCaption } from './lazy-static' 24import { getPreview, getVideoCaption } from './lazy-static'
22import { VideoStreamingPlaylistType } from '@shared/models/videos/video-streaming-playlist.type' 25import { VideoStreamingPlaylistType } from '@shared/models/videos/video-streaming-playlist.type'
23import { MVideoFile, MVideoFullLight } from '@server/typings/models' 26import { MVideoFile, MVideoFullLight } from '@server/typings/models'
24import { getTorrentFilePath, getVideoFilePath } from '@server/lib/video-paths' 27import { getTorrentFilePath, getVideoFilePath } from '@server/lib/video-paths'
28import { getThemeOrDefault } from '../lib/plugins/theme-utils'
29import { getEnabledResolutions, getRegisteredPlugins, getRegisteredThemes } from '@server/controllers/api/config'
25 30
26const staticRouter = express.Router() 31const staticRouter = express.Router()
27 32
@@ -228,7 +233,87 @@ async function generateNodeinfo (req: express.Request, res: express.Response) {
228 postsName: 'Videos' 233 postsName: 'Videos'
229 }, 234 },
230 nodeName: CONFIG.INSTANCE.NAME, 235 nodeName: CONFIG.INSTANCE.NAME,
231 nodeDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION 236 nodeDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION,
237 nodeConfig: {
238 plugin: {
239 registered: getRegisteredPlugins()
240 },
241 theme: {
242 registered: getRegisteredThemes(),
243 default: getThemeOrDefault(CONFIG.THEME.DEFAULT, DEFAULT_THEME_NAME)
244 },
245 email: {
246 enabled: Emailer.isEnabled()
247 },
248 contactForm: {
249 enabled: CONFIG.CONTACT_FORM.ENABLED
250 },
251 transcoding: {
252 hls: {
253 enabled: CONFIG.TRANSCODING.HLS.ENABLED
254 },
255 webtorrent: {
256 enabled: CONFIG.TRANSCODING.WEBTORRENT.ENABLED
257 },
258 enabledResolutions: getEnabledResolutions()
259 },
260 import: {
261 videos: {
262 http: {
263 enabled: CONFIG.IMPORT.VIDEOS.HTTP.ENABLED
264 },
265 torrent: {
266 enabled: CONFIG.IMPORT.VIDEOS.TORRENT.ENABLED
267 }
268 }
269 },
270 autoBlacklist: {
271 videos: {
272 ofUsers: {
273 enabled: CONFIG.AUTO_BLACKLIST.VIDEOS.OF_USERS.ENABLED
274 }
275 }
276 },
277 avatar: {
278 file: {
279 size: {
280 max: CONSTRAINTS_FIELDS.ACTORS.AVATAR.FILE_SIZE.max
281 },
282 extensions: CONSTRAINTS_FIELDS.ACTORS.AVATAR.EXTNAME
283 }
284 },
285 video: {
286 image: {
287 extensions: CONSTRAINTS_FIELDS.VIDEOS.IMAGE.EXTNAME,
288 size: {
289 max: CONSTRAINTS_FIELDS.VIDEOS.IMAGE.FILE_SIZE.max
290 }
291 },
292 file: {
293 extensions: CONSTRAINTS_FIELDS.VIDEOS.EXTNAME
294 }
295 },
296 videoCaption: {
297 file: {
298 size: {
299 max: CONSTRAINTS_FIELDS.VIDEO_CAPTIONS.CAPTION_FILE.FILE_SIZE.max
300 },
301 extensions: CONSTRAINTS_FIELDS.VIDEO_CAPTIONS.CAPTION_FILE.EXTNAME
302 }
303 },
304 user: {
305 videoQuota: CONFIG.USER.VIDEO_QUOTA,
306 videoQuotaDaily: CONFIG.USER.VIDEO_QUOTA_DAILY
307 },
308 trending: {
309 videos: {
310 intervalDays: CONFIG.TRENDING.VIDEOS.INTERVAL_DAYS
311 }
312 },
313 tracker: {
314 enabled: CONFIG.TRACKER.ENABLED
315 }
316 }
232 } 317 }
233 } as HttpNodeinfoDiasporaSoftwareNsSchema20 318 } as HttpNodeinfoDiasporaSoftwareNsSchema20
234 res.contentType('application/json; profile="http://nodeinfo.diaspora.software/ns/schema/2.0#"') 319 res.contentType('application/json; profile="http://nodeinfo.diaspora.software/ns/schema/2.0#"')