From d4b01cb14a2540f7e887b87641593fccc5da4551 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Wed, 20 Sep 2023 15:47:01 +0800 Subject: [PATCH] fix VITE_COMPANION_ALLOWED_HOSTS it was broken --- .env.example | 2 +- private/dev/Dashboard.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index bac7262a7c..6bcc9d4c3f 100644 --- a/.env.example +++ b/.env.example @@ -69,7 +69,7 @@ VITE_UPLOADER=tus VITE_COMPANION_URL=http://localhost:3020 # See also Transloadit.COMPANION_PATTERN -VITE_COMPANION_ALLOWED_HOSTS="/\.transloadit\.com\$/" +VITE_COMPANION_ALLOWED_HOSTS="\.transloadit\.com$" VITE_TUS_ENDPOINT=https://tusd.tusdemo.net/files/ VITE_XHR_ENDPOINT=https://xhr-server.herokuapp.com/upload diff --git a/private/dev/Dashboard.js b/private/dev/Dashboard.js index 69f8ef83a6..7ae714a584 100644 --- a/private/dev/Dashboard.js +++ b/private/dev/Dashboard.js @@ -24,7 +24,6 @@ import generateSignatureIfSecret from './generateSignatureIfSecret.js' const { VITE_UPLOADER : UPLOADER, VITE_COMPANION_URL : COMPANION_URL, - VITE_COMPANION_ALLOWED_HOSTS : companionAllowedHosts, VITE_TUS_ENDPOINT : TUS_ENDPOINT, VITE_XHR_ENDPOINT : XHR_ENDPOINT, VITE_TRANSLOADIT_KEY : TRANSLOADIT_KEY, @@ -33,6 +32,9 @@ const { VITE_TRANSLOADIT_SERVICE_URL : TRANSLOADIT_SERVICE_URL, } = import.meta.env +const companionAllowedHosts = import.meta.env.VITE_COMPANION_ALLOWED_HOSTS + && new RegExp(import.meta.env.VITE_COMPANION_ALLOWED_HOSTS) + import.meta.env.VITE_TRANSLOADIT_KEY &&= '***' // to avoid leaking secrets in screenshots. import.meta.env.VITE_TRANSLOADIT_SECRET &&= '***' // to avoid leaking secrets in screenshots. console.log(import.meta.env)