diff options
Diffstat (limited to 'server/controllers/static.ts')
-rw-r--r-- | server/controllers/static.ts | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/server/controllers/static.ts b/server/controllers/static.ts index a4bb3a4d9..75d1a816b 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts | |||
@@ -45,12 +45,12 @@ staticRouter.use( | |||
45 | staticRouter.use( | 45 | staticRouter.use( |
46 | STATIC_DOWNLOAD_PATHS.TORRENTS + ':id-:resolution([0-9]+).torrent', | 46 | STATIC_DOWNLOAD_PATHS.TORRENTS + ':id-:resolution([0-9]+).torrent', |
47 | asyncMiddleware(videosDownloadValidator), | 47 | asyncMiddleware(videosDownloadValidator), |
48 | asyncMiddleware(downloadTorrent) | 48 | downloadTorrent |
49 | ) | 49 | ) |
50 | staticRouter.use( | 50 | staticRouter.use( |
51 | STATIC_DOWNLOAD_PATHS.TORRENTS + ':id-:resolution([0-9]+)-hls.torrent', | 51 | STATIC_DOWNLOAD_PATHS.TORRENTS + ':id-:resolution([0-9]+)-hls.torrent', |
52 | asyncMiddleware(videosDownloadValidator), | 52 | asyncMiddleware(videosDownloadValidator), |
53 | asyncMiddleware(downloadHLSVideoFileTorrent) | 53 | downloadHLSVideoFileTorrent |
54 | ) | 54 | ) |
55 | 55 | ||
56 | // Videos path for webseeding | 56 | // Videos path for webseeding |
@@ -68,13 +68,13 @@ staticRouter.use( | |||
68 | staticRouter.use( | 68 | staticRouter.use( |
69 | STATIC_DOWNLOAD_PATHS.VIDEOS + ':id-:resolution([0-9]+).:extension', | 69 | STATIC_DOWNLOAD_PATHS.VIDEOS + ':id-:resolution([0-9]+).:extension', |
70 | asyncMiddleware(videosDownloadValidator), | 70 | asyncMiddleware(videosDownloadValidator), |
71 | asyncMiddleware(downloadVideoFile) | 71 | downloadVideoFile |
72 | ) | 72 | ) |
73 | 73 | ||
74 | staticRouter.use( | 74 | staticRouter.use( |
75 | STATIC_DOWNLOAD_PATHS.HLS_VIDEOS + ':id-:resolution([0-9]+)-fragmented.:extension', | 75 | STATIC_DOWNLOAD_PATHS.HLS_VIDEOS + ':id-:resolution([0-9]+)-fragmented.:extension', |
76 | asyncMiddleware(videosDownloadValidator), | 76 | asyncMiddleware(videosDownloadValidator), |
77 | asyncMiddleware(downloadHLSVideoFile) | 77 | downloadHLSVideoFile |
78 | ) | 78 | ) |
79 | 79 | ||
80 | // HLS | 80 | // HLS |
@@ -235,6 +235,12 @@ async function generateNodeinfo (req: express.Request, res: express.Response) { | |||
235 | nodeName: CONFIG.INSTANCE.NAME, | 235 | nodeName: CONFIG.INSTANCE.NAME, |
236 | nodeDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION, | 236 | nodeDescription: CONFIG.INSTANCE.SHORT_DESCRIPTION, |
237 | nodeConfig: { | 237 | nodeConfig: { |
238 | search: { | ||
239 | remoteUri: { | ||
240 | users: CONFIG.SEARCH.REMOTE_URI.USERS, | ||
241 | anonymous: CONFIG.SEARCH.REMOTE_URI.ANONYMOUS | ||
242 | } | ||
243 | }, | ||
238 | plugin: { | 244 | plugin: { |
239 | registered: getRegisteredPlugins() | 245 | registered: getRegisteredPlugins() |
240 | }, | 246 | }, |
@@ -325,7 +331,7 @@ async function generateNodeinfo (req: express.Request, res: express.Response) { | |||
325 | return res.send(json).end() | 331 | return res.send(json).end() |
326 | } | 332 | } |
327 | 333 | ||
328 | async function downloadTorrent (req: express.Request, res: express.Response) { | 334 | function downloadTorrent (req: express.Request, res: express.Response) { |
329 | const video = res.locals.videoAll | 335 | const video = res.locals.videoAll |
330 | 336 | ||
331 | const videoFile = getVideoFile(req, video.VideoFiles) | 337 | const videoFile = getVideoFile(req, video.VideoFiles) |
@@ -334,7 +340,7 @@ async function downloadTorrent (req: express.Request, res: express.Response) { | |||
334 | return res.download(getTorrentFilePath(video, videoFile), `${video.name}-${videoFile.resolution}p.torrent`) | 340 | return res.download(getTorrentFilePath(video, videoFile), `${video.name}-${videoFile.resolution}p.torrent`) |
335 | } | 341 | } |
336 | 342 | ||
337 | async function downloadHLSVideoFileTorrent (req: express.Request, res: express.Response) { | 343 | function downloadHLSVideoFileTorrent (req: express.Request, res: express.Response) { |
338 | const video = res.locals.videoAll | 344 | const video = res.locals.videoAll |
339 | 345 | ||
340 | const playlist = getHLSPlaylist(video) | 346 | const playlist = getHLSPlaylist(video) |
@@ -346,7 +352,7 @@ async function downloadHLSVideoFileTorrent (req: express.Request, res: express.R | |||
346 | return res.download(getTorrentFilePath(playlist, videoFile), `${video.name}-${videoFile.resolution}p-hls.torrent`) | 352 | return res.download(getTorrentFilePath(playlist, videoFile), `${video.name}-${videoFile.resolution}p-hls.torrent`) |
347 | } | 353 | } |
348 | 354 | ||
349 | async function downloadVideoFile (req: express.Request, res: express.Response) { | 355 | function downloadVideoFile (req: express.Request, res: express.Response) { |
350 | const video = res.locals.videoAll | 356 | const video = res.locals.videoAll |
351 | 357 | ||
352 | const videoFile = getVideoFile(req, video.VideoFiles) | 358 | const videoFile = getVideoFile(req, video.VideoFiles) |
@@ -355,7 +361,7 @@ async function downloadVideoFile (req: express.Request, res: express.Response) { | |||
355 | return res.download(getVideoFilePath(video, videoFile), `${video.name}-${videoFile.resolution}p${videoFile.extname}`) | 361 | return res.download(getVideoFilePath(video, videoFile), `${video.name}-${videoFile.resolution}p${videoFile.extname}`) |
356 | } | 362 | } |
357 | 363 | ||
358 | async function downloadHLSVideoFile (req: express.Request, res: express.Response) { | 364 | function downloadHLSVideoFile (req: express.Request, res: express.Response) { |
359 | const video = res.locals.videoAll | 365 | const video = res.locals.videoAll |
360 | const playlist = getHLSPlaylist(video) | 366 | const playlist = getHLSPlaylist(video) |
361 | if (!playlist) return res.status(404).end | 367 | if (!playlist) return res.status(404).end |