diff options
Diffstat (limited to 'server/controllers')
-rw-r--r-- | server/controllers/static.ts | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/server/controllers/static.ts b/server/controllers/static.ts index 3ccf624a7..2a92810f3 100644 --- a/server/controllers/static.ts +++ b/server/controllers/static.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | import * as cors from 'cors' | 1 | import * as cors from 'cors' |
2 | import { createReadStream } from 'fs' | ||
2 | import * as express from 'express' | 3 | import * as express from 'express' |
3 | import { CONFIG, STATIC_DOWNLOAD_PATHS, STATIC_MAX_AGE, STATIC_PATHS, ROUTE_CACHE_LIFETIME } from '../initializers' | 4 | import { CONFIG, STATIC_DOWNLOAD_PATHS, STATIC_MAX_AGE, STATIC_PATHS, ROUTE_CACHE_LIFETIME } from '../initializers' |
4 | import { VideosPreviewCache } from '../lib/cache' | 5 | import { VideosPreviewCache } from '../lib/cache' |
@@ -93,10 +94,26 @@ staticRouter.use('/.well-known/nodeinfo', | |||
93 | } | 94 | } |
94 | ) | 95 | ) |
95 | staticRouter.use('/nodeinfo/:version.json', | 96 | staticRouter.use('/nodeinfo/:version.json', |
96 | // asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.NODEINFO)), | 97 | asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.NODEINFO)), |
97 | asyncMiddleware(generateNodeinfo) | 98 | asyncMiddleware(generateNodeinfo) |
98 | ) | 99 | ) |
99 | 100 | ||
101 | // dnt-policy.txt service (see https://www.eff.org/dnt-policy) | ||
102 | staticRouter.use('/.well-known/dnt-policy.txt', | ||
103 | asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.DNT_POLICY)), | ||
104 | (_, res: express.Response) => { | ||
105 | res.type('text/plain') | ||
106 | createReadStream('./server/static/dnt-policy/dnt-policy-1.0.txt').pipe(res) | ||
107 | } | ||
108 | ) | ||
109 | |||
110 | // dnt service (see https://www.w3.org/TR/tracking-dnt/#status-resource) | ||
111 | staticRouter.use('/.well-known/dnt/', | ||
112 | (_, res: express.Response) => { | ||
113 | res.json({ tracking: 'N' }) | ||
114 | } | ||
115 | ) | ||
116 | |||
100 | // --------------------------------------------------------------------------- | 117 | // --------------------------------------------------------------------------- |
101 | 118 | ||
102 | export { | 119 | export { |