aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/static.ts19
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 @@
1import * as cors from 'cors' 1import * as cors from 'cors'
2import { createReadStream } from 'fs'
2import * as express from 'express' 3import * as express from 'express'
3import { CONFIG, STATIC_DOWNLOAD_PATHS, STATIC_MAX_AGE, STATIC_PATHS, ROUTE_CACHE_LIFETIME } from '../initializers' 4import { CONFIG, STATIC_DOWNLOAD_PATHS, STATIC_MAX_AGE, STATIC_PATHS, ROUTE_CACHE_LIFETIME } from '../initializers'
4import { VideosPreviewCache } from '../lib/cache' 5import { VideosPreviewCache } from '../lib/cache'
@@ -93,10 +94,26 @@ staticRouter.use('/.well-known/nodeinfo',
93 } 94 }
94) 95)
95staticRouter.use('/nodeinfo/:version.json', 96staticRouter.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)
102staticRouter.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)
111staticRouter.use('/.well-known/dnt/',
112 (_, res: express.Response) => {
113 res.json({ tracking: 'N' })
114 }
115)
116
100// --------------------------------------------------------------------------- 117// ---------------------------------------------------------------------------
101 118
102export { 119export {