mirror of
https://github.com/iv-org/invidious.git
synced 2026-09-18 20:13:46 +00:00
chore: lint and remove unused variables
This commit is contained in:
@@ -81,7 +81,6 @@ module Invidious::Routes::API::Manifest
|
||||
xml.element("AdaptationSet", id: i, mimeType: mime_type, startWithSAP: 1, subsegmentAlignment: true, label: "#{displayname} [#{bitrate}k]", lang: lang) do
|
||||
codecs = fmt["mimeType"].as_s.split("codecs=")[1].strip('"')
|
||||
bandwidth = fmt["bitrate"].as_i
|
||||
itag = fmt["itag"].as_i
|
||||
url = fmt["url"].as_s
|
||||
|
||||
xml.element("Role", schemeIdUri: "urn:mpeg:dash:role:2011", value: is_default ? "main" : "alternate")
|
||||
|
||||
@@ -380,7 +380,6 @@ module Invidious::Routes::API::V1::Authenticated
|
||||
def self.get_tokens(env)
|
||||
env.response.content_type = "application/json"
|
||||
user = env.get("user").as(User)
|
||||
scopes = env.get("scopes").as(Array(String))
|
||||
|
||||
tokens = Invidious::Database::SessionIDs.select_all(user.email)
|
||||
|
||||
@@ -398,6 +397,8 @@ module Invidious::Routes::API::V1::Authenticated
|
||||
|
||||
def self.register_token(env)
|
||||
user = env.get("user").as(User)
|
||||
# Used by template bellow.
|
||||
# ameba:disable Lint/UselessAssign
|
||||
locale = env.get("preferences").as(Preferences).locale
|
||||
|
||||
case env.request.headers["Content-Type"]?
|
||||
@@ -424,6 +425,8 @@ module Invidious::Routes::API::V1::Authenticated
|
||||
if sid = env.get?("sid").try &.as(String)
|
||||
env.response.content_type = "text/html"
|
||||
|
||||
# Used by template bellow.
|
||||
# ameba:disable Lint/UselessAssign
|
||||
csrf_token = generate_response(sid, {":authorize_token"}, HMAC_KEY, use_nonce: true)
|
||||
return templated "user/authorize_token"
|
||||
else
|
||||
@@ -462,7 +465,6 @@ module Invidious::Routes::API::V1::Authenticated
|
||||
def self.unregister_token(env)
|
||||
env.response.content_type = "application/json"
|
||||
|
||||
user = env.get("user").as(User)
|
||||
scopes = env.get("scopes").as(Array(String))
|
||||
|
||||
session = env.params.json["session"]?.try &.as(String)
|
||||
@@ -484,7 +486,7 @@ module Invidious::Routes::API::V1::Authenticated
|
||||
env.response.content_type = "text/event-stream"
|
||||
|
||||
raw_topics = env.params.body["topics"]? || env.params.query["topics"]?
|
||||
topics = raw_topics.try &.split(",").uniq.first(1000)
|
||||
topics = raw_topics.try &.split(",").uniq!.first(1000)
|
||||
topics ||= [] of String
|
||||
|
||||
Helpers.create_notification_stream(env, topics, CONNECTION_CHANNEL)
|
||||
|
||||
@@ -35,7 +35,6 @@ module Invidious::Routes::API::V1::Channels
|
||||
# playlist doesnt exist.
|
||||
videos = [] of PlaylistVideo
|
||||
end
|
||||
next_continuation = nil
|
||||
else
|
||||
begin
|
||||
videos, _ = Channel::Tabs.get_videos(channel, sort_by: sort_by)
|
||||
|
||||
@@ -8,7 +8,7 @@ module Invidious::Routes::API::V1::Feeds
|
||||
trending_type = env.params.query["type"]?
|
||||
|
||||
begin
|
||||
trending, plid = fetch_trending(trending_type, region, locale)
|
||||
trending, _ = fetch_trending(trending_type, region, locale)
|
||||
rescue ex
|
||||
return error_json(500, ex)
|
||||
end
|
||||
|
||||
@@ -340,6 +340,9 @@ module Invidious::Routes::API::V1::Videos
|
||||
format ||= "json"
|
||||
|
||||
action = env.params.query["action"]?
|
||||
# 2026-09-14 TODO: Check if action is or can be used somewhere
|
||||
# as is unused currently, but for some reason is it here.
|
||||
# ameba:disable Lint/UselessAssign
|
||||
action ||= "action_get_comments"
|
||||
|
||||
continuation = env.params.query["continuation"]?
|
||||
|
||||
@@ -696,7 +696,7 @@ module YoutubeAPI
|
||||
# Multiple encodings can be combined, and are listed in the order
|
||||
# in which they were applied. E.g: "deflate, gzip" means that the
|
||||
# content must be first "gunzipped", then "defated".
|
||||
encodings.split(',').reverse.each do |enc|
|
||||
encodings.split(',').reverse!.each do |enc|
|
||||
case enc.strip(' ')
|
||||
when "gzip"
|
||||
body_io = Compress::Gzip::Reader.new(body_io, sync_close: true)
|
||||
|
||||
Reference in New Issue
Block a user