diff options
author | Chocobozzz <me@florianbigard.com> | 2018-09-25 11:13:34 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-09-25 11:13:34 +0200 |
commit | aac0118dc3a563f4923426ec580a8491874922f4 (patch) | |
tree | 32e2f30336485efa4cac264b20d0695091553b32 /server | |
parent | 4ebf25fda02cc19cbb0919f2595234c7e945596f (diff) | |
download | PeerTube-aac0118dc3a563f4923426ec580a8491874922f4.tar.gz PeerTube-aac0118dc3a563f4923426ec580a8491874922f4.tar.zst PeerTube-aac0118dc3a563f4923426ec580a8491874922f4.zip |
Fix dnt route
Diffstat (limited to 'server')
-rw-r--r-- | server/controllers/static.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/server/controllers/static.ts b/server/controllers/static.ts index 63f78b3b3..baafe1ac4 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import * as cors from 'cors' | 1 | import * as cors from 'cors' |
2 | import { createReadStream } from 'fs-extra' | ||
3 | import * as express from 'express' | 2 | import * as express from 'express' |
4 | import { CONFIG, ROUTE_CACHE_LIFETIME, STATIC_DOWNLOAD_PATHS, STATIC_MAX_AGE, STATIC_PATHS } from '../initializers' | 3 | import { CONFIG, ROUTE_CACHE_LIFETIME, STATIC_DOWNLOAD_PATHS, STATIC_MAX_AGE, STATIC_PATHS } from '../initializers' |
5 | import { VideosPreviewCache } from '../lib/cache' | 4 | import { VideosPreviewCache } from '../lib/cache' |
@@ -10,6 +9,8 @@ import { VideosCaptionCache } from '../lib/cache/videos-caption-cache' | |||
10 | import { UserModel } from '../models/account/user' | 9 | import { UserModel } from '../models/account/user' |
11 | import { VideoCommentModel } from '../models/video/video-comment' | 10 | import { VideoCommentModel } from '../models/video/video-comment' |
12 | import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo' | 11 | import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo' |
12 | import { join } from 'path' | ||
13 | import { root } from '../helpers/core-utils' | ||
13 | 14 | ||
14 | const packageJSON = require('../../../package.json') | 15 | const packageJSON = require('../../../package.json') |
15 | const staticRouter = express.Router() | 16 | const staticRouter = express.Router() |
@@ -118,7 +119,8 @@ staticRouter.use('/.well-known/dnt-policy.txt', | |||
118 | asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.DNT_POLICY)), | 119 | asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.DNT_POLICY)), |
119 | (_, res: express.Response) => { | 120 | (_, res: express.Response) => { |
120 | res.type('text/plain') | 121 | res.type('text/plain') |
121 | createReadStream('./server/static/dnt-policy/dnt-policy-1.0.txt').pipe(res) | 122 | |
123 | return res.sendFile(join(root(), 'server/static/dnt-policy/dnt-policy-1.0.txt')) | ||
122 | } | 124 | } |
123 | ) | 125 | ) |
124 | 126 | ||