From a81c0f329cfe0ef343c31636b74615e91e613f72 Mon Sep 17 00:00:00 2001 From: syeopite Date: Tue, 8 Aug 2023 15:13:23 -0700 Subject: [PATCH] Add workaround for storyboards on priv. instances An upstream problem with videojs-vtt-thumbnails means that URLs gets joined incorrectly on any instance where `domain`, `external_port` and `https_only` aren't set. This commit adds some logic with the 404 handler to mitigate this problem. This is however only a workaround. See: https://github.com/iv-org/invidious/issues/3117 https://github.com/chrisboustead/videojs-vtt-thumbnails/issues/31 --- src/invidious/routes/errors.cr | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/invidious/routes/errors.cr b/src/invidious/routes/errors.cr index b138b562..4d8d9ee8 100644 --- a/src/invidious/routes/errors.cr +++ b/src/invidious/routes/errors.cr @@ -1,5 +1,10 @@ module Invidious::Routes::ErrorRoutes def self.error_404(env) + # Workaround for # 3117 + if HOST_URL.empty? && env.request.path.starts_with?("/v1/storyboards/sb") + return env.redirect "#{env.request.path[15..]}?#{env.params.query}" + end + if md = env.request.path.match(/^\/(?([a-zA-Z0-9_-]{11})|(\w+))$/) item = md["id"]