forked from midou/invidious
i18n: pass only the ISO code string to 'translate()'
Don't use the whole Hash everywhere. Also fall back nicely to english string if no translation exists.
This commit is contained in:
@@ -36,7 +36,7 @@ module Invidious::Routes::API::V1::Authenticated
|
||||
env.response.content_type = "application/json"
|
||||
|
||||
user = env.get("user").as(User)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
max_results = env.params.query["max_results"]?.try &.to_i?
|
||||
max_results ||= user.preferences.max_results
|
||||
@@ -122,7 +122,7 @@ module Invidious::Routes::API::V1::Authenticated
|
||||
end
|
||||
|
||||
def self.list_playlists(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
env.response.content_type = "application/json"
|
||||
user = env.get("user").as(User)
|
||||
@@ -141,7 +141,7 @@ module Invidious::Routes::API::V1::Authenticated
|
||||
def self.create_playlist(env)
|
||||
env.response.content_type = "application/json"
|
||||
user = env.get("user").as(User)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
title = env.params.json["title"]?.try &.as(String).delete("<>").byte_slice(0, 150)
|
||||
if !title
|
||||
@@ -167,7 +167,7 @@ module Invidious::Routes::API::V1::Authenticated
|
||||
end
|
||||
|
||||
def self.update_playlist_attribute(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
env.response.content_type = "application/json"
|
||||
user = env.get("user").as(User)
|
||||
@@ -200,7 +200,7 @@ module Invidious::Routes::API::V1::Authenticated
|
||||
end
|
||||
|
||||
def self.delete_playlist(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
env.response.content_type = "application/json"
|
||||
user = env.get("user").as(User)
|
||||
@@ -223,7 +223,7 @@ module Invidious::Routes::API::V1::Authenticated
|
||||
end
|
||||
|
||||
def self.insert_video_into_playlist(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
env.response.content_type = "application/json"
|
||||
user = env.get("user").as(User)
|
||||
@@ -281,7 +281,7 @@ module Invidious::Routes::API::V1::Authenticated
|
||||
end
|
||||
|
||||
def self.delete_video_in_playlist(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
env.response.content_type = "application/json"
|
||||
user = env.get("user").as(User)
|
||||
@@ -334,7 +334,7 @@ module Invidious::Routes::API::V1::Authenticated
|
||||
|
||||
def self.register_token(env)
|
||||
user = env.get("user").as(User)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
case env.request.headers["Content-Type"]?
|
||||
when "application/x-www-form-urlencoded"
|
||||
@@ -396,7 +396,7 @@ module Invidious::Routes::API::V1::Authenticated
|
||||
end
|
||||
|
||||
def self.unregister_token(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
env.response.content_type = "application/json"
|
||||
user = env.get("user").as(User)
|
||||
scopes = env.get("scopes").as(Array(String))
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Invidious::Routes::API::V1::Channels
|
||||
def self.home(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
env.response.content_type = "application/json"
|
||||
|
||||
@@ -124,7 +124,7 @@ module Invidious::Routes::API::V1::Channels
|
||||
end
|
||||
|
||||
def self.latest(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
env.response.content_type = "application/json"
|
||||
|
||||
@@ -146,7 +146,7 @@ module Invidious::Routes::API::V1::Channels
|
||||
end
|
||||
|
||||
def self.videos(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
env.response.content_type = "application/json"
|
||||
|
||||
@@ -182,7 +182,7 @@ module Invidious::Routes::API::V1::Channels
|
||||
end
|
||||
|
||||
def self.playlists(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
env.response.content_type = "application/json"
|
||||
|
||||
@@ -219,7 +219,7 @@ module Invidious::Routes::API::V1::Channels
|
||||
end
|
||||
|
||||
def self.community(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
env.response.content_type = "application/json"
|
||||
|
||||
@@ -242,7 +242,7 @@ module Invidious::Routes::API::V1::Channels
|
||||
end
|
||||
|
||||
def self.search(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
env.response.content_type = "application/json"
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Invidious::Routes::API::V1::Feeds
|
||||
def self.trending(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
env.response.content_type = "application/json"
|
||||
|
||||
@@ -25,7 +25,7 @@ module Invidious::Routes::API::V1::Feeds
|
||||
end
|
||||
|
||||
def self.popular(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
env.response.content_type = "application/json"
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
module Invidious::Routes::API::V1::Misc
|
||||
# Stats API endpoint for Invidious
|
||||
def self.stats(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
env.response.content_type = "application/json"
|
||||
|
||||
if !CONFIG.statistics_enabled
|
||||
@@ -15,7 +15,7 @@ module Invidious::Routes::API::V1::Misc
|
||||
# user playlists and Invidious playlists. This means that we can't
|
||||
# reasonably split them yet. This should be addressed in APIv2
|
||||
def self.get_playlist(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
env.response.content_type = "application/json"
|
||||
plid = env.params.url["plid"]
|
||||
@@ -84,7 +84,7 @@ module Invidious::Routes::API::V1::Misc
|
||||
end
|
||||
|
||||
def self.mixes(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
env.response.content_type = "application/json"
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Invidious::Routes::API::V1::Search
|
||||
def self.search(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
region = env.params.query["region"]?
|
||||
|
||||
env.response.content_type = "application/json"
|
||||
@@ -43,7 +43,7 @@ module Invidious::Routes::API::V1::Search
|
||||
end
|
||||
|
||||
def self.search_suggestions(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
region = env.params.query["region"]?
|
||||
|
||||
env.response.content_type = "application/json"
|
||||
|
@@ -1,6 +1,6 @@
|
||||
module Invidious::Routes::API::V1::Videos
|
||||
def self.videos(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
env.response.content_type = "application/json"
|
||||
|
||||
@@ -20,7 +20,7 @@ module Invidious::Routes::API::V1::Videos
|
||||
end
|
||||
|
||||
def self.captions(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
env.response.content_type = "application/json"
|
||||
|
||||
@@ -149,7 +149,7 @@ module Invidious::Routes::API::V1::Videos
|
||||
# thumbnails for individual scenes in a video.
|
||||
# See https://support.jwplayer.com/articles/how-to-add-preview-thumbnails
|
||||
def self.storyboards(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
env.response.content_type = "application/json"
|
||||
|
||||
@@ -223,7 +223,7 @@ module Invidious::Routes::API::V1::Videos
|
||||
end
|
||||
|
||||
def self.annotations(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
env.response.content_type = "text/xml"
|
||||
|
||||
@@ -293,7 +293,7 @@ module Invidious::Routes::API::V1::Videos
|
||||
end
|
||||
|
||||
def self.comments(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
region = env.params.query["region"]?
|
||||
|
||||
env.response.content_type = "application/json"
|
||||
|
@@ -104,7 +104,7 @@ module Invidious::Routes::Channels
|
||||
|
||||
# Redirects brand url channels to a normal /channel/:ucid route
|
||||
def self.brand_redirect(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
# /attribution_link endpoint needs both the `a` and `u` parameter
|
||||
# and in order to avoid detection from YouTube we should only send the required ones
|
||||
@@ -148,7 +148,7 @@ module Invidious::Routes::Channels
|
||||
end
|
||||
|
||||
private def self.fetch_basic_information(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
user = env.get? "user"
|
||||
if user
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
module Invidious::Routes::Embed
|
||||
def self.redirect(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
if plid = env.params.query["list"]?.try &.gsub(/[^a-zA-Z0-9_-]/, "")
|
||||
begin
|
||||
@@ -26,7 +26,7 @@ module Invidious::Routes::Embed
|
||||
end
|
||||
|
||||
def self.show(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
id = env.params.url["id"]
|
||||
|
||||
plid = env.params.query["list"]?.try &.gsub(/[^a-zA-Z0-9_-]/, "")
|
||||
|
@@ -6,7 +6,7 @@ module Invidious::Routes::Feeds
|
||||
end
|
||||
|
||||
def self.playlists(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
user = env.get? "user"
|
||||
referer = get_referer(env)
|
||||
@@ -31,7 +31,7 @@ module Invidious::Routes::Feeds
|
||||
end
|
||||
|
||||
def self.popular(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
if CONFIG.popular_enabled
|
||||
templated "feeds/popular"
|
||||
@@ -42,7 +42,7 @@ module Invidious::Routes::Feeds
|
||||
end
|
||||
|
||||
def self.trending(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
trending_type = env.params.query["type"]?
|
||||
trending_type ||= "Default"
|
||||
@@ -60,7 +60,7 @@ module Invidious::Routes::Feeds
|
||||
end
|
||||
|
||||
def self.subscriptions(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
user = env.get? "user"
|
||||
sid = env.get? "sid"
|
||||
@@ -108,7 +108,7 @@ module Invidious::Routes::Feeds
|
||||
end
|
||||
|
||||
def self.history(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
user = env.get? "user"
|
||||
referer = get_referer(env)
|
||||
@@ -137,7 +137,7 @@ module Invidious::Routes::Feeds
|
||||
# RSS feeds
|
||||
|
||||
def self.rss_channel(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
env.response.headers["Content-Type"] = "application/atom+xml"
|
||||
env.response.content_type = "application/atom+xml"
|
||||
@@ -209,7 +209,7 @@ module Invidious::Routes::Feeds
|
||||
end
|
||||
|
||||
def self.rss_private(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
env.response.headers["Content-Type"] = "application/atom+xml"
|
||||
env.response.content_type = "application/atom+xml"
|
||||
@@ -253,7 +253,7 @@ module Invidious::Routes::Feeds
|
||||
end
|
||||
|
||||
def self.rss_playlist(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
env.response.headers["Content-Type"] = "application/atom+xml"
|
||||
env.response.content_type = "application/atom+xml"
|
||||
@@ -374,7 +374,7 @@ module Invidious::Routes::Feeds
|
||||
end
|
||||
|
||||
def self.push_notifications_post(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
token = env.params.url["token"]
|
||||
body = env.request.body.not_nil!.gets_to_end
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
module Invidious::Routes::Login
|
||||
def self.login_page(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
user = env.get? "user"
|
||||
|
||||
@@ -31,7 +31,7 @@ module Invidious::Routes::Login
|
||||
end
|
||||
|
||||
def self.login(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
referer = get_referer(env, "/feed/subscriptions")
|
||||
|
||||
@@ -491,7 +491,7 @@ module Invidious::Routes::Login
|
||||
end
|
||||
|
||||
def self.signout(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
user = env.get? "user"
|
||||
sid = env.get? "sid"
|
||||
|
@@ -3,7 +3,7 @@
|
||||
module Invidious::Routes::Misc
|
||||
def self.home(env)
|
||||
preferences = env.get("preferences").as(Preferences)
|
||||
locale = LOCALES[preferences.locale]?
|
||||
locale = preferences.locale
|
||||
user = env.get? "user"
|
||||
|
||||
case preferences.default_home
|
||||
@@ -29,12 +29,12 @@ module Invidious::Routes::Misc
|
||||
end
|
||||
|
||||
def self.privacy(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
templated "privacy"
|
||||
end
|
||||
|
||||
def self.licenses(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
rendered "licenses"
|
||||
end
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
module Invidious::Routes::Playlists
|
||||
def self.new(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
user = env.get? "user"
|
||||
sid = env.get? "sid"
|
||||
@@ -18,7 +18,7 @@ module Invidious::Routes::Playlists
|
||||
end
|
||||
|
||||
def self.create(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
user = env.get? "user"
|
||||
sid = env.get? "sid"
|
||||
@@ -56,7 +56,7 @@ module Invidious::Routes::Playlists
|
||||
end
|
||||
|
||||
def self.subscribe(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
user = env.get? "user"
|
||||
referer = get_referer(env)
|
||||
@@ -73,7 +73,7 @@ module Invidious::Routes::Playlists
|
||||
end
|
||||
|
||||
def self.delete_page(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
user = env.get? "user"
|
||||
sid = env.get? "sid"
|
||||
@@ -96,7 +96,7 @@ module Invidious::Routes::Playlists
|
||||
end
|
||||
|
||||
def self.delete(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
user = env.get? "user"
|
||||
sid = env.get? "sid"
|
||||
@@ -129,7 +129,7 @@ module Invidious::Routes::Playlists
|
||||
end
|
||||
|
||||
def self.edit(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
user = env.get? "user"
|
||||
sid = env.get? "sid"
|
||||
@@ -169,7 +169,7 @@ module Invidious::Routes::Playlists
|
||||
end
|
||||
|
||||
def self.update(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
user = env.get? "user"
|
||||
sid = env.get? "sid"
|
||||
@@ -213,7 +213,7 @@ module Invidious::Routes::Playlists
|
||||
end
|
||||
|
||||
def self.add_playlist_items_page(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
user = env.get? "user"
|
||||
sid = env.get? "sid"
|
||||
@@ -260,7 +260,7 @@ module Invidious::Routes::Playlists
|
||||
end
|
||||
|
||||
def self.playlist_ajax(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
user = env.get? "user"
|
||||
sid = env.get? "sid"
|
||||
@@ -387,7 +387,7 @@ module Invidious::Routes::Playlists
|
||||
end
|
||||
|
||||
def self.show(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
user = env.get?("user").try &.as(User)
|
||||
referer = get_referer(env)
|
||||
@@ -435,7 +435,7 @@ module Invidious::Routes::Playlists
|
||||
end
|
||||
|
||||
def self.mix(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
rdid = env.params.query["list"]?
|
||||
if !rdid
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
module Invidious::Routes::PreferencesRoute
|
||||
def self.show(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
referer = get_referer(env)
|
||||
|
||||
@@ -12,7 +12,7 @@ module Invidious::Routes::PreferencesRoute
|
||||
end
|
||||
|
||||
def self.update(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
referer = get_referer(env)
|
||||
|
||||
video_loop = env.params.body["video_loop"]?.try &.as(String)
|
||||
@@ -227,7 +227,7 @@ module Invidious::Routes::PreferencesRoute
|
||||
end
|
||||
|
||||
def self.toggle_theme(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
referer = get_referer(env, unroll: false)
|
||||
|
||||
redirect = env.params.query["redirect"]?
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
module Invidious::Routes::Search
|
||||
def self.opensearch(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
env.response.content_type = "application/opensearchdescription+xml"
|
||||
|
||||
XML.build(indent: " ", encoding: "UTF-8") do |xml|
|
||||
@@ -18,7 +18,7 @@ module Invidious::Routes::Search
|
||||
end
|
||||
|
||||
def self.results(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
query = env.params.query["search_query"]?
|
||||
query ||= env.params.query["q"]?
|
||||
@@ -37,7 +37,7 @@ module Invidious::Routes::Search
|
||||
end
|
||||
|
||||
def self.search(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
region = env.params.query["region"]?
|
||||
|
||||
query = env.params.query["search_query"]?
|
||||
|
@@ -1,7 +1,7 @@
|
||||
module Invidious::Routes::VideoPlayback
|
||||
# /videoplayback
|
||||
def self.get_video_playback(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
query_params = env.params.query
|
||||
|
||||
fvip = query_params["fvip"]? || "3"
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
module Invidious::Routes::Watch
|
||||
def self.handle(env)
|
||||
locale = LOCALES[env.get("preferences").as(Preferences).locale]?
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
region = env.params.query["region"]?
|
||||
|
||||
if env.params.query.to_s.includes?("%20") || env.params.query.to_s.includes?("+")
|
||||
|
Reference in New Issue
Block a user