From bbf66c9b72de55e4803fd73b9906cc7a4429550c Mon Sep 17 00:00:00 2001 From: CalculationPaper <109677665+CalculationPaper@users.noreply.github.com> Date: Fri, 12 Aug 2022 07:58:52 +0200 Subject: [PATCH 1/8] Add/Change Javascript license notice --- src/invidious/views/licenses.ecr | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/invidious/views/licenses.ecr b/src/invidious/views/licenses.ecr index 25b24ed4..4e395d6d 100644 --- a/src/invidious/views/licenses.ecr +++ b/src/invidious/views/licenses.ecr @@ -23,6 +23,20 @@ + + + helpers.js + + + + AGPL-3.0 + + + + <%= translate(locale, "source") %> + + + community.js @@ -169,7 +183,7 @@ - MIT + Expat @@ -253,7 +267,7 @@ - MIT + Expat From c847d6d3708532451609ec1fb2cd9d1cbf842c68 Mon Sep 17 00:00:00 2001 From: CalculationPaper <109677665+CalculationPaper@users.noreply.github.com> Date: Fri, 12 Aug 2022 19:59:35 +0200 Subject: [PATCH 2/8] Update licenses.ecr Oh, it's handlers not helpers. --- src/invidious/views/licenses.ecr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/invidious/views/licenses.ecr b/src/invidious/views/licenses.ecr index 4e395d6d..667cfa37 100644 --- a/src/invidious/views/licenses.ecr +++ b/src/invidious/views/licenses.ecr @@ -25,7 +25,7 @@ - helpers.js + handlers.js @@ -33,7 +33,7 @@ - <%= translate(locale, "source") %> + <%= translate(locale, "source") %> From ca4c2115eebd5b3eaeb7ebf9e4e704ad83e5b4bf Mon Sep 17 00:00:00 2001 From: Emilien Devos Date: Sat, 6 Aug 2022 13:14:35 +0200 Subject: [PATCH 3/8] Message when the video doesn't exist in playlist --- locales/en-US.json | 3 ++- src/invidious/routes/embed.cr | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/locales/en-US.json b/locales/en-US.json index 9701a621..5caa4bd1 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -471,5 +471,6 @@ "crash_page_switch_instance": "tried to use another instance", "crash_page_read_the_faq": "read the Frequently Asked Questions (FAQ)", "crash_page_search_issue": "searched for existing issues on GitHub", - "crash_page_report_issue": "If none of the above helped, please open a new issue on GitHub (preferably in English) and include the following text in your message (do NOT translate that text):" + "crash_page_report_issue": "If none of the above helped, please open a new issue on GitHub (preferably in English) and include the following text in your message (do NOT translate that text):", + "video_not_exist_in_playlist": "The video requested doesn't exist in the playlist. Click here for the playlist home page." } diff --git a/src/invidious/routes/embed.cr b/src/invidious/routes/embed.cr index 84da9993..7860f8b9 100644 --- a/src/invidious/routes/embed.cr +++ b/src/invidious/routes/embed.cr @@ -2,11 +2,16 @@ 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) offset = env.params.query["index"]?.try &.to_i? || 0 videos = get_playlist_videos(playlist, offset: offset) + if videos.empty? + url = "/playlist?list=#{plid}" + raise NotFoundException.new(translate(locale, "video_not_exist_in_playlist", url)) + end rescue ex : NotFoundException return error_template(404, ex) rescue ex @@ -26,6 +31,7 @@ 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_-]/, "") @@ -62,6 +68,10 @@ module Invidious::Routes::Embed playlist = get_playlist(plid) offset = env.params.query["index"]?.try &.to_i? || 0 videos = get_playlist_videos(playlist, offset: offset) + if videos.empty? + url = "/playlist?list=#{plid}" + raise NotFoundException.new(translate(locale, "video_not_exist_in_playlist", url)) + end rescue ex : NotFoundException return error_template(404, ex) rescue ex From 689365d71320ba14c43ae62b2c221fe23ae83c0c Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Sat, 20 Aug 2022 12:20:54 +0200 Subject: [PATCH 4/8] Update Spanish translation Co-authored-by: Hosted Weblate Co-authored-by: nyoooooooooooooooom --- locales/es.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/locales/es.json b/locales/es.json index 0958a736..4e9f35d9 100644 --- a/locales/es.json +++ b/locales/es.json @@ -470,5 +470,6 @@ "tokens_count": "{{count}} token", "tokens_count_plural": "{{count}} tokens", "search_message_use_another_instance": " También puede buscar en otra instancia.", - "search_filters_duration_option_medium": "Medio (4 - 20 minutes)" + "search_filters_duration_option_medium": "Medio (4 - 20 minutes)", + "Popular enabled: ": "¿Habilitar la sección popular? " } From 4e44123abcedd12e066b23bc6dffd84414948e88 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Sat, 20 Aug 2022 12:20:54 +0200 Subject: [PATCH 5/8] Update French translation Co-authored-by: Chance Ducharme --- locales/fr.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locales/fr.json b/locales/fr.json index 928a4400..e526648f 100644 --- a/locales/fr.json +++ b/locales/fr.json @@ -116,7 +116,7 @@ "preferences_default_home_label": "Page d'accueil par défaut : ", "preferences_feed_menu_label": "Préferences des abonnements : ", "preferences_show_nick_label": "Afficher le nom d'utilisateur en haut à droite : ", - "Popular enabled: ": "Page \"populaire\" activée: ", + "Popular enabled: ": "Page \"populaire\" activée : ", "Top enabled: ": "Top activé : ", "CAPTCHA enabled: ": "CAPTCHA activé : ", "Login enabled: ": "Autoriser l'ouverture de sessions utilisateur : ", From 508a5761a1ce154d6d51c51a647403ea480ae46a Mon Sep 17 00:00:00 2001 From: Andrei E Date: Sun, 28 Aug 2022 13:26:30 +0100 Subject: [PATCH 6/8] Handle long usernames gracefully --- src/invidious/views/template.ecr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/invidious/views/template.ecr b/src/invidious/views/template.ecr index caf5299f..98f72eba 100644 --- a/src/invidious/views/template.ecr +++ b/src/invidious/views/template.ecr @@ -67,7 +67,7 @@ <% if env.get("preferences").as(Preferences).show_nick %> -
+
<%= HTML.escape(env.get("user").as(Invidious::User).email) %>
<% end %> From 6f3b4fbaaf0eecb5c26b199befcae4e305d86da1 Mon Sep 17 00:00:00 2001 From: Emilien Devos Date: Fri, 2 Sep 2022 20:16:02 +0200 Subject: [PATCH 7/8] fix replies count --- src/invidious/comments.cr | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr index 5112ad3d..d691ca36 100644 --- a/src/invidious/comments.cr +++ b/src/invidious/comments.cr @@ -201,15 +201,6 @@ def fetch_youtube_comments(id, cursor, format, locale, thin_mode, region, sort_b end if node_replies && !response["commentRepliesContinuation"]? - if node_replies["moreText"]? - reply_count = (node_replies["moreText"]["simpleText"]? || node_replies["moreText"]["runs"]?.try &.[0]?.try &.["text"]?) - .try &.as_s.gsub(/\D/, "").to_i? || 1 - elsif node_replies["viewReplies"]? - reply_count = node_replies["viewReplies"]["buttonRenderer"]["text"]?.try &.["runs"][1]?.try &.["text"]?.try &.as_s.to_i? || 1 - else - reply_count = 1 - end - if node_replies["continuations"]? continuation = node_replies["continuations"]?.try &.as_a[0]["nextContinuationData"]["continuation"].as_s elsif node_replies["contents"]? @@ -219,7 +210,7 @@ def fetch_youtube_comments(id, cursor, format, locale, thin_mode, region, sort_b json.field "replies" do json.object do - json.field "replyCount", reply_count + json.field "replyCount", node_comment["replyCount"]? || 1 json.field "continuation", continuation end end From 260bab598e00fe769ff36ba2c171768a1fbc31bb Mon Sep 17 00:00:00 2001 From: Emilien Devos Date: Fri, 2 Sep 2022 20:20:43 +0200 Subject: [PATCH 8/8] reword error messages --- locales/en-US.json | 2 +- src/invidious/routes/embed.cr | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/locales/en-US.json b/locales/en-US.json index 5caa4bd1..5554b928 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -472,5 +472,5 @@ "crash_page_read_the_faq": "read the Frequently Asked Questions (FAQ)", "crash_page_search_issue": "searched for existing issues on GitHub", "crash_page_report_issue": "If none of the above helped, please open a new issue on GitHub (preferably in English) and include the following text in your message (do NOT translate that text):", - "video_not_exist_in_playlist": "The video requested doesn't exist in the playlist. Click here for the playlist home page." + "error_video_not_in_playlist": "The requested video doesn't exist in this playlist. Click here for the playlist home page." } diff --git a/src/invidious/routes/embed.cr b/src/invidious/routes/embed.cr index 7860f8b9..e6486587 100644 --- a/src/invidious/routes/embed.cr +++ b/src/invidious/routes/embed.cr @@ -10,7 +10,7 @@ module Invidious::Routes::Embed videos = get_playlist_videos(playlist, offset: offset) if videos.empty? url = "/playlist?list=#{plid}" - raise NotFoundException.new(translate(locale, "video_not_exist_in_playlist", url)) + raise NotFoundException.new(translate(locale, "error_video_not_in_playlist", url)) end rescue ex : NotFoundException return error_template(404, ex) @@ -70,7 +70,7 @@ module Invidious::Routes::Embed videos = get_playlist_videos(playlist, offset: offset) if videos.empty? url = "/playlist?list=#{plid}" - raise NotFoundException.new(translate(locale, "video_not_exist_in_playlist", url)) + raise NotFoundException.new(translate(locale, "error_video_not_in_playlist", url)) end rescue ex : NotFoundException return error_template(404, ex)