Fix dnt route
This commit is contained in:
parent
4ebf25fda0
commit
aac0118dc3
|
@ -5,3 +5,4 @@ set -eu
|
||||||
rm -rf ./dist
|
rm -rf ./dist
|
||||||
|
|
||||||
npm run tsc
|
npm run tsc
|
||||||
|
cp -r "./server/static" "./dist"
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import * as cors from 'cors'
|
import * as cors from 'cors'
|
||||||
import { createReadStream } from 'fs-extra'
|
|
||||||
import * as express from 'express'
|
import * as express from 'express'
|
||||||
import { CONFIG, ROUTE_CACHE_LIFETIME, STATIC_DOWNLOAD_PATHS, STATIC_MAX_AGE, STATIC_PATHS } from '../initializers'
|
import { CONFIG, ROUTE_CACHE_LIFETIME, STATIC_DOWNLOAD_PATHS, STATIC_MAX_AGE, STATIC_PATHS } from '../initializers'
|
||||||
import { VideosPreviewCache } from '../lib/cache'
|
import { VideosPreviewCache } from '../lib/cache'
|
||||||
|
@ -10,6 +9,8 @@ import { VideosCaptionCache } from '../lib/cache/videos-caption-cache'
|
||||||
import { UserModel } from '../models/account/user'
|
import { UserModel } from '../models/account/user'
|
||||||
import { VideoCommentModel } from '../models/video/video-comment'
|
import { VideoCommentModel } from '../models/video/video-comment'
|
||||||
import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo'
|
import { HttpNodeinfoDiasporaSoftwareNsSchema20 } from '../../shared/models/nodeinfo'
|
||||||
|
import { join } from 'path'
|
||||||
|
import { root } from '../helpers/core-utils'
|
||||||
|
|
||||||
const packageJSON = require('../../../package.json')
|
const packageJSON = require('../../../package.json')
|
||||||
const staticRouter = express.Router()
|
const staticRouter = express.Router()
|
||||||
|
@ -118,7 +119,8 @@ staticRouter.use('/.well-known/dnt-policy.txt',
|
||||||
asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.DNT_POLICY)),
|
asyncMiddleware(cacheRoute(ROUTE_CACHE_LIFETIME.DNT_POLICY)),
|
||||||
(_, res: express.Response) => {
|
(_, res: express.Response) => {
|
||||||
res.type('text/plain')
|
res.type('text/plain')
|
||||||
createReadStream('./server/static/dnt-policy/dnt-policy-1.0.txt').pipe(res)
|
|
||||||
|
return res.sendFile(join(root(), 'server/static/dnt-policy/dnt-policy-1.0.txt'))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue