diff options
-rwxr-xr-x | scripts/build/server.sh | 1 | ||||
-rw-r--r-- | server/controllers/static.ts | 6 |
2 files changed, 5 insertions, 2 deletions
diff --git a/scripts/build/server.sh b/scripts/build/server.sh index 41b59a212..bd4d1bf47 100755 --- a/scripts/build/server.sh +++ b/scripts/build/server.sh | |||
@@ -5,3 +5,4 @@ set -eu | |||
5 | rm -rf ./dist | 5 | rm -rf ./dist |
6 | 6 | ||
7 | npm run tsc | 7 | npm run tsc |
8 | cp -r "./server/static" "./dist" | ||
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 | ||