Ameba: Fix Lint/UselessAssign (#4795)

Related to issue 2231
This commit is contained in:
Samantaz Fox 2024-08-11 13:38:29 +02:00
commit 5e38ef59da
No known key found for this signature in database
GPG key ID: F42821059186176E
8 changed files with 6 additions and 12 deletions

View file

@ -301,7 +301,6 @@ Spectator.describe Invidious::Search::Filters do
it "Encodes features filter (single)" do it "Encodes features filter (single)" do
Invidious::Search::Filters::Features.each do |value| Invidious::Search::Filters::Features.each do |value|
string = described_class.format_features(value)
filters = described_class.new(features: value) filters = described_class.new(features: value)
expect("#{filters.to_iv_params}") expect("#{filters.to_iv_params}")

View file

@ -232,7 +232,7 @@ def fetch_channel(ucid, pull_all_videos : Bool)
id: video_id, id: video_id,
title: title, title: title,
published: published, published: published,
updated: Time.utc, updated: updated,
ucid: ucid, ucid: ucid,
author: author, author: author,
length_seconds: length_seconds, length_seconds: length_seconds,

View file

@ -6,9 +6,9 @@ module Invidious::Frontend::Misc
if prefs.automatic_instance_redirect if prefs.automatic_instance_redirect
current_page = env.get?("current_page").as(String) current_page = env.get?("current_page").as(String)
redirect_url = "/redirect?referer=#{current_page}" return "/redirect?referer=#{current_page}"
else else
redirect_url = "https://redirect.invidious.io#{env.request.resource}" return "https://redirect.invidious.io#{env.request.resource}"
end end
end end
end end

View file

@ -97,7 +97,7 @@ class AuthHandler < Kemal::Handler
if token = env.request.headers["Authorization"]? if token = env.request.headers["Authorization"]?
token = JSON.parse(URI.decode_www_form(token.lchop("Bearer "))) token = JSON.parse(URI.decode_www_form(token.lchop("Bearer ")))
session = URI.decode_www_form(token["session"].as_s) session = URI.decode_www_form(token["session"].as_s)
scopes, expire, signature = validate_request(token, session, env.request, HMAC_KEY, nil) scopes, _, _ = validate_request(token, session, env.request, HMAC_KEY, nil)
if email = Invidious::Database::SessionIDs.select_email(session) if email = Invidious::Database::SessionIDs.select_email(session)
user = Invidious::Database::Users.select!(email: email) user = Invidious::Database::Users.select!(email: email)

View file

@ -124,7 +124,7 @@ struct Invidious::User
playlist = create_playlist(title, privacy, user) playlist = create_playlist(title, privacy, user)
Invidious::Database::Playlists.update_description(playlist.id, description) Invidious::Database::Playlists.update_description(playlist.id, description)
videos = item["videos"]?.try &.as_a?.try &.each_with_index do |video_id, idx| item["videos"]?.try &.as_a?.try &.each_with_index do |video_id, idx|
if idx > CONFIG.playlist_length_limit if idx > CONFIG.playlist_length_limit
raise InfoException.new("Playlist cannot have more than #{CONFIG.playlist_length_limit} videos") raise InfoException.new("Playlist cannot have more than #{CONFIG.playlist_length_limit} videos")
end end

View file

@ -394,10 +394,6 @@ end
def fetch_video(id, region) def fetch_video(id, region)
info = extract_video_info(video_id: id) info = extract_video_info(video_id: id)
allowed_regions = info
.dig?("microformat", "playerMicroformatRenderer", "availableCountries")
.try &.as_a.map &.as_s || [] of String
if reason = info["reason"]? if reason = info["reason"]?
if reason == "Video unavailable" if reason == "Video unavailable"
raise NotFoundException.new(reason.as_s || "") raise NotFoundException.new(reason.as_s || "")

View file

@ -109,7 +109,6 @@ private module Parsers
end end
live_now = false live_now = false
paid = false
premium = false premium = false
premiere_timestamp = item_contents.dig?("upcomingEventData", "startTime").try { |t| Time.unix(t.as_s.to_i64) } premiere_timestamp = item_contents.dig?("upcomingEventData", "startTime").try { |t| Time.unix(t.as_s.to_i64) }

View file

@ -83,5 +83,5 @@ end
def extract_selected_tab(tabs) def extract_selected_tab(tabs)
# Extract the selected tab from the array of tabs Youtube returns # Extract the selected tab from the array of tabs Youtube returns
return selected_target = tabs.as_a.select(&.["tabRenderer"]?.try &.["selected"]?.try &.as_bool)[0]["tabRenderer"] return tabs.as_a.select(&.["tabRenderer"]?.try &.["selected"]?.try &.as_bool)[0]["tabRenderer"]
end end