From c15790f230ae9d7da13fd894de54eb73772ce7ea Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Mon, 25 Mar 2019 16:33:46 -0500 Subject: [PATCH] Use user preferences in embedded videos --- src/invidious.cr | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/invidious.cr b/src/invidious.cr index 6824ec74..b5823513 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -447,6 +447,10 @@ get "/embed/:id" do |env| locale = LOCALES[env.get("preferences").as(Preferences).locale]? id = env.params.url["id"] + if env.get? "preferences" + preferences = env.get("preferences").as(Preferences) + end + if id.includes?("%20") || id.includes?("+") || env.params.query.to_s.includes?("%20") || env.params.query.to_s.includes?("+") id = env.params.url["id"].gsub("%20", "").delete("+") @@ -469,7 +473,7 @@ get "/embed/:id" do |env| next env.redirect url end - params = process_video_params(env.params.query, nil) + params = process_video_params(env.params.query, preferences) begin video = get_video(id, PG_DB, proxies, region: params[:region])