about summary refs log tree commit diff
path: root/streaming
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-07-30 12:22:33 +0200
committerThibaut Girka <thib@sitedethib.com>2019-07-30 12:22:33 +0200
commit24968d20a07d483cd36b4747bd1db8bd512002c2 (patch)
treed306d08bc32edba292cf9aa85c3be8ba009c1b1c /streaming
parentf48c7689d230b915ed740a4774736bd5998cbc66 (diff)
parentb31b232edfcc7f04acf828bf6829ab716b290692 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
- app/controllers/directories_controller.rb
- package.json
- yarn.lock
Diffstat (limited to 'streaming')
-rw-r--r--streaming/index.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/streaming/index.js b/streaming/index.js
index 12e4e3ab1..64e71f353 100644
--- a/streaming/index.js
+++ b/streaming/index.js
@@ -12,6 +12,7 @@ const uuid = require('uuid');
 const fs = require('fs');
 
 const env = process.env.NODE_ENV || 'development';
+const alwaysRequireAuth = process.env.WHITELIST_MODE === 'true' || process.env.AUTHORIZED_FETCH === 'true';
 
 dotenv.config({
   path: env === 'production' ? '.env.production' : '.env',
@@ -271,7 +272,7 @@ const startWorker = (workerId) => {
 
   const wsVerifyClient = (info, cb) => {
     const location = url.parse(info.req.url, true);
-    const authRequired = !PUBLIC_STREAMS.some(stream => stream === location.query.stream);
+    const authRequired = alwaysRequireAuth || !PUBLIC_STREAMS.some(stream => stream === location.query.stream);
     const allowedScopes = [];
 
     if (authRequired) {
@@ -306,7 +307,7 @@ const startWorker = (workerId) => {
       return;
     }
 
-    const authRequired = !PUBLIC_ENDPOINTS.some(endpoint => endpoint === req.path);
+    const authRequired = alwaysRequireAuth || !PUBLIC_ENDPOINTS.some(endpoint => endpoint === req.path);
     const allowedScopes = [];
 
     if (authRequired) {