diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2018-08-03 02:02:01 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-08 09:22:15 +0200 |
commit | aad0ec24e886a93c5f85cbb8eb4c31ff5e973e1a (patch) | |
tree | 6a54425465578ddc1c6d5a3bc9c220d3653b5722 /server/controllers/static.ts | |
parent | 9a12f169c15b638fe78cf6e85a1993550a25e404 (diff) | |
download | PeerTube-aad0ec24e886a93c5f85cbb8eb4c31ff5e973e1a.tar.gz PeerTube-aad0ec24e886a93c5f85cbb8eb4c31ff5e973e1a.tar.zst PeerTube-aad0ec24e886a93c5f85cbb8eb4c31ff5e973e1a.zip |
advertising PeerTube's rather simple DNT policy
Diffstat (limited to 'server/controllers/static.ts')
-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 { |