From c928e1364fbdff87f27fd982710b95426a250491 Mon Sep 17 00:00:00 2001
From: Chocobozzz <me@florianbigard.com>
Date: Mon, 29 Jul 2019 14:58:41 +0200
Subject: [PATCH] Improve nginx client images cache

---
 shared/extra-utils/miscs/miscs.ts | 6 +++++-
 support/nginx/peertube            | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/shared/extra-utils/miscs/miscs.ts b/shared/extra-utils/miscs/miscs.ts
index 08f41a7e7..ae8a26c98 100644
--- a/shared/extra-utils/miscs/miscs.ts
+++ b/shared/extra-utils/miscs/miscs.ts
@@ -64,7 +64,11 @@ function buildAbsoluteFixturePath (path: string, customCIPath = false) {
     return path
   }
 
-  if (customCIPath && process.env.GITLAB_CI) return join(root(), 'cached-fixtures', path)
+  if (customCIPath) {
+    if (process.env.GITLAB_CI) return join(root(), 'cached-fixtures', path)
+
+    if (process.env.TRAVIS) return join(process.env.HOME, 'fixtures', path)
+  }
 
   return join(root(), 'server', 'tests', 'fixtures', path)
 }
diff --git a/support/nginx/peertube b/support/nginx/peertube
index fee0f5d1c..aca985785 100644
--- a/support/nginx/peertube
+++ b/support/nginx/peertube
@@ -59,7 +59,7 @@ server {
   }
 
   # Bypass PeerTube for performance reasons. Could be removed
-  location ~ ^/client/(.*\.(js|css|woff2|otf|ttf|woff|eot))$ {
+  location ~ ^/client/(.*\.(js|css|png|svg|woff2|otf|ttf|woff|eot))$ {
     add_header Cache-Control "public, max-age=31536000, immutable";
 
     alias /var/www/peertube/peertube-latest/client/dist/$1;
-- 
2.25.1