Merge branch 'master' of github.com:iv-org/invidious

This commit is contained in:
テクニカル諏訪子 2022-09-11 11:37:46 +09:00
commit 51a56bf31c
7 changed files with 33 additions and 16 deletions

View file

@ -471,5 +471,6 @@
"crash_page_switch_instance": "tried to <a href=\"`x`\">use another instance</a>", "crash_page_switch_instance": "tried to <a href=\"`x`\">use another instance</a>",
"crash_page_read_the_faq": "read the <a href=\"`x`\">Frequently Asked Questions (FAQ)</a>", "crash_page_read_the_faq": "read the <a href=\"`x`\">Frequently Asked Questions (FAQ)</a>",
"crash_page_search_issue": "searched for <a href=\"`x`\">existing issues on GitHub</a>", "crash_page_search_issue": "searched for <a href=\"`x`\">existing issues on GitHub</a>",
"crash_page_report_issue": "If none of the above helped, please <a href=\"`x`\">open a new issue on GitHub</a> (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 <a href=\"`x`\">open a new issue on GitHub</a> (preferably in English) and include the following text in your message (do NOT translate that text):",
"error_video_not_in_playlist": "The requested video doesn't exist in this playlist. <a href=\"`x`\">Click here for the playlist home page.</a>"
} }

View file

@ -470,5 +470,6 @@
"tokens_count": "{{count}} token", "tokens_count": "{{count}} token",
"tokens_count_plural": "{{count}} tokens", "tokens_count_plural": "{{count}} tokens",
"search_message_use_another_instance": " También puede <a href=\"`x`\">buscar en otra instancia</a>.", "search_message_use_another_instance": " También puede <a href=\"`x`\">buscar en otra instancia</a>.",
"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? "
} }

View file

@ -116,7 +116,7 @@
"preferences_default_home_label": "Page d'accueil par défaut : ", "preferences_default_home_label": "Page d'accueil par défaut : ",
"preferences_feed_menu_label": "Préferences des abonnements : ", "preferences_feed_menu_label": "Préferences des abonnements : ",
"preferences_show_nick_label": "Afficher le nom d'utilisateur en haut à droite : ", "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é : ", "Top enabled: ": "Top activé : ",
"CAPTCHA enabled: ": "CAPTCHA activé : ", "CAPTCHA enabled: ": "CAPTCHA activé : ",
"Login enabled: ": "Autoriser l'ouverture de sessions utilisateur : ", "Login enabled: ": "Autoriser l'ouverture de sessions utilisateur : ",

View file

@ -201,15 +201,6 @@ def fetch_youtube_comments(id, cursor, format, locale, thin_mode, region, sort_b
end end
if node_replies && !response["commentRepliesContinuation"]? 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"]? if node_replies["continuations"]?
continuation = node_replies["continuations"]?.try &.as_a[0]["nextContinuationData"]["continuation"].as_s continuation = node_replies["continuations"]?.try &.as_a[0]["nextContinuationData"]["continuation"].as_s
elsif node_replies["contents"]? 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.field "replies" do
json.object do json.object do
json.field "replyCount", reply_count json.field "replyCount", node_comment["replyCount"]? || 1
json.field "continuation", continuation json.field "continuation", continuation
end end
end end

View file

@ -2,11 +2,16 @@
module Invidious::Routes::Embed module Invidious::Routes::Embed
def self.redirect(env) def self.redirect(env)
locale = env.get("preferences").as(Preferences).locale
if plid = env.params.query["list"]?.try &.gsub(/[^a-zA-Z0-9_-]/, "") if plid = env.params.query["list"]?.try &.gsub(/[^a-zA-Z0-9_-]/, "")
begin begin
playlist = get_playlist(plid) playlist = get_playlist(plid)
offset = env.params.query["index"]?.try &.to_i? || 0 offset = env.params.query["index"]?.try &.to_i? || 0
videos = get_playlist_videos(playlist, offset: offset) videos = get_playlist_videos(playlist, offset: offset)
if videos.empty?
url = "/playlist?list=#{plid}"
raise NotFoundException.new(translate(locale, "error_video_not_in_playlist", url))
end
rescue ex : NotFoundException rescue ex : NotFoundException
return error_template(404, ex) return error_template(404, ex)
rescue ex rescue ex
@ -26,6 +31,7 @@ module Invidious::Routes::Embed
end end
def self.show(env) def self.show(env)
locale = env.get("preferences").as(Preferences).locale
id = env.params.url["id"] id = env.params.url["id"]
plid = env.params.query["list"]?.try &.gsub(/[^a-zA-Z0-9_-]/, "") plid = env.params.query["list"]?.try &.gsub(/[^a-zA-Z0-9_-]/, "")
@ -62,6 +68,10 @@ module Invidious::Routes::Embed
playlist = get_playlist(plid) playlist = get_playlist(plid)
offset = env.params.query["index"]?.try &.to_i? || 0 offset = env.params.query["index"]?.try &.to_i? || 0
videos = get_playlist_videos(playlist, offset: offset) videos = get_playlist_videos(playlist, offset: offset)
if videos.empty?
url = "/playlist?list=#{plid}"
raise NotFoundException.new(translate(locale, "error_video_not_in_playlist", url))
end
rescue ex : NotFoundException rescue ex : NotFoundException
return error_template(404, ex) return error_template(404, ex)
rescue ex rescue ex

View file

@ -23,6 +23,20 @@
</td> </td>
</tr> </tr>
<tr>
<td>
<a href="/js/handlers.js?v=<%= ASSET_COMMIT %>">handlers.js</a>
</td>
<td>
<a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL-3.0</a>
</td>
<td>
<a href="/js/handlers.js?v=<%= ASSET_COMMIT %>"><%= translate(locale, "source") %></a>
</td>
</tr>
<tr> <tr>
<td> <td>
<a href="/js/community.js?v=<%= ASSET_COMMIT %>">community.js</a> <a href="/js/community.js?v=<%= ASSET_COMMIT %>">community.js</a>
@ -169,7 +183,7 @@
</td> </td>
<td> <td>
<a href="https://choosealicense.com/licenses/mit/">MIT</a> <a href="https://choosealicense.com/licenses/mit/">Expat</a>
</td> </td>
<td> <td>
@ -253,7 +267,7 @@
</td> </td>
<td> <td>
<a href="https://choosealicense.com/licenses/mit">MIT</a> <a href="https://choosealicense.com/licenses/mit">Expat</a>
</td> </td>
<td> <td>

View file

@ -68,7 +68,7 @@
</a> </a>
</div> </div>
<% if env.get("preferences").as(Preferences).show_nick %> <% if env.get("preferences").as(Preferences).show_nick %>
<div class="pure-u-1-4"> <div class="pure-u-1-4" style="overflow: hidden; white-space: nowrap;">
<span id="user_name"><%= HTML.escape(env.get("user").as(Invidious::User).email) %></span> <span id="user_name"><%= HTML.escape(env.get("user").as(Invidious::User).email) %></span>
</div> </div>
<% end %> <% end %>