-
+
<%= translate(locale, "View playlist on YouTube") %>
|
diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr
index 7a1cf2c3..586b4cff 100644
--- a/src/invidious/views/watch.ecr
+++ b/src/invidious/views/watch.ecr
@@ -26,7 +26,7 @@
-
+
<%= rendered "components/player_sources" %>
<%= title %> - Invidious
@@ -123,8 +123,8 @@ we're going to need to do it here in order to allow for translations.
link_yt_embed = IV::HttpServer::Utils.add_params_to_url(link_yt_embed, link_yt_param)
end
-%>
-
<%= translate(locale, "videoinfo_watch_on_youTube") %>
- (
<%= translate(locale, "videoinfo_youTube_embed_link") %>)
+
<%= translate(locale, "videoinfo_watch_on_youTube") %>
+ (
<%= translate(locale, "videoinfo_youTube_embed_link") %>)
From c4fec89a9bac0228f6fac6ab2e8547132b57cc98 Mon Sep 17 00:00:00 2001
From: ulmemxpoc <123284914+ulmemxpoc@users.noreply.github.com>
Date: Fri, 10 May 2024 11:23:11 -0700
Subject: [PATCH 02/11] Apply suggestions from code review
---
src/invidious/frontend/comments_youtube.cr | 2 +-
src/invidious/views/watch.ecr | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/invidious/frontend/comments_youtube.cr b/src/invidious/frontend/comments_youtube.cr
index f9eb44ef..a0e1d783 100644
--- a/src/invidious/frontend/comments_youtube.cr
+++ b/src/invidious/frontend/comments_youtube.cr
@@ -149,7 +149,7 @@ module Invidious::Frontend::Comments
if comments["videoId"]?
html << <<-END_HTML
- [YT]
+ [YT]
|
END_HTML
elsif comments["authorId"]?
diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr
index 586b4cff..fd9e1592 100644
--- a/src/invidious/views/watch.ecr
+++ b/src/invidious/views/watch.ecr
@@ -26,7 +26,7 @@
-
+
<%= rendered "components/player_sources" %>
<%= title %> - Invidious
From 8258062ec512f9adf9523e259fbb0d33552329e9 Mon Sep 17 00:00:00 2001
From: syeopite
Date: Mon, 15 Jul 2024 17:36:00 -0700
Subject: [PATCH 03/11] Ameba: Fix Lint/NotNilAfterNoBang
---
src/invidious/helpers/signatures.cr | 16 ++++++++--------
src/invidious/routes/api/v1/videos.cr | 4 ++--
src/invidious/user/imports.cr | 2 +-
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/invidious/helpers/signatures.cr b/src/invidious/helpers/signatures.cr
index ee09415b..38ded969 100644
--- a/src/invidious/helpers/signatures.cr
+++ b/src/invidious/helpers/signatures.cr
@@ -13,20 +13,20 @@ struct DecryptFunction
private def fetch_decrypt_function(id = "CvFH_6DNRCY")
document = YT_POOL.client &.get("/watch?v=#{id}&gl=US&hl=en").body
- url = document.match(/src="(?\/s\/player\/[^\/]+\/player_ias[^\/]+\/en_US\/base.js)"/).not_nil!["url"]
+ url = document.match!(/src="(?\/s\/player\/[^\/]+\/player_ias[^\/]+\/en_US\/base.js)"/)["url"]
player = YT_POOL.client &.get(url).body
- function_name = player.match(/^(?[^=]+)=function\(\w\){\w=\w\.split\(""\);[^\. ]+\.[^( ]+/m).not_nil!["name"]
- function_body = player.match(/^#{Regex.escape(function_name)}=function\(\w\){(?[^}]+)}/m).not_nil!["body"]
+ function_name = player.match!(/^(?[^=]+)=function\(\w\){\w=\w\.split\(""\);[^\. ]+\.[^( ]+/m)["name"]
+ function_body = player.match!(/^#{Regex.escape(function_name)}=function\(\w\){(?[^}]+)}/m)["body"]
function_body = function_body.split(";")[1..-2]
var_name = function_body[0][0, 2]
- var_body = player.delete("\n").match(/var #{Regex.escape(var_name)}={(?(.*?))};/).not_nil!["body"]
+ var_body = player.delete("\n").match!(/var #{Regex.escape(var_name)}={(?(.*?))};/)["body"]
operations = {} of String => SigProc
var_body.split("},").each do |operation|
- op_name = operation.match(/^[^:]+/).not_nil![0]
- op_body = operation.match(/\{[^}]+/).not_nil![0]
+ op_name = operation.match!(/^[^:]+/)[0]
+ op_body = operation.match!(/\{[^}]+/)[0]
case op_body
when "{a.reverse()"
@@ -42,8 +42,8 @@ struct DecryptFunction
function_body.each do |function|
function = function.lchop(var_name).delete("[].")
- op_name = function.match(/[^\(]+/).not_nil![0]
- value = function.match(/\(\w,(?[\d]+)\)/).not_nil!["value"].to_i
+ op_name = function.match!(/[^\(]+/)[0]
+ value = function.match!(/\(\w,(?[\d]+)\)/)["value"].to_i
decrypt_function << {operations[op_name], value}
end
diff --git a/src/invidious/routes/api/v1/videos.cr b/src/invidious/routes/api/v1/videos.cr
index faff2f59..4fc6a205 100644
--- a/src/invidious/routes/api/v1/videos.cr
+++ b/src/invidious/routes/api/v1/videos.cr
@@ -215,7 +215,7 @@ module Invidious::Routes::API::V1::Videos
storyboard[:storyboard_count].times do |i|
url = storyboard[:url]
- authority = /(i\d?).ytimg.com/.match(url).not_nil![1]?
+ authority = /(i\d?).ytimg.com/.match!(url)[1]?
url = url.gsub("$M", i).gsub(%r(https://i\d?.ytimg.com/sb/), "")
url = "#{HOST_URL}/sb/#{authority}/#{url}"
@@ -250,7 +250,7 @@ module Invidious::Routes::API::V1::Videos
if CONFIG.cache_annotations && (cached_annotation = Invidious::Database::Annotations.select(id))
annotations = cached_annotation.annotations
else
- index = CHARS_SAFE.index(id[0]).not_nil!.to_s.rjust(2, '0')
+ index = CHARS_SAFE.index!(id[0]).to_s.rjust(2, '0')
# IA doesn't handle leading hyphens,
# so we use https://archive.org/details/youtubeannotations_64
diff --git a/src/invidious/user/imports.cr b/src/invidious/user/imports.cr
index 108f2ccc..29b59293 100644
--- a/src/invidious/user/imports.cr
+++ b/src/invidious/user/imports.cr
@@ -182,7 +182,7 @@ struct Invidious::User
if is_opml?(type, extension)
subscriptions = XML.parse(body)
user.subscriptions += subscriptions.xpath_nodes(%q(//outline[@type="rss"])).map do |channel|
- channel["xmlUrl"].match(/UC[a-zA-Z0-9_-]{22}/).not_nil![0]
+ channel["xmlUrl"].match!(/UC[a-zA-Z0-9_-]{22}/)[0]
end
elsif extension == "json" || type == "application/json"
subscriptions = JSON.parse(body)
From fad0a4f52d7c9b2f9310c1c52156560ddd3f36a3 Mon Sep 17 00:00:00 2001
From: syeopite
Date: Wed, 17 Jul 2024 12:39:40 -0700
Subject: [PATCH 04/11] Ameba: Fix Lint/UselessAssign
---
spec/invidious/search/iv_filters_spec.cr | 1 -
src/invidious/channels/channels.cr | 2 +-
src/invidious/frontend/misc.cr | 4 ++--
src/invidious/helpers/handlers.cr | 2 +-
src/invidious/user/imports.cr | 2 +-
src/invidious/videos.cr | 4 ----
src/invidious/yt_backend/connection_pool.cr | 2 +-
src/invidious/yt_backend/extractors.cr | 1 -
src/invidious/yt_backend/extractors_utils.cr | 2 +-
9 files changed, 7 insertions(+), 13 deletions(-)
diff --git a/spec/invidious/search/iv_filters_spec.cr b/spec/invidious/search/iv_filters_spec.cr
index b0897a63..3cefafa1 100644
--- a/spec/invidious/search/iv_filters_spec.cr
+++ b/spec/invidious/search/iv_filters_spec.cr
@@ -301,7 +301,6 @@ Spectator.describe Invidious::Search::Filters do
it "Encodes features filter (single)" do
Invidious::Search::Filters::Features.each do |value|
- string = described_class.format_features(value)
filters = described_class.new(features: value)
expect("#{filters.to_iv_params}")
diff --git a/src/invidious/channels/channels.cr b/src/invidious/channels/channels.cr
index be739673..29546e38 100644
--- a/src/invidious/channels/channels.cr
+++ b/src/invidious/channels/channels.cr
@@ -232,7 +232,7 @@ def fetch_channel(ucid, pull_all_videos : Bool)
id: video_id,
title: title,
published: published,
- updated: Time.utc,
+ updated: updated,
ucid: ucid,
author: author,
length_seconds: length_seconds,
diff --git a/src/invidious/frontend/misc.cr b/src/invidious/frontend/misc.cr
index 43ba9f5c..7a6cf79d 100644
--- a/src/invidious/frontend/misc.cr
+++ b/src/invidious/frontend/misc.cr
@@ -6,9 +6,9 @@ module Invidious::Frontend::Misc
if prefs.automatic_instance_redirect
current_page = env.get?("current_page").as(String)
- redirect_url = "/redirect?referer=#{current_page}"
+ return "/redirect?referer=#{current_page}"
else
- redirect_url = "https://redirect.invidious.io#{env.request.resource}"
+ return "https://redirect.invidious.io#{env.request.resource}"
end
end
end
diff --git a/src/invidious/helpers/handlers.cr b/src/invidious/helpers/handlers.cr
index 174f620d..f3e3b951 100644
--- a/src/invidious/helpers/handlers.cr
+++ b/src/invidious/helpers/handlers.cr
@@ -97,7 +97,7 @@ class AuthHandler < Kemal::Handler
if token = env.request.headers["Authorization"]?
token = JSON.parse(URI.decode_www_form(token.lchop("Bearer ")))
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)
user = Invidious::Database::Users.select!(email: email)
diff --git a/src/invidious/user/imports.cr b/src/invidious/user/imports.cr
index 108f2ccc..4a3e1259 100644
--- a/src/invidious/user/imports.cr
+++ b/src/invidious/user/imports.cr
@@ -124,7 +124,7 @@ struct Invidious::User
playlist = create_playlist(title, privacy, user)
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
raise InfoException.new("Playlist cannot have more than #{CONFIG.playlist_length_limit} videos")
end
diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr
index c218b4ef..9a357376 100644
--- a/src/invidious/videos.cr
+++ b/src/invidious/videos.cr
@@ -394,10 +394,6 @@ end
def fetch_video(id, region)
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 == "Video unavailable"
raise NotFoundException.new(reason.as_s || "")
diff --git a/src/invidious/yt_backend/connection_pool.cr b/src/invidious/yt_backend/connection_pool.cr
index d3dbcc0e..c0356c59 100644
--- a/src/invidious/yt_backend/connection_pool.cr
+++ b/src/invidious/yt_backend/connection_pool.cr
@@ -24,7 +24,7 @@ struct YoutubeConnectionPool
@pool = build_pool()
end
- def client(&block)
+ def client(&)
conn = pool.checkout
begin
response = yield conn
diff --git a/src/invidious/yt_backend/extractors.cr b/src/invidious/yt_backend/extractors.cr
index 0e72957e..0f4f59b8 100644
--- a/src/invidious/yt_backend/extractors.cr
+++ b/src/invidious/yt_backend/extractors.cr
@@ -109,7 +109,6 @@ private module Parsers
end
live_now = false
- paid = false
premium = false
premiere_timestamp = item_contents.dig?("upcomingEventData", "startTime").try { |t| Time.unix(t.as_s.to_i64) }
diff --git a/src/invidious/yt_backend/extractors_utils.cr b/src/invidious/yt_backend/extractors_utils.cr
index 11d95958..c83a2de5 100644
--- a/src/invidious/yt_backend/extractors_utils.cr
+++ b/src/invidious/yt_backend/extractors_utils.cr
@@ -83,5 +83,5 @@ end
def extract_selected_tab(tabs)
# 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
From 3415507e4a9545addc21e4a985a6c0097ba9cf8b Mon Sep 17 00:00:00 2001
From: syeopite
Date: Wed, 24 Jul 2024 19:48:34 -0700
Subject: [PATCH 05/11] Ameba: undo Lint/NotNilAfterNoBang in signatures.cr
File is set to be removed with #4772
---
src/invidious/helpers/signatures.cr | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/invidious/helpers/signatures.cr b/src/invidious/helpers/signatures.cr
index 38ded969..ee09415b 100644
--- a/src/invidious/helpers/signatures.cr
+++ b/src/invidious/helpers/signatures.cr
@@ -13,20 +13,20 @@ struct DecryptFunction
private def fetch_decrypt_function(id = "CvFH_6DNRCY")
document = YT_POOL.client &.get("/watch?v=#{id}&gl=US&hl=en").body
- url = document.match!(/src="(?\/s\/player\/[^\/]+\/player_ias[^\/]+\/en_US\/base.js)"/)["url"]
+ url = document.match(/src="(?\/s\/player\/[^\/]+\/player_ias[^\/]+\/en_US\/base.js)"/).not_nil!["url"]
player = YT_POOL.client &.get(url).body
- function_name = player.match!(/^(?[^=]+)=function\(\w\){\w=\w\.split\(""\);[^\. ]+\.[^( ]+/m)["name"]
- function_body = player.match!(/^#{Regex.escape(function_name)}=function\(\w\){(?[^}]+)}/m)["body"]
+ function_name = player.match(/^(?[^=]+)=function\(\w\){\w=\w\.split\(""\);[^\. ]+\.[^( ]+/m).not_nil!["name"]
+ function_body = player.match(/^#{Regex.escape(function_name)}=function\(\w\){(?[^}]+)}/m).not_nil!["body"]
function_body = function_body.split(";")[1..-2]
var_name = function_body[0][0, 2]
- var_body = player.delete("\n").match!(/var #{Regex.escape(var_name)}={(?(.*?))};/)["body"]
+ var_body = player.delete("\n").match(/var #{Regex.escape(var_name)}={(?(.*?))};/).not_nil!["body"]
operations = {} of String => SigProc
var_body.split("},").each do |operation|
- op_name = operation.match!(/^[^:]+/)[0]
- op_body = operation.match!(/\{[^}]+/)[0]
+ op_name = operation.match(/^[^:]+/).not_nil![0]
+ op_body = operation.match(/\{[^}]+/).not_nil![0]
case op_body
when "{a.reverse()"
@@ -42,8 +42,8 @@ struct DecryptFunction
function_body.each do |function|
function = function.lchop(var_name).delete("[].")
- op_name = function.match!(/[^\(]+/)[0]
- value = function.match!(/\(\w,(?[\d]+)\)/)["value"].to_i
+ op_name = function.match(/[^\(]+/).not_nil![0]
+ value = function.match(/\(\w,(?[\d]+)\)/).not_nil!["value"].to_i
decrypt_function << {operations[op_name], value}
end
From 636a6d0be27cea0c0e255dfe2d0c367edc0a3fba Mon Sep 17 00:00:00 2001
From: syeopite
Date: Wed, 24 Jul 2024 19:57:54 -0700
Subject: [PATCH 06/11] Ameba: Fix Lint/UnusedArgument
---
src/invidious/routes/account.cr | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/invidious/routes/account.cr b/src/invidious/routes/account.cr
index 9d930841..dd65e7a6 100644
--- a/src/invidious/routes/account.cr
+++ b/src/invidious/routes/account.cr
@@ -53,7 +53,7 @@ module Invidious::Routes::Account
return error_template(401, "Password is a required field")
end
- new_passwords = env.params.body.select { |k, v| k.match(/^new_password\[\d+\]$/) }.map { |k, v| v }
+ new_passwords = env.params.body.select { |k, _| k.match(/^new_password\[\d+\]$/) }.map { |_, v| v }
if new_passwords.size <= 1 || new_passwords.uniq.size != 1
return error_template(400, "New passwords must match")
@@ -240,7 +240,7 @@ module Invidious::Routes::Account
return error_template(400, ex)
end
- scopes = env.params.body.select { |k, v| k.match(/^scopes\[\d+\]$/) }.map { |k, v| v }
+ scopes = env.params.body.select { |k, _| k.match(/^scopes\[\d+\]$/) }.map { |_, v| v }
callback_url = env.params.body["callbackUrl"]?
expire = env.params.body["expire"]?.try &.to_i?
From c8fb75e6fd314bc1241bf256a2b897d409f79f42 Mon Sep 17 00:00:00 2001
From: syeopite
Date: Wed, 24 Jul 2024 19:59:20 -0700
Subject: [PATCH 07/11] Ameba: Fix Lint/UnusedBlockArgument
---
src/invidious/yt_backend/connection_pool.cr | 4 ++--
src/invidious/yt_backend/extractors.cr | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/invidious/yt_backend/connection_pool.cr b/src/invidious/yt_backend/connection_pool.cr
index d3dbcc0e..0ac785e6 100644
--- a/src/invidious/yt_backend/connection_pool.cr
+++ b/src/invidious/yt_backend/connection_pool.cr
@@ -24,7 +24,7 @@ struct YoutubeConnectionPool
@pool = build_pool()
end
- def client(&block)
+ def client(&)
conn = pool.checkout
begin
response = yield conn
@@ -69,7 +69,7 @@ def make_client(url : URI, region = nil, force_resolve : Bool = false)
return client
end
-def make_client(url : URI, region = nil, force_resolve : Bool = false, &block)
+def make_client(url : URI, region = nil, force_resolve : Bool = false, &)
client = make_client(url, region, force_resolve)
begin
yield client
diff --git a/src/invidious/yt_backend/extractors.cr b/src/invidious/yt_backend/extractors.cr
index 0e72957e..57a5dc3d 100644
--- a/src/invidious/yt_backend/extractors.cr
+++ b/src/invidious/yt_backend/extractors.cr
@@ -856,7 +856,7 @@ end
#
# This function yields the container so that items can be parsed separately.
#
-def extract_items(initial_data : InitialData, &block)
+def extract_items(initial_data : InitialData, &)
if unpackaged_data = initial_data["contents"]?.try &.as_h
elsif unpackaged_data = initial_data["response"]?.try &.as_h
elsif unpackaged_data = initial_data.dig?("onResponseReceivedActions", 1).try &.as_h
From 0db3b830b7d838f34710d7625d118a6aec821451 Mon Sep 17 00:00:00 2001
From: syeopite
Date: Wed, 24 Jul 2024 20:03:41 -0700
Subject: [PATCH 08/11] Ameba: Fix Lint/HashDuplicatedKey
---
src/invidious/helpers/i18next.cr | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/invidious/helpers/i18next.cr b/src/invidious/helpers/i18next.cr
index 9f4077e1..04033e8c 100644
--- a/src/invidious/helpers/i18next.cr
+++ b/src/invidious/helpers/i18next.cr
@@ -95,7 +95,6 @@ module I18next::Plurals
"hr" => PluralForms::Special_Hungarian_Serbian,
"it" => PluralForms::Special_Spanish_Italian,
"pt" => PluralForms::Special_French_Portuguese,
- "pt" => PluralForms::Special_French_Portuguese,
"sr" => PluralForms::Special_Hungarian_Serbian,
}
From 205f988491886c81f0179f08c23691201e2ae172 Mon Sep 17 00:00:00 2001
From: syeopite
Date: Wed, 24 Jul 2024 20:04:44 -0700
Subject: [PATCH 09/11] Ameba: Fix Naming/MethodNames
---
src/invidious/helpers/i18next.cr | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/invidious/helpers/i18next.cr b/src/invidious/helpers/i18next.cr
index 04033e8c..c82a1f08 100644
--- a/src/invidious/helpers/i18next.cr
+++ b/src/invidious/helpers/i18next.cr
@@ -261,9 +261,9 @@ module I18next::Plurals
when .special_hebrew? then return special_hebrew(count)
when .special_odia? then return special_odia(count)
# Mixed v3/v4 forms
- when .special_spanish_italian? then return special_cldr_Spanish_Italian(count)
- when .special_french_portuguese? then return special_cldr_French_Portuguese(count)
- when .special_hungarian_serbian? then return special_cldr_Hungarian_Serbian(count)
+ when .special_spanish_italian? then return special_cldr_spanish_italian(count)
+ when .special_french_portuguese? then return special_cldr_french_portuguese(count)
+ when .special_hungarian_serbian? then return special_cldr_hungarian_serbian(count)
else
# default, if nothing matched above
return 0_u8
@@ -534,7 +534,7 @@ module I18next::Plurals
#
# This rule is mostly compliant to CLDR v42
#
- def self.special_cldr_Spanish_Italian(count : Int) : UInt8
+ def self.special_cldr_spanish_italian(count : Int) : UInt8
return 0_u8 if (count == 1) # one
return 1_u8 if (count != 0 && count % 1_000_000 == 0) # many
return 2_u8 # other
@@ -544,7 +544,7 @@ module I18next::Plurals
#
# This rule is mostly compliant to CLDR v42
#
- def self.special_cldr_French_Portuguese(count : Int) : UInt8
+ def self.special_cldr_french_portuguese(count : Int) : UInt8
return 0_u8 if (count == 0 || count == 1) # one
return 1_u8 if (count % 1_000_000 == 0) # many
return 2_u8 # other
@@ -554,7 +554,7 @@ module I18next::Plurals
#
# This rule is mostly compliant to CLDR v42
#
- def self.special_cldr_Hungarian_Serbian(count : Int) : UInt8
+ def self.special_cldr_hungarian_serbian(count : Int) : UInt8
n_mod_10 = count % 10
n_mod_100 = count % 100
From 6506b8dbfce93f9761999b8d91b182350b64b0ff Mon Sep 17 00:00:00 2001
From: syeopite
Date: Thu, 25 Jul 2024 20:08:26 -0700
Subject: [PATCH 10/11] Ameba: Fix Naming/PredicateName
---
src/invidious/helpers/i18next.cr | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/invidious/helpers/i18next.cr b/src/invidious/helpers/i18next.cr
index c82a1f08..684e6d14 100644
--- a/src/invidious/helpers/i18next.cr
+++ b/src/invidious/helpers/i18next.cr
@@ -188,7 +188,7 @@ module I18next::Plurals
# Emulate the `rule.numbers.size == 2 && rule.numbers[0] == 1` check
# from original i18next code
- private def is_simple_plural(form : PluralForms) : Bool
+ private def simple_plural?(form : PluralForms) : Bool
case form
when .single_gt_one? then return true
when .single_not_one? then return true
@@ -210,7 +210,7 @@ module I18next::Plurals
idx = SuffixIndex.get_index(plural_form, count)
# Simple plurals are handled differently in all versions (but v4)
- if @simplify_plural_suffix && is_simple_plural(plural_form)
+ if @simplify_plural_suffix && simple_plural?(plural_form)
return (idx == 1) ? "_plural" : ""
end
From e098c27a4564f936443f298cb59ea63a49b0c118 Mon Sep 17 00:00:00 2001
From: syeopite
Date: Sun, 28 Jul 2024 16:44:30 -0700
Subject: [PATCH 11/11] Remove unused methods in `Invidious::LogHandler`
---
src/invidious/helpers/logger.cr | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/src/invidious/helpers/logger.cr b/src/invidious/helpers/logger.cr
index e2e50905..b443073e 100644
--- a/src/invidious/helpers/logger.cr
+++ b/src/invidious/helpers/logger.cr
@@ -34,24 +34,11 @@ class Invidious::LogHandler < Kemal::BaseLogHandler
context
end
- def puts(message : String)
- @io << message << '\n'
- @io.flush
- end
-
def write(message : String)
@io << message
@io.flush
end
- def set_log_level(level : String)
- @level = LogLevel.parse(level)
- end
-
- def set_log_level(level : LogLevel)
- @level = level
- end
-
{% for level in %w(trace debug info warn error fatal) %}
def {{level.id}}(message : String)
if LogLevel::{{level.id.capitalize}} >= @level