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
This commit is contained in:
syeopite 2023-08-08 15:13:23 -07:00
parent 3450896602
commit a81c0f329c
No known key found for this signature in database
GPG key ID: A73C186DA3955A1A

View file

@ -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(/^\/(?<id>([a-zA-Z0-9_-]{11})|(\w+))$/)
item = md["id"]