From a0ba474fcc314717b323603f98cf33a75c0469f1 Mon Sep 17 00:00:00 2001 From: Benjamin Loison Date: Tue, 7 Feb 2023 22:42:24 +0100 Subject: [PATCH] Remove ability in `channels.php` to download whole archive for not leaking API keys used --- website/channels.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/website/channels.php b/website/channels.php index b4b6c9a..3cf3936 100644 --- a/website/channels.php +++ b/website/channels.php @@ -14,12 +14,10 @@ $uri = $_SERVER['REQUEST_URI']; $uri = str_replace('/channels/', '', $uri); + $uri = str_replace('/', '#', $uri); $uri = "/mnt/HDD0/YouTube_captions_search_engine/channels/$uri"; - if (str_contains('/', $uri)) { - $uri = str_replace('/', '#', $uri); - header('Content-Type: application/json; charset=UTF-8'); - echo file_get_contents("zip://$uri"); - } else { - header("Content-Type: application/zip"); - echo readfile($uri); - } + header('Content-Type: application/json; charset=UTF-8'); + $content = file_get_contents("zip://$uri"); + echo stripFirstLine($content); + +?>