X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=server%2Fcontrollers%2Fstatic.ts;h=4fd58f70c008b11704042f558fce4d42eaf3354a;hb=e8d246d5267ea8b6b3114d4bcf4f34fe5f3a5241;hp=63f78b3b3e11799bdbebe1a57467ac1975aa3081;hpb=5447516b9a87725a6f8c55ec7e4ea1c1be839ee6;p=oweals%2Fpeertube.git diff --git a/server/controllers/static.ts b/server/controllers/static.ts index 63f78b3b3..4fd58f70c 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts @@ -1,5 +1,4 @@ import * as cors from 'cors' -import { createReadStream } from 'fs-extra' import * as express from 'express' import { CONFIG, ROUTE_CACHE_LIFETIME, STATIC_DOWNLOAD_PATHS, STATIC_MAX_AGE, STATIC_PATHS } from '../initializers' import { VideosPreviewCache } from '../lib/cache' @@ -10,6 +9,8 @@ import { VideosCaptionCache } from '../lib/cache/videos-caption-cache' import { UserModel } from '../models/account/user' import { VideoCommentModel } from '../models/video/video-comment' import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo' +import { join } from 'path' +import { root } from '../helpers/core-utils' const packageJSON = require('../../../package.json') const staticRouter = express.Router() @@ -33,12 +34,17 @@ staticRouter.use( ) // Videos path for webseeding -const videosPhysicalPath = CONFIG.STORAGE.VIDEOS_DIR staticRouter.use( STATIC_PATHS.WEBSEED, cors(), - express.static(videosPhysicalPath) + express.static(CONFIG.STORAGE.VIDEOS_DIR, { fallthrough: false }) // 404 because we don't have this video ) +staticRouter.use( + STATIC_PATHS.REDUNDANCY, + cors(), + express.static(CONFIG.STORAGE.REDUNDANCY_DIR, { fallthrough: false }) // 404 because we don't have this video +) + staticRouter.use( STATIC_DOWNLOAD_PATHS.VIDEOS + ':id-:resolution([0-9]+).:extension', asyncMiddleware(videosGetValidator), @@ -118,7 +124,8 @@ staticRouter.use('/.well-known/dnt-policy.txt', asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.DNT_POLICY)), (_, res: express.Response) => { res.type('text/plain') - createReadStream('./server/static/dnt-policy/dnt-policy-1.0.txt').pipe(res) + + return res.sendFile(join(root(), 'dist/server/static/dnt-policy/dnt-policy-1.0.txt')) } ) @@ -129,6 +136,12 @@ staticRouter.use('/.well-known/dnt/', } ) +staticRouter.use('/.well-known/change-password', + (_, res: express.Response) => { + res.redirect('/my-account/settings') + } +) + // --------------------------------------------------------------------------- export {