Invidious is an alternative front-end to YouTube
chore: lint and remove unused variables
Fijxue4ad826f1fcc
diff --git a/src/invidious/routes/api/manifest.cr b/src/invidious/routes/api/manifest.crindex c27caad7..88430029 100644--- a/src/invidious/routes/api/manifest.cr+++ b/src/invidious/routes/api/manifest.cr@@ -81,7 +81,6 @@ module Invidious::Routes::API::Manifestxml.element("AdaptationSet", id: i, mimeType: mime_type, startWithSAP: 1, subsegmentAlignment: true, label: "#{displayname} [#{bitrate}k]", lang: lang) docodecs = fmt["mimeType"].as_s.split("codecs=")[1].strip('"')bandwidth = fmt["bitrate"].as_i- itag = fmt["itag"].as_iurl = fmt["url"].as_sxml.element("Role", schemeIdUri: "urn:mpeg:dash:role:2011", value: is_default ? "main" : "alternate")diff --git a/src/invidious/routes/api/v1/authenticated.cr b/src/invidious/routes/api/v1/authenticated.crindex ebbbc2a7..da706a9e 100644--- a/src/invidious/routes/api/v1/authenticated.cr+++ b/src/invidious/routes/api/v1/authenticated.cr@@ -380,7 +380,6 @@ module Invidious::Routes::API::V1::Authenticateddef 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::Authenticateddef self.register_token(env)user = env.get("user").as(User)+ # Used by template bellow.+ # ameba:disable Lint/UselessAssignlocale = env.get("preferences").as(Preferences).localecase env.request.headers["Content-Type"]?@@ -424,6 +425,8 @@ module Invidious::Routes::API::V1::Authenticatedif sid = env.get?("sid").try &.as(String)env.response.content_type = "text/html"+ # Used by template bellow.+ # ameba:disable Lint/UselessAssigncsrf_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::Authenticateddef 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::Authenticatedenv.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 StringHelpers.create_notification_stream(env, topics, CONNECTION_CHANNEL)diff --git a/src/invidious/routes/api/v1/channels.cr b/src/invidious/routes/api/v1/channels.crindex b72aa6cf..8c21fe19 100644--- a/src/invidious/routes/api/v1/channels.cr+++ b/src/invidious/routes/api/v1/channels.cr@@ -35,7 +35,6 @@ module Invidious::Routes::API::V1::Channels# playlist doesnt exist.videos = [] of PlaylistVideoend- next_continuation = nilelsebeginvideos, _ = Channel::Tabs.get_videos(channel, sort_by: sort_by)diff --git a/src/invidious/routes/api/v1/feeds.cr b/src/invidious/routes/api/v1/feeds.crindex fea2993c..46618008 100644--- a/src/invidious/routes/api/v1/feeds.cr+++ b/src/invidious/routes/api/v1/feeds.cr@@ -8,7 +8,7 @@ module Invidious::Routes::API::V1::Feedstrending_type = env.params.query["type"]?begin- trending, plid = fetch_trending(trending_type, region, locale)+ trending, _ = fetch_trending(trending_type, region, locale)rescue exreturn error_json(500, ex)enddiff --git a/src/invidious/routes/api/v1/videos.cr b/src/invidious/routes/api/v1/videos.crindex 5600e30d..14221ed0 100644--- a/src/invidious/routes/api/v1/videos.cr+++ b/src/invidious/routes/api/v1/videos.cr@@ -340,6 +340,9 @@ module Invidious::Routes::API::V1::Videosformat ||= "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/UselessAssignaction ||= "action_get_comments"continuation = env.params.query["continuation"]?diff --git a/src/invidious/yt_backend/youtube_api.cr b/src/invidious/yt_backend/youtube_api.crindex c40133ed..6a38ded6 100644--- a/src/invidious/yt_backend/youtube_api.cr+++ b/src/invidious/yt_backend/youtube_api.cr@@ -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)