aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-02-22 14:15:23 +0100
committerChocobozzz <me@florianbigard.com>2018-02-22 14:15:23 +0100
commit78967fca4cacbc247fa6fb62d64b2d6825a10804 (patch)
treef063a82b0658005e3d5ce23648333805782155ed /server
parent93df58cc4865af9046d2b31e03fa37d3ae54e45b (diff)
downloadPeerTube-78967fca4cacbc247fa6fb62d64b2d6825a10804.tar.gz
PeerTube-78967fca4cacbc247fa6fb62d64b2d6825a10804.tar.zst
PeerTube-78967fca4cacbc247fa6fb62d64b2d6825a10804.zip
Register service worker
Diffstat (limited to 'server')
-rw-r--r--server/controllers/client.ts15
1 files changed, 11 insertions, 4 deletions
diff --git a/server/controllers/client.ts b/server/controllers/client.ts
index f5124c55b..2fcca6f76 100644
--- a/server/controllers/client.ts
+++ b/server/controllers/client.ts
@@ -11,8 +11,6 @@ const clientsRouter = express.Router()
11 11
12const distPath = join(root(), 'client', 'dist') 12const distPath = join(root(), 'client', 'dist')
13const assetsImagesPath = join(root(), 'client', 'dist', 'client', 'assets', 'images') 13const assetsImagesPath = join(root(), 'client', 'dist', 'client', 'assets', 'images')
14const manifestPath = join(root(), 'client', 'dist', 'manifest.json')
15const serviceWorkerPath = join(root(), 'client', 'dist', 'ngsw-worker.js')
16const embedPath = join(distPath, 'standalone', 'videos', 'embed.html') 14const embedPath = join(distPath, 'standalone', 'videos', 'embed.html')
17const indexPath = join(distPath, 'index.html') 15const indexPath = join(distPath, 'index.html')
18 16
@@ -27,8 +25,17 @@ clientsRouter.use('/videos/embed', (req: express.Request, res: express.Response,
27}) 25})
28 26
29// Static HTML/CSS/JS client files 27// Static HTML/CSS/JS client files
30clientsRouter.use('/manifest.json', express.static(manifestPath, { maxAge: STATIC_MAX_AGE })) 28
31clientsRouter.use('/ngsw-worker.js', express.static(serviceWorkerPath, { maxAge: STATIC_MAX_AGE })) 29const staticClientFiles = [
30 'manifest.json',
31 'ngsw-worker.js',
32 'ngsw.json'
33]
34for (const staticClientFile of staticClientFiles) {
35 const path = join(root(), 'client', 'dist', staticClientFile)
36 clientsRouter.use('/' + staticClientFile, express.static(path, { maxAge: STATIC_MAX_AGE }))
37}
38
32clientsRouter.use('/client', express.static(distPath, { maxAge: STATIC_MAX_AGE })) 39clientsRouter.use('/client', express.static(distPath, { maxAge: STATIC_MAX_AGE }))
33clientsRouter.use('/client/assets/images', express.static(assetsImagesPath, { maxAge: STATIC_MAX_AGE })) 40clientsRouter.use('/client/assets/images', express.static(assetsImagesPath, { maxAge: STATIC_MAX_AGE }))
34 41