Invidious is an alternative front-end to YouTube
Add CORS headers to local URLs
Omar Rothc1bb75e616dc
diff --git a/src/invidious.cr b/src/invidious.crindex 6e97c70e..e57dd5c6 100644--- a/src/invidious.cr+++ b/src/invidious.cr@@ -2689,6 +2689,18 @@ options "/videoplayback/*" do |env|env.response.headers["Access-Control-Allow-Headers"] = "Content-Type, range"end+options "/api/manifest/dash/id/videoplayback" do |env|+ env.response.headers["Access-Control-Allow-Origin"] = "*"+ env.response.headers["Access-Control-Allow-Methods"] = "GET"+ env.response.headers["Access-Control-Allow-Headers"] = "Content-Type, range"+end++options "/api/manifest/dash/id/videoplayback/*" do |env|+ env.response.headers["Access-Control-Allow-Origin"] = "*"+ env.response.headers["Access-Control-Allow-Methods"] = "GET"+ env.response.headers["Access-Control-Allow-Headers"] = "Content-Type, range"+end+get "/videoplayback/*" do |env|path = env.request.pathdiff --git a/src/invidious/helpers/helpers.cr b/src/invidious/helpers/helpers.crindex 874927e5..fcc191f6 100644--- a/src/invidious/helpers/helpers.cr+++ b/src/invidious/helpers/helpers.cr@@ -17,7 +17,7 @@ class Configendclass FilteredCompressHandler < Kemal::Handler- exclude ["/videoplayback/*", "/api/*"]+ exclude ["/videoplayback", "/api/*"]def call(env)return call_next env if exclude_match? env