diff options
Diffstat (limited to 'server/controllers/static.ts')
-rw-r--r-- | server/controllers/static.ts | 89 |
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' |
12 | import { cacheRoute } from '../middlewares/cache' | 14 | import { cacheRoute } from '../middlewares/cache' |
13 | import { asyncMiddleware, videosDownloadValidator } from '../middlewares' | 15 | import { asyncMiddleware, videosDownloadValidator } from '../middlewares' |
@@ -18,10 +20,13 @@ import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/node | |||
18 | import { join } from 'path' | 20 | import { join } from 'path' |
19 | import { root } from '../helpers/core-utils' | 21 | import { root } from '../helpers/core-utils' |
20 | import { CONFIG } from '../initializers/config' | 22 | import { CONFIG } from '../initializers/config' |
23 | import { Emailer } from '../lib/emailer' | ||
21 | import { getPreview, getVideoCaption } from './lazy-static' | 24 | import { getPreview, getVideoCaption } from './lazy-static' |
22 | import { VideoStreamingPlaylistType } from '@shared/models/videos/video-streaming-playlist.type' | 25 | import { VideoStreamingPlaylistType } from '@shared/models/videos/video-streaming-playlist.type' |
23 | import { MVideoFile, MVideoFullLight } from '@server/typings/models' | 26 | import { MVideoFile, MVideoFullLight } from '@server/typings/models' |
24 | import { getTorrentFilePath, getVideoFilePath } from '@server/lib/video-paths' | 27 | import { getTorrentFilePath, getVideoFilePath } from '@server/lib/video-paths' |
28 | import { getThemeOrDefault } from '../lib/plugins/theme-utils' | ||
29 | import { getEnabledResolutions, getRegisteredPlugins, getRegisteredThemes } from '@server/controllers/api/config' | ||
25 | 30 | ||
26 | const staticRouter = express.Router() | 31 | const 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#"') |