Remove useless 'locale = env.get...' from many routes

This commit is contained in:
Samantaz Fox 2022-01-20 16:03:04 +01:00
parent fa99c9aa85
commit 4cd7a3e83f
No known key found for this signature in database
GPG key ID: F42821059186176E
4 changed files with 1 additions and 24 deletions

View file

@ -115,8 +115,6 @@ module Invidious::Routes::API::V1::Authenticated
end
def self.list_playlists(env)
locale = env.get("preferences").as(Preferences).locale
env.response.content_type = "application/json"
user = env.get("user").as(User)
@ -134,7 +132,6 @@ module Invidious::Routes::API::V1::Authenticated
def self.create_playlist(env)
env.response.content_type = "application/json"
user = env.get("user").as(User)
locale = env.get("preferences").as(Preferences).locale
title = env.params.json["title"]?.try &.as(String).delete("<>").byte_slice(0, 150)
if !title
@ -160,8 +157,6 @@ module Invidious::Routes::API::V1::Authenticated
end
def self.update_playlist_attribute(env)
locale = env.get("preferences").as(Preferences).locale
env.response.content_type = "application/json"
user = env.get("user").as(User)
@ -197,8 +192,6 @@ module Invidious::Routes::API::V1::Authenticated
end
def self.delete_playlist(env)
locale = env.get("preferences").as(Preferences).locale
env.response.content_type = "application/json"
user = env.get("user").as(User)
@ -219,8 +212,6 @@ module Invidious::Routes::API::V1::Authenticated
end
def self.insert_video_into_playlist(env)
locale = env.get("preferences").as(Preferences).locale
env.response.content_type = "application/json"
user = env.get("user").as(User)
@ -274,8 +265,6 @@ module Invidious::Routes::API::V1::Authenticated
end
def self.delete_video_in_playlist(env)
locale = env.get("preferences").as(Preferences).locale
env.response.content_type = "application/json"
user = env.get("user").as(User)
@ -389,8 +378,8 @@ module Invidious::Routes::API::V1::Authenticated
end
def self.unregister_token(env)
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))

View file

@ -1,7 +1,6 @@
module Invidious::Routes::API::V1::Misc
# Stats API endpoint for Invidious
def self.stats(env)
locale = env.get("preferences").as(Preferences).locale
env.response.content_type = "application/json"
if !CONFIG.statistics_enabled
@ -15,8 +14,6 @@ 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 : HTTP::Server::Context)
locale = env.get("preferences").as(Preferences).locale
env.response.content_type = "application/json"
plid = env.params.url["plid"]

View file

@ -20,8 +20,6 @@ module Invidious::Routes::API::V1::Videos
end
def self.captions(env)
locale = env.get("preferences").as(Preferences).locale
env.response.content_type = "application/json"
id = env.params.url["id"]
@ -149,8 +147,6 @@ 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 = env.get("preferences").as(Preferences).locale
env.response.content_type = "application/json"
id = env.params.url["id"]
@ -223,8 +219,6 @@ module Invidious::Routes::API::V1::Videos
end
def self.annotations(env)
locale = env.get("preferences").as(Preferences).locale
env.response.content_type = "text/xml"
id = env.params.url["id"]

View file

@ -2,8 +2,6 @@
module Invidious::Routes::Embed
def self.redirect(env)
locale = env.get("preferences").as(Preferences).locale
if plid = env.params.query["list"]?.try &.gsub(/[^a-zA-Z0-9_-]/, "")
begin
playlist = get_playlist(plid)
@ -26,7 +24,6 @@ module Invidious::Routes::Embed
end
def self.show(env)
locale = env.get("preferences").as(Preferences).locale
id = env.params.url["id"]
plid = env.params.query["list"]?.try &.gsub(/[^a-zA-Z0-9_-]/, "")