From cb0f7bf6b0ae8427e7ef96e9eacfcff79c28232d Mon Sep 17 00:00:00 2001 From: mastihios <91783447+mastihios@users.noreply.github.com> Date: Mon, 11 Oct 2021 20:35:07 +0000 Subject: [PATCH 001/106] Change encoding to HTML.escape --- src/invidious/views/authorize_token.ecr | 2 +- src/invidious/views/change_password.ecr | 2 +- src/invidious/views/clear_watch_history.ecr | 2 +- src/invidious/views/components/item.ecr | 6 +++--- src/invidious/views/components/subscribe_widget.ecr | 4 ++-- src/invidious/views/create_playlist.ecr | 2 +- src/invidious/views/delete_account.ecr | 2 +- src/invidious/views/delete_playlist.ecr | 2 +- src/invidious/views/edit_playlist.ecr | 2 +- src/invidious/views/login.ecr | 4 ++-- src/invidious/views/subscription_manager.ecr | 2 +- src/invidious/views/template.ecr | 2 +- src/invidious/views/token_manager.ecr | 2 +- 13 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/invidious/views/authorize_token.ecr b/src/invidious/views/authorize_token.ecr index 2dc948d9..725f392e 100644 --- a/src/invidious/views/authorize_token.ecr +++ b/src/invidious/views/authorize_token.ecr @@ -72,7 +72,7 @@ <% end %> - + <% end %> diff --git a/src/invidious/views/change_password.ecr b/src/invidious/views/change_password.ecr index fb558f1d..1b9eb82e 100644 --- a/src/invidious/views/change_password.ecr +++ b/src/invidious/views/change_password.ecr @@ -23,7 +23,7 @@ <%= translate(locale, "Change password") %> - + diff --git a/src/invidious/views/clear_watch_history.ecr b/src/invidious/views/clear_watch_history.ecr index 5f9d1032..c9acbe44 100644 --- a/src/invidious/views/clear_watch_history.ecr +++ b/src/invidious/views/clear_watch_history.ecr @@ -19,6 +19,6 @@ - + diff --git a/src/invidious/views/components/item.ecr b/src/invidious/views/components/item.ecr index 5a93d802..5f8bde13 100644 --- a/src/invidious/views/components/item.ecr +++ b/src/invidious/views/components/item.ecr @@ -54,7 +54,7 @@ <% if plid = env.get?("remove_playlist_items") %>
" method="post"> - "> + ">

@@ -11,7 +11,7 @@ <% else %>

" method="post"> - "> + "> diff --git a/src/invidious/views/create_playlist.ecr b/src/invidious/views/create_playlist.ecr index 14f3673e..807244e6 100644 --- a/src/invidious/views/create_playlist.ecr +++ b/src/invidious/views/create_playlist.ecr @@ -30,7 +30,7 @@ - + diff --git a/src/invidious/views/delete_account.ecr b/src/invidious/views/delete_account.ecr index 9103d5b7..67351bbf 100644 --- a/src/invidious/views/delete_account.ecr +++ b/src/invidious/views/delete_account.ecr @@ -19,6 +19,6 @@ - + diff --git a/src/invidious/views/delete_playlist.ecr b/src/invidious/views/delete_playlist.ecr index 480e36f4..cd66b963 100644 --- a/src/invidious/views/delete_playlist.ecr +++ b/src/invidious/views/delete_playlist.ecr @@ -19,6 +19,6 @@ - + diff --git a/src/invidious/views/edit_playlist.ecr b/src/invidious/views/edit_playlist.ecr index 308bd677..89819ef0 100644 --- a/src/invidious/views/edit_playlist.ecr +++ b/src/invidious/views/edit_playlist.ecr @@ -41,7 +41,7 @@

- + <% if playlist.is_a?(InvidiousPlaylist) && playlist.author == user.try &.email %> diff --git a/src/invidious/views/login.ecr b/src/invidious/views/login.ecr index e2963e9f..01d7a210 100644 --- a/src/invidious/views/login.ecr +++ b/src/invidious/views/login.ecr @@ -66,7 +66,7 @@ <% captcha = captcha.not_nil! %> <% captcha[:tokens].each_with_index do |token, i| %> - + <% end %> @@ -74,7 +74,7 @@ <% else # "text" %> <% captcha = captcha.not_nil! %> <% captcha[:tokens].each_with_index do |token, i| %> - + <% end %> diff --git a/src/invidious/views/subscription_manager.ecr b/src/invidious/views/subscription_manager.ecr index 5fa7d203..c2a89ca2 100644 --- a/src/invidious/views/subscription_manager.ecr +++ b/src/invidious/views/subscription_manager.ecr @@ -38,7 +38,7 @@

" method="post"> - "> + "> "> diff --git a/src/invidious/views/template.ecr b/src/invidious/views/template.ecr index 240b523a..92df1272 100644 --- a/src/invidious/views/template.ecr +++ b/src/invidious/views/template.ecr @@ -72,7 +72,7 @@ <% end %>
" method="post"> - "> + "> "> diff --git a/src/invidious/views/token_manager.ecr b/src/invidious/views/token_manager.ecr index 12e0e8c9..79f905a1 100644 --- a/src/invidious/views/token_manager.ecr +++ b/src/invidious/views/token_manager.ecr @@ -30,7 +30,7 @@

" method="post"> - "> + "> "> From 5026698ebf37a4291928a1dca6e19d1d32c84ab8 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 3 Feb 2022 00:09:31 +0100 Subject: [PATCH 002/106] =?UTF-8?q?Update=20Norwegian=20Bokm=C3=A5l=20tran?= =?UTF-8?q?slation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Petter Reinholdtsen --- locales/nb-NO.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/locales/nb-NO.json b/locales/nb-NO.json index d1ad9c7a..20993b5f 100644 --- a/locales/nb-NO.json +++ b/locales/nb-NO.json @@ -430,5 +430,12 @@ "generic_count_minutes": "{{count}} minutt", "generic_count_minutes_plural": "{{count}} minutter", "generic_count_years": "{{count}} år", - "generic_count_years_plural": "{{count}} år" + "generic_count_years_plural": "{{count}} år", + "crash_page_read_the_faq": "lest de Ofte stilte spørsmålene (OSS/FAQ)", + "crash_page_search_issue": "søkt etter eksisterende utfordringer på Github", + "crash_page_you_found_a_bug": "Det ser ut til at du fant en feil i Invidious!", + "crash_page_refresh": "forsøkt å laste siden på nytt", + "crash_page_switch_instance": "forsøkt et annet eksemplar", + "crash_page_before_reporting": "Før du rapporterer en feil, sikre at du har:", + "crash_page_report_issue": "Hvis intet av det overnevnte hjalp, lag en ny utfordring på Github (fortrinnsvis på engelsk) og ta med følgende tekstbit i meldingen dit (IKKE oversett denne teksten):" } From e98aeaf29397e64cade25e74e9cad9dc4de5d49b Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 3 Feb 2022 00:09:31 +0100 Subject: [PATCH 003/106] Update Arabic translation Co-authored-by: Mohammed Anas <6daf084a-8eaf-40fb-86c7-8500077c3b69@anonaddy.me> --- locales/ar.json | 61 +++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/locales/ar.json b/locales/ar.json index b2845acf..c7220be6 100644 --- a/locales/ar.json +++ b/locales/ar.json @@ -154,7 +154,7 @@ "Shared `x`": "شارك منذ `x`", "Premieres in `x`": "يعرض فى `x`", "Premieres `x`": "يعرض `x`", - "Hi! Looks like you have JavaScript turned off. Click here to view comments, keep in mind they may take a bit longer to load.": "اهلا! يبدو ان الجافاسكريبت معطلة. اضغط هنا لعرض التعليقات, ضع فى إعتبارك انها ستأخذ وقت اطول للعرض.", + "Hi! Looks like you have JavaScript turned off. Click here to view comments, keep in mind they may take a bit longer to load.": "أهلًا! يبدو ان جافاسكريبت معطلة لديك. اضغط هنا لعرض التعليقات، وضع فى اعتبارك أنها ستأخذ وقت أطول للعرض.", "View YouTube comments": "عرض تعليقات اليوتيوب", "View more comments on Reddit": "عرض المزيد من التعليقات على\\من موقع Reddit", "View `x` comments": { @@ -164,25 +164,25 @@ "View Reddit comments": "عرض تعليقات ريدإت Reddit", "Hide replies": "إخفاء الردود", "Show replies": "عرض الردود", - "Incorrect password": "الرقم السرى غير صحيح", - "Quota exceeded, try again in a few hours": "تم تجاوز عدد المرات المسموح بها, حاول مرة اخرى بعد عدة ساعات", - "Unable to log in, make sure two-factor authentication (Authenticator or SMS) is turned on.": "غير قادر على تسجيل الدخول, تأكد من تشغيل المصادقة الثنائية 2FA.", + "Incorrect password": "كلمة السر غير صحيحة", + "Quota exceeded, try again in a few hours": "تم تجاوز عدد المرات المسموح بها، حاول مجددًا بعد بضع ساعات", + "Unable to log in, make sure two-factor authentication (Authenticator or SMS) is turned on.": "غير قادر على تسجيل الدخول، تأكد من تشغيل المصادقة الثنائية 2FA.", "Invalid TFA code": "كود مصادقة ثنائية 2FA غير صحيح", - "Login failed. This may be because two-factor authentication is not turned on for your account.": "لم يتم تسجيل الدخول. هذا ربما بسبب ان المصادقة الثنائية 2FA معطلة فى حسابك.", + "Login failed. This may be because two-factor authentication is not turned on for your account.": "فشل تسجيل الدخول. قد يكون هذا بسبب أن المصادقة الثنائية 2FA معطلة في حسابك.", "Wrong answer": "إجابة خاطئة", "Erroneous CAPTCHA": "الكابتشا CAPTCHA غير صاحلة", "CAPTCHA is a required field": "مكان الكابتشا CAPTCHA مطلوب", - "User ID is a required field": "مكان إسم المستخدم مطلوب", - "Password is a required field": "مكان الرقم السرى مطلوب", - "Wrong username or password": "إسم المستخدم او الرقم السرى غير صحيح", + "User ID is a required field": "مكان اسم المستخدم مطلوب", + "Password is a required field": "مكان كلمة السر مطلوب", + "Wrong username or password": "اسم المستخدم او كلمة السر غير صحيح", "Please sign in using 'Log in with Google'": "الرجاء تسجيل الدخول 'تسجيل الدخول بواسطة جوجل'", - "Password cannot be empty": "الرقم السرى لايمكن ان يكون فارغ", - "Password cannot be longer than 55 characters": "الرقم السرى لا يتعدى 55 حرف", + "Password cannot be empty": "لا يمكن أن تكون كلمة السر فارغة", + "Password cannot be longer than 55 characters": "يجب أن لا تتعدى كلمة السر 55 حرفًا", "Please log in": "الرجاء تسجيل الدخول", "Invidious Private Feed for `x`": "تغذية Invidious خاصة ل 'x'", "channel:`x`": "قناة:`x`", "Deleted or invalid channel": "قناة ممسوحة او غير صالحة", - "This channel does not exist.": "القناة غير موجودة.", + "This channel does not exist.": "هذه القناة غير موجودة.", "Could not get channel info.": "لم يستطع الحصول على معلومات القناة.", "Could not fetch comments": "لم يتمكن من إحضار التعليقات", "`x` ago": "`x` منذ", @@ -192,22 +192,22 @@ "Not a playlist.": "قائمة التشغيل غير صالحة.", "Playlist does not exist.": "قائمة التشغيل غير موجودة.", "Could not pull trending pages.": "لم يستطع عرض الصفحات الراجئة.", - "Hidden field \"challenge\" is a required field": "مكان مخفى \"تحدى\" مكان مطلوب", - "Hidden field \"token\" is a required field": "مكان مخفى \"رمز\" مكان مطلوب", - "Erroneous challenge": "تحدى غير صالح", + "Hidden field \"challenge\" is a required field": "مكان مخفي \"تحدي\" مكان مطلوب", + "Hidden field \"token\" is a required field": "مكان مخفي \"رمز\" مكان مطلوب", + "Erroneous challenge": "تحدي غير صالح", "Erroneous token": "روز غير صالح", "No such user": "مستخدم غير صالح", - "Token is expired, please try again": "الرمز منتهى الصلاحية , الرجاء المحاولة مرة اخرى", - "English": "إنجليزى", - "English (auto-generated)": "إنجليزى (تم إنشائة تلقائى)", + "Token is expired, please try again": "الرمز منتهى الصلاحية، الرجاء المحاولة مرة اخرى", + "English": "إنجليزي", + "English (auto-generated)": "إنجليزي (تم إنشائه تلقائيًا)", "Afrikaans": "الأفريكانية", "Albanian": "الألبانية", "Amharic": "الأمهرية", "Arabic": "العربية", - "Armenian": "الأرميني", - "Azerbaijani": "أذربيجان", + "Armenian": "الأرمينية", + "Azerbaijani": "أذربيجانية", "Bangla": "البنغالية", - "Basque": "الباسكي", + "Basque": "الباسكية", "Belarusian": "البيلاروسية", "Bosnian": "البوسنية", "Bulgarian": "البلغارية", @@ -318,18 +318,18 @@ "News": "الأخبار", "Movies": "الأفلام", "Download": "نزّل", - "Download as: ": "نزله ك:. ", + "Download as: ": "نزله كـ: ", "%A %B %-d, %Y": "%A %-d %B %Y", - "(edited)": "(تم تعديلة)", + "(edited)": "(معدّل)", "YouTube comment permalink": "رابط التعليق على اليوتيوب", "permalink": "الرابط", - "`x` marked it with a ❤": "`x` اعجب بهذا", - "Audio mode": "الوضع الصوتى", + "`x` marked it with a ❤": "`x` أعجب بهذا", + "Audio mode": "الوضع الصوتي", "Video mode": "وضع الفيديو", "Videos": "الفيديوهات", "Playlists": "قوائم التشغيل", "Community": "المجتمع", - "relevance": "ملاءم", + "relevance": "ملاؤم", "rating": "تقييم", "date": "التاريخ", "views": "مشاهدات", @@ -339,9 +339,9 @@ "sort": "فرز", "hour": "ساعة", "today": "اليوم", - "week": "إسبوع", - "month": "شهر", - "year": "سنة", + "week": "هذا الأسبوع", + "month": "هذا الشهر", + "year": "هذه السنة", "video": "فيديو", "channel": "قناة", "playlist": "قائمة التشغيل", @@ -353,7 +353,7 @@ "3d": "ثلاثي الأبعاد", "live": "مباشر", "4k": "4k", - "location": "الاماكن", + "location": "الأماكن", "hdr": "وضع التباين العالي", "filter": "معامل الفرز", "Current version: ": "الإصدار الحالي: ", @@ -398,5 +398,6 @@ "360": "360°", "download_subtitles": "ترجمات - 'x' (.vtt)", "invidious": "الخيالي", - "preferences_save_player_pos_label": "احفظ وقت الفيديو الحالي: " + "preferences_save_player_pos_label": "احفظ وقت الفيديو الحالي: ", + "crash_page_you_found_a_bug": "يبدو أنك قد وجدت خطأً برمجيًّا في Invidious!" } From 1668e4187ee1c1432e9af7b71bb266be60ca72e1 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Mon, 7 Feb 2022 00:37:47 +0100 Subject: [PATCH 004/106] Related channel may contain a continuation entry --- src/invidious/channels/about.cr | 27 ++++++++++++++++++------- src/invidious/routes/api/v1/channels.cr | 8 ++++++-- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/invidious/channels/about.cr b/src/invidious/channels/about.cr index 0f3928f5..4f82a0f1 100644 --- a/src/invidious/channels/about.cr +++ b/src/invidious/channels/about.cr @@ -140,19 +140,32 @@ def fetch_related_channels(about_channel : AboutChannel) : Array(AboutRelatedCha return [] of AboutRelatedChannel if tab.nil? - items = tab.dig?("tabRenderer", "content", "sectionListRenderer", "contents", 0, "itemSectionRenderer", "contents", 0, "gridRenderer", "items").try(&.as_a?) || [] of JSON::Any + items = tab.dig?( + "tabRenderer", "content", + "sectionListRenderer", "contents", 0, + "itemSectionRenderer", "contents", 0, + "gridRenderer", "items" + ).try &.as_a? - items.map do |item| - related_id = item.dig("gridChannelRenderer", "channelId").as_s - related_title = item.dig("gridChannelRenderer", "title", "simpleText").as_s - related_author_url = item.dig("gridChannelRenderer", "navigationEndpoint", "browseEndpoint", "canonicalBaseUrl").as_s - related_author_thumbnail = item.dig("gridChannelRenderer", "thumbnail", "thumbnails", -1, "url").as_s + related = [] of AboutRelatedChannel + return related if (items.nil? || items.empty?) - AboutRelatedChannel.new( + items.each do |item| + renderer = item["gridChannelRenderer"]? + next if !renderer + + related_id = renderer.dig("channelId").as_s + related_title = renderer.dig("title", "simpleText").as_s + related_author_url = renderer.dig("navigationEndpoint", "browseEndpoint", "canonicalBaseUrl").as_s + related_author_thumbnail = HelperExtractors.get_thumbnails(renderer) + + related << AboutRelatedChannel.new( ucid: related_id, author: related_title, author_url: related_author_url, author_thumbnail: related_author_thumbnail, ) end + + return related end diff --git a/src/invidious/routes/api/v1/channels.cr b/src/invidious/routes/api/v1/channels.cr index 3e55b412..83c6db04 100644 --- a/src/invidious/routes/api/v1/channels.cr +++ b/src/invidious/routes/api/v1/channels.cr @@ -96,7 +96,10 @@ module Invidious::Routes::API::V1::Channels json.field "relatedChannels" do json.array do - fetch_related_channels(channel).each do |related_channel| + # Fetch related channels + related_channels = fetch_related_channels(channel) + + related_channels.each do |related_channel| json.object do json.field "author", related_channel.author json.field "authorId", related_channel.ucid @@ -118,7 +121,8 @@ module Invidious::Routes::API::V1::Channels end end end - end + end # relatedChannels + end end end From 698a6f38863c399b50cda27b5b509be2980e8a21 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Mon, 7 Feb 2022 00:52:18 +0100 Subject: [PATCH 005/106] API: handle related channels parsing exceptions --- src/invidious/routes/api/v1/channels.cr | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/invidious/routes/api/v1/channels.cr b/src/invidious/routes/api/v1/channels.cr index 83c6db04..c4d6643a 100644 --- a/src/invidious/routes/api/v1/channels.cr +++ b/src/invidious/routes/api/v1/channels.cr @@ -97,7 +97,11 @@ module Invidious::Routes::API::V1::Channels json.field "relatedChannels" do json.array do # Fetch related channels - related_channels = fetch_related_channels(channel) + begin + related_channels = fetch_related_channels(channel) + rescue ex + related_channels = [] of AboutRelatedChannel + end related_channels.each do |related_channel| json.object do From 7e4690e43c9d037134cc0700b3ced7b46de94dcb Mon Sep 17 00:00:00 2001 From: Dimitris Apostolou Date: Mon, 7 Feb 2022 14:57:14 +0200 Subject: [PATCH 006/106] Fix typos --- assets/js/player.js | 6 +++--- assets/js/themes.js | 2 +- config/config.example.yml | 22 +++++++++++----------- src/invidious/config.cr | 4 ++-- src/invidious/helpers/i18n.cr | 2 +- src/invidious/helpers/tokens.cr | 2 +- src/invidious/helpers/utils.cr | 12 ++++++------ src/invidious/playlists.cr | 2 +- src/invidious/routes/preferences.cr | 2 +- src/invidious/yt_backend/extractors.cr | 2 +- src/invidious/yt_backend/youtube_api.cr | 14 +++++++------- 11 files changed, 35 insertions(+), 35 deletions(-) diff --git a/assets/js/player.js b/assets/js/player.js index 66d1682f..a5ea08ec 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -86,7 +86,7 @@ if (location.pathname.startsWith('/embed/')) { }); } -// Detect mobile users and initalize mobileUi for better UX +// Detect mobile users and initialize mobileUi for better UX // Detection code taken from https://stackoverflow.com/a/20293441 function isMobile() { @@ -119,7 +119,7 @@ if (isMobile()) { operations_bar_element.className += " mobile-operations-bar" player.addChild(operations_bar) - // Playback menu doesn't work when its initalized outside of the primary control bar + // Playback menu doesn't work when it's initialized outside of the primary control bar playback_element = document.getElementsByClassName("vjs-playback-rate")[0] operations_bar_element.append(playback_element) @@ -138,7 +138,7 @@ if (isMobile()) { player.on('error', function (event) { if (player.error().code === 2 || player.error().code === 4) { setTimeout(function (event) { - console.log('An error occured in the player, reloading...'); + console.log('An error occurred in the player, reloading...'); var currentTime = player.currentTime(); var playbackRate = player.playbackRate(); diff --git a/assets/js/themes.js b/assets/js/themes.js index 470f10bf..0214a7f0 100644 --- a/assets/js/themes.js +++ b/assets/js/themes.js @@ -77,7 +77,7 @@ function update_mode (mode) { // If preference for dark mode indicated set_mode(true); } - else if (mode === 'false' /* for backwards compaibility */ || mode === 'light') { + else if (mode === 'false' /* for backwards compatibility */ || mode === 'light') { // If preference for light mode indicated set_mode(false); } diff --git a/config/config.example.yml b/config/config.example.yml index d1c1f300..59cb486b 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -163,7 +163,7 @@ https_only: false #use_quic: false ## -## Additionnal cookies to be sent when requesting the youtube API. +## Additional cookies to be sent when requesting the youtube API. ## ## Accepted values: a string in the format "name1=value1; name2=value2..." ## Default: @@ -188,7 +188,7 @@ https_only: false ## ## Path to log file. Can be absolute or relative to the invidious -## binary. This is overriden if "-o OUTPUT" or "--output=OUTPUT" +## binary. This is overridden if "-o OUTPUT" or "--output=OUTPUT" ## are passed on the command line. ## ## Accepted values: a filesystem path or 'STDOUT' @@ -197,7 +197,7 @@ https_only: false #output: STDOUT ## -## Logging Verbosity. This is overriden if "-l LEVEL" or +## Logging Verbosity. This is overridden if "-l LEVEL" or ## "--log-level=LEVEL" are passed on the command line. ## ## Accepted values: All, Trace, Debug, Info, Warn, Error, Fatal, Off @@ -306,7 +306,7 @@ https_only: false ## ## Notes: ## - Setting this to 0 will disable the channel videos crawl job. -## - This setting is overriden if "-c THREADS" or +## - This setting is overridden if "-c THREADS" or ## "--channel-threads=THREADS" are passed on the command line. ## ## Accepted values: a positive integer @@ -328,7 +328,7 @@ full_refresh: false ## ## Notes: ## - Setting this to 0 will disable the channel videos crawl job. -## - This setting is overriden if "-f THREADS" or +## - This setting is overridden if "-f THREADS" or ## "--feed-threads=THREADS" are passed on the command line. ## ## Accepted values: a positive integer @@ -371,7 +371,7 @@ feed_threads: 1 # ----------------------------- -# Miscellanous +# Miscellaneous # ----------------------------- ## @@ -433,7 +433,7 @@ feed_threads: 1 #cache_annotations: false ## -## Source code URL. If your instance is running a modfied source +## Source code URL. If your instance is running a modified source ## code, you MUST publish it somewhere and set this option. ## ## Accepted values: a string @@ -520,9 +520,9 @@ default_user_preferences: #region: US ## - ## Top 3 prefered languages for video captions. + ## Top 3 preferred languages for video captions. ## - ## Note: overridin the default (no preferred + ## Note: overriding the default (no preferred ## caption language) is not recommended, in order ## to not penalize people using other languages. ## @@ -594,7 +594,7 @@ default_user_preferences: #feed_menu: ["Popular", "Trending", "Subscriptions", "Playlists"] ## - ## Default feed to diplay on the home page. + ## Default feed to display on the home page. ## ## Note: setting this option to "Popular" has no ## effect when 'popular_enabled' is set to false. @@ -812,7 +812,7 @@ default_user_preferences: # ----------------------------- - # Miscellanous + # Miscellaneous # ----------------------------- ## diff --git a/src/invidious/config.cr b/src/invidious/config.cr index c4a8bf83..72e145da 100644 --- a/src/invidious/config.cr +++ b/src/invidious/config.cr @@ -91,8 +91,8 @@ class Config @[YAML::Field(converter: Preferences::FamilyConverter)] property force_resolve : Socket::Family = Socket::Family::UNSPEC # Connect to YouTube over 'ipv6', 'ipv4'. Will sometimes resolve fix issues with rate-limiting (see https://github.com/ytdl-org/youtube-dl/issues/21729) - property port : Int32 = 3000 # Port to listen for connections (overrided by command line argument) - property host_binding : String = "0.0.0.0" # Host to bind (overrided by command line argument) + property port : Int32 = 3000 # Port to listen for connections (overridden by command line argument) + property host_binding : String = "0.0.0.0" # Host to bind (overridden by command line argument) property pool_size : Int32 = 100 # Pool size for HTTP requests to youtube.com and ytimg.com (each domain has a separate pool of `pool_size`) property use_quic : Bool = false # Use quic transport for youtube api diff --git a/src/invidious/helpers/i18n.cr b/src/invidious/helpers/i18n.cr index 3cf9ad1c..6571dbe6 100644 --- a/src/invidious/helpers/i18n.cr +++ b/src/invidious/helpers/i18n.cr @@ -135,7 +135,7 @@ def translate_count(locale : String, key : String, count : Int, format = NumberF # Try #2: Fallback to english translation = translate_count("en-US", key, count) else - # Return key if we're already in english, as the tranlation is missing + # Return key if we're already in english, as the translation is missing LOGGER.warn("i18n: Missing translation key \"#{key}\"") return key end diff --git a/src/invidious/helpers/tokens.cr b/src/invidious/helpers/tokens.cr index 9b664646..a44988cd 100644 --- a/src/invidious/helpers/tokens.cr +++ b/src/invidious/helpers/tokens.cr @@ -44,7 +44,7 @@ def sign_token(key, hash) # TODO: figure out which "key" variable is used # Ameba reports a warning for "Lint/ShadowingOuterLocalVar" on this - # variable, but its preferrable to not touch that (works fine atm). + # variable, but it's preferable to not touch that (works fine atm). hash.each do |key, value| next if key == "signature" diff --git a/src/invidious/helpers/utils.cr b/src/invidious/helpers/utils.cr index 3ab9a0fc..a58a21b1 100644 --- a/src/invidious/helpers/utils.cr +++ b/src/invidious/helpers/utils.cr @@ -161,11 +161,11 @@ def short_text_to_number(short_text : String) : Int32 end def number_to_short_text(number) - seperated = number_with_separator(number).gsub(",", ".").split("") - text = seperated.first(2).join + separated = number_with_separator(number).gsub(",", ".").split("") + text = separated.first(2).join - if seperated[2]? && seperated[2] != "." - text += seperated[2] + if separated[2]? && separated[2] != "." + text += separated[2] end text = text.rchop(".0") @@ -323,8 +323,8 @@ def fetch_random_instance instance_list.each do |data| # TODO Check if current URL is onion instance and use .onion types if so. if data[1]["type"] == "https" - # Instances can have statisitics disabled, which is an requirement of version validation. - # as_nil? doesn't exist. Thus we'll have to handle the error rasied if as_nil fails. + # Instances can have statistics disabled, which is an requirement of version validation. + # as_nil? doesn't exist. Thus we'll have to handle the error raised if as_nil fails. begin data[1]["stats"].as_nil next diff --git a/src/invidious/playlists.cr b/src/invidious/playlists.cr index 88888a65..aefa34cc 100644 --- a/src/invidious/playlists.cr +++ b/src/invidious/playlists.cr @@ -401,7 +401,7 @@ def fetch_playlist(plid : String) end def get_playlist_videos(playlist : InvidiousPlaylist | Playlist, offset : Int32, video_id = nil) - # Show empy playlist if requested page is out of range + # Show empty playlist if requested page is out of range # (e.g, when a new playlist has been created, offset will be negative) if offset >= playlist.video_count || offset < 0 return [] of PlaylistVideo diff --git a/src/invidious/routes/preferences.cr b/src/invidious/routes/preferences.cr index 9c740cf2..930c588b 100644 --- a/src/invidious/routes/preferences.cr +++ b/src/invidious/routes/preferences.cr @@ -136,7 +136,7 @@ module Invidious::Routes::PreferencesRoute notifications_only ||= "off" notifications_only = notifications_only == "on" - # Convert to JSON and back again to take advantage of converters used for compatability + # Convert to JSON and back again to take advantage of converters used for compatibility preferences = Preferences.from_json({ annotations: annotations, annotations_subscribed: annotations_subscribed, diff --git a/src/invidious/yt_backend/extractors.cr b/src/invidious/yt_backend/extractors.cr index 41d95962..ce39bc28 100644 --- a/src/invidious/yt_backend/extractors.cr +++ b/src/invidious/yt_backend/extractors.cr @@ -568,7 +568,7 @@ def extract_item(item : JSON::Any, author_fallback : String? = "", # Cycles through all of the item parsers and attempt to parse the raw YT JSON data. # Each parser automatically validates the data given to see if the data is - # applicable to itself. If not nil is returned and the next parser is attemped. + # applicable to itself. If not nil is returned and the next parser is attempted. ITEM_PARSERS.each do |parser| LOGGER.trace("extract_item: Attempting to parse item using \"#{parser.parser_name}\" (cycling...)") diff --git a/src/invidious/yt_backend/youtube_api.cr b/src/invidious/yt_backend/youtube_api.cr index 426c076a..5bbd9213 100644 --- a/src/invidious/yt_backend/youtube_api.cr +++ b/src/invidious/yt_backend/youtube_api.cr @@ -90,7 +90,7 @@ module YoutubeAPI property client_type : ClientType # Region to provide to youtube, e.g to alter search results - # (this is passed as the `gl` parmeter). + # (this is passed as the `gl` parameter). property region : String | Nil # ISO code of country where the proxy is located. @@ -205,7 +205,7 @@ module YoutubeAPI # :ditto: def browse( browse_id : String, - *, # Force the following paramters to be passed by name + *, # Force the following parameters to be passed by name params : String, client_config : ClientConfig | Nil = nil ) @@ -215,7 +215,7 @@ module YoutubeAPI "context" => self.make_context(client_config), } - # Append the additionnal parameters if those were provided + # Append the additional parameters if those were provided # (this is required for channel info, playlist and community, e.g) if params != "" data["params"] = params @@ -292,14 +292,14 @@ module YoutubeAPI # and POST data in order to get a JSON reply. # # The requested data is a video ID (`v=` parameter), with some - # additional paramters, formatted as a base64 string. + # additional parameters, formatted as a base64 string. # # An optional ClientConfig parameter can be passed, too (see # `struct ClientConfig` above for more details). # def player( video_id : String, - *, # Force the following paramters to be passed by name + *, # Force the following parameters to be passed by name params : String, client_config : ClientConfig | Nil = nil ) @@ -309,7 +309,7 @@ module YoutubeAPI "context" => self.make_context(client_config), } - # Append the additionnal parameters if those were provided + # Append the additional parameters if those were provided if params != "" data["params"] = params end @@ -363,7 +363,7 @@ module YoutubeAPI # order to get non-US results. # # The requested data is a search string, with some additional - # paramters, formatted as a base64 string. + # parameters, formatted as a base64 string. # # An optional ClientConfig parameter can be passed, too (see # `struct ClientConfig` above for more details). From 7ace3fc989d5b24104af92537dc3a67cf9f608c3 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Fri, 4 Feb 2022 04:46:38 +0100 Subject: [PATCH 007/106] Move remaining user-related routes out of main file --- src/invidious.cr | 333 ++--------------------------- src/invidious/routes/account.cr | 358 ++++++++++++++++++++++++++++++++ 2 files changed, 372 insertions(+), 319 deletions(-) create mode 100644 src/invidious/routes/account.cr diff --git a/src/invidious.cr b/src/invidious.cr index f4cae7ea..6f4f575b 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -364,16 +364,30 @@ end Invidious::Routing.get "/results", Invidious::Routes::Search, :results Invidious::Routing.get "/search", Invidious::Routes::Search, :search + # User login/out Invidious::Routing.get "/login", Invidious::Routes::Login, :login_page Invidious::Routing.post "/login", Invidious::Routes::Login, :login Invidious::Routing.post "/signout", Invidious::Routes::Login, :signout + # User preferences Invidious::Routing.get "/preferences", Invidious::Routes::PreferencesRoute, :show Invidious::Routing.post "/preferences", Invidious::Routes::PreferencesRoute, :update Invidious::Routing.get "/toggle_theme", Invidious::Routes::PreferencesRoute, :toggle_theme Invidious::Routing.get "/data_control", Invidious::Routes::PreferencesRoute, :data_control Invidious::Routing.post "/data_control", Invidious::Routes::PreferencesRoute, :update_data_control + # User account management + Invidious::Routing.get "/change_password", Invidious::Routes::Account, :get_change_password + Invidious::Routing.post "/change_password", Invidious::Routes::Account, :post_change_password + Invidious::Routing.get "/delete_account", Invidious::Routes::Account, :get_delete + Invidious::Routing.post "/delete_account", Invidious::Routes::Account, :post_delete + Invidious::Routing.get "/clear_watch_history", Invidious::Routes::Account, :get_clear_history + Invidious::Routing.post "/clear_watch_history", Invidious::Routes::Account, :post_clear_history + Invidious::Routing.get "/authorize_token", Invidious::Routes::Account, :get_authorize_token + Invidious::Routing.post "/authorize_token", Invidious::Routes::Account, :post_authorize_token + Invidious::Routing.get "/token_manager", Invidious::Routes::Account, :token_manager + Invidious::Routing.post "/token_ajax", Invidious::Routes::Account, :token_ajax + # Feeds Invidious::Routing.get "/view_all_playlists", Invidious::Routes::Feeds, :view_all_playlists_redirect Invidious::Routing.get "/feed/playlists", Invidious::Routes::Feeds, :playlists @@ -412,325 +426,6 @@ define_v1_api_routes() define_api_manifest_routes() define_video_playback_routes() -get "/change_password" do |env| - locale = env.get("preferences").as(Preferences).locale - - user = env.get? "user" - sid = env.get? "sid" - referer = get_referer(env) - - if !user - next env.redirect referer - end - - user = user.as(User) - sid = sid.as(String) - csrf_token = generate_response(sid, {":change_password"}, HMAC_KEY) - - templated "change_password" -end - -post "/change_password" do |env| - locale = env.get("preferences").as(Preferences).locale - - user = env.get? "user" - sid = env.get? "sid" - referer = get_referer(env) - - if !user - next env.redirect referer - end - - user = user.as(User) - sid = sid.as(String) - token = env.params.body["csrf_token"]? - - # We don't store passwords for Google accounts - if !user.password - next error_template(400, "Cannot change password for Google accounts") - end - - begin - validate_request(token, sid, env.request, HMAC_KEY, locale) - rescue ex - next error_template(400, ex) - end - - password = env.params.body["password"]? - if !password - next 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 } - - if new_passwords.size <= 1 || new_passwords.uniq.size != 1 - next error_template(400, "New passwords must match") - end - - new_password = new_passwords.uniq[0] - if new_password.empty? - next error_template(401, "Password cannot be empty") - end - - if new_password.bytesize > 55 - next error_template(400, "Password cannot be longer than 55 characters") - end - - if !Crypto::Bcrypt::Password.new(user.password.not_nil!).verify(password.byte_slice(0, 55)) - next error_template(401, "Incorrect password") - end - - new_password = Crypto::Bcrypt::Password.create(new_password, cost: 10) - Invidious::Database::Users.update_password(user, new_password.to_s) - - env.redirect referer -end - -get "/delete_account" do |env| - locale = env.get("preferences").as(Preferences).locale - - user = env.get? "user" - sid = env.get? "sid" - referer = get_referer(env) - - if !user - next env.redirect referer - end - - user = user.as(User) - sid = sid.as(String) - csrf_token = generate_response(sid, {":delete_account"}, HMAC_KEY) - - templated "delete_account" -end - -post "/delete_account" do |env| - locale = env.get("preferences").as(Preferences).locale - - user = env.get? "user" - sid = env.get? "sid" - referer = get_referer(env) - - if !user - next env.redirect referer - end - - user = user.as(User) - sid = sid.as(String) - token = env.params.body["csrf_token"]? - - begin - validate_request(token, sid, env.request, HMAC_KEY, locale) - rescue ex - next error_template(400, ex) - end - - view_name = "subscriptions_#{sha256(user.email)}" - Invidious::Database::Users.delete(user) - Invidious::Database::SessionIDs.delete(email: user.email) - PG_DB.exec("DROP MATERIALIZED VIEW #{view_name}") - - env.request.cookies.each do |cookie| - cookie.expires = Time.utc(1990, 1, 1) - env.response.cookies << cookie - end - - env.redirect referer -end - -get "/clear_watch_history" do |env| - locale = env.get("preferences").as(Preferences).locale - - user = env.get? "user" - sid = env.get? "sid" - referer = get_referer(env) - - if !user - next env.redirect referer - end - - user = user.as(User) - sid = sid.as(String) - csrf_token = generate_response(sid, {":clear_watch_history"}, HMAC_KEY) - - templated "clear_watch_history" -end - -post "/clear_watch_history" do |env| - locale = env.get("preferences").as(Preferences).locale - - user = env.get? "user" - sid = env.get? "sid" - referer = get_referer(env) - - if !user - next env.redirect referer - end - - user = user.as(User) - sid = sid.as(String) - token = env.params.body["csrf_token"]? - - begin - validate_request(token, sid, env.request, HMAC_KEY, locale) - rescue ex - next error_template(400, ex) - end - - Invidious::Database::Users.clear_watch_history(user) - env.redirect referer -end - -get "/authorize_token" do |env| - locale = env.get("preferences").as(Preferences).locale - - user = env.get? "user" - sid = env.get? "sid" - referer = get_referer(env) - - if !user - next env.redirect referer - end - - user = user.as(User) - sid = sid.as(String) - csrf_token = generate_response(sid, {":authorize_token"}, HMAC_KEY) - - scopes = env.params.query["scopes"]?.try &.split(",") - scopes ||= [] of String - - callback_url = env.params.query["callback_url"]? - if callback_url - callback_url = URI.parse(callback_url) - end - - expire = env.params.query["expire"]?.try &.to_i? - - templated "authorize_token" -end - -post "/authorize_token" do |env| - locale = env.get("preferences").as(Preferences).locale - - user = env.get? "user" - sid = env.get? "sid" - referer = get_referer(env) - - if !user - next env.redirect referer - end - - user = env.get("user").as(User) - sid = sid.as(String) - token = env.params.body["csrf_token"]? - - begin - validate_request(token, sid, env.request, HMAC_KEY, locale) - rescue ex - next error_template(400, ex) - end - - scopes = env.params.body.select { |k, v| k.match(/^scopes\[\d+\]$/) }.map { |k, v| v } - callback_url = env.params.body["callbackUrl"]? - expire = env.params.body["expire"]?.try &.to_i? - - access_token = generate_token(user.email, scopes, expire, HMAC_KEY) - - if callback_url - access_token = URI.encode_www_form(access_token) - url = URI.parse(callback_url) - - if url.query - query = HTTP::Params.parse(url.query.not_nil!) - else - query = HTTP::Params.new - end - - query["token"] = access_token - url.query = query.to_s - - env.redirect url.to_s - else - csrf_token = "" - env.set "access_token", access_token - templated "authorize_token" - end -end - -get "/token_manager" do |env| - locale = env.get("preferences").as(Preferences).locale - - user = env.get? "user" - sid = env.get? "sid" - referer = get_referer(env, "/subscription_manager") - - if !user - next env.redirect referer - end - - user = user.as(User) - tokens = Invidious::Database::SessionIDs.select_all(user.email) - - templated "token_manager" -end - -post "/token_ajax" do |env| - locale = env.get("preferences").as(Preferences).locale - - user = env.get? "user" - sid = env.get? "sid" - referer = get_referer(env) - - redirect = env.params.query["redirect"]? - redirect ||= "true" - redirect = redirect == "true" - - if !user - if redirect - next env.redirect referer - else - next error_json(403, "No such user") - end - end - - user = user.as(User) - sid = sid.as(String) - token = env.params.body["csrf_token"]? - - begin - validate_request(token, sid, env.request, HMAC_KEY, locale) - rescue ex - if redirect - next error_template(400, ex) - else - next error_json(400, ex) - end - end - - if env.params.query["action_revoke_token"]? - action = "action_revoke_token" - else - next env.redirect referer - end - - session = env.params.query["session"]? - session ||= "" - - case action - when .starts_with? "action_revoke_token" - Invidious::Database::SessionIDs.delete(sid: session, email: user.email) - else - next error_json(400, "Unsupported action #{action}") - end - - if redirect - env.redirect referer - else - env.response.content_type = "application/json" - "{}" - end -end - # Channels {"/channel/:ucid/live", "/user/:user/live", "/c/:user/live"}.each do |route| diff --git a/src/invidious/routes/account.cr b/src/invidious/routes/account.cr new file mode 100644 index 00000000..2be0de37 --- /dev/null +++ b/src/invidious/routes/account.cr @@ -0,0 +1,358 @@ +{% skip_file if flag?(:api_only) %} + +module Invidious::Routes::Account + extend self + + # ------------------- + # Password update + # ------------------- + + # Show the password change interface (GET request) + def get_change_password(env) + locale = env.get("preferences").as(Preferences).locale + + user = env.get? "user" + sid = env.get? "sid" + referer = get_referer(env) + + if !user + return env.redirect referer + end + + user = user.as(User) + sid = sid.as(String) + csrf_token = generate_response(sid, {":change_password"}, HMAC_KEY) + + templated "change_password" + end + + # Handle the password change (POST request) + def post_change_password(env) + locale = env.get("preferences").as(Preferences).locale + + user = env.get? "user" + sid = env.get? "sid" + referer = get_referer(env) + + if !user + return env.redirect referer + end + + user = user.as(User) + sid = sid.as(String) + token = env.params.body["csrf_token"]? + + # We don't store passwords for Google accounts + if !user.password + return error_template(400, "Cannot change password for Google accounts") + end + + begin + validate_request(token, sid, env.request, HMAC_KEY, locale) + rescue ex + return error_template(400, ex) + end + + password = env.params.body["password"]? + if !password + 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 } + + if new_passwords.size <= 1 || new_passwords.uniq.size != 1 + return error_template(400, "New passwords must match") + end + + new_password = new_passwords.uniq[0] + if new_password.empty? + return error_template(401, "Password cannot be empty") + end + + if new_password.bytesize > 55 + return error_template(400, "Password cannot be longer than 55 characters") + end + + if !Crypto::Bcrypt::Password.new(user.password.not_nil!).verify(password.byte_slice(0, 55)) + return error_template(401, "Incorrect password") + end + + new_password = Crypto::Bcrypt::Password.create(new_password, cost: 10) + Invidious::Database::Users.update_password(user, new_password.to_s) + + env.redirect referer + end + + # ------------------- + # Account deletion + # ------------------- + + # Show the account deletion confirmation prompt (GET request) + def get_delete(env) + locale = env.get("preferences").as(Preferences).locale + + user = env.get? "user" + sid = env.get? "sid" + referer = get_referer(env) + + if !user + return env.redirect referer + end + + user = user.as(User) + sid = sid.as(String) + csrf_token = generate_response(sid, {":delete_account"}, HMAC_KEY) + + templated "delete_account" + end + + # Handle the account deletion (POST request) + def post_delete(env) + locale = env.get("preferences").as(Preferences).locale + + user = env.get? "user" + sid = env.get? "sid" + referer = get_referer(env) + + if !user + return env.redirect referer + end + + user = user.as(User) + sid = sid.as(String) + token = env.params.body["csrf_token"]? + + begin + validate_request(token, sid, env.request, HMAC_KEY, locale) + rescue ex + return error_template(400, ex) + end + + view_name = "subscriptions_#{sha256(user.email)}" + Invidious::Database::Users.delete(user) + Invidious::Database::SessionIDs.delete(email: user.email) + PG_DB.exec("DROP MATERIALIZED VIEW #{view_name}") + + env.request.cookies.each do |cookie| + cookie.expires = Time.utc(1990, 1, 1) + env.response.cookies << cookie + end + + env.redirect referer + end + + # ------------------- + # Clear history + # ------------------- + + # Show the watch history deletion confirmation prompt (GET request) + def get_clear_history(env) + locale = env.get("preferences").as(Preferences).locale + + user = env.get? "user" + sid = env.get? "sid" + referer = get_referer(env) + + if !user + return env.redirect referer + end + + user = user.as(User) + sid = sid.as(String) + csrf_token = generate_response(sid, {":clear_watch_history"}, HMAC_KEY) + + templated "clear_watch_history" + end + + # Handle the watch history clearing (POST request) + def post_clear_history(env) + locale = env.get("preferences").as(Preferences).locale + + user = env.get? "user" + sid = env.get? "sid" + referer = get_referer(env) + + if !user + return env.redirect referer + end + + user = user.as(User) + sid = sid.as(String) + token = env.params.body["csrf_token"]? + + begin + validate_request(token, sid, env.request, HMAC_KEY, locale) + rescue ex + return error_template(400, ex) + end + + Invidious::Database::Users.clear_watch_history(user) + env.redirect referer + end + + # ------------------- + # Authorize tokens + # ------------------- + + # Show the "authorize token?" confirmation prompt (GET request) + def get_authorize_token(env) + locale = env.get("preferences").as(Preferences).locale + + user = env.get? "user" + sid = env.get? "sid" + referer = get_referer(env) + + if !user + return env.redirect referer + end + + user = user.as(User) + sid = sid.as(String) + csrf_token = generate_response(sid, {":authorize_token"}, HMAC_KEY) + + scopes = env.params.query["scopes"]?.try &.split(",") + scopes ||= [] of String + + callback_url = env.params.query["callback_url"]? + if callback_url + callback_url = URI.parse(callback_url) + end + + expire = env.params.query["expire"]?.try &.to_i? + + templated "authorize_token" + end + + # Handle token authorization (POST request) + def post_authorize_token(env) + locale = env.get("preferences").as(Preferences).locale + + user = env.get? "user" + sid = env.get? "sid" + referer = get_referer(env) + + if !user + return env.redirect referer + end + + user = env.get("user").as(User) + sid = sid.as(String) + token = env.params.body["csrf_token"]? + + begin + validate_request(token, sid, env.request, HMAC_KEY, locale) + rescue ex + return error_template(400, ex) + end + + scopes = env.params.body.select { |k, v| k.match(/^scopes\[\d+\]$/) }.map { |k, v| v } + callback_url = env.params.body["callbackUrl"]? + expire = env.params.body["expire"]?.try &.to_i? + + access_token = generate_token(user.email, scopes, expire, HMAC_KEY) + + if callback_url + access_token = URI.encode_www_form(access_token) + url = URI.parse(callback_url) + + if url.query + query = HTTP::Params.parse(url.query.not_nil!) + else + query = HTTP::Params.new + end + + query["token"] = access_token + url.query = query.to_s + + env.redirect url.to_s + else + csrf_token = "" + env.set "access_token", access_token + templated "authorize_token" + end + end + + # ------------------- + # Manage tokens + # ------------------- + + # Show the token manager page (GET request) + def token_manager(env) + locale = env.get("preferences").as(Preferences).locale + + user = env.get? "user" + sid = env.get? "sid" + referer = get_referer(env, "/subscription_manager") + + if !user + return env.redirect referer + end + + user = user.as(User) + tokens = Invidious::Database::SessionIDs.select_all(user.email) + + templated "token_manager" + end + + # ------------------- + # AJAX for tokens + # ------------------- + + # Handle internal (non-API) token actions (POST request) + def token_ajax(env) + locale = env.get("preferences").as(Preferences).locale + + user = env.get? "user" + sid = env.get? "sid" + referer = get_referer(env) + + redirect = env.params.query["redirect"]? + redirect ||= "true" + redirect = redirect == "true" + + if !user + if redirect + return env.redirect referer + else + return error_json(403, "No such user") + end + end + + user = user.as(User) + sid = sid.as(String) + token = env.params.body["csrf_token"]? + + begin + validate_request(token, sid, env.request, HMAC_KEY, locale) + rescue ex + if redirect + return error_template(400, ex) + else + return error_json(400, ex) + end + end + + if env.params.query["action_revoke_token"]? + action = "action_revoke_token" + else + return env.redirect referer + end + + session = env.params.query["session"]? + session ||= "" + + case action + when .starts_with? "action_revoke_token" + Invidious::Database::SessionIDs.delete(sid: session, email: user.email) + else + return error_json(400, "Unsupported action #{action}") + end + + if redirect + return env.redirect referer + else + env.response.content_type = "application/json" + return "{}" + end + end +end From fb3615502258c71249c6d77aebe684234756b416 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Fri, 4 Feb 2022 04:55:50 +0100 Subject: [PATCH 008/106] Move user routes definitions to a macro in routing.cr --- src/invidious.cr | 25 ++----------------------- src/invidious/routing.cr | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 23 deletions(-) diff --git a/src/invidious.cr b/src/invidious.cr index 6f4f575b..fc498dbf 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -364,29 +364,8 @@ end Invidious::Routing.get "/results", Invidious::Routes::Search, :results Invidious::Routing.get "/search", Invidious::Routes::Search, :search - # User login/out - Invidious::Routing.get "/login", Invidious::Routes::Login, :login_page - Invidious::Routing.post "/login", Invidious::Routes::Login, :login - Invidious::Routing.post "/signout", Invidious::Routes::Login, :signout - - # User preferences - Invidious::Routing.get "/preferences", Invidious::Routes::PreferencesRoute, :show - Invidious::Routing.post "/preferences", Invidious::Routes::PreferencesRoute, :update - Invidious::Routing.get "/toggle_theme", Invidious::Routes::PreferencesRoute, :toggle_theme - Invidious::Routing.get "/data_control", Invidious::Routes::PreferencesRoute, :data_control - Invidious::Routing.post "/data_control", Invidious::Routes::PreferencesRoute, :update_data_control - - # User account management - Invidious::Routing.get "/change_password", Invidious::Routes::Account, :get_change_password - Invidious::Routing.post "/change_password", Invidious::Routes::Account, :post_change_password - Invidious::Routing.get "/delete_account", Invidious::Routes::Account, :get_delete - Invidious::Routing.post "/delete_account", Invidious::Routes::Account, :post_delete - Invidious::Routing.get "/clear_watch_history", Invidious::Routes::Account, :get_clear_history - Invidious::Routing.post "/clear_watch_history", Invidious::Routes::Account, :post_clear_history - Invidious::Routing.get "/authorize_token", Invidious::Routes::Account, :get_authorize_token - Invidious::Routing.post "/authorize_token", Invidious::Routes::Account, :post_authorize_token - Invidious::Routing.get "/token_manager", Invidious::Routes::Account, :token_manager - Invidious::Routing.post "/token_ajax", Invidious::Routes::Account, :token_ajax + # User routes + define_user_routes() # Feeds Invidious::Routing.get "/view_all_playlists", Invidious::Routes::Feeds, :view_all_playlists_redirect diff --git a/src/invidious/routing.cr b/src/invidious/routing.cr index 7551f22d..5efe1bd8 100644 --- a/src/invidious/routing.cr +++ b/src/invidious/routing.cr @@ -10,6 +10,32 @@ module Invidious::Routing {% end %} end +macro define_user_routes + # User login/out + Invidious::Routing.get "/login", Invidious::Routes::Login, :login_page + Invidious::Routing.post "/login", Invidious::Routes::Login, :login + Invidious::Routing.post "/signout", Invidious::Routes::Login, :signout + + # User preferences + Invidious::Routing.get "/preferences", Invidious::Routes::PreferencesRoute, :show + Invidious::Routing.post "/preferences", Invidious::Routes::PreferencesRoute, :update + Invidious::Routing.get "/toggle_theme", Invidious::Routes::PreferencesRoute, :toggle_theme + Invidious::Routing.get "/data_control", Invidious::Routes::PreferencesRoute, :data_control + Invidious::Routing.post "/data_control", Invidious::Routes::PreferencesRoute, :update_data_control + + # User account management + Invidious::Routing.get "/change_password", Invidious::Routes::Account, :get_change_password + Invidious::Routing.post "/change_password", Invidious::Routes::Account, :post_change_password + Invidious::Routing.get "/delete_account", Invidious::Routes::Account, :get_delete + Invidious::Routing.post "/delete_account", Invidious::Routes::Account, :post_delete + Invidious::Routing.get "/clear_watch_history", Invidious::Routes::Account, :get_clear_history + Invidious::Routing.post "/clear_watch_history", Invidious::Routes::Account, :post_clear_history + Invidious::Routing.get "/authorize_token", Invidious::Routes::Account, :get_authorize_token + Invidious::Routing.post "/authorize_token", Invidious::Routes::Account, :post_authorize_token + Invidious::Routing.get "/token_manager", Invidious::Routes::Account, :token_manager + Invidious::Routing.post "/token_ajax", Invidious::Routes::Account, :token_ajax +end + macro define_v1_api_routes {{namespace = Invidious::Routes::API::V1}} # Videos From c04f45d5e36499e6faefd163e92c58fa1abaa7ae Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Fri, 4 Feb 2022 04:09:07 +0100 Subject: [PATCH 009/106] Move user struct to own file, under Invidious namespace --- src/invidious.cr | 2 +- src/invidious/search.cr | 2 +- src/invidious/user/user.cr | 27 ++++++++++++++++++++++++++ src/invidious/users.cr | 30 ++--------------------------- src/invidious/views/preferences.ecr | 2 +- src/invidious/views/template.ecr | 4 ++-- 6 files changed, 34 insertions(+), 33 deletions(-) create mode 100644 src/invidious/user/user.cr diff --git a/src/invidious.cr b/src/invidious.cr index fc498dbf..1e78ef5d 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -548,7 +548,7 @@ add_handler AuthHandler.new add_handler DenyFrame.new add_context_storage_type(Array(String)) add_context_storage_type(Preferences) -add_context_storage_type(User) +add_context_storage_type(Invidious::User) Kemal.config.logger = LOGGER Kemal.config.host_binding = Kemal.config.host_binding != "0.0.0.0" ? Kemal.config.host_binding : CONFIG.host_binding diff --git a/src/invidious/search.cr b/src/invidious/search.cr index d8971e79..ae106bf6 100644 --- a/src/invidious/search.cr +++ b/src/invidious/search.cr @@ -176,7 +176,7 @@ end def process_search_query(query, page, user, region) if user - user = user.as(User) + user = user.as(Invidious::User) view_name = "subscriptions_#{sha256(user.email)}" end diff --git a/src/invidious/user/user.cr b/src/invidious/user/user.cr new file mode 100644 index 00000000..a6d05fd1 --- /dev/null +++ b/src/invidious/user/user.cr @@ -0,0 +1,27 @@ +require "db" + +struct Invidious::User + include DB::Serializable + + property updated : Time + property notifications : Array(String) + property subscriptions : Array(String) + property email : String + + @[DB::Field(converter: Invidious::User::PreferencesConverter)] + property preferences : Preferences + property password : String? + property token : String + property watched : Array(String) + property feed_needs_update : Bool? + + module PreferencesConverter + def self.from_rs(rs) + begin + Preferences.from_json(rs.read(String)) + rescue ex + Preferences.from_json("{}") + end + end + end +end diff --git a/src/invidious/users.cr b/src/invidious/users.cr index 9810f8a2..b4995e95 100644 --- a/src/invidious/users.cr +++ b/src/invidious/users.cr @@ -3,32 +3,6 @@ require "crypto/bcrypt/password" # Materialized views may not be defined using bound parameters (`$1` as used elsewhere) MATERIALIZED_VIEW_SQL = ->(email : String) { "SELECT cv.* FROM channel_videos cv WHERE EXISTS (SELECT subscriptions FROM users u WHERE cv.ucid = ANY (u.subscriptions) AND u.email = E'#{email.gsub({'\'' => "\\'", '\\' => "\\\\"})}') ORDER BY published DESC" } -struct User - include DB::Serializable - - property updated : Time - property notifications : Array(String) - property subscriptions : Array(String) - property email : String - - @[DB::Field(converter: User::PreferencesConverter)] - property preferences : Preferences - property password : String? - property token : String - property watched : Array(String) - property feed_needs_update : Bool? - - module PreferencesConverter - def self.from_rs(rs) - begin - Preferences.from_json(rs.read(String)) - rescue ex - Preferences.from_json("{}") - end - end - end -end - def get_user(sid, headers, refresh = true) if email = Invidious::Database::SessionIDs.select_email(sid) user = Invidious::Database::Users.select!(email: email) @@ -84,7 +58,7 @@ def fetch_user(sid, headers) token = Base64.urlsafe_encode(Random::Secure.random_bytes(32)) - user = User.new({ + user = Invidious::User.new({ updated: Time.utc, notifications: [] of String, subscriptions: channels, @@ -102,7 +76,7 @@ def create_user(sid, email, password) password = Crypto::Bcrypt::Password.create(password, cost: 10) token = Base64.urlsafe_encode(Random::Secure.random_bytes(32)) - user = User.new({ + user = Invidious::User.new({ updated: Time.utc, notifications: [] of String, subscriptions: [] of String, diff --git a/src/invidious/views/preferences.ecr b/src/invidious/views/preferences.ecr index 96904259..3606d140 100644 --- a/src/invidious/views/preferences.ecr +++ b/src/invidious/views/preferences.ecr @@ -252,7 +252,7 @@ <% end %> <% end %> - <% if env.get?("user") && CONFIG.admins.includes? env.get?("user").as(User).email %> + <% if env.get?("user") && CONFIG.admins.includes? env.get?("user").as(Invidious::User).email %> <%= translate(locale, "preferences_category_admin") %>
diff --git a/src/invidious/views/template.ecr b/src/invidious/views/template.ecr index 92df1272..bd908dd6 100644 --- a/src/invidious/views/template.ecr +++ b/src/invidious/views/template.ecr @@ -52,7 +52,7 @@
<% if env.get("preferences").as(Preferences).show_nick %>
- <%= env.get("user").as(User).email %> + <%= env.get("user").as(Invidious::User).email %>
<% end %>
From ad4a06fca5d11b57705540818d3eb4e86bb6ac14 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Fri, 4 Feb 2022 03:44:10 +0100 Subject: [PATCH 010/106] Move user captcha code to its own module --- src/invidious.cr | 15 ++++--- src/invidious/routes/login.cr | 4 +- src/invidious/user/captcha.cr | 78 +++++++++++++++++++++++++++++++++++ src/invidious/users.cr | 69 ------------------------------- 4 files changed, 87 insertions(+), 79 deletions(-) create mode 100644 src/invidious/user/captcha.cr diff --git a/src/invidious.cr b/src/invidious.cr index 1e78ef5d..06ce3ead 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -38,14 +38,13 @@ require "./invidious/jobs/**" CONFIG = Config.load HMAC_KEY = CONFIG.hmac_key || Random::Secure.hex(32) -PG_DB = DB.open CONFIG.database_url -ARCHIVE_URL = URI.parse("https://archive.org") -LOGIN_URL = URI.parse("https://accounts.google.com") -PUBSUB_URL = URI.parse("https://pubsubhubbub.appspot.com") -REDDIT_URL = URI.parse("https://www.reddit.com") -TEXTCAPTCHA_URL = URI.parse("https://textcaptcha.com") -YT_URL = URI.parse("https://www.youtube.com") -HOST_URL = make_host_url(Kemal.config) +PG_DB = DB.open CONFIG.database_url +ARCHIVE_URL = URI.parse("https://archive.org") +LOGIN_URL = URI.parse("https://accounts.google.com") +PUBSUB_URL = URI.parse("https://pubsubhubbub.appspot.com") +REDDIT_URL = URI.parse("https://www.reddit.com") +YT_URL = URI.parse("https://www.youtube.com") +HOST_URL = make_host_url(Kemal.config) CHARS_SAFE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_" TEST_IDS = {"AgbeGFYluEA", "BaW_jenozKc", "a9LDPn-MO4I", "ddFvjfvPnqk", "iqKdEhx-dD4"} diff --git a/src/invidious/routes/login.cr b/src/invidious/routes/login.cr index f4859e6f..42ac0b1d 100644 --- a/src/invidious/routes/login.cr +++ b/src/invidious/routes/login.cr @@ -393,9 +393,9 @@ module Invidious::Routes::Login prompt = "" if captcha_type == "image" - captcha = generate_captcha(HMAC_KEY) + captcha = Invidious::User::Captcha.generate_image(HMAC_KEY) else - captcha = generate_text_captcha(HMAC_KEY) + captcha = Invidious::User::Captcha.generate_text(HMAC_KEY) end return templated "login" diff --git a/src/invidious/user/captcha.cr b/src/invidious/user/captcha.cr new file mode 100644 index 00000000..8a0f67e5 --- /dev/null +++ b/src/invidious/user/captcha.cr @@ -0,0 +1,78 @@ +require "openssl/hmac" + +struct Invidious::User + module Captcha + extend self + + private TEXTCAPTCHA_URL = URI.parse("https://textcaptcha.com") + + def generate_image(key) + second = Random::Secure.rand(12) + second_angle = second * 30 + second = second * 5 + + minute = Random::Secure.rand(12) + minute_angle = minute * 30 + minute = minute * 5 + + hour = Random::Secure.rand(12) + hour_angle = hour * 30 + minute_angle.to_f / 12 + if hour == 0 + hour = 12 + end + + clock_svg = <<-END_SVG + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + + + + + + + END_SVG + + image = "data:image/png;base64," + image += Process.run(%(rsvg-convert -w 400 -h 400 -b none -f png), shell: true, + input: IO::Memory.new(clock_svg), output: Process::Redirect::Pipe + ) do |proc| + Base64.strict_encode(proc.output.gets_to_end) + end + + answer = "#{hour}:#{minute.to_s.rjust(2, '0')}:#{second.to_s.rjust(2, '0')}" + answer = OpenSSL::HMAC.hexdigest(:sha256, key, answer) + + return { + question: image, + tokens: {generate_response(answer, {":login"}, key, use_nonce: true)}, + } + end + + def generate_text(key) + response = make_client(TEXTCAPTCHA_URL, &.get("/github.com/iv.org/invidious.json").body) + response = JSON.parse(response) + + tokens = response["a"].as_a.map do |answer| + generate_response(answer.as_s, {":login"}, key, use_nonce: true) + end + + return { + question: response["q"].as_s, + tokens: tokens, + } + end + end +end diff --git a/src/invidious/users.cr b/src/invidious/users.cr index b4995e95..b763596b 100644 --- a/src/invidious/users.cr +++ b/src/invidious/users.cr @@ -91,75 +91,6 @@ def create_user(sid, email, password) return user, sid end -def generate_captcha(key) - second = Random::Secure.rand(12) - second_angle = second * 30 - second = second * 5 - - minute = Random::Secure.rand(12) - minute_angle = minute * 30 - minute = minute * 5 - - hour = Random::Secure.rand(12) - hour_angle = hour * 30 + minute_angle.to_f / 12 - if hour == 0 - hour = 12 - end - - clock_svg = <<-END_SVG - - - - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12 - - - - - - - END_SVG - - image = "data:image/png;base64," - image += Process.run(%(rsvg-convert -w 400 -h 400 -b none -f png), shell: true, - input: IO::Memory.new(clock_svg), output: Process::Redirect::Pipe - ) do |proc| - Base64.strict_encode(proc.output.gets_to_end) - end - - answer = "#{hour}:#{minute.to_s.rjust(2, '0')}:#{second.to_s.rjust(2, '0')}" - answer = OpenSSL::HMAC.hexdigest(:sha256, key, answer) - - return { - question: image, - tokens: {generate_response(answer, {":login"}, key, use_nonce: true)}, - } -end - -def generate_text_captcha(key) - response = make_client(TEXTCAPTCHA_URL, &.get("/github.com/iv.org/invidious.json").body) - response = JSON.parse(response) - - tokens = response["a"].as_a.map do |answer| - generate_response(answer.as_s, {":login"}, key, use_nonce: true) - end - - return { - question: response["q"].as_s, - tokens: tokens, - } -end - def subscribe_ajax(channel_id, action, env_headers) headers = HTTP::Headers.new headers["Cookie"] = env_headers["Cookie"] From ef8dc7272beed31189df1568e59b14b805783a62 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Fri, 4 Feb 2022 05:19:22 +0100 Subject: [PATCH 011/106] Put CSV import function under its own module --- src/invidious/user/imports.cr | 42 ++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/src/invidious/user/imports.cr b/src/invidious/user/imports.cr index 2ae1dcb1..c8580038 100644 --- a/src/invidious/user/imports.cr +++ b/src/invidious/user/imports.cr @@ -1,27 +1,33 @@ require "csv" -def parse_subscription_export_csv(csv_content : String) - rows = CSV.new(csv_content, headers: true) - subscriptions = Array(String).new +struct Invidious::User + module Import + extend self - # Counter to limit the amount of imports. - # This is intended to prevent DoS. - row_counter = 0 + # Parse a youtube CSV subscription file + def parse_subscription_export_csv(csv_content : String) + rows = CSV.new(csv_content, headers: true) + subscriptions = Array(String).new - rows.each do |row| - # Limit to 1200 - row_counter += 1 - break if row_counter > 1_200 + # Counter to limit the amount of imports. + # This is intended to prevent DoS. + row_counter = 0 - # Channel ID is the first column in the csv export we can't use the header - # name, because the header name is localized depending on the - # language the user has set on their account - channel_id = row[0].strip + rows.each do |row| + # Limit to 1200 + row_counter += 1 + break if row_counter > 1_200 - next if channel_id.empty? + # Channel ID is the first column in the csv export we can't use the header + # name, because the header name is localized depending on the + # language the user has set on their account + channel_id = row[0].strip - subscriptions << channel_id + next if channel_id.empty? + subscriptions << channel_id + end + + return subscriptions + end end - - return subscriptions end From 2bbd424fce4ad1d19643b370250c9f8cee8f1e6f Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Fri, 4 Feb 2022 06:01:07 +0100 Subject: [PATCH 012/106] Move import logic to its own module --- spec/invidious/user/imports_spec.cr | 4 +- src/invidious/routes/preferences.cr | 142 ++------------------- src/invidious/user/imports.cr | 191 +++++++++++++++++++++++++++- 3 files changed, 202 insertions(+), 135 deletions(-) diff --git a/spec/invidious/user/imports_spec.cr b/spec/invidious/user/imports_spec.cr index 5a682ec5..762ce0d8 100644 --- a/spec/invidious/user/imports_spec.cr +++ b/spec/invidious/user/imports_spec.cr @@ -25,9 +25,9 @@ def csv_sample CSV end -Spectator.describe "Invidious::User::Imports" do +Spectator.describe Invidious::User::Import do it "imports CSV" do - subscriptions = parse_subscription_export_csv(csv_sample) + subscriptions = Invidious::User::Import.parse_subscription_export_csv(csv_sample) expect(subscriptions).to be_an(Array(String)) expect(subscriptions.size).to eq(13) diff --git a/src/invidious/routes/preferences.cr b/src/invidious/routes/preferences.cr index 930c588b..b574c1c1 100644 --- a/src/invidious/routes/preferences.cr +++ b/src/invidious/routes/preferences.cr @@ -321,149 +321,27 @@ module Invidious::Routes::PreferencesRoute # TODO: Unify into single import based on content-type case part.name when "import_invidious" - body = JSON.parse(body) - - if body["subscriptions"]? - user.subscriptions += body["subscriptions"].as_a.map(&.as_s) - user.subscriptions.uniq! - - user.subscriptions = get_batch_channels(user.subscriptions) - - Invidious::Database::Users.update_subscriptions(user) - end - - if body["watch_history"]? - user.watched += body["watch_history"].as_a.map(&.as_s) - user.watched.uniq! - Invidious::Database::Users.update_watch_history(user) - end - - if body["preferences"]? - user.preferences = Preferences.from_json(body["preferences"].to_json) - Invidious::Database::Users.update_preferences(user) - end - - if playlists = body["playlists"]?.try &.as_a? - playlists.each do |item| - title = item["title"]?.try &.as_s?.try &.delete("<>") - description = item["description"]?.try &.as_s?.try &.delete("\r") - privacy = item["privacy"]?.try &.as_s?.try { |privacy| PlaylistPrivacy.parse? privacy } - - next if !title - next if !description - next if !privacy - - 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| - raise InfoException.new("Playlist cannot have more than 500 videos") if idx > 500 - - video_id = video_id.try &.as_s? - next if !video_id - - begin - video = get_video(video_id) - rescue ex - next - end - - playlist_video = PlaylistVideo.new({ - title: video.title, - id: video.id, - author: video.author, - ucid: video.ucid, - length_seconds: video.length_seconds, - published: video.published, - plid: playlist.id, - live_now: video.live_now, - index: Random::Secure.rand(0_i64..Int64::MAX), - }) - - Invidious::Database::PlaylistVideos.insert(playlist_video) - Invidious::Database::Playlists.update_video_added(playlist.id, playlist_video.index) - end - end - end + Invidious::User::Import.from_invidious(user, body) when "import_youtube" filename = part.filename || "" - extension = filename.split(".").last + success = Invidious::User::Import.from_youtube(user, body, filename, type) - if extension == "xml" || type == "application/xml" || type == "text/xml" - 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] - end - elsif extension == "json" || type == "application/json" - subscriptions = JSON.parse(body) - user.subscriptions += subscriptions.as_a.compact_map do |entry| - entry["snippet"]["resourceId"]["channelId"].as_s - end - elsif extension == "csv" || type == "text/csv" - subscriptions = parse_subscription_export_csv(body) - user.subscriptions += subscriptions - else + if !success haltf(env, status_code: 415, response: error_template(415, "Invalid subscription file uploaded") ) end - - user.subscriptions.uniq! - user.subscriptions = get_batch_channels(user.subscriptions) - - Invidious::Database::Users.update_subscriptions(user) when "import_freetube" - user.subscriptions += body.scan(/"channelId":"(?[a-zA-Z0-9_-]{24})"/).map do |md| - md["channel_id"] - end - user.subscriptions.uniq! - - user.subscriptions = get_batch_channels(user.subscriptions) - - Invidious::Database::Users.update_subscriptions(user) + Invidious::User::Import.from_freetube(user, body) when "import_newpipe_subscriptions" - body = JSON.parse(body) - user.subscriptions += body["subscriptions"].as_a.compact_map do |channel| - if match = channel["url"].as_s.match(/\/channel\/(?UC[a-zA-Z0-9_-]{22})/) - next match["channel"] - elsif match = channel["url"].as_s.match(/\/user\/(?.+)/) - response = YT_POOL.client &.get("/user/#{match["user"]}?disable_polymer=1&hl=en&gl=US") - html = XML.parse_html(response.body) - ucid = html.xpath_node(%q(//link[@rel="canonical"])).try &.["href"].split("/")[-1] - next ucid if ucid - end - - nil - end - user.subscriptions.uniq! - - user.subscriptions = get_batch_channels(user.subscriptions) - - Invidious::Database::Users.update_subscriptions(user) + Invidious::User::Import.from_newpipe_subs(user, body) when "import_newpipe" - Compress::Zip::Reader.open(IO::Memory.new(body)) do |file| - file.each_entry do |entry| - if entry.filename == "newpipe.db" - tempfile = File.tempfile(".db") - File.write(tempfile.path, entry.io.gets_to_end) - db = DB.open("sqlite3://" + tempfile.path) + success = Invidious::User::Import.from_newpipe(user, body) - user.watched += db.query_all("SELECT url FROM streams", as: String).map(&.lchop("https://www.youtube.com/watch?v=")) - user.watched.uniq! - - Invidious::Database::Users.update_watch_history(user) - - user.subscriptions += db.query_all("SELECT url FROM subscriptions", as: String).map(&.lchop("https://www.youtube.com/channel/")) - user.subscriptions.uniq! - - user.subscriptions = get_batch_channels(user.subscriptions) - - Invidious::Database::Users.update_subscriptions(user) - - db.close - tempfile.delete - end - end + if !success + haltf(env, status_code: 415, + response: error_template(415, "Uploaded file is too large") + ) end else nil # Ignore end diff --git a/src/invidious/user/imports.cr b/src/invidious/user/imports.cr index c8580038..7404cd97 100644 --- a/src/invidious/user/imports.cr +++ b/src/invidious/user/imports.cr @@ -29,5 +29,194 @@ struct Invidious::User return subscriptions end - end + + # ------------------- + # Invidious + # ------------------- + + # Import from another invidious account + def from_invidious(user : User, body : String) + data = JSON.parse(body) + + if data["subscriptions"]? + user.subscriptions += data["subscriptions"].as_a.map(&.as_s) + user.subscriptions.uniq! + user.subscriptions = get_batch_channels(user.subscriptions) + + Invidious::Database::Users.update_subscriptions(user) + end + + if data["watch_history"]? + user.watched += data["watch_history"].as_a.map(&.as_s) + user.watched.uniq! + Invidious::Database::Users.update_watch_history(user) + end + + if data["preferences"]? + user.preferences = Preferences.from_json(data["preferences"].to_json) + Invidious::Database::Users.update_preferences(user) + end + + if playlists = data["playlists"]?.try &.as_a? + playlists.each do |item| + title = item["title"]?.try &.as_s?.try &.delete("<>") + description = item["description"]?.try &.as_s?.try &.delete("\r") + privacy = item["privacy"]?.try &.as_s?.try { |privacy| PlaylistPrivacy.parse? privacy } + + next if !title + next if !description + next if !privacy + + 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| + raise InfoException.new("Playlist cannot have more than 500 videos") if idx > 500 + + video_id = video_id.try &.as_s? + next if !video_id + + begin + video = get_video(video_id) + rescue ex + next + end + + playlist_video = PlaylistVideo.new({ + title: video.title, + id: video.id, + author: video.author, + ucid: video.ucid, + length_seconds: video.length_seconds, + published: video.published, + plid: playlist.id, + live_now: video.live_now, + index: Random::Secure.rand(0_i64..Int64::MAX), + }) + + Invidious::Database::PlaylistVideos.insert(playlist_video) + Invidious::Database::Playlists.update_video_added(playlist.id, playlist_video.index) + end + end + end + end + + # ------------------- + # Youtube + # ------------------- + + # Import subscribed channels from Youtube + # Returns success status + def from_youtube(user : User, body : String, filename : String, type : String) : Bool + extension = filename.split(".").last + + if extension == "xml" || type == "application/xml" || type == "text/xml" + 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] + end + elsif extension == "json" || type == "application/json" + subscriptions = JSON.parse(body) + user.subscriptions += subscriptions.as_a.compact_map do |entry| + entry["snippet"]["resourceId"]["channelId"].as_s + end + elsif extension == "csv" || type == "text/csv" + subscriptions = parse_subscription_export_csv(body) + user.subscriptions += subscriptions + else + return false + end + + user.subscriptions.uniq! + user.subscriptions = get_batch_channels(user.subscriptions) + + Invidious::Database::Users.update_subscriptions(user) + return true + end + + # ------------------- + # Freetube + # ------------------- + + def from_freetube(user : User, body : String) + matches = body.scan(/"channelId":"(?[a-zA-Z0-9_-]{24})"/) + + user.subscriptions += matches.map(&.["channel_id"]) + user.subscriptions.uniq! + user.subscriptions = get_batch_channels(user.subscriptions) + + Invidious::Database::Users.update_subscriptions(user) + end + + # ------------------- + # Newpipe + # ------------------- + + def from_newpipe_subs(user : User, body : String) + data = JSON.parse(body) + + user.subscriptions += data["subscriptions"].as_a.compact_map do |channel| + if match = channel["url"].as_s.match(/\/channel\/(?UC[a-zA-Z0-9_-]{22})/) + next match["channel"] + elsif match = channel["url"].as_s.match(/\/user\/(?.+)/) + # Resolve URL using the API + resolved_url = YoutubeAPI.resolve_url("https://www.youtube.com/user/#{match["user"]}") + ucid = resolved_url.dig?("endpoint", "browseEndpoint", "browseId") + next ucid.as_s if ucid + end + + nil + end + + user.subscriptions.uniq! + user.subscriptions = get_batch_channels(user.subscriptions) + + Invidious::Database::Users.update_subscriptions(user) + end + + def from_newpipe(user : User, body : String) : Bool + io = IO::Memory.new(body) + + Compress::Zip::File.open(io) do |file| + file.entries.each do |entry| + entry.open do |file_io| + # Ensure max size of 4MB + io_sized = IO::Sized.new(file_io, 0x400000) + + next if entry.filename != "newpipe.db" + + tempfile = File.tempfile(".db") + + begin + File.write(tempfile.path, io_sized.gets_to_end) + rescue + return false + end + + db = DB.open("sqlite3://" + tempfile.path) + + user.watched += db.query_all("SELECT url FROM streams", as: String) + .map(&.lchop("https://www.youtube.com/watch?v=")) + + user.watched.uniq! + Invidious::Database::Users.update_watch_history(user) + + user.subscriptions += db.query_all("SELECT url FROM subscriptions", as: String) + .map(&.lchop("https://www.youtube.com/channel/")) + + user.subscriptions.uniq! + user.subscriptions = get_batch_channels(user.subscriptions) + + Invidious::Database::Users.update_subscriptions(user) + + db.close + tempfile.delete + end + end + end + + # Success! + return true + end + end # module end From 71a8867a4a719023230802f2927617d676bfa0b4 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Fri, 4 Feb 2022 06:43:43 +0100 Subject: [PATCH 013/106] Move user cookies to their own module --- src/invidious/routes/login.cr | 40 +++-------------------------- src/invidious/routes/preferences.cr | 30 ++-------------------- src/invidious/user/cookies.cr | 37 ++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 65 deletions(-) create mode 100644 src/invidious/user/cookies.cr diff --git a/src/invidious/routes/login.cr b/src/invidious/routes/login.cr index 42ac0b1d..8767ec22 100644 --- a/src/invidious/routes/login.cr +++ b/src/invidious/routes/login.cr @@ -282,18 +282,8 @@ module Invidious::Routes::Login host = URI.parse(env.request.headers["Host"]).host - if Kemal.config.ssl || CONFIG.https_only - secure = true - else - secure = false - end - cookies.each do |cookie| - if Kemal.config.ssl || CONFIG.https_only - cookie.secure = secure - else - cookie.secure = secure - end + cookie.secure = Invidious::User::Cookies::SECURE if cookie.extension cookie.extension = cookie.extension.not_nil!.gsub(".youtube.com", host) @@ -338,19 +328,7 @@ module Invidious::Routes::Login sid = Base64.urlsafe_encode(Random::Secure.random_bytes(32)) Invidious::Database::SessionIDs.insert(sid, email) - if Kemal.config.ssl || CONFIG.https_only - secure = true - else - secure = false - end - - if CONFIG.domain - env.response.cookies["SID"] = HTTP::Cookie.new(name: "SID", domain: "#{CONFIG.domain}", value: sid, expires: Time.utc + 2.years, - secure: secure, http_only: true) - else - env.response.cookies["SID"] = HTTP::Cookie.new(name: "SID", value: sid, expires: Time.utc + 2.years, - secure: secure, http_only: true) - end + env.response.cookies["SID"] = Invidious::User::Cookies.sid(CONFIG.domain, sid) else return error_template(401, "Wrong username or password") end @@ -455,19 +433,7 @@ module Invidious::Routes::Login view_name = "subscriptions_#{sha256(user.email)}" PG_DB.exec("CREATE MATERIALIZED VIEW #{view_name} AS #{MATERIALIZED_VIEW_SQL.call(user.email)}") - if Kemal.config.ssl || CONFIG.https_only - secure = true - else - secure = false - end - - if CONFIG.domain - env.response.cookies["SID"] = HTTP::Cookie.new(name: "SID", domain: "#{CONFIG.domain}", value: sid, expires: Time.utc + 2.years, - secure: secure, http_only: true) - else - env.response.cookies["SID"] = HTTP::Cookie.new(name: "SID", value: sid, expires: Time.utc + 2.years, - secure: secure, http_only: true) - end + env.response.cookies["SID"] = Invidious::User::Cookies.sid(CONFIG.domain, sid) if env.request.cookies["PREFS"]? user.preferences = env.get("preferences").as(Preferences) diff --git a/src/invidious/routes/preferences.cr b/src/invidious/routes/preferences.cr index b574c1c1..294932eb 100644 --- a/src/invidious/routes/preferences.cr +++ b/src/invidious/routes/preferences.cr @@ -214,19 +214,7 @@ module Invidious::Routes::PreferencesRoute File.write("config/config.yml", CONFIG.to_yaml) end else - if Kemal.config.ssl || CONFIG.https_only - secure = true - else - secure = false - end - - if CONFIG.domain - env.response.cookies["PREFS"] = HTTP::Cookie.new(name: "PREFS", domain: "#{CONFIG.domain}", value: URI.encode_www_form(preferences.to_json), expires: Time.utc + 2.years, - secure: secure, http_only: true) - else - env.response.cookies["PREFS"] = HTTP::Cookie.new(name: "PREFS", value: URI.encode_www_form(preferences.to_json), expires: Time.utc + 2.years, - secure: secure, http_only: true) - end + env.response.cookies["PREFS"] = Invidious::User::Cookies.prefs(CONFIG.domain, preferences) end env.redirect referer @@ -261,21 +249,7 @@ module Invidious::Routes::PreferencesRoute preferences.dark_mode = "dark" end - preferences = preferences.to_json - - if Kemal.config.ssl || CONFIG.https_only - secure = true - else - secure = false - end - - if CONFIG.domain - env.response.cookies["PREFS"] = HTTP::Cookie.new(name: "PREFS", domain: "#{CONFIG.domain}", value: URI.encode_www_form(preferences), expires: Time.utc + 2.years, - secure: secure, http_only: true) - else - env.response.cookies["PREFS"] = HTTP::Cookie.new(name: "PREFS", value: URI.encode_www_form(preferences), expires: Time.utc + 2.years, - secure: secure, http_only: true) - end + env.response.cookies["PREFS"] = Invidious::User::Cookies.prefs(CONFIG.domain, preferences) end if redirect diff --git a/src/invidious/user/cookies.cr b/src/invidious/user/cookies.cr new file mode 100644 index 00000000..99df1b07 --- /dev/null +++ b/src/invidious/user/cookies.cr @@ -0,0 +1,37 @@ +require "http/cookie" + +struct Invidious::User + module Cookies + extend self + + # Note: we use ternary operator because the two variables + # used in here are not booleans. + SECURE = (Kemal.config.ssl || CONFIG.https_only) ? true : false + + # Session ID (SID) cookie + # Parameter "domain" comes from the global config + def sid(domain : String?, sid) : HTTP::Cookie + return HTTP::Cookie.new( + name: "SID", + domain: domain, + value: sid, + expires: Time.utc + 2.years, + secure: SECURE, + http_only: true + ) + end + + # Preferences (PREFS) cookie + # Parameter "domain" comes from the global config + def prefs(domain : String?, preferences : Preferences) : HTTP::Cookie + return HTTP::Cookie.new( + name: "PREFS", + domain: domain, + value: URI.encode_www_form(preferences.to_json), + expires: Time.utc + 2.years, + secure: SECURE, + http_only: true + ) + end + end +end From 99d770be643d36fe40fbb8ac54a5fa5f692aebf0 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Sun, 6 Feb 2022 21:51:02 +0100 Subject: [PATCH 014/106] Move user pages (ECR files) to subfolder --- src/invidious/routes/account.cr | 12 ++++++------ src/invidious/routes/api/v1/authenticated.cr | 2 +- src/invidious/routes/login.cr | 8 ++++---- src/invidious/routes/preferences.cr | 4 ++-- src/invidious/routes/subscriptions.cr | 2 +- src/invidious/views/{ => user}/authorize_token.ecr | 0 src/invidious/views/{ => user}/change_password.ecr | 0 .../views/{ => user}/clear_watch_history.ecr | 0 src/invidious/views/{ => user}/data_control.ecr | 0 src/invidious/views/{ => user}/delete_account.ecr | 0 src/invidious/views/{ => user}/login.ecr | 0 src/invidious/views/{ => user}/preferences.ecr | 0 .../views/{ => user}/subscription_manager.ecr | 0 src/invidious/views/{ => user}/token_manager.ecr | 0 14 files changed, 14 insertions(+), 14 deletions(-) rename src/invidious/views/{ => user}/authorize_token.ecr (100%) rename src/invidious/views/{ => user}/change_password.ecr (100%) rename src/invidious/views/{ => user}/clear_watch_history.ecr (100%) rename src/invidious/views/{ => user}/data_control.ecr (100%) rename src/invidious/views/{ => user}/delete_account.ecr (100%) rename src/invidious/views/{ => user}/login.ecr (100%) rename src/invidious/views/{ => user}/preferences.ecr (100%) rename src/invidious/views/{ => user}/subscription_manager.ecr (100%) rename src/invidious/views/{ => user}/token_manager.ecr (100%) diff --git a/src/invidious/routes/account.cr b/src/invidious/routes/account.cr index 2be0de37..9bb73136 100644 --- a/src/invidious/routes/account.cr +++ b/src/invidious/routes/account.cr @@ -23,7 +23,7 @@ module Invidious::Routes::Account sid = sid.as(String) csrf_token = generate_response(sid, {":change_password"}, HMAC_KEY) - templated "change_password" + templated "user/change_password" end # Handle the password change (POST request) @@ -103,7 +103,7 @@ module Invidious::Routes::Account sid = sid.as(String) csrf_token = generate_response(sid, {":delete_account"}, HMAC_KEY) - templated "delete_account" + templated "user/delete_account" end # Handle the account deletion (POST request) @@ -161,7 +161,7 @@ module Invidious::Routes::Account sid = sid.as(String) csrf_token = generate_response(sid, {":clear_watch_history"}, HMAC_KEY) - templated "clear_watch_history" + templated "user/clear_watch_history" end # Handle the watch history clearing (POST request) @@ -220,7 +220,7 @@ module Invidious::Routes::Account expire = env.params.query["expire"]?.try &.to_i? - templated "authorize_token" + templated "user/authorize_token" end # Handle token authorization (POST request) @@ -268,7 +268,7 @@ module Invidious::Routes::Account else csrf_token = "" env.set "access_token", access_token - templated "authorize_token" + templated "user/authorize_token" end end @@ -291,7 +291,7 @@ module Invidious::Routes::Account user = user.as(User) tokens = Invidious::Database::SessionIDs.select_all(user.email) - templated "token_manager" + templated "user/token_manager" end # ------------------- diff --git a/src/invidious/routes/api/v1/authenticated.cr b/src/invidious/routes/api/v1/authenticated.cr index 4e9fc801..c27853ca 100644 --- a/src/invidious/routes/api/v1/authenticated.cr +++ b/src/invidious/routes/api/v1/authenticated.cr @@ -343,7 +343,7 @@ module Invidious::Routes::API::V1::Authenticated env.response.content_type = "text/html" csrf_token = generate_response(sid, {":authorize_token"}, HMAC_KEY, use_nonce: true) - return templated "authorize_token" + return templated "user/authorize_token" else env.response.content_type = "application/json" diff --git a/src/invidious/routes/login.cr b/src/invidious/routes/login.cr index 8767ec22..65b337d1 100644 --- a/src/invidious/routes/login.cr +++ b/src/invidious/routes/login.cr @@ -27,7 +27,7 @@ module Invidious::Routes::Login tfa = env.params.query["tfa"]? prompt = nil - templated "login" + templated "user/login" end def self.login(env) @@ -133,7 +133,7 @@ module Invidious::Routes::Login tfa = tfa_code captcha = {tokens: [token], question: ""} - return templated "login" + return templated "user/login" end if challenge_results[0][-1]?.try &.[5] == "INCORRECT_ANSWER_ENTERED" @@ -190,7 +190,7 @@ module Invidious::Routes::Login tfa = nil captcha = nil - return templated "login" + return templated "user/login" end tl = challenge_results[1][2] @@ -376,7 +376,7 @@ module Invidious::Routes::Login captcha = Invidious::User::Captcha.generate_text(HMAC_KEY) end - return templated "login" + return templated "user/login" end tokens = env.params.body.select { |k, _| k.match(/^token\[\d+\]$/) }.map { |_, v| v } diff --git a/src/invidious/routes/preferences.cr b/src/invidious/routes/preferences.cr index 294932eb..68d61fd1 100644 --- a/src/invidious/routes/preferences.cr +++ b/src/invidious/routes/preferences.cr @@ -8,7 +8,7 @@ module Invidious::Routes::PreferencesRoute preferences = env.get("preferences").as(Preferences) - templated "preferences" + templated "user/preferences" end def self.update(env) @@ -272,7 +272,7 @@ module Invidious::Routes::PreferencesRoute user = user.as(User) - templated "data_control" + templated "user/data_control" end def self.update_data_control(env) diff --git a/src/invidious/routes/subscriptions.cr b/src/invidious/routes/subscriptions.cr index ec8fe67b..7b1fa876 100644 --- a/src/invidious/routes/subscriptions.cr +++ b/src/invidious/routes/subscriptions.cr @@ -163,6 +163,6 @@ module Invidious::Routes::Subscriptions end end - templated "subscription_manager" + templated "user/subscription_manager" end end diff --git a/src/invidious/views/authorize_token.ecr b/src/invidious/views/user/authorize_token.ecr similarity index 100% rename from src/invidious/views/authorize_token.ecr rename to src/invidious/views/user/authorize_token.ecr diff --git a/src/invidious/views/change_password.ecr b/src/invidious/views/user/change_password.ecr similarity index 100% rename from src/invidious/views/change_password.ecr rename to src/invidious/views/user/change_password.ecr diff --git a/src/invidious/views/clear_watch_history.ecr b/src/invidious/views/user/clear_watch_history.ecr similarity index 100% rename from src/invidious/views/clear_watch_history.ecr rename to src/invidious/views/user/clear_watch_history.ecr diff --git a/src/invidious/views/data_control.ecr b/src/invidious/views/user/data_control.ecr similarity index 100% rename from src/invidious/views/data_control.ecr rename to src/invidious/views/user/data_control.ecr diff --git a/src/invidious/views/delete_account.ecr b/src/invidious/views/user/delete_account.ecr similarity index 100% rename from src/invidious/views/delete_account.ecr rename to src/invidious/views/user/delete_account.ecr diff --git a/src/invidious/views/login.ecr b/src/invidious/views/user/login.ecr similarity index 100% rename from src/invidious/views/login.ecr rename to src/invidious/views/user/login.ecr diff --git a/src/invidious/views/preferences.ecr b/src/invidious/views/user/preferences.ecr similarity index 100% rename from src/invidious/views/preferences.ecr rename to src/invidious/views/user/preferences.ecr diff --git a/src/invidious/views/subscription_manager.ecr b/src/invidious/views/user/subscription_manager.ecr similarity index 100% rename from src/invidious/views/subscription_manager.ecr rename to src/invidious/views/user/subscription_manager.ecr diff --git a/src/invidious/views/token_manager.ecr b/src/invidious/views/user/token_manager.ecr similarity index 100% rename from src/invidious/views/token_manager.ecr rename to src/invidious/views/user/token_manager.ecr From d12dff9dcfd2d85405375f6ab8282acd19b90035 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Mon, 7 Feb 2022 22:18:24 +0100 Subject: [PATCH 015/106] Use a regex to fix badly aligned captions --- src/invidious/routes/api/v1/videos.cr | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/invidious/routes/api/v1/videos.cr b/src/invidious/routes/api/v1/videos.cr index 86eb26ee..2b23d2ad 100644 --- a/src/invidious/routes/api/v1/videos.cr +++ b/src/invidious/routes/api/v1/videos.cr @@ -130,7 +130,13 @@ module Invidious::Routes::API::V1::Videos end end else + # Some captions have "align:[start/end]" and "position:[num]%" + # attributes. Those are causing issues with VideoJS, which is unable + # to properly align the captions on the video, so we remove them. + # + # See: https://github.com/iv-org/invidious/issues/2391 webvtt = YT_POOL.client &.get("#{url}&format=vtt").body + .gsub(/([0-9:.]+ --> [0-9:.]+).+/, "\\1") end if title = env.params.query["title"]? From f73aef33f013d79d59c069c9e6eb5ec1b8c610d9 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Mon, 7 Feb 2022 22:45:08 +0100 Subject: [PATCH 016/106] Add compile option to disable fetching of player dependencies --- Makefile | 3 ++- src/invidious.cr | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index ef6c4e16..a82d76b4 100644 --- a/Makefile +++ b/Makefile @@ -62,7 +62,8 @@ test: crystal spec verify: - crystal build src/invidious.cr --no-codegen --progress --stats --error-trace + crystal build src/invidious.cr -Ddont_fetch_videojs \ + --no-codegen --progress --stats --error-trace # ----------------------- diff --git a/src/invidious.cr b/src/invidious.cr index f4cae7ea..79429404 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -114,16 +114,18 @@ LOGGER = Invidious::LogHandler.new(OUTPUT, CONFIG.log_level) # Check table integrity Invidious::Database.check_integrity(CONFIG) -# Resolve player dependencies. This is done at compile time. -# -# Running the script by itself would show some colorful feedback while this doesn't. -# Perhaps we should just move the script to runtime in order to get that feedback? +{% unless flag?(:dont_fetch_videojs) %} + # Resolve player dependencies. This is done at compile time. + # + # Running the script by itself would show some colorful feedback while this doesn't. + # Perhaps we should just move the script to runtime in order to get that feedback? -{% puts "\nChecking player dependencies...\n" %} -{% if flag?(:minified_player_dependencies) %} - {% puts run("../scripts/fetch-player-dependencies.cr", "--minified").stringify %} -{% else %} - {% puts run("../scripts/fetch-player-dependencies.cr").stringify %} + {% puts "\nChecking player dependencies...\n" %} + {% if flag?(:minified_player_dependencies) %} + {% puts run("../scripts/fetch-player-dependencies.cr", "--minified").stringify %} + {% else %} + {% puts run("../scripts/fetch-player-dependencies.cr").stringify %} + {% end %} {% end %} # Start jobs From 3c882cff6e31d8dfc680ce3fe4dce73ba8946817 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Tue, 8 Feb 2022 00:01:53 +0100 Subject: [PATCH 017/106] player shortcuts: ignore numpad --- assets/js/player.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/assets/js/player.js b/assets/js/player.js index a5ea08ec..d7dd8bf8 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -612,6 +612,9 @@ window.addEventListener('keydown', e => { case '7': case '8': case '9': + // Ignore numpad numbers + if (code > 57) break; + const percent = (code - 48) * 10; action = set_time_percent.bind(this, percent); break; From b344e1aadbe301c343e8c186d34320729988a039 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Tue, 8 Feb 2022 00:04:02 +0100 Subject: [PATCH 018/106] handlers.js: fix TypeError on document.activeElement.type --- assets/js/handlers.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/js/handlers.js b/assets/js/handlers.js index d3957b89..02175957 100644 --- a/assets/js/handlers.js +++ b/assets/js/handlers.js @@ -150,13 +150,13 @@ // Ignore shortcuts if any text input is focused let focused_tag = document.activeElement.tagName.toLowerCase(); - let focused_type = document.activeElement.type.toLowerCase(); - let allowed = /^(button|checkbox|file|radio|submit)$/; + const allowed = /^(button|checkbox|file|radio|submit)$/; - if (focused_tag === "textarea" || - (focused_tag === "input" && !focused_type.match(allowed)) - ) - return; + if (focused_tag === "textarea") return; + if (focused_tag === "input") { + let focused_type = document.activeElement.type.toLowerCase(); + if (!focused_type.match(allowed)) return; + } // Focus search bar on '/' if (event.key == "/") { From 53d349a648246d50ae65295403d2546d158f95fd Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Tue, 8 Feb 2022 00:08:52 +0100 Subject: [PATCH 019/106] Inline a few JS functions Helps sending less bytes to the client. --- assets/js/player.js | 127 +++++++++++--------------------------------- 1 file changed, 30 insertions(+), 97 deletions(-) diff --git a/assets/js/player.js b/assets/js/player.js index d7dd8bf8..81a27009 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -60,29 +60,19 @@ videojs.Vhs.xhr.beforeRequest = function(options) { var player = videojs('player', options); const storage = (() => { - try { - if (localStorage.length !== -1) { - return localStorage; - } - } catch (e) { - console.info('No storage available: ' + e); - } + try { if (localStorage.length !== -1) return localStorage; } + catch (e) { console.info('No storage available: ' + e); } + return undefined; })(); if (location.pathname.startsWith('/embed/')) { + var overlay_content = '

' + player_data.title + '

'; player.overlay({ - overlays: [{ - start: 'loadstart', - content: '

' + player_data.title + '

', - end: 'playing', - align: 'top' - }, { - start: 'pause', - content: '

' + player_data.title + '

', - end: 'playing', - align: 'top' - }] + overlays: [ + { start: 'loadstart', content: overlay_content, end: 'playing', align: 'top'}, + { start: 'pause', content: overlay_content, end: 'playing', align: 'top'} + ] }); } @@ -99,9 +89,7 @@ if (isMobile()) { buttons = ["playToggle", "volumePanel", "captionsButton"]; - if (video_data.params.quality !== 'dash') { - buttons.push("qualitySelector") - } + if (video_data.params.quality !== 'dash') buttons.push("qualitySelector") // Create new control bar object for operation buttons const ControlBar = videojs.getComponent("controlBar"); @@ -146,16 +134,12 @@ player.on('error', function (event) { player.load(); - if (currentTime > 0.5) { - currentTime -= 0.5; - } + if (currentTime > 0.5) currentTime -= 0.5; player.currentTime(currentTime); player.playbackRate(playbackRate); - if (!paused) { - player.play(); - } + if (!paused) player.play(); }, 5000); } }); @@ -183,13 +167,8 @@ if (video_data.params.video_start > 0 || video_data.params.video_end > 0) { player.markers({ onMarkerReached: function (marker) { - if (marker.text === 'End') { - if (player.loop()) { - player.markers.prev('Start'); - } else { - player.pause(); - } - } + if (marker.text === 'End') + player.loop() ? player.markers.prev('Start') : player.pause(); }, markers: markers }); @@ -217,9 +196,7 @@ if (video_data.params.save_player_pos) { const remeberedTime = get_video_time(); let lastUpdated = 0; - if(!hasTimeParam) { - set_seconds_after_start(remeberedTime); - } + if(!hasTimeParam) set_seconds_after_start(remeberedTime); const updateTime = () => { const raw = player.currentTime(); @@ -233,9 +210,7 @@ if (video_data.params.save_player_pos) { player.on("timeupdate", updateTime); } -else { - remove_all_video_times(); -} +else remove_all_video_times(); if (video_data.params.autoplay) { var bpb = player.getChild('bigPlayButton'); @@ -433,26 +408,10 @@ function set_time_percent(percent) { player.currentTime(newTime); } -function play() { - player.play(); -} - -function pause() { - player.pause(); -} - -function stop() { - player.pause(); - player.currentTime(0); -} - -function toggle_play() { - if (player.paused()) { - play(); - } else { - pause(); - } -} +function play() { player.play(); } +function pause() { player.pause(); } +function stop() { player.pause(); player.currentTime(0); } +function toggle_play() { player.paused() ? play() : pause(); } const toggle_captions = (function () { let toggledTrack = null; @@ -490,9 +449,7 @@ const toggle_captions = (function () { const tracks = player.textTracks(); for (let i = 0; i < tracks.length; i++) { const track = tracks[i]; - if (track.kind !== 'captions') { - continue; - } + if (track.kind !== 'captions') continue; if (fallbackCaptionsTrack === null) { fallbackCaptionsTrack = track; @@ -513,11 +470,7 @@ const toggle_captions = (function () { })(); function toggle_fullscreen() { - if (player.isFullscreen()) { - player.exitFullscreen(); - } else { - player.requestFullscreen(); - } + player.isFullscreen() ? player.exitFullscreen() : player.requestFullscreen(); } function increase_playback_rate(steps) { @@ -560,27 +513,15 @@ window.addEventListener('keydown', e => { action = toggle_play; break; - case 'MediaPlay': - action = play; - break; - - case 'MediaPause': - action = pause; - break; - - case 'MediaStop': - action = stop; - break; + case 'MediaPlay': action = play; break; + case 'MediaPause': action = pause; break; + case 'MediaStop': action = stop; break; case 'ArrowUp': - if (isPlayerFocused) { - action = increase_volume.bind(this, 0.1); - } + if (isPlayerFocused) action = increase_volume.bind(this, 0.1); break; case 'ArrowDown': - if (isPlayerFocused) { - action = increase_volume.bind(this, -0.1); - } + if (isPlayerFocused) action = increase_volume.bind(this, -0.1); break; case 'm': @@ -619,12 +560,8 @@ window.addEventListener('keydown', e => { action = set_time_percent.bind(this, percent); break; - case 'c': - action = toggle_captions; - break; - case 'f': - action = toggle_fullscreen; - break; + case 'c': action = toggle_captions; break; + case 'f': action = toggle_fullscreen; break; case 'N': case 'MediaTrackNext': @@ -642,12 +579,8 @@ window.addEventListener('keydown', e => { // TODO: Add support for previous-frame-stepping. break; - case '>': - action = increase_playback_rate.bind(this, 1); - break; - case '<': - action = increase_playback_rate.bind(this, -1); - break; + case '>': action = increase_playback_rate.bind(this, 1); break; + case '<': action = increase_playback_rate.bind(this, -1); break; default: console.info('Unhandled key down event: %s:', decoratedKey, e); From 76cc8ac66b88bb7ac632eee2e06d2557ec086151 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Tue, 8 Feb 2022 01:48:44 +0100 Subject: [PATCH 020/106] HTML escape error message --- src/invidious/helpers/errors.cr | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/invidious/helpers/errors.cr b/src/invidious/helpers/errors.cr index 3acbac84..6155e561 100644 --- a/src/invidious/helpers/errors.cr +++ b/src/invidious/helpers/errors.cr @@ -38,12 +38,15 @@ def error_template_helper(env : HTTP::Server::Context, status_code : Int32, exce issue_title = "#{exception.message} (#{exception.class})" - issue_template = %(Title: `#{issue_title}`) - issue_template += %(\nDate: `#{Time::Format::ISO_8601_DATE_TIME.format(Time.utc)}`) - issue_template += %(\nRoute: `#{env.request.resource}`) - issue_template += %(\nVersion: `#{SOFTWARE["version"]} @ #{SOFTWARE["branch"]}`) - # issue_template += github_details("Preferences", env.get("preferences").as(Preferences).to_pretty_json) - issue_template += github_details("Backtrace", exception.inspect_with_backtrace) + issue_template = <<-TEXT + Title: `#{HTML.escape(issue_title)}` + Date: `#{Time::Format::ISO_8601_DATE_TIME.format(Time.utc)}` + Route: `#{HTML.escape(env.request.resource)}` + Version: `#{SOFTWARE["version"]} @ #{SOFTWARE["branch"]}` + + TEXT + + issue_template += github_details("Backtrace", HTML.escape(exception.inspect_with_backtrace)) # URLs for the error message below url_faq = "https://github.com/iv-org/documentation/blob/master/FAQ.md" From 8642c66710f93eea1ae120bc2d7fdd49eddfa010 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Tue, 8 Feb 2022 01:54:09 +0100 Subject: [PATCH 021/106] Mention that VR videos option require WebGL --- locales/en-US.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locales/en-US.json b/locales/en-US.json index f733f7db..83d06cce 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -94,7 +94,7 @@ "preferences_related_videos_label": "Show related videos: ", "preferences_annotations_label": "Show annotations by default: ", "preferences_extend_desc_label": "Automatically extend video description: ", - "preferences_vr_mode_label": "Interactive 360 degree videos: ", + "preferences_vr_mode_label": "Interactive 360 degree videos (requires WebGL): ", "preferences_category_visual": "Visual preferences", "preferences_region_label": "Content country: ", "preferences_player_style_label": "Player style: ", From febd785428809f84ba3ab6a0d311af40d7f30a83 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Tue, 8 Feb 2022 02:13:14 +0100 Subject: [PATCH 022/106] Add missing subtitle languages --- locales/en-US.json | 23 +++++++++++++++++++++++ src/invidious/videos.cr | 23 +++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/locales/en-US.json b/locales/en-US.json index 83d06cce..c7f6e178 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -236,6 +236,8 @@ "No such user": "No such user", "Token is expired, please try again": "Token is expired, please try again", "English": "English", + "English (United Kingdom)": "English (United Kingdom)", + "English (United States)": "English (United States)", "English (auto-generated)": "English (auto-generated)", "Afrikaans": "Afrikaans", "Albanian": "Albanian", @@ -249,23 +251,31 @@ "Bosnian": "Bosnian", "Bulgarian": "Bulgarian", "Burmese": "Burmese", + "Cantonese (Hong Kong)": "Cantonese (Hong Kong)", "Catalan": "Catalan", "Cebuano": "Cebuano", + "Chinese": "Chinese", + "Chinese (China)": "Chinese (China)", + "Chinese (Hong Kong)": "Chinese (Hong Kong)", "Chinese (Simplified)": "Chinese (Simplified)", + "Chinese (Taiwan)": "Chinese (Taiwan)", "Chinese (Traditional)": "Chinese (Traditional)", "Corsican": "Corsican", "Croatian": "Croatian", "Czech": "Czech", "Danish": "Danish", "Dutch": "Dutch", + "Dutch (auto-generated)": "Dutch (auto-generated)", "Esperanto": "Esperanto", "Estonian": "Estonian", "Filipino": "Filipino", "Finnish": "Finnish", "French": "French", + "French (auto-generated)": "French (auto-generated)", "Galician": "Galician", "Georgian": "Georgian", "German": "German", + "German (auto-generated)": "German (auto-generated)", "Greek": "Greek", "Gujarati": "Gujarati", "Haitian Creole": "Haitian Creole", @@ -278,14 +288,19 @@ "Icelandic": "Icelandic", "Igbo": "Igbo", "Indonesian": "Indonesian", + "Indonesian (auto-generated)": "Indonesian (auto-generated)", + "Interlingue": "Interlingue", "Irish": "Irish", "Italian": "Italian", + "Italian (auto-generated)": "Italian (auto-generated)", "Japanese": "Japanese", + "Japanese (auto-generated)": "Japanese (auto-generated)", "Javanese": "Javanese", "Kannada": "Kannada", "Kazakh": "Kazakh", "Khmer": "Khmer", "Korean": "Korean", + "Korean (auto-generated)": "Korean (auto-generated)", "Kurdish": "Kurdish", "Kyrgyz": "Kyrgyz", "Lao": "Lao", @@ -308,9 +323,12 @@ "Persian": "Persian", "Polish": "Polish", "Portuguese": "Portuguese", + "Portuguese (auto-generated)": "Portuguese (auto-generated)", + "Portuguese (Brazil)": "Portuguese (Brazil)", "Punjabi": "Punjabi", "Romanian": "Romanian", "Russian": "Russian", + "Russian (auto-generated)": "Russian (auto-generated)", "Samoan": "Samoan", "Scottish Gaelic": "Scottish Gaelic", "Serbian": "Serbian", @@ -322,7 +340,10 @@ "Somali": "Somali", "Southern Sotho": "Southern Sotho", "Spanish": "Spanish", + "Spanish (auto-generated)": "Spanish (auto-generated)", "Spanish (Latin America)": "Spanish (Latin America)", + "Spanish (Mexico)": "Spanish (Mexico)", + "Spanish (Spain)": "Spanish (Spain)", "Sundanese": "Sundanese", "Swahili": "Swahili", "Swedish": "Swedish", @@ -331,10 +352,12 @@ "Telugu": "Telugu", "Thai": "Thai", "Turkish": "Turkish", + "Turkish (auto-generated)": "Turkish (auto-generated)", "Ukrainian": "Ukrainian", "Urdu": "Urdu", "Uzbek": "Uzbek", "Vietnamese": "Vietnamese", + "Vietnamese (auto-generated)": "Vietnamese (auto-generated)", "Welsh": "Welsh", "Western Frisian": "Western Frisian", "Xhosa": "Xhosa", diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index 446e8e03..335f6b60 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -2,6 +2,8 @@ CAPTION_LANGUAGES = { "", "English", "English (auto-generated)", + "English (United Kingdom)", + "English (United States)", "Afrikaans", "Albanian", "Amharic", @@ -14,23 +16,31 @@ CAPTION_LANGUAGES = { "Bosnian", "Bulgarian", "Burmese", + "Cantonese (Hong Kong)", "Catalan", "Cebuano", + "Chinese", + "Chinese (China)", + "Chinese (Hong Kong)", "Chinese (Simplified)", + "Chinese (Taiwan)", "Chinese (Traditional)", "Corsican", "Croatian", "Czech", "Danish", "Dutch", + "Dutch (auto-generated)", "Esperanto", "Estonian", "Filipino", "Finnish", "French", + "French (auto-generated)", "Galician", "Georgian", "German", + "German (auto-generated)", "Greek", "Gujarati", "Haitian Creole", @@ -43,14 +53,19 @@ CAPTION_LANGUAGES = { "Icelandic", "Igbo", "Indonesian", + "Indonesian (auto-generated)", + "Interlingue", "Irish", "Italian", + "Italian (auto-generated)", "Japanese", + "Japanese (auto-generated)", "Javanese", "Kannada", "Kazakh", "Khmer", "Korean", + "Korean (auto-generated)", "Kurdish", "Kyrgyz", "Lao", @@ -73,9 +88,12 @@ CAPTION_LANGUAGES = { "Persian", "Polish", "Portuguese", + "Portuguese (auto-generated)", + "Portuguese (Brazil)", "Punjabi", "Romanian", "Russian", + "Russian (auto-generated)", "Samoan", "Scottish Gaelic", "Serbian", @@ -87,7 +105,10 @@ CAPTION_LANGUAGES = { "Somali", "Southern Sotho", "Spanish", + "Spanish (auto-generated)", "Spanish (Latin America)", + "Spanish (Mexico)", + "Spanish (Spain)", "Sundanese", "Swahili", "Swedish", @@ -96,10 +117,12 @@ CAPTION_LANGUAGES = { "Telugu", "Thai", "Turkish", + "Turkish (auto-generated)", "Ukrainian", "Urdu", "Uzbek", "Vietnamese", + "Vietnamese (auto-generated)", "Welsh", "Western Frisian", "Xhosa", From 4f4b19a962999ad191b1312e53aa44c8180d22fa Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Tue, 8 Feb 2022 02:41:08 +0100 Subject: [PATCH 023/106] embed page: fix typo in videojs-overlay script URL --- src/invidious/views/embed.ecr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/invidious/views/embed.ecr b/src/invidious/views/embed.ecr index cd0fd0d5..27a8e266 100644 --- a/src/invidious/views/embed.ecr +++ b/src/invidious/views/embed.ecr @@ -7,7 +7,7 @@ <%= rendered "components/player_sources" %> - + <%= HTML.escape(video.title) %> - Invidious From 492d1144e0dff85bc58071037ef0980c4027cc69 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Tue, 8 Feb 2022 03:05:49 +0100 Subject: [PATCH 024/106] Apply changes from code review --- Makefile | 2 +- src/invidious.cr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index a82d76b4..7f56d722 100644 --- a/Makefile +++ b/Makefile @@ -62,7 +62,7 @@ test: crystal spec verify: - crystal build src/invidious.cr -Ddont_fetch_videojs \ + crystal build src/invidious.cr -Dskip_videojs_download \ --no-codegen --progress --stats --error-trace diff --git a/src/invidious.cr b/src/invidious.cr index 79429404..1ff70905 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -114,7 +114,7 @@ LOGGER = Invidious::LogHandler.new(OUTPUT, CONFIG.log_level) # Check table integrity Invidious::Database.check_integrity(CONFIG) -{% unless flag?(:dont_fetch_videojs) %} +{% if !flag?(:skip_videojs_download) %} # Resolve player dependencies. This is done at compile time. # # Running the script by itself would show some colorful feedback while this doesn't. From ec55b905cb8b0b65deeb21a89751b17160676159 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Wed, 9 Feb 2022 01:36:17 +0100 Subject: [PATCH 025/106] Fix empty error page on BrokenTubeException --- src/invidious/exceptions.cr | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/invidious/exceptions.cr b/src/invidious/exceptions.cr index 391a574d..490d98cd 100644 --- a/src/invidious/exceptions.cr +++ b/src/invidious/exceptions.cr @@ -1,8 +1,12 @@ # Exception used to hold the name of the missing item # Should be used in all parsing functions -class BrokenTubeException < InfoException +class BrokenTubeException < Exception getter element : String def initialize(@element) end + + def message + return "Missing JSON element \"#{@element}\"" + end end From 5a349ae88ba896829f4b87870c13b66307e2e1c6 Mon Sep 17 00:00:00 2001 From: matthewmcgarvey Date: Wed, 9 Feb 2022 23:38:24 -0600 Subject: [PATCH 026/106] Update wording on data control page for clarity --- src/invidious/views/data_control.ecr | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/invidious/views/data_control.ecr b/src/invidious/views/data_control.ecr index 74ccc06c..1a120065 100644 --- a/src/invidious/views/data_control.ecr +++ b/src/invidious/views/data_control.ecr @@ -8,14 +8,14 @@ <%= translate(locale, "Import") %>
- +
From 8faf8b8e576debe6b26fb5b22634f43b9a97296b Mon Sep 17 00:00:00 2001 From: matthewmcgarvey Date: Thu, 10 Feb 2022 11:29:00 -0600 Subject: [PATCH 027/106] Update en-US translations instead of translation keys for data control --- locales/en-US.json | 6 +++--- src/invidious/views/data_control.ecr | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/locales/en-US.json b/locales/en-US.json index c7f6e178..c924c8aa 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -31,15 +31,15 @@ "No": "No", "Import and Export Data": "Import and Export Data", "Import": "Import", - "Import Invidious data": "Import Invidious data", - "Import YouTube subscriptions": "Import YouTube subscriptions", + "Import Invidious data": "Import Invidious JSON data", + "Import YouTube subscriptions": "Import YouTube/OPML subscriptions", "Import FreeTube subscriptions (.db)": "Import FreeTube subscriptions (.db)", "Import NewPipe subscriptions (.json)": "Import NewPipe subscriptions (.json)", "Import NewPipe data (.zip)": "Import NewPipe data (.zip)", "Export": "Export", "Export subscriptions as OPML": "Export subscriptions as OPML", "Export subscriptions as OPML (for NewPipe & FreeTube)": "Export subscriptions as OPML (for NewPipe & FreeTube)", - "Export data as JSON": "Export data as JSON", + "Export data as JSON": "Export Invidious data as JSON", "Delete account?": "Delete account?", "History": "History", "An alternative front-end to YouTube": "An alternative front-end to YouTube", diff --git a/src/invidious/views/data_control.ecr b/src/invidious/views/data_control.ecr index 1a120065..74ccc06c 100644 --- a/src/invidious/views/data_control.ecr +++ b/src/invidious/views/data_control.ecr @@ -8,14 +8,14 @@ <%= translate(locale, "Import") %>
- +
From 72fce387db874f65bf7f87c6b896bf43ec904793 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 10 Feb 2022 18:38:35 +0100 Subject: [PATCH 028/106] Update Spanish translation Co-authored-by: Jorge Maldonado Ventura --- locales/es.json | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/locales/es.json b/locales/es.json index d89b5c08..96fd4fdb 100644 --- a/locales/es.json +++ b/locales/es.json @@ -66,7 +66,7 @@ "preferences_related_videos_label": "¿Mostrar vídeos relacionados? ", "preferences_annotations_label": "¿Mostrar anotaciones por defecto? ", "preferences_extend_desc_label": "Extender automáticamente la descripción del vídeo: ", - "preferences_vr_mode_label": "Vídeos interactivos de 360 grados: ", + "preferences_vr_mode_label": "Vídeos interactivos de 360 grados (necesita WebGL): ", "preferences_category_visual": "Preferencias visuales", "preferences_player_style_label": "Estilo de reproductor: ", "Dark mode: ": "Modo oscuro: ", @@ -199,7 +199,7 @@ "No such user": "Usuario no válido", "Token is expired, please try again": "El símbolo ha caducado, inténtelo de nuevo", "English": "Inglés", - "English (auto-generated)": "Inglés (autogenerado)", + "English (auto-generated)": "Inglés (generados automáticamente)", "Afrikaans": "Afrikáans", "Albanian": "Albanés", "Amharic": "Amárico", @@ -435,5 +435,28 @@ "crash_page_search_issue": "buscado problemas existentes en Github", "crash_page_you_found_a_bug": "¡Parece que has encontrado un error en Invidious!", "crash_page_refresh": "probado a recargar la página", - "crash_page_report_issue": "Si nada de lo anterior ha sido de ayuda, por favor, abre una nueva incidencia en GitHub (preferiblemente en inglés) e incluye el siguiente texto en tu mensaje (NO traduzcas este texto):" + "crash_page_report_issue": "Si nada de lo anterior ha sido de ayuda, por favor, abre una nueva incidencia en GitHub (preferiblemente en inglés) e incluye el siguiente texto en tu mensaje (NO traduzcas este texto):", + "English (United States)": "Inglés (Estados Unidos)", + "Cantonese (Hong Kong)": "Cantonés (Hong Kong)", + "Dutch (auto-generated)": "Neerlandés (generados automáticamente)", + "French (auto-generated)": "Francés (generados automáticamente)", + "Interlingue": "Occidental", + "Japanese (auto-generated)": "Japonés (generados automáticamente)", + "Russian (auto-generated)": "Ruso (generados automáticamente)", + "Spanish (Spain)": "Español (España)", + "Vietnamese (auto-generated)": "Vietnamita (generados automáticamente)", + "English (United Kingdom)": "Inglés (Reino Unido)", + "Chinese (Taiwan)": "Chino (Taiwán)", + "German (auto-generated)": "Alemán (generados automáticamente)", + "Italian (auto-generated)": "Italiano (generados automáticamente)", + "Turkish (auto-generated)": "Turco (generados automáticamente)", + "Portuguese (Brazil)": "Portugués (Brasil)", + "Indonesian (auto-generated)": "Indonesio (generados automáticamente)", + "Portuguese (auto-generated)": "Portugués (generados automáticamente)", + "Chinese": "Chino", + "Chinese (Hong Kong)": "Chino (Hong Kong)", + "Chinese (China)": "Chino (China)", + "Korean (auto-generated)": "Coreano (generados automáticamente)", + "Spanish (Mexico)": "Español (Méjico)", + "Spanish (auto-generated)": "Español (generados automáticamente)" } From fa044a2971d0c0452747f970fbc03fe3fe64bd60 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 10 Feb 2022 18:38:35 +0100 Subject: [PATCH 029/106] Update Hungarian translation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: István Nyitrai --- locales/hu-HU.json | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/locales/hu-HU.json b/locales/hu-HU.json index 60285d94..d1948a47 100644 --- a/locales/hu-HU.json +++ b/locales/hu-HU.json @@ -76,7 +76,7 @@ "preferences_related_videos_label": "Hasonló videók ajánlása: ", "preferences_annotations_label": "Szövegmagyarázat alapértelmezett mutatása: ", "preferences_extend_desc_label": "A videó leírása automatikusan látható: ", - "preferences_vr_mode_label": "Interaktív, 360°-os videók ", + "preferences_vr_mode_label": "Interaktív 360 fokos videók (WebGL szükséges): ", "preferences_category_visual": "Kinézet, elrendezés és régió beállításai", "preferences_player_style_label": "Lejátszó kinézete: ", "Dark mode: ": "Elsötétített mód: ", @@ -437,5 +437,28 @@ "crash_page_search_issue": "járj utána a már meglévő issue-knak a GitHubon", "crash_page_switch_instance": "válts át másik Invidious-oldalra", "crash_page_refresh": "töltsd újra az oldalt", - "crash_page_report_issue": "Ha a fentiek után nem jutottál eredményre, akkor nyiss egy új issue-t a GitHubon (lehetőleg angol nyelven írj) és másold be pontosan a lenti szöveget (ezt nem kell lefordítani):" + "crash_page_report_issue": "Ha a fentiek után nem jutottál eredményre, akkor nyiss egy új issue-t a GitHubon (lehetőleg angol nyelven írj) és másold be pontosan a lenti szöveget (ezt nem kell lefordítani):", + "Cantonese (Hong Kong)": "kantoni (Hongkong)", + "Chinese": "kínai", + "Chinese (China)": "kínai (Kína)", + "Chinese (Hong Kong)": "kínai (Hongkong)", + "Chinese (Taiwan)": "kínai (Tajvan)", + "German (auto-generated)": "német (automatikusan generált)", + "Interlingue": "interlingva", + "Japanese (auto-generated)": "japán (automatikusan generált)", + "Korean (auto-generated)": "koreai (automatikusan generált)", + "Portuguese (Brazil)": "portugál (Brazília)", + "Russian (auto-generated)": "orosz (automatikusan generált)", + "Spanish (auto-generated)": "spanyol (automatikusan generált)", + "Spanish (Mexico)": "spanyol (Mexikó)", + "Spanish (Spain)": "spanyol (Spanyolország)", + "English (United States)": "angol (Egyesült Államok)", + "Portuguese (auto-generated)": "portugál (automatikusan generált)", + "Turkish (auto-generated)": "török (automatikusan generált)", + "English (United Kingdom)": "angol (Egyesült Királyság)", + "Indonesian (auto-generated)": "indonéz (automatikusan generált)", + "Italian (auto-generated)": "olasz (automatikusan generált)", + "Dutch (auto-generated)": "holland (automatikusan generált)", + "French (auto-generated)": "francia (automatikusan generált)", + "Vietnamese (auto-generated)": "vietnámi (automatikusan generált)" } From d6d7d209c1f5f483020f830989e65f3edd86d7bf Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 10 Feb 2022 18:38:35 +0100 Subject: [PATCH 030/106] Update Turkish translation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Oğuz Ersen --- locales/tr.json | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/locales/tr.json b/locales/tr.json index 5c3102c5..fba72adf 100644 --- a/locales/tr.json +++ b/locales/tr.json @@ -66,7 +66,7 @@ "preferences_related_videos_label": "İlgili videoları göster: ", "preferences_annotations_label": "Öntanımlı olarak ek açıklamaları göster: ", "preferences_extend_desc_label": "Video açıklamasını otomatik olarak genişlet: ", - "preferences_vr_mode_label": "Etkileşimli 360 derece videolar: ", + "preferences_vr_mode_label": "Etkileşimli 360 derece videolar (WebGL gerektirir): ", "preferences_category_visual": "Görsel tercihler", "preferences_player_style_label": "Oynatıcı biçimi: ", "Dark mode: ": "Karanlık mod: ", @@ -437,5 +437,28 @@ "crash_page_switch_instance": "başka bir örnek kullanmaya çalıştınız", "crash_page_read_the_faq": "Sık Sorulan Soruları (SSS) okudunuz", "crash_page_search_issue": "Github'daki sorunlarda aradınız", - "crash_page_report_issue": "Yukarıdakilerin hiçbiri yardımcı olmadıysa, lütfen GitHub'da yeni bir sorun açın (tercihen İngilizce) ve mesajınıza aşağıdaki metni ekleyin (bu metni ÇEVİRMEYİN):" + "crash_page_report_issue": "Yukarıdakilerin hiçbiri yardımcı olmadıysa, lütfen GitHub'da yeni bir sorun açın (tercihen İngilizce) ve mesajınıza aşağıdaki metni ekleyin (bu metni ÇEVİRMEYİN):", + "English (United Kingdom)": "İngilizce (Birleşik Krallık)", + "Chinese": "Çince", + "Interlingue": "İnterlingue", + "Italian (auto-generated)": "İtalyanca (otomatik oluşturuldu)", + "Japanese (auto-generated)": "Japonca (otomatik oluşturuldu)", + "Portuguese (Brazil)": "Portekizce (Brezilya)", + "Russian (auto-generated)": "Rusça (otomatik oluşturuldu)", + "Spanish (auto-generated)": "İspanyolca (otomatik oluşturuldu)", + "Spanish (Mexico)": "İspanyolca (Meksika)", + "English (United States)": "İngilizce (ABD)", + "Cantonese (Hong Kong)": "Kantonca (Hong Kong)", + "Chinese (Taiwan)": "Çince (Tayvan)", + "Dutch (auto-generated)": "Felemenkçe (otomatik oluşturuldu)", + "Indonesian (auto-generated)": "Endonezyaca (otomatik oluşturuldu)", + "Chinese (Hong Kong)": "Çince (Hong Kong)", + "French (auto-generated)": "Fransızca (otomatik oluşturuldu)", + "Korean (auto-generated)": "Korece (otomatik oluşturuldu)", + "Turkish (auto-generated)": "Türkçe (otomatik oluşturuldu)", + "Chinese (China)": "Çince (Çin)", + "German (auto-generated)": "Almanca (otomatik oluşturuldu)", + "Portuguese (auto-generated)": "Portekizce (otomatik oluşturuldu)", + "Spanish (Spain)": "İspanyolca (İspanya)", + "Vietnamese (auto-generated)": "Vietnamca (otomatik oluşturuldu)" } From 03fe8d17169e89c3911a5bdc66f286b3fb6ba029 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 10 Feb 2022 18:38:35 +0100 Subject: [PATCH 031/106] Update Chinese (Simplified) translation Co-authored-by: Eric --- locales/zh-CN.json | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/locales/zh-CN.json b/locales/zh-CN.json index 521545bc..0e277fc2 100644 --- a/locales/zh-CN.json +++ b/locales/zh-CN.json @@ -71,7 +71,7 @@ "preferences_related_videos_label": "是否显示相关视频: ", "preferences_annotations_label": "是否默认显示视频注释: ", "preferences_extend_desc_label": "自动展开视频描述: ", - "preferences_vr_mode_label": "互动式 360 度视频: ", + "preferences_vr_mode_label": "互动式 360 度视频 (需要 WebGL): ", "preferences_category_visual": "视觉选项", "preferences_player_style_label": "播放器样式: ", "Dark mode: ": "深色模式: ", @@ -421,5 +421,28 @@ "purchased": "已购买", "360": "360°", "none": "无", - "preferences_save_player_pos_label": "保存播放位置: " + "preferences_save_player_pos_label": "保存播放位置: ", + "Spanish (Mexico)": "西班牙语 (墨西哥)", + "Portuguese (auto-generated)": "葡萄牙语 (自动生成)", + "Portuguese (Brazil)": "葡萄牙语 (巴西)", + "English (United Kingdom)": "英语 (英国)", + "English (United States)": "英语 (美国)", + "Chinese": "中文", + "Chinese (China)": "中文 (中国)", + "Chinese (Hong Kong)": "中文 (中国香港)", + "Chinese (Taiwan)": "中文 (中国台湾)", + "German (auto-generated)": "德语 (自动生成)", + "Indonesian (auto-generated)": "印尼语 (自动生成)", + "Interlingue": "国际语", + "Italian (auto-generated)": "意大利语 (自动生成)", + "Japanese (auto-generated)": "日语 (自动生成)", + "Korean (auto-generated)": "韩语 (自动生成)", + "Russian (auto-generated)": "俄语 (自动生成)", + "Spanish (auto-generated)": "西班牙语 (自动生成)", + "Vietnamese (auto-generated)": "越南语 (自动生成)", + "Cantonese (Hong Kong)": "粤语 (中国香港)", + "Dutch (auto-generated)": "荷兰语 (自动生成)", + "French (auto-generated)": "法语 (自动生成)", + "Turkish (auto-generated)": "土耳其语 (自动生成)", + "Spanish (Spain)": "西班牙语 (西班牙)" } From 4e55d9937c7c39d0240510053f2c2064c915582f Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 10 Feb 2022 18:38:35 +0100 Subject: [PATCH 032/106] Update Chinese (Traditional) translation Co-authored-by: Jeff Huang --- locales/zh-TW.json | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/locales/zh-TW.json b/locales/zh-TW.json index 8c9133c6..fc18eb7e 100644 --- a/locales/zh-TW.json +++ b/locales/zh-TW.json @@ -71,7 +71,7 @@ "preferences_related_videos_label": "顯示相關的影片: ", "preferences_annotations_label": "預設顯示註釋: ", "preferences_extend_desc_label": "自動展開影片描述: ", - "preferences_vr_mode_label": "互動式 360 度影片: ", + "preferences_vr_mode_label": "互動式 360 度影片(需要 WebGL): ", "preferences_category_visual": "視覺偏好設定", "preferences_player_style_label": "播放器樣式: ", "Dark mode: ": "深色模式: ", @@ -421,5 +421,28 @@ "crash_page_read_the_faq": "閱讀常見問題解答 (FAQ)", "crash_page_search_issue": "搜尋 GitHub 上既有的問題", "crash_page_report_issue": "若以上的動作都沒有幫到忙,請在 GitHub 上開啟新的議題(請盡量使用英文)並在您的訊息中包含以下文字(不要翻譯文字):", - "crash_page_before_reporting": "在回報臭蟲之前,請確保您有:" + "crash_page_before_reporting": "在回報臭蟲之前,請確保您有:", + "English (United Kingdom)": "英文(英國)", + "English (United States)": "英文(美國)", + "Cantonese (Hong Kong)": "粵語(香港)", + "Chinese": "中文", + "Chinese (China)": "中文(中國)", + "Chinese (Taiwan)": "中文(台灣)", + "Dutch (auto-generated)": "荷蘭語(自動產生)", + "German (auto-generated)": "德語(自動產生)", + "Korean (auto-generated)": "韓語(自動產生)", + "Russian (auto-generated)": "俄語(自動產生)", + "Spanish (auto-generated)": "西班牙語(自動產生)", + "Spanish (Mexico)": "西班牙語(墨西哥)", + "Spanish (Spain)": "西班牙語(西班牙)", + "Turkish (auto-generated)": "土耳其語(自動產生)", + "French (auto-generated)": "法語(自動產生)", + "Vietnamese (auto-generated)": "越南語(自動產生)", + "Interlingue": "西方國際語", + "Chinese (Hong Kong)": "中文(香港)", + "Italian (auto-generated)": "義大利語(自動產生)", + "Indonesian (auto-generated)": "印尼語(自動產生)", + "Portuguese (Brazil)": "葡萄牙語(巴西)", + "Japanese (auto-generated)": "日語(自動產生)", + "Portuguese (auto-generated)": "葡萄牙語(自動產生)" } From 3cfc5c164d48f5a1c7f48446d5eaa57b56ae1703 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 10 Feb 2022 18:38:36 +0100 Subject: [PATCH 033/106] Update Arabic translation Co-authored-by: Hosted Weblate Co-authored-by: Mohammed Anas <6daf084a-8eaf-40fb-86c7-8500077c3b69@anonaddy.me> --- locales/ar.json | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/locales/ar.json b/locales/ar.json index c7220be6..bca37eaf 100644 --- a/locales/ar.json +++ b/locales/ar.json @@ -399,5 +399,23 @@ "download_subtitles": "ترجمات - 'x' (.vtt)", "invidious": "الخيالي", "preferences_save_player_pos_label": "احفظ وقت الفيديو الحالي: ", - "crash_page_you_found_a_bug": "يبدو أنك قد وجدت خطأً برمجيًّا في Invidious!" + "crash_page_you_found_a_bug": "يبدو أنك قد وجدت خطأً برمجيًّا في Invidious!", + "generic_videos_count_0": "لا فيديوهات", + "generic_videos_count_1": "فيديو واحد", + "generic_videos_count_2": "فيديوهين", + "generic_videos_count_3": "{{count}} فيديوهات", + "generic_videos_count_4": "{{count}} فيديو", + "generic_videos_count_5": "{{count}} فيديو", + "generic_subscribers_count_0": "لا مشتركين", + "generic_subscribers_count_1": "مشترك واحد", + "generic_subscribers_count_2": "مشتركان", + "generic_subscribers_count_3": "{{count}} مشتركين", + "generic_subscribers_count_4": "{{count}} مشترك", + "generic_subscribers_count_5": "{{count}} مشترك", + "generic_views_count_0": "لا مشاهدات", + "generic_views_count_1": "مشاهدة واحدة", + "generic_views_count_2": "مشاهدتان", + "generic_views_count_3": "{{count}} مشاهدات", + "generic_views_count_4": "{{count}} مشاهدة", + "generic_views_count_5": "{{count}} مشاهدة" } From 8b29895ef323cef1dc663bcaa9029b09daa14612 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 10 Feb 2022 18:38:36 +0100 Subject: [PATCH 034/106] Update French translation Co-authored-by: Samantaz Fox --- locales/fr.json | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/locales/fr.json b/locales/fr.json index 8593feb1..86e7f056 100644 --- a/locales/fr.json +++ b/locales/fr.json @@ -76,7 +76,7 @@ "preferences_related_videos_label": "Voir les vidéos liées : ", "preferences_annotations_label": "Afficher les annotations par défaut : ", "preferences_extend_desc_label": "Etendre automatiquement la description : ", - "preferences_vr_mode_label": "Vidéos interactives à 360° : ", + "preferences_vr_mode_label": "Vidéos interactives à 360° (nécessite WebGL) : ", "preferences_category_visual": "Préférences du site", "preferences_player_style_label": "Style du lecteur : ", "Dark mode: ": "Mode sombre : ", @@ -437,5 +437,28 @@ "crash_page_read_the_faq": "lu la Foire Aux Questions (FAQ)", "crash_page_search_issue": "cherché ce bug sur Github", "crash_page_before_reporting": "Avant de signaler un bug, veuillez vous assurez que vous avez :", - "crash_page_report_issue": "Si aucune des solutions proposées ci-dessus ne vous a aidé, veuillez ouvrir une \"issue\" sur GitHub (de préférence en anglais) et d'y inclure le message suivant (ne PAS traduire le texte) :" + "crash_page_report_issue": "Si aucune des solutions proposées ci-dessus ne vous a aidé, veuillez ouvrir une \"issue\" sur GitHub (de préférence en anglais) et d'y inclure le message suivant (ne PAS traduire le texte) :", + "English (United States)": "Anglais (Etats-Unis)", + "Chinese (China)": "Chinois (Chine)", + "Chinese (Hong Kong)": "Chinois (Hong Kong)", + "Dutch (auto-generated)": "Danoi (auto-généré)", + "French (auto-generated)": "Français (auto-généré)", + "German (auto-generated)": "Allemand (auto-généré)", + "Japanese (auto-generated)": "Japonais (auto-généré)", + "Korean (auto-generated)": "Coréen (auto-généré)", + "Indonesian (auto-generated)": "Indonésien (auto-généré)", + "Portuguese (auto-generated)": "Portuguais (auto-généré)", + "Portuguese (Brazil)": "Portugais (Brésil)", + "Spanish (auto-generated)": "Espagnol (auto-généré)", + "Spanish (Mexico)": "Espagnol (Mexique)", + "Turkish (auto-generated)": "Turque (auto-généré)", + "Chinese": "Chinois", + "English (United Kingdom)": "Anglais (Royaume-Uni)", + "Chinese (Taiwan)": "Chinois (Taiwan)", + "Cantonese (Hong Kong)": "Cantonais (Hong Kong)", + "Interlingue": "Interlingua", + "Italian (auto-generated)": "Italien (auto-généré)", + "Vietnamese (auto-generated)": "Vietnamien (auto-généré)", + "Russian (auto-generated)": "Russe (auto-généré)", + "Spanish (Spain)": "Espagnol (Espagne)" } From d169f91d648a6ec6abb25815fd18f4cc9789f69f Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 10 Feb 2022 18:38:36 +0100 Subject: [PATCH 035/106] Update Croatian translation Co-authored-by: Hosted Weblate Co-authored-by: Milo Ivir --- locales/hr.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/locales/hr.json b/locales/hr.json index 5770041e..2f5d3bcf 100644 --- a/locales/hr.json +++ b/locales/hr.json @@ -446,5 +446,12 @@ "generic_views_count_2": "{{count}} prikaza", "comments_view_x_replies_0": "Prikaži {{count}} odgovor", "comments_view_x_replies_1": "Prikaži {{count}} odgovora", - "comments_view_x_replies_2": "Prikaži {{count}} odgovora" + "comments_view_x_replies_2": "Prikaži {{count}} odgovora", + "crash_page_you_found_a_bug": "Čini se da si pronašao/la grešku u Invidiousu!", + "crash_page_before_reporting": "Prije prijavljivanja greške:", + "crash_page_refresh": "pokušaj aktualizirati stranicu", + "crash_page_switch_instance": "pokušaj koristiti jednu drugu instancu", + "crash_page_read_the_faq": "pročitaj Često postavljena pitanja (ČPP)", + "crash_page_search_issue": "pretraži postojeće probleme na Github-u", + "crash_page_report_issue": "Ako ništa od gore navedenog ne pomaže, prijavi novi problem na GitHub-u (po mogućnosti na engleskom) i uključi sljedeći tekst u poruku (NEMOJ prevoditi taj tekst):" } From ea5a4f6d6e72971d6969548d38a18590db00c424 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 10 Feb 2022 18:38:36 +0100 Subject: [PATCH 036/106] Update Portuguese translation Co-authored-by: Hosted Weblate Co-authored-by: SC --- locales/pt.json | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/locales/pt.json b/locales/pt.json index c13c1fd5..0a352f79 100644 --- a/locales/pt.json +++ b/locales/pt.json @@ -388,7 +388,7 @@ "preferences_quality_dash_label": "Qualidade de vídeo DASH preferida: ", "preferences_quality_option_small": "Baixa", "preferences_quality_option_hd720": "HD720", - "preferences_quality_dash_option_auto": "Auto", + "preferences_quality_dash_option_auto": "Automático", "preferences_quality_dash_option_best": "Melhor", "preferences_quality_dash_option_4320p": "4320p", "preferences_quality_dash_option_2160p": "2160p", @@ -397,12 +397,12 @@ "preferences_quality_dash_option_360p": "360p", "preferences_quality_dash_option_240p": "240p", "preferences_quality_dash_option_144p": "144p", - "purchased": "Adquirido", + "purchased": "Comprado", "360": "360°", "videoinfo_invidious_embed_link": "Incorporar hiperligação", "Video unavailable": "Vídeo não disponível", "invidious": "Invidious", - "preferences_quality_option_medium": "Médio", + "preferences_quality_option_medium": "Média", "preferences_quality_option_dash": "DASH (qualidade adaptativa)", "preferences_quality_dash_option_1440p": "1440p", "preferences_quality_dash_option_480p": "480p", @@ -410,5 +410,32 @@ "preferences_quality_dash_option_worst": "Pior", "none": "nenhum", "videoinfo_youTube_embed_link": "Incorporar", - "preferences_save_player_pos_label": "Guardar o tempo atual do vídeo: " + "preferences_save_player_pos_label": "Guardar a posição de reprodução atual do vídeo: ", + "download_subtitles": "Legendas - `x` (.vtt)", + "generic_views_count": "{{count}} visualização", + "generic_views_count_plural": "{{count}} visualizações", + "videoinfo_started_streaming_x_ago": "Iniciou a transmissão há `x`", + "user_saved_playlists": "`x` listas de reprodução guardadas", + "generic_videos_count": "{{count}} vídeo", + "generic_videos_count_plural": "{{count}} vídeos", + "generic_playlists_count": "{{count}} lista de reprodução", + "generic_playlists_count_plural": "{{count}} listas de reprodução", + "subscriptions_unseen_notifs_count": "{{count}} notificação não vista", + "subscriptions_unseen_notifs_count_plural": "{{count}} notificações não vistas", + "comments_view_x_replies": "Ver {{count}} resposta", + "comments_view_x_replies_plural": "Ver {{count}} respostas", + "generic_subscribers_count": "{{count}} inscrito", + "generic_subscribers_count_plural": "{{count}} inscritos", + "generic_subscriptions_count": "{{count}} inscrição", + "generic_subscriptions_count_plural": "{{count}} inscrições", + "comments_points_count": "{{count}} ponto", + "comments_points_count_plural": "{{count}} pontos", + "crash_page_you_found_a_bug": "Parece que encontrou um erro no Invidious!", + "crash_page_before_reporting": "Antes de reportar um erro, verifique se:", + "crash_page_refresh": "tentou recarregar a página", + "crash_page_switch_instance": "tentou usar outra instância", + "crash_page_read_the_faq": "leu as Perguntas frequentes (FAQ)", + "crash_page_search_issue": "procurou se o erro já foi reportado no Github", + "crash_page_report_issue": "Se nenhuma opção acima ajudou, por favor abra um novo problema no Github (preferencialmente em inglês) e inclua o seguinte texto tal qual (NÃO o traduza):", + "user_created_playlists": "`x` listas de reprodução criadas" } From 55c280af5d92eaf5d0b1421210cd29d259e50bbf Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 10 Feb 2022 18:38:36 +0100 Subject: [PATCH 037/106] Update Indonesian translation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Hosted Weblate Co-authored-by: ʏᴜᴜ --- locales/id.json | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/locales/id.json b/locales/id.json index 11016a1c..be15e8e1 100644 --- a/locales/id.json +++ b/locales/id.json @@ -325,7 +325,7 @@ "Search": "Cari", "Top": "Teratas", "About": "Tentang", - "Rating: ": "Rating: ", + "Rating: ": "Penilaian: ", "preferences_locale_label": "Bahasa: ", "View as playlist": "Lihat sebagai daftar putar", "Default": "Baku", @@ -346,7 +346,7 @@ "Playlists": "Daftar putar", "Community": "Komunitas", "relevance": "Relevansi", - "rating": "Rating", + "rating": "Penilaian", "date": "Tanggal unggah", "views": "Jumlah ditonton", "content_type": "Tipe", @@ -414,5 +414,7 @@ "preferences_quality_dash_option_auto": "Otomatis", "preferences_quality_dash_option_480p": "480p", "Video unavailable": "Video tidak tersedia", - "preferences_save_player_pos_label": "Simpan posisi pemutaran: " + "preferences_save_player_pos_label": "Simpan posisi pemutaran: ", + "crash_page_you_found_a_bug": "Sepertinya kamu telah menemukan masalah di invidious!", + "crash_page_before_reporting": "Sebelum melaporkan masalah, pastikan anda memiliki:" } From cdd473e1951a219f95e145e0bc540c0e1882813e Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Thu, 10 Feb 2022 19:52:45 +0100 Subject: [PATCH 038/106] DB: fix inverted arguments in User.update_password() Closes https://github.com/iv-org/invidious/issues/2875 --- src/invidious/database/users.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/invidious/database/users.cr b/src/invidious/database/users.cr index 26be4270..f62b43ea 100644 --- a/src/invidious/database/users.cr +++ b/src/invidious/database/users.cr @@ -171,7 +171,7 @@ module Invidious::Database::Users WHERE email = $2 SQL - PG_DB.exec(request, user.email, pass) + PG_DB.exec(request, pass, user.email) end # ------------------- From 01135db80a0272b3a6b0bc733b883d90ac414337 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Fri, 11 Feb 2022 01:36:53 +0100 Subject: [PATCH 039/106] video_playback: Check "host" parameter validity --- src/invidious/routes/video_playback.cr | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/invidious/routes/video_playback.cr b/src/invidious/routes/video_playback.cr index f6340c57..6ac1e780 100644 --- a/src/invidious/routes/video_playback.cr +++ b/src/invidious/routes/video_playback.cr @@ -14,12 +14,18 @@ module Invidious::Routes::VideoPlayback end if query_params["host"]? && !query_params["host"].empty? - host = "https://#{query_params["host"]}" + host = query_params["host"] query_params.delete("host") else - host = "https://r#{fvip}---#{mns.pop}.googlevideo.com" + host = "r#{fvip}---#{mns.pop}.googlevideo.com" end + # Sanity check, to avoid being used as an open proxy + if !host.matches?(/[\w-]+.googlevideo.com/) + return error_template(400, "Invalid \"host\" parameter.") + end + + host = "https://#{host}" url = "/videoplayback?#{query_params}" headers = HTTP::Headers.new From ddf1e84f7c088051a20461f5c0b7fef069089c74 Mon Sep 17 00:00:00 2001 From: matthewmcgarvey Date: Thu, 10 Feb 2022 23:43:14 -0600 Subject: [PATCH 040/106] Raise exception if playability not ok, also handle missing related videos --- src/invidious/videos.cr | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/invidious/videos.cr b/src/invidious/videos.cr index 335f6b60..81fce5b8 100644 --- a/src/invidious/videos.cr +++ b/src/invidious/videos.cr @@ -881,11 +881,13 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_ player_response = YoutubeAPI.player(video_id: video_id, params: "", client_config: client_config) - if player_response["playabilityStatus"]?.try &.["status"]?.try &.as_s != "OK" - reason = player_response["playabilityStatus"]["errorScreen"]?.try &.["playerErrorMessageRenderer"]?.try &.["subreason"]?.try { |s| - s["simpleText"]?.try &.as_s || s["runs"].as_a.map { |r| r["text"] }.join("") - } || player_response["playabilityStatus"]["reason"].as_s + if player_response.dig?("playabilityStatus", "status").try &.as_s != "OK" + subreason = player_response.dig?("playabilityStatus", "errorScreen", "playerErrorMessageRenderer", "subreason") + reason = subreason.try &.[]?("simpleText").try &.as_s + reason ||= subreason.try &.[]("runs").as_a.map(&.[]("text")).join("") + reason ||= player_response.dig("playabilityStatus", "reason").as_s params["reason"] = JSON::Any.new(reason) + return params end params["shortDescription"] = player_response.dig?("videoDetails", "shortDescription") || JSON::Any.new(nil) @@ -928,11 +930,8 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_ raise BrokenTubeException.new("twoColumnWatchNextResults") if !main_results primary_results = main_results.dig?("results", "results", "contents") - secondary_results = main_results - .dig?("secondaryResults", "secondaryResults", "results") raise BrokenTubeException.new("results") if !primary_results - raise BrokenTubeException.new("secondaryResults") if !secondary_results video_primary_renderer = primary_results .as_a.find(&.["videoPrimaryInfoRenderer"]?) @@ -952,7 +951,9 @@ def extract_video_info(video_id : String, proxy_region : String? = nil, context_ related = [] of JSON::Any # Parse "compactVideoRenderer" items (under secondary results) - secondary_results.as_a.each do |element| + secondary_results = main_results + .dig?("secondaryResults", "secondaryResults", "results") + secondary_results.try &.as_a.each do |element| if item = element["compactVideoRenderer"]? related_video = parse_related_video(item) related << JSON::Any.new(related_video) if related_video @@ -1119,7 +1120,9 @@ def fetch_video(id, region) info = embed_info if !embed_info["reason"]? end - raise InfoException.new(info["reason"]?.try &.as_s || "") if !info["videoDetails"]? + if reason = info["reason"]? + raise InfoException.new(reason.as_s || "") + end video = Video.new({ id: id, From 60e870b27783bdcdb07d26489b50d18a85c49eeb Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Sat, 12 Feb 2022 17:32:20 +0100 Subject: [PATCH 041/106] Fix OPML import --- src/invidious/user/imports.cr | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/invidious/user/imports.cr b/src/invidious/user/imports.cr index 7404cd97..61d10719 100644 --- a/src/invidious/user/imports.cr +++ b/src/invidious/user/imports.cr @@ -105,12 +105,25 @@ struct Invidious::User # Youtube # ------------------- + private def is_opml?(mimetype : String, extension : String) + opml_mimetypes = [ + "application/xml", + "text/xml", + "text/x-opml", + "text/x-opml+xml", + ] + + opml_extensions = ["xml", "opml"] + + return opml_mimetypes.any?(&.== mimetype) || opml_extensions.any?(&.== extension) + end + # Import subscribed channels from Youtube # Returns success status def from_youtube(user : User, body : String, filename : String, type : String) : Bool extension = filename.split(".").last - if extension == "xml" || type == "application/xml" || type == "text/xml" + 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] From 7d756209b19e09a68a6b9c38fa0177e581e8fc3e Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Sun, 13 Feb 2022 01:14:56 +0100 Subject: [PATCH 042/106] Update Spanish translation Co-authored-by: Jorge Maldonado Ventura --- locales/es.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locales/es.json b/locales/es.json index 96fd4fdb..24f8dbdf 100644 --- a/locales/es.json +++ b/locales/es.json @@ -21,15 +21,15 @@ "No": "No", "Import and Export Data": "Importación y exportación de datos", "Import": "Importar", - "Import Invidious data": "Importar datos de Invidious", - "Import YouTube subscriptions": "Importar suscripciones de YouTube", + "Import Invidious data": "Importar datos JSON de Invidious", + "Import YouTube subscriptions": "Importar suscripciones de YouTube/OPML", "Import FreeTube subscriptions (.db)": "Importar suscripciones de FreeTube (.db)", "Import NewPipe subscriptions (.json)": "Importar suscripciones de NewPipe (.json)", "Import NewPipe data (.zip)": "Importar datos de NewPipe (.zip)", "Export": "Exportar", "Export subscriptions as OPML": "Exportar suscripciones como OPML", "Export subscriptions as OPML (for NewPipe & FreeTube)": "Exportar suscripciones como OPML (para NewPipe y FreeTube)", - "Export data as JSON": "Exportar datos como JSON", + "Export data as JSON": "Exportar datos de Invidious como JSON", "Delete account?": "¿Quiere borrar la cuenta?", "History": "Historial", "An alternative front-end to YouTube": "Una interfaz alternativa para YouTube", From 34e1a465beb739079d3e0cfa0b02c6c03ce81a5e Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Sun, 13 Feb 2022 01:14:56 +0100 Subject: [PATCH 043/106] =?UTF-8?q?Update=20Norwegian=20Bokm=C3=A5l=20tran?= =?UTF-8?q?slation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Allan Nordhøy --- locales/nb-NO.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locales/nb-NO.json b/locales/nb-NO.json index 20993b5f..1c5ffbc8 100644 --- a/locales/nb-NO.json +++ b/locales/nb-NO.json @@ -21,8 +21,8 @@ "No": "Nei", "Import and Export Data": "Importer- og eksporter data", "Import": "Importer", - "Import Invidious data": "Importer Invidious-data", - "Import YouTube subscriptions": "Importer YouTube-abonnementer", + "Import Invidious data": "Importer Invidious-JSON-data", + "Import YouTube subscriptions": "Importer YouTube/OPML-abonnementer", "Import FreeTube subscriptions (.db)": "Importer FreeTube-abonnementer (.db)", "Import NewPipe subscriptions (.json)": "Importer NewPipe-abonnementer (.json)", "Import NewPipe data (.zip)": "Importer NewPipe-data (.zip)", From dde850a2e976594ab58f78a29ab591f2aa2a0291 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Sun, 13 Feb 2022 01:14:57 +0100 Subject: [PATCH 044/106] Update Arabic translation Co-authored-by: Mohammed Anas --- locales/ar.json | 100 +++++++++++++++++++++++++++--------------------- 1 file changed, 56 insertions(+), 44 deletions(-) diff --git a/locales/ar.json b/locales/ar.json index bca37eaf..306566d7 100644 --- a/locales/ar.json +++ b/locales/ar.json @@ -1,7 +1,7 @@ { "LIVE": "مُباشِر", "Shared `x` ago": "تمَّ رفع المقطع المرئيّ مُنذ `x`", - "Unsubscribe": "إلغاء الإشتراك", + "Unsubscribe": "إلغاء الاشتراك", "Subscribe": "الإشتراك", "View channel on YouTube": "زيارة القناة على موقع يوتيوب", "View playlist on YouTube": "عرض قائمة التشغيل على اليوتيوب", @@ -13,7 +13,7 @@ "Previous page": "الصفحة السابقة", "Clear watch history?": "هل تريد محو سجل المشاهدة؟", "New password": "كلمة مرور جديدة", - "New passwords must match": "يَجبُ أن تكون كلمتي المرور متطابقتان", + "New passwords must match": "يَجبُ أن تكون كلمتا المرور متطابقتين", "Cannot change password for Google accounts": "لا يُمكن تغيير كلمة المرور لِحسابات جوجل", "Authorize token?": "رمز التفويض؟", "Authorize token for `x`?": "السماح بالرمز المميز ل 'x'؟", @@ -27,8 +27,8 @@ "Import NewPipe subscriptions (.json)": "استيراد اشتراكات نيو بايب (.json)", "Import NewPipe data (.zip)": "استيراد بيانات نيو بايب (.zip)", "Export": "تصدير", - "Export subscriptions as OPML": "تصدير الاشتراكات كَ OPML", - "Export subscriptions as OPML (for NewPipe & FreeTube)": "تصدير الاشتراكات كَ OPML (لِنيو بايب و فريتيوب)", + "Export subscriptions as OPML": "تصدير الاشتراكات كـOPML", + "Export subscriptions as OPML (for NewPipe & FreeTube)": "تصدير الاشتراكات كـOPML (لِنيو بايب و فريتيوب)", "Export data as JSON": "تصدير البيانات بتنسيق JSON", "Delete account?": "حذف الحساب؟", "History": "السِّجل", @@ -47,18 +47,18 @@ "Register": "التسجيل", "E-mail": "البريد الإلكتروني", "Google verification code": "رمز تحقق جوجل", - "Preferences": "التفضيلات", - "preferences_category_player": "التفضيلات المُشغِّل", + "Preferences": "الإعدادات", + "preferences_category_player": "إعدادات المُشغِّل", "preferences_video_loop_label": "كرر المقطع المرئيّ دائما: ", "preferences_autoplay_label": "تشغيل تلقائي: ", "preferences_continue_label": "شغل المقطع التالي تلقائيًا: ", "preferences_continue_autoplay_label": "شغل المقطع التالي تلقائيًا: ", "preferences_listen_label": "تشغيل النسخة السمعية تلقائيًا: ", "preferences_local_label": "بروكسي المقاطع المرئيّة؟ ", - "preferences_speed_label": "السرعة الإفتراضية: ", + "preferences_speed_label": "السرعة الافتراضية: ", "preferences_quality_label": "الجودة المفضلة للمقاطع: ", "preferences_volume_label": "صوت المشغل: ", - "preferences_comments_label": "التعليقات الإفتراضية: ", + "preferences_comments_label": "التعليقات الافتراضية: ", "youtube": "يوتيوب", "reddit": "ريديت", "preferences_captions_label": "التسميات التوضيحية الإفتراضية: ", @@ -69,41 +69,41 @@ "preferences_vr_mode_label": "مقاطع فيديو تفاعلية ب درجة 360: ", "preferences_category_visual": "التفضيلات المرئية", "preferences_player_style_label": "شكل مشغل الفيديوهات: ", - "Dark mode: ": "الوضع الليلى: ", + "Dark mode: ": "الوضع الليلي: ", "preferences_dark_mode_label": "المظهر: ", "dark": "غامق (اسود)", "light": "فاتح (ابيض)", "preferences_thin_mode_label": "الوضع الخفيف: ", "preferences_category_misc": "تفضيلات متنوعة", "preferences_automatic_instance_redirect_label": "إعادة توجيه المثيل التلقائي (إعادة التوجيه إلى redirect.invidious.io): ", - "preferences_category_subscription": "تفضيلات الإشتراك", + "preferences_category_subscription": "تفضيلات الاشتراك", "preferences_annotations_subscribed_label": "عرض الملاحظات في الفيديوهات تلقائيا في القنوات المشترك بها فقط: ", "Redirect homepage to feed: ": "إعادة التوجية من الصفحة الرئيسية لصفحة المشتركين (لرؤية اخر فيديوهات المشتركين): ", "preferences_max_results_label": "عدد الفيديوهات التى ستظهر فى صفحة المشتركين: ", - "preferences_sort_label": "ترتيب الفيديو ب: ", - "published": "احدث فيديو", - "published - reverse": "احدث فيديو - عكسى", - "alphabetically": "ترتيب ابجدى", - "alphabetically - reverse": "ابجدى - عكسى", - "channel name": "بإسم القناة", - "channel name - reverse": "بإسم القناة - عكسى", - "Only show latest video from channel: ": "فقط إظهر اخر فيديو من القناة: ", - "Only show latest unwatched video from channel: ": "فقط اظهر اخر فيديو لم يتم رؤيتة من القناة: ", - "preferences_unseen_only_label": "فقط اظهر الذى لم يتم رؤيتة: ", + "preferences_sort_label": "ترتيب الفيديوهات بـ: ", + "published": "أحدث فيديو", + "published - reverse": "أحدث فيديو - عكسي", + "alphabetically": "ترتيب أبجدي", + "alphabetically - reverse": "أبجدي - عكسي", + "channel name": "باسم القناة", + "channel name - reverse": "باسم القناة - عكسى", + "Only show latest video from channel: ": "فقط أظهر آخر فيديو من القناة: ", + "Only show latest unwatched video from channel: ": "فقط أظهر آخر فيديو لم يتم رؤيته من القناة: ", + "preferences_unseen_only_label": "فقط أظهر الذي لم يتم رؤيته: ", "preferences_notifications_only_label": "إظهار الإشعارات فقط (إذا كان هناك أي): ", "Enable web notifications": "تفعيل إشعارات المتصفح", "`x` uploaded a video": "`x` رفع فيديو", - "`x` is live": "`x` فى بث مباشر", + "`x` is live": "`x` في بث مباشر", "preferences_category_data": "إعدادات التفضيلات", "Clear watch history": "حذف سجل المشاهدة", - "Import/export data": "إضافة\\إستخراج البيانات", - "Change password": "غير الرقم السرى", - "Manage subscriptions": "إدارة المشتركين", + "Import/export data": "إضافة\\استخراج البيانات", + "Change password": "غير كلمة السر", + "Manage subscriptions": "إدارة الاشتراكات", "Manage tokens": "إدارة الرموز", "Watch history": "سجل المشاهدة", "Delete account": "حذف الحساب", "preferences_category_admin": "إعدادات المدير", - "preferences_default_home_label": "الصفحة الرئيسية الافتراضية ", + "preferences_default_home_label": "الصفحة الرئيسية الافتراضية: ", "preferences_feed_menu_label": "قائمة التدفقات: ", "preferences_show_nick_label": "إظهار اللقب في الأعلى: ", "Top enabled: ": "تفعيل 'الأفضل' ؟ ", @@ -111,14 +111,14 @@ "Login enabled: ": "تفعيل الولوج: ", "Registration enabled: ": "تفعيل التسجيل: ", "Report statistics: ": "الإبلاغ عن الإحصائيات: ", - "Save preferences": "حفظ التفضيلات", - "Subscription manager": "مدير الإشتراكات", + "Save preferences": "حفظ الإعدادات", + "Subscription manager": "مدير الاشتراكات", "Token manager": "إداره الرمز", "Token": "الرمز", - "Import/export": "إضافة\\إستخراج", - "unsubscribe": "إلغاء الإشتراك", + "Import/export": "استيراد/تصدير", + "unsubscribe": "إلغاء الاشتراك", "revoke": "مسح", - "Subscriptions": "الإشتراكات", + "Subscriptions": "الاشتراكات", "search": "بحث", "Log out": "تسجيل الخروج", "Released under the AGPLv3 on Github.": "صدر تحت AGPLv3 على Github.", @@ -131,30 +131,30 @@ "Private": "خاص", "View all playlists": "عرض جميع قوائم التشغيل", "Updated `x` ago": "تم تحديثه منذ `x`", - "Delete playlist `x`?": "حذف قائمه التشغيل `x` ?", - "Delete playlist": "حذف قائمه التغشيل", - "Create playlist": "إنشاء قائمه تشغيل", + "Delete playlist `x`?": "حذف قائمة التشغيل `x`؟", + "Delete playlist": "حذف قائمة التغشيل", + "Create playlist": "إنشاء قائمة تشغيل", "Title": "العنوان", - "Playlist privacy": "إعدادات الخصوصيه", - "Editing playlist `x`": "تعديل قائمه التشفيل `x`", - "Show more": "أظهر المزيد", + "Playlist privacy": "إعدادات الخصوصية", + "Editing playlist `x`": "تعديل قائمة التشغيل `x`", + "Show more": "إظهار المزيد", "Show less": "عرض اقل", "Watch on YouTube": "مشاهدة الفيديو على اليوتيوب", "Switch Invidious Instance": "تبديل المثيل Invidious", "Broken? Try another Invidious Instance": "معطل؟ جرب مثيل Invidious آخر", - "Hide annotations": "إخفاء الملاحظات فى الفيديو", - "Show annotations": "عرض الملاحظات فى الفيديو", + "Hide annotations": "إخفاء الملاحظات في الفيديو", + "Show annotations": "عرض الملاحظات في الفيديو", "Genre: ": "النوع: ", "License: ": "التراخيص: ", - "Family friendly? ": "محتوى عائلى? ", + "Family friendly? ": "محتوى عائلي؟ ", "Wilson score: ": "درجة ويلسون: ", - "Engagement: ": "نسبة المشاركة (عدد المشاهدات\\عدد الإعجابات): ", + "Engagement: ": "نسبة المشاركة: ", "Whitelisted regions: ": "الدول المسموح فيها هذا الفيديو: ", - "Blacklisted regions: ": "الدول الحظور فيها هذا الفيديو: ", + "Blacklisted regions: ": "الدول المحظور فيها هذا الفيديو: ", "Shared `x`": "شارك منذ `x`", "Premieres in `x`": "يعرض فى `x`", "Premieres `x`": "يعرض `x`", - "Hi! Looks like you have JavaScript turned off. Click here to view comments, keep in mind they may take a bit longer to load.": "أهلًا! يبدو ان جافاسكريبت معطلة لديك. اضغط هنا لعرض التعليقات، وضع فى اعتبارك أنها ستأخذ وقت أطول للعرض.", + "Hi! Looks like you have JavaScript turned off. Click here to view comments, keep in mind they may take a bit longer to load.": "أهلًا! يبدو أن جافاسكريبت معطلٌ لديك. اضغط هنا لعرض التعليقات، وَضَع في اعتبارك أنها ستأخذ وقتًا أطول للتحميل.", "View YouTube comments": "عرض تعليقات اليوتيوب", "View more comments on Reddit": "عرض المزيد من التعليقات على\\من موقع Reddit", "View `x` comments": { @@ -368,7 +368,7 @@ "adminprefs_modified_source_code_url_label": "URL إلى مستودع التعليمات البرمجية المصدرية المعدلة", "footer_documentation": "التوثيق", "footer_donate_page": "تبرّع", - "preferences_region_label": "بلد المحتوى:. ", + "preferences_region_label": "بلد المحتوى: ", "preferences_quality_dash_label": "جودة فيديو DASH المفضلة: ", "preferences_quality_option_dash": "DASH (جودة تكييفية)", "preferences_quality_option_hd720": "HD720", @@ -417,5 +417,17 @@ "generic_views_count_2": "مشاهدتان", "generic_views_count_3": "{{count}} مشاهدات", "generic_views_count_4": "{{count}} مشاهدة", - "generic_views_count_5": "{{count}} مشاهدة" + "generic_views_count_5": "{{count}} مشاهدة", + "generic_subscriptions_count_0": "لا اشتراكات", + "generic_subscriptions_count_1": "اشتراك واحد", + "generic_subscriptions_count_2": "اشتراكان", + "generic_subscriptions_count_3": "{{count}} اشتراكات", + "generic_subscriptions_count_4": "{{count}} اشتراك", + "generic_subscriptions_count_5": "{{count}} اشتراك", + "generic_playlists_count_0": "لا قوائم تشغيل", + "generic_playlists_count_1": "قائمة تشغيل واحدة", + "generic_playlists_count_2": "قائمتا تشغيل", + "generic_playlists_count_3": "{{count}} قوائم تشغيل", + "generic_playlists_count_4": "{{count}} قائمة تشغيل", + "generic_playlists_count_5": "{{count}} قائمة تشغيل" } From 47f529dc0917762eba6e4094de129da3a170d66d Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Sun, 13 Feb 2022 01:14:57 +0100 Subject: [PATCH 045/106] Update Russian translation Co-authored-by: AHOHNMYC --- locales/ru.json | 127 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 121 insertions(+), 6 deletions(-) diff --git a/locales/ru.json b/locales/ru.json index 809f7187..6d370b80 100644 --- a/locales/ru.json +++ b/locales/ru.json @@ -21,15 +21,15 @@ "No": "Нет", "Import and Export Data": "Импорт и экспорт данных", "Import": "Импорт", - "Import Invidious data": "Импортировать данные Invidious", - "Import YouTube subscriptions": "Импортировать подписки из YouTube", + "Import Invidious data": "Импортировать JSON с данными Invidious", + "Import YouTube subscriptions": "Импортировать подписки из YouTube/OPML", "Import FreeTube subscriptions (.db)": "Импортировать подписки из FreeTube (.db)", "Import NewPipe subscriptions (.json)": "Импортировать подписки из NewPipe (.json)", "Import NewPipe data (.zip)": "Импортировать данные из NewPipe (.zip)", "Export": "Экспорт", "Export subscriptions as OPML": "Экспортировать подписки в формате OPML", "Export subscriptions as OPML (for NewPipe & FreeTube)": "Экспортировать подписки в формате OPML (для NewPipe и FreeTube)", - "Export data as JSON": "Экспортировать данные в формате JSON", + "Export data as JSON": "Экспортировать данные Invidious в формате JSON", "Delete account?": "Удалить аккаунт?", "History": "История", "An alternative front-end to YouTube": "Альтернативный фронтенд для YouTube", @@ -66,7 +66,7 @@ "preferences_related_videos_label": "Показывать похожие видео? ", "preferences_annotations_label": "Всегда показывать аннотации? ", "preferences_extend_desc_label": "Автоматически раскрывать описание видео: ", - "preferences_vr_mode_label": "Интерактивные 360-градусные видео: ", + "preferences_vr_mode_label": "Интерактивные 360-градусные видео (необходим WebGL): ", "preferences_category_visual": "Настройки сайта", "preferences_player_style_label": "Стиль проигрывателя: ", "Dark mode: ": "Тёмное оформление: ", @@ -75,7 +75,7 @@ "light": "светлая", "preferences_thin_mode_label": "Облегчённое оформление: ", "preferences_category_misc": "Прочие предпочтения", - "preferences_automatic_instance_redirect_label": "Автоматическое перенаправление экземпляра (резервный вариант redirect.invidious.io): ", + "preferences_automatic_instance_redirect_label": "Автоматическое перенаправление на зеркало сайта (резервный вариант redirect.invidious.io): ", "preferences_category_subscription": "Настройки подписок", "preferences_annotations_subscribed_label": "Всегда показывать аннотации в видео каналов, на которые вы подписаны? ", "Redirect homepage to feed: ": "Отображать видео с каналов, на которые вы подписаны, как главную страницу: ", @@ -361,5 +361,120 @@ "next_steps_error_message_refresh": "Обновить", "next_steps_error_message_go_to_youtube": "Перейти на YouTube", "short": "Короткие (< 4 минут)", - "long": "Длинные (> 20 минут)" + "long": "Длинные (> 20 минут)", + "preferences_quality_dash_option_best": "Наилучшее", + "generic_count_weeks_0": "{{count}} неделя", + "generic_count_weeks_1": "{{count}} недели", + "generic_count_weeks_2": "{{count}} недель", + "English (United Kingdom)": "Английский (Великобритания)", + "English (United States)": "Английский (США)", + "Cantonese (Hong Kong)": "Кантонский (Гонконг)", + "Chinese (Taiwan)": "Китайский (Тайвань)", + "Dutch (auto-generated)": "Голландский (автоматический)", + "German (auto-generated)": "Немецкий (автоматический)", + "Indonesian (auto-generated)": "Индонезийский (автоматический)", + "Italian (auto-generated)": "Итальянский (автоматический)", + "Interlingue": "Интерлингва", + "Russian (auto-generated)": "Русский (автоматический)", + "Spanish (auto-generated)": "Испанский (автоматический)", + "Spanish (Spain)": "Испанский (Испания)", + "Turkish (auto-generated)": "Турецкий (автоматический)", + "Vietnamese (auto-generated)": "Вьетнамский (автоматический)", + "footer_documentation": "Документация", + "adminprefs_modified_source_code_url_label": "Ссылка на нашу ветку репозитория", + "none": "ничего", + "videoinfo_watch_on_youTube": "Смотреть на YouTube", + "videoinfo_youTube_embed_link": "Встраиваемый элемент", + "videoinfo_invidious_embed_link": "Встраиваемая ссылка", + "download_subtitles": "Субтитры - `x` (.vtt)", + "user_created_playlists": "`x` созданных плейлистов", + "crash_page_you_found_a_bug": "Похоже вы нашли баг в Invidious!", + "crash_page_before_reporting": "Прежде чем сообщать об ошибке, убедитесь, что вы:", + "crash_page_refresh": "пробовали перезагрузить страницу", + "crash_page_report_issue": "Если ни один вариант не помог, пожалуйста откройте новую проблему на GitHub (желательно на английском) и приложите следующий текст к вашему сообщению (НЕ переводите его):", + "generic_videos_count_0": "{{count}} видео", + "generic_videos_count_1": "{{count}} видео", + "generic_videos_count_2": "{{count}} видео", + "generic_playlists_count_0": "{{count}} плейлист", + "generic_playlists_count_1": "{{count}} плейлиста", + "generic_playlists_count_2": "{{count}} плейлистов", + "tokens_count_0": "{{count}} токен", + "tokens_count_1": "{{count}} токена", + "tokens_count_2": "{{count}} токенов", + "subscriptions_unseen_notifs_count_0": "{{count}} новое уведомление", + "subscriptions_unseen_notifs_count_1": "{{count}} новых уведомления", + "subscriptions_unseen_notifs_count_2": "{{count}} новых уведомлений", + "comments_view_x_replies_0": "{{count}} ответ", + "comments_view_x_replies_1": "{{count}} ответа", + "comments_view_x_replies_2": "{{count}} ответов", + "generic_count_years_0": "{{count}} год", + "generic_count_years_1": "{{count}} года", + "generic_count_years_2": "{{count}} лет", + "generic_count_minutes_0": "{{count}} минута", + "generic_count_minutes_1": "{{count}} минуты", + "generic_count_minutes_2": "{{count}} минут", + "generic_subscribers_count_0": "{{count}} подписчик", + "generic_subscribers_count_1": "{{count}} подписчика", + "generic_subscribers_count_2": "{{count}} подписчиков", + "generic_views_count_0": "{{count}} просмотр", + "generic_views_count_1": "{{count}} просмотра", + "generic_views_count_2": "{{count}} просмотров", + "French (auto-generated)": "Французский (автоматический)", + "Portuguese (auto-generated)": "Португальский (автоматический)", + "generic_count_days_0": "{{count}} день", + "generic_count_days_1": "{{count}} дня", + "generic_count_days_2": "{{count}} дней", + "preferences_quality_dash_option_auto": "Автоматическое", + "preferences_quality_dash_option_1080p": "1080p", + "preferences_quality_dash_option_720p": "720p", + "generic_subscriptions_count_0": "{{count}} подписка", + "generic_subscriptions_count_1": "{{count}} подписки", + "generic_subscriptions_count_2": "{{count}} подписок", + "preferences_quality_option_small": "Низкое", + "preferences_quality_dash_option_1440p": "1440p", + "preferences_quality_dash_option_480p": "480p", + "preferences_quality_dash_option_360p": "360p", + "generic_count_seconds_0": "{{count}} секунда", + "generic_count_seconds_1": "{{count}} секунды", + "generic_count_seconds_2": "{{count}} секунд", + "purchased": "Приобретено", + "videoinfo_started_streaming_x_ago": "Трансляция началась `x` назад", + "crash_page_switch_instance": "пробовали использовать другое зеркало", + "crash_page_read_the_faq": "прочли Частые Вопросы (ЧаВо)", + "Chinese": "Китайский", + "Chinese (Hong Kong)": "Китайский (Гонконг)", + "Japanese (auto-generated)": "Японский (автоматический)", + "Chinese (China)": "Китайский (Китай)", + "Korean (auto-generated)": "Корейский (автоматический)", + "generic_count_months_0": "{{count}} месяц", + "generic_count_months_1": "{{count}} месяца", + "generic_count_months_2": "{{count}} месяцев", + "generic_count_hours_0": "{{count}} час", + "generic_count_hours_1": "{{count}} часа", + "generic_count_hours_2": "{{count}} часов", + "Portuguese (Brazil)": "Португальский (Бразилия)", + "footer_source_code": "Исходный код", + "footer_original_source_code": "Оригинальный исходный код", + "footer_modfied_source_code": "Изменённый исходный код", + "user_saved_playlists": "`x` сохранённых плейлистов", + "crash_page_search_issue": "искали похожую проблему на Github", + "comments_points_count_0": "{{count}} плюс", + "comments_points_count_1": "{{count}} плюса", + "comments_points_count_2": "{{count}} плюсов", + "Spanish (Mexico)": "Испанский (Мексика)", + "footer_donate_page": "Поддержать проект", + "preferences_quality_option_dash": "DASH (автоматическое качество)", + "preferences_quality_option_hd720": "HD720", + "preferences_quality_option_medium": "Среднее", + "preferences_quality_dash_label": "Предпочтительное автоматическое качество видео: ", + "preferences_quality_dash_option_worst": "Очень низкое", + "preferences_quality_dash_option_4320p": "4320p", + "preferences_quality_dash_option_2160p": "2160p", + "preferences_quality_dash_option_240p": "240p", + "preferences_quality_dash_option_144p": "144p", + "invidious": "Invidious", + "360": "360°", + "Video unavailable": "Видео недоступно", + "preferences_save_player_pos_label": "Запоминать позицию: ", + "preferences_region_label": "Страна: " } From e0d09c3cdaad334f7d86006a5ceb468979bc8ac6 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Sun, 13 Feb 2022 01:14:57 +0100 Subject: [PATCH 046/106] Update Albanian translation Co-authored-by: Besnik Bleta Co-authored-by: Hosted Weblate --- locales/sq.json | 384 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 383 insertions(+), 1 deletion(-) diff --git a/locales/sq.json b/locales/sq.json index 0967ef42..6b3b8daa 100644 --- a/locales/sq.json +++ b/locales/sq.json @@ -1 +1,383 @@ -{} +{ + "Albanian": "Shqip", + "Amharic": "Amharike", + "Arabic": "Arabisht", + "Armenian": "Armenisht", + "Gujarati": "Gujaratase", + "Haitian Creole": "Kreolase Haiti", + "Hausa": "Hausisht", + "Hawaiian": "Havajane", + "Hebrew": "Hebraisht", + "Hindi": "Indiane", + "Hungarian": "Hungarisht", + "Icelandic": "Islandisht", + "Igbo": "Igboisht", + "Irish": "Irlandisht", + "Javanese": "Xhavanisht", + "Kazakh": "Kazake", + "Khmer": "Khmere", + "Korean": "Koreane", + "Kurdish": "Kurdisht", + "Kyrgyz": "Kirgizisht", + "Sundanese": "Sundaneze", + "Swahili": "Suahilisht", + "Swedish": "Suedisht", + "Tajik": "Taxhike", + "Tamil": "Tamilisht", + "Telugu": "Telugu", + "Vietnamese": "Vietnamisht", + "creative_commons": "Creative Commons", + "3d": "3D", + "live": "Drejtpërsëdrejti", + "4k": "4K", + "location": "Vendndodhja", + "videoinfo_watch_on_youTube": "Shiheni në YouTube", + "videoinfo_youTube_embed_link": "Trupëzojeni", + "videoinfo_invidious_embed_link": "Lidhje Trupëzimi", + "oldest": "më të vjetrat", + "Cannot change password for Google accounts": "S’mund të ndryshojë fjalëkalimin për llogari Google", + "New passwords must match": "Fjalëkalimet e rinj duhet të përputhen me njëri-tjetrin", + "Authorize token?": "Të autorizohet token-i?", + "Authorize token for `x`?": "Të autorizohet token-i për `x`?", + "Log in/register": "Hyni/regjistrohuni", + "Log in with Google": "Hyni me Google", + "User ID": "ID Përdoruesi", + "Password": "Fjalëkalim", + "Time (h:mm:ss):": "Kohë (h:mm:ss):", + "Text CAPTCHA": "CAPTCHA Tekst", + "Image CAPTCHA": "CAPTCHA Figurë", + "Sign In": "Hyni", + "Register": "Regjistrohuni", + "E-mail": "Email", + "Preferences": "Parapëlqime", + "preferences_category_player": "Parapëlqime Lojtësi", + "preferences_autoplay_label": "Vetëluaje: ", + "preferences_continue_label": "Luaj pasuesen, si parazgjedhje: ", + "preferences_continue_autoplay_label": "Vetëluaj videon pasuese: ", + "preferences_listen_label": "Si parazgjedhje, dëgjojeni me: ", + "preferences_speed_label": "Shpejtësi parazgjedhje: ", + "preferences_quality_label": "Cilësi e parapëlqyer për videot: ", + "preferences_quality_option_dash": "DASH (cilësi që përshtatet)", + "preferences_quality_option_hd720": "HD720", + "preferences_quality_option_medium": "Mesatare", + "preferences_quality_option_small": "E ulët", + "preferences_quality_dash_label": "Cilësi DASH e parapëlqyer për videot: ", + "preferences_quality_dash_option_auto": "Auto", + "preferences_quality_dash_option_best": "Më e mira", + "preferences_quality_dash_option_worst": "Më e keqja", + "preferences_quality_dash_option_4320p": "4320p", + "preferences_quality_dash_option_2160p": "2160p", + "preferences_quality_dash_option_1440p": "1440p", + "preferences_quality_dash_option_1080p": "1080p", + "preferences_quality_dash_option_720p": "720p", + "preferences_quality_dash_option_480p": "480p", + "preferences_quality_dash_option_360p": "360p", + "preferences_quality_dash_option_240p": "240p", + "preferences_quality_dash_option_144p": "144p", + "preferences_volume_label": "Volum lojtësi: ", + "preferences_comments_label": "Komente parazgjedhje: ", + "youtube": "YouTube", + "reddit": "Reddit", + "invidious": "Invidious", + "preferences_captions_label": "Titra parazgjedhje: ", + "preferences_extend_desc_label": "Zgjero automatikisht përshkrimin e videos: ", + "preferences_player_style_label": "Silt lojtësi: ", + "Dark mode: ": "Mënyra e errët: ", + "preferences_dark_mode_label": "Temë: ", + "dark": "e errët", + "light": "e çelët", + "preferences_thin_mode_label": "Mënyrë e hollë: ", + "preferences_category_misc": "Parapëlqime të ndryshme", + "preferences_automatic_instance_redirect_label": "Ridrejtim i automatizuar i instancës (si parazgjedhje, te redirect.invidious.io): ", + "preferences_category_subscription": "Parapëlqime pajtimesh", + "preferences_annotations_subscribed_label": "Të shfaqen, si parazgjedhje, shënime për kanalet e pajtuar? ", + "Redirect homepage to feed: ": "Ridrejtoje faqen hyrëse te prurje: ", + "preferences_max_results_label": "Numër videosh të shfaqura në prurje: ", + "preferences_sort_label": "Renditi videot sipas: ", + "published": "e publikuar", + "alphabetically": "alfabetikisht", + "alphabetically - reverse": "alfabetikisht - së prapthi", + "channel name": "emër kanali", + "Only show latest video from channel: ": "Shfaq vetëm videot më të reja nga kanali: ", + "Only show latest unwatched video from channel: ": "Shfaq vetëm videot më të reja të papara në kanal: ", + "preferences_unseen_only_label": "Shfaq vetëm të paparat: ", + "preferences_notifications_only_label": "Shfaq vetëm njoftime (nëse ka të tilla): ", + "Enable web notifications": "Aktivizoni njoftime web", + "`x` uploaded a video": "`x` ngarkoi një video", + "`x` is live": "`x` funksionon", + "preferences_category_data": "Parapëlqime për të dhënat", + "Clear watch history": "Spastro historik parjesh", + "Import/export data": "Importoni/eksportoni të dhëna", + "Change password": "Ndryshoni fjalëkalimin", + "Manage subscriptions": "Administroni pajtimet", + "Manage tokens": "Administroni token-ë", + "Watch history": "Shihni historikun", + "Delete account": "Fshije llogarinë", + "preferences_category_admin": "Parapëlqime përgjegjësi", + "preferences_default_home_label": "Faqe hyrëse parazgjedhje: ", + "preferences_feed_menu_label": "Menu prurjesh: ", + "Registration enabled: ": "Regjistrim i aktivizuar: ", + "Save preferences": "Ruaji parapëlqimet", + "Token": "Token", + "Subscription manager": "Përgjegjës pajtimesh", + "Token manager": "Përgjegjës token-ësh", + "Import/export": "Importim/eksportim", + "unsubscribe": "shpajtohuni", + "revoke": "shfuqizoje", + "Subscriptions": "Pajtime", + "search": "kërko", + "Log out": "Dilni", + "Released under the AGPLv3 on Github.": "Hedhur në qarkullim në Github sipas licencës AGPLv3.", + "Source available here.": "Burimi i passhëm që këtu.", + "View JavaScript license information.": "Shihni hollësi licence JavaScript.", + "View privacy policy.": "Shihni rregulla privatësie.", + "Trending": "Në modë", + "Public": "Publike", + "Unlisted": "Jo në listë", + "Private": "Private", + "View all playlists": "Shihni krejt luajlistat", + "Updated `x` ago": "Përditësuar `x` më parë", + "Delete playlist": "Fshije luajlistën", + "Delete playlist `x`?": "Të fshihet luajlista `x`?", + "Create playlist": "Krijoni luajlistë", + "Title": "Titull", + "Playlist privacy": "Privatësi luajliste", + "Editing playlist `x`": "Po përpunohet luajlista `x`", + "Show more": "Shfaq më tepër", + "Show less": "Shfaq më pak", + "Watch on YouTube": "Shiheni në YouTube", + "Switch Invidious Instance": "Ndërroni Instancë Invidious", + "Broken? Try another Invidious Instance": "E prishur? Provoni një tjetër Instancë Invidious", + "Hide annotations": "Fshihi shënimet", + "Show annotations": "Shfaq shënime", + "License: ": "Licencë: ", + "Family friendly? ": "E përshtatshme për familje? ", + "Wilson score: ": "Klasifikim Wilson: ", + "Engagement: ": "Angazhim: ", + "Whitelisted regions: ": "Rajone të lejuara: ", + "Premieres `x`": "Premiera `x`", + "Hi! Looks like you have JavaScript turned off. Click here to view comments, keep in mind they may take a bit longer to load.": "Njatjeta! Duket sikur keni JavaScript-in të çaktivizuar. Klikoni këtu që të shihni komentet, mbani parasysh se mund të duhet pak më tepër kohë që të ngarkohen.", + "Quota exceeded, try again in a few hours": "Janë tejkaluar kuotat, riprovoni pas pak orësh", + "Blacklisted regions: ": "Rajone të palejuara: ", + "Premieres in `x`": "Premiera në `x`", + "Unable to log in, make sure two-factor authentication (Authenticator or SMS) is turned on.": "S’arrihet të bëhet hyrja, sigurohuni se mirëfilltësimi dyfaktorësh (me Mirëfilltësues apo SMS) është i aktivizuar.", + "Wrong answer": "Përgjigje e gabuar", + "Invalid TFA code": "Kod MDF i pavlefshëm", + "Login failed. This may be because two-factor authentication is not turned on for your account.": "Dështoi hyrja. Kjo mund të vijë ngaqë për llogarinë tuaj s’është aktivizuar mirëfilltësimi dyfaktorësh.", + "Erroneous CAPTCHA": "CAPTCHA e gabuar", + "CAPTCHA is a required field": "CAPTCHA është fushë e domosdoshme", + "User ID is a required field": "ID-ja e përdoruesit është fushë e domosdoshme", + "Password is a required field": "Fusha e fjalëkalimit është e domosdoshme", + "Wrong username or password": "Emër përdoruesi ose fjalëkalim i gabuar", + "Please sign in using 'Log in with Google'": "Ju lutemi, bëni hyrjen duke përdorur “Bëni hyrjen me Google”", + "Password cannot be empty": "Fjalëkalimi s’mund të jetë i zbrazët", + "Password cannot be longer than 55 characters": "Fjalëkalimi s’mund të jetë më i gjatë se 55 shenja", + "Please log in": "Ju lutemi, bëni hyrjen", + "Invidious Private Feed for `x`": "Prurje Private Invidious për `x`", + "channel:`x`": "kanal:`x`", + "Deleted or invalid channel": "Kanal i fshirë ose i pavlefshëm", + "This channel does not exist.": "Ky kanal s’ekziston.", + "Could not get channel info.": "S’u morën dot hollësi kanali.", + "Could not fetch comments": "S’u sollën dot komente", + "`x` ago": "`x` më parë", + "Load more": "Ngarko më tepër", + "Empty playlist": "Luajlistë e zbrazët", + "Not a playlist.": "S’është luajlistë.", + "Playlist does not exist.": "Luajlista s’ekziston.", + "Hidden field \"challenge\" is a required field": "Fusha e fshehur “challenge” është fushë e domosdoshme", + "Hidden field \"token\" is a required field": "Fusha e fshehur “token” është fushë e domosdoshme", + "Erroneous token": "Token i gabuar", + "No such user": "S’ka përdorues të tillë", + "Token is expired, please try again": "Token-i ka skaduar, ju lutemi, riprovoni", + "English": "Anglisht", + "English (auto-generated)": "Anglisht (të vetë-prodhuara)", + "Afrikaans": "Afrikaans", + "Azerbaijani": "Azerbajxhanase", + "Bangla": "Bangla", + "Basque": "Baske", + "Burmese": "Burmanisht", + "Catalan": "Katalane", + "Belarusian": "Bjellorusisht", + "Bosnian": "Boshnjake", + "Bulgarian": "Bullgarisht", + "Cebuano": "Cebuano", + "Chinese (Simplified)": "Kineze (E thjeshtuar)", + "Chinese (Traditional)": "Kineze (Tradicionale)", + "Corsican": "Korsikanisht", + "Croatian": "Kroatisht", + "Czech": "Çekisht", + "Danish": "Danisht", + "Dutch": "Holandisht", + "Esperanto": "Esperanto", + "Estonian": "Estonisht", + "Filipino": "Filipineze", + "Finnish": "Finlandisht", + "French": "Frëngjisht", + "Galician": "Galicisht", + "Georgian": "Gjeorgjisht", + "German": "Gjermanisht", + "Greek": "Greqisht", + "Indonesian": "Indonezisht", + "Italian": "Italisht", + "Japanese": "Japonisht", + "Lao": "Laosisht", + "Lithuanian": "Lituanisht", + "Luxembourgish": "Luksemburgisht", + "Latin": "Latinisht", + "Latvian": "Letonisht", + "Macedonian": "Maqedonisht", + "Nyanja": "Nianja", + "Pashto": "Pashtune", + "Persian": "Perisht", + "Polish": "Polonisht", + "Portuguese": "Portugalisht", + "Punjabi": "Panxhabe", + "Romanian": "Rumanisht", + "Russian": "Rusisht", + "Samoan": "Samoanisht", + "Scottish Gaelic": "Galike Skoceze", + "Serbian": "Serbisht", + "Shona": "Shonisht", + "Sindhi": "Sindi", + "Sinhala": "Sinhaleze", + "Slovak": "Slovakisht", + "Slovenian": "Sllovenisht", + "Somali": "Somalisht", + "Southern Sotho": "Sotoishte Jugore", + "Spanish": "Spanjisht", + "Spanish (Latin America)": "Spanjisht (Amerikë Latine)", + "Thai": "Tajlandeze", + "Turkish": "Turqisht", + "Ukrainian": "Ukrainase", + "Urdu": "Urdisht", + "Uzbek": "Uzbeke", + "Welsh": "Uellase", + "Western Frisian": "Frizishte Perëndimore", + "Xhosa": "Xhosa", + "Yiddish": "Jidisht", + "%A %B %-d, %Y": "%A %B %-d, %Y", + "(edited)": "(u përpunua)", + "YouTube comment permalink": "Permalidhje komenti YouTube", + "Audio mode": "Mënyrë për audion", + "Playlists": "Luajlista", + "Community": "Bashkësi", + "relevance": "Rëndësi", + "Video mode": "Mënyrë video", + "Videos": "Video", + "rating": "Vlerësim", + "date": "Datë ngarkimi", + "views": "Numër parjesh", + "content_type": "Lloj", + "duration": "Kohëzgjatje", + "features": "Veçori", + "sort": "Renditi Sipas", + "hour": "Orën e Fundit", + "today": "Sot", + "long": "E gjatë (> 20 minuta)", + "hd": "HD", + "subtitles": "Titra/CC", + "hdr": "HDR", + "week": "Këtë javë", + "month": "Këtë muaj", + "year": "Këtë vit", + "video": "Video", + "channel": "Kanal", + "playlist": "Luajlistë", + "movie": "Film", + "show": "Shfaqe", + "short": "E shkurtër (< 4 minuta)", + "purchased": "Të blera", + "footer_modfied_source_code": "Kod Burim i ndryshuar", + "adminprefs_modified_source_code_url_label": "URL e depos së ndryshuar të kodit burim", + "none": "asnjë", + "videoinfo_started_streaming_x_ago": "Filloi transmetimin `x` më parë", + "LIVE": "DREJTPËRSËDREJTI", + "Shared `x` ago": "Ndarë me të tjerë `x` më parë", + "Unsubscribe": "Shpajtohuni", + "Subscribe": "Pajtomë", + "View channel on YouTube": "Shihni kanalin në YouTube", + "View playlist on YouTube": "Shihni luajlistën në YouTube", + "newest": "më të rejat", + "popular": "popullore", + "last": "e fundit", + "Next page": "Faqja pasuese", + "Previous page": "Faqja e mëparshme", + "Clear watch history?": "Të spastrohet historiku i parjeve?", + "New password": "Fjalëkalim i ri", + "Google verification code": "Kod verifikimi Google", + "preferences_related_videos_label": "Shfaq video të afërta: ", + "preferences_annotations_label": "Si parazgjedhje, shfaqi shënimet: ", + "preferences_show_nick_label": "Shfaqe nofkën në krye: ", + "CAPTCHA enabled: ": "Me CAPTCHA të aktivizuar: ", + "Login enabled: ": "Me hyrjen të aktivizuar: ", + "Genre: ": "Zhanër: ", + "Could not create mix.": "S’u krijua dot përzierja.", + "Yoruba": "Jorubaisht", + "Zulu": "Zulu", + "Popular": "Popullore", + "Search": "Kërko", + "About": "Mbi", + "Rating: ": "Vlerësim: ", + "preferences_locale_label": "Gjuhë: ", + "View as playlist": "Shiheni si luajlistë", + "Default": "Parazgjedhje", + "Music": "Muzikë", + "Gaming": "Lojëra", + "News": "Lajme", + "Movies": "Filma", + "Download": "Shkarkoje", + "Download as: ": "Shkarkoje si: ", + "permalink": "permalidhje", + "`x` marked it with a ❤": "`x` i është vënë një ❤", + "download_subtitles": "Titra - `x` (.vtt)", + "user_created_playlists": "`x` krijoi luajlista", + "user_saved_playlists": "`x` ruajti luajlista", + "Video unavailable": "Video jo e passhme", + "Yes": "Po", + "No": "Jo", + "Import and Export Data": "Importoni dhe Eksportoni të Dhëna", + "Import": "Importo", + "Import FreeTube subscriptions (.db)": "Importoni pajtime FreeTube (.db)", + "Import NewPipe subscriptions (.json)": "Importoni pajtime NewPipe (.json)", + "Import NewPipe data (.zip)": "Importoni të dhëna NewPipe (.zip)", + "Export": "Eksporto", + "Export subscriptions as OPML": "Eksportoni pajtime si OPML", + "Export subscriptions as OPML (for NewPipe & FreeTube)": "Eksportoji pajtimet si OPML (për NewPipe & FreeTube)", + "Delete account?": "Të fshihet llogaria?", + "History": "Historik", + "An alternative front-end to YouTube": "Një front-end alternativ për YouTube-in", + "JavaScript license information": "Hollësi licence JavaScript", + "source": "burim", + "Log in": "Hyni", + "preferences_category_visual": "Parapëlqime pamore", + "preferences_region_label": "Vend lënde: ", + "View YouTube comments": "Shihni komente Youtube", + "View more comments on Reddit": "Shihni më tepër komente në Reddit", + "View `x` comments": { + "([^.,0-9]|^)1([^.,0-9]|$)": "Shihni `x` komente", + "": "Shihni `x` komente" + }, + "View Reddit comments": "Shihni komente Reddit", + "Hide replies": "Fshihi përgjigjet", + "Show replies": "Shfaq përgjigje", + "Incorrect password": "Fjalëkalim i pasaktë", + "Malagasy": "Malagashe", + "Malay": "Malajase", + "Malayalam": "Malajalamase", + "Maltese": "Maltisht", + "Maori": "Maori", + "Marathi": "Marati", + "Mongolian": "Mongolisht", + "Nepali": "Nepaleze", + "Norwegian Bokmål": "Norvegjishte Bokmål", + "360": "360°", + "filter": "Filtroji", + "Current version: ": "Versioni i tanishëm: ", + "next_steps_error_message": "Pas të cilës duhet të provoni të: ", + "next_steps_error_message_refresh": "Rifreskoje", + "next_steps_error_message_go_to_youtube": "Kaloni në Youtube", + "footer_donate_page": "Dhuroni", + "footer_documentation": "Dokumentim", + "footer_source_code": "Kod burim", + "footer_original_source_code": "Kodim burim origjinal" +} From 85d178ff8b380ef0bf05e44a4db45c78501e931b Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Sun, 13 Feb 2022 01:14:57 +0100 Subject: [PATCH 047/106] Update French translation Co-authored-by: Samantaz Fox --- locales/fr.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locales/fr.json b/locales/fr.json index 86e7f056..b9732345 100644 --- a/locales/fr.json +++ b/locales/fr.json @@ -456,7 +456,7 @@ "English (United Kingdom)": "Anglais (Royaume-Uni)", "Chinese (Taiwan)": "Chinois (Taiwan)", "Cantonese (Hong Kong)": "Cantonais (Hong Kong)", - "Interlingue": "Interlingua", + "Interlingue": "Occidental", "Italian (auto-generated)": "Italien (auto-généré)", "Vietnamese (auto-generated)": "Vietnamien (auto-généré)", "Russian (auto-generated)": "Russe (auto-généré)", From 1e6cd0b18f5a784b69d0d317127a77b4a9578d3f Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Sun, 13 Feb 2022 01:14:57 +0100 Subject: [PATCH 048/106] Update Turkish translation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Oğuz Ersen --- locales/tr.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locales/tr.json b/locales/tr.json index fba72adf..65648fd7 100644 --- a/locales/tr.json +++ b/locales/tr.json @@ -21,15 +21,15 @@ "No": "Hayır", "Import and Export Data": "Verileri İçe ve Dışa Aktar", "Import": "İçe aktar", - "Import Invidious data": "İnvidious verilerini içe aktar", - "Import YouTube subscriptions": "YouTube aboneliklerini içe aktar", + "Import Invidious data": "İnvidious JSON verilerini içe aktar", + "Import YouTube subscriptions": "YouTube/OPML aboneliklerini içe aktar", "Import FreeTube subscriptions (.db)": "FreeTube aboneliklerini içe aktar (.db)", "Import NewPipe subscriptions (.json)": "NewPipe aboneliklerini içe aktar (.json)", "Import NewPipe data (.zip)": "NewPipe verilerini içe aktar (.zip)", "Export": "Dışa aktar", "Export subscriptions as OPML": "Abonelikleri OPML olarak dışa aktar", "Export subscriptions as OPML (for NewPipe & FreeTube)": "Abonelikleri OPML olarak dışa aktar (NewPipe ve FreeTube için)", - "Export data as JSON": "Verileri JSON olarak dışa aktar", + "Export data as JSON": "Invidious verilerini JSON olarak dışa aktar", "Delete account?": "Hesap silinsin mi?", "History": "Geçmiş", "An alternative front-end to YouTube": "YouTube için alternatif bir ön-yüz", From 2194bd2812442665e555ca8e75ecf98a650a40c1 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Sun, 13 Feb 2022 01:14:58 +0100 Subject: [PATCH 049/106] Update Chinese (Simplified) translation Co-authored-by: Eric --- locales/zh-CN.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locales/zh-CN.json b/locales/zh-CN.json index 0e277fc2..f21fe8da 100644 --- a/locales/zh-CN.json +++ b/locales/zh-CN.json @@ -26,15 +26,15 @@ "No": "否", "Import and Export Data": "导入与导出数据", "Import": "导入", - "Import Invidious data": "导入 Invidious 数据", - "Import YouTube subscriptions": "导入 YouTube 订阅", + "Import Invidious data": "导入 Invidious JSON 数据", + "Import YouTube subscriptions": "导入 YouTube/OPML 订阅", "Import FreeTube subscriptions (.db)": "导入 FreeTube 订阅 (.db)", "Import NewPipe subscriptions (.json)": "导入 NewPipe 订阅 (.json)", "Import NewPipe data (.zip)": "导入 NewPipe 数据 (.zip)", "Export": "导出", "Export subscriptions as OPML": "导出订阅到 OPML 格式", "Export subscriptions as OPML (for NewPipe & FreeTube)": "导出订阅到 OPML 格式(用于 NewPipe 及 FreeTube)", - "Export data as JSON": "导出数据为 JSON 格式", + "Export data as JSON": "导出 Invidious 数据为 JSON 格式", "Delete account?": "删除账户?", "History": "历史", "An alternative front-end to YouTube": "另一个 YouTube 前端", From 9ff26ea4d4aa1b2b8635fd521c73c2d6133e9d40 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Sun, 13 Feb 2022 01:14:58 +0100 Subject: [PATCH 050/106] Update Chinese (Traditional) translation Co-authored-by: Jeff Huang --- locales/zh-TW.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/locales/zh-TW.json b/locales/zh-TW.json index fc18eb7e..2fdb2036 100644 --- a/locales/zh-TW.json +++ b/locales/zh-TW.json @@ -26,15 +26,15 @@ "No": "否", "Import and Export Data": "匯入與匯出資料", "Import": "匯入", - "Import Invidious data": "匯入 Invidious 資料", - "Import YouTube subscriptions": "匯入 YouTube 訂閱", + "Import Invidious data": "匯入 Invidious JSON 資料", + "Import YouTube subscriptions": "匯入 YouTube/OPML 訂閱", "Import FreeTube subscriptions (.db)": "匯入 FreeTube 訂閱 (.db)", "Import NewPipe subscriptions (.json)": "匯入 NewPipe 訂閱 (.json)", "Import NewPipe data (.zip)": "匯入 NewPipe 資料 (.zip)", "Export": "匯出", "Export subscriptions as OPML": "將訂閱匯出為 OPML", "Export subscriptions as OPML (for NewPipe & FreeTube)": "將訂閱匯出為 OPML(供 NewPipe 與 FreeTube 使用)", - "Export data as JSON": "將 JSON 匯出為 JSON", + "Export data as JSON": "將 Invidious 資料匯出為 JSON", "Delete account?": "刪除帳號?", "History": "歷史", "An alternative front-end to YouTube": "一個 YouTube 的替代前端", From 57353fe0c611f2065ccec8863d26ab586d72fdfb Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Sun, 13 Feb 2022 22:35:22 +0100 Subject: [PATCH 051/106] Fix Freetube subscriptions import --- src/invidious/user/imports.cr | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/invidious/user/imports.cr b/src/invidious/user/imports.cr index 61d10719..f8b9e4e4 100644 --- a/src/invidious/user/imports.cr +++ b/src/invidious/user/imports.cr @@ -152,9 +152,16 @@ struct Invidious::User # ------------------- def from_freetube(user : User, body : String) + # Legacy import? matches = body.scan(/"channelId":"(?[a-zA-Z0-9_-]{24})"/) + subs = matches.map(&.["channel_id"]) - user.subscriptions += matches.map(&.["channel_id"]) + if subs.empty? + data = JSON.parse(body)["subscriptions"] + subs = data.as_a.map(&.["id"].as_s) + end + + user.subscriptions += subs user.subscriptions.uniq! user.subscriptions = get_batch_channels(user.subscriptions) From 7112f3579378808a709b389ed4549baf74f679b1 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Mon, 14 Feb 2022 21:54:26 +0100 Subject: [PATCH 052/106] comments: don't error out when video has no comments continuationItems is nil when video has no comments --- src/invidious/comments.cr | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/invidious/comments.cr b/src/invidious/comments.cr index 65f4b135..ab9fcc8b 100644 --- a/src/invidious/comments.cr +++ b/src/invidious/comments.cr @@ -78,7 +78,8 @@ def fetch_youtube_comments(id, cursor, format, locale, thin_mode, region, sort_b when "RELOAD_CONTINUATION_SLOT_HEADER" header = item["reloadContinuationItemsCommand"]["continuationItems"][0] when "RELOAD_CONTINUATION_SLOT_BODY" - contents = item["reloadContinuationItemsCommand"]["continuationItems"] + # continuationItems is nil when video has no comments + contents = item["reloadContinuationItemsCommand"]["continuationItems"]? end elsif item["appendContinuationItemsAction"]? contents = item["appendContinuationItemsAction"]["continuationItems"] From b4c532f062e76e838fe390c2fb2ee4be6a1f77ce Mon Sep 17 00:00:00 2001 From: TheFrenchGhosty <47571719+TheFrenchGhosty@users.noreply.github.com> Date: Wed, 16 Feb 2022 17:27:03 +0000 Subject: [PATCH 053/106] Remove the e-mail section from the README and link to the website --- README.md | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 4e3c7a77..7fd27004 100644 --- a/README.md +++ b/README.md @@ -51,8 +51,8 @@ Mastodon: @invidious@social.tchncs.de
- - Contact the team directly + + E-mail
@@ -152,19 +152,6 @@ Weblate also allows you to log-in with major SSO providers like Github, Gitlab, - [HoloPlay](https://github.com/stephane-r/HoloPlay): Funny Android application connecting on Invidious API's with search, playlists and favorites. -## Contact the team directly - -Every team member is available through GitHub or through the Matrix room (bridged to IRC), however, if you need/have to, you can contact the team directly via e-mail (remove `+SPAMGUARD` from the addresses): - -- General Inquiries (forwarded to all team members): `contact +SPAMGUARD [at] invidious [dot] io` - -Note: before sending a bug report please check that it hasn't already be reported on GitHub - bug reports sent to this address will be copied to GitHub - -- Security issues (forwarded to the two project owners, @TheFrenchGhosty and @Perflyst): `security +SPAMGUARD [at] invidious [dot] io` - -Note: the creation of a PGP key for this address is planned - - ## Liability We take no responsibility for the use of our tool, or external instances From dbba9d76872a463c8f2a60e42a973e9591c4fc1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9ry=20Mathieu=20=28Mathius=29?= Date: Fri, 18 Feb 2022 17:23:16 +0100 Subject: [PATCH 054/106] Expose version in /api/v1/stats with statistic disabled --- docker-compose.yml | 1 + src/invidious/routes/api/v1/misc.cr | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c76c314c..1c853a08 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,6 +34,7 @@ services: dbname: invidious full_refresh: false https_only: false + statistics_enabled: false domain: healthcheck: test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/comments/jNQXAC9IVRw || exit 1 diff --git a/src/invidious/routes/api/v1/misc.cr b/src/invidious/routes/api/v1/misc.cr index a1ce0cbc..844fedb8 100644 --- a/src/invidious/routes/api/v1/misc.cr +++ b/src/invidious/routes/api/v1/misc.cr @@ -4,10 +4,10 @@ module Invidious::Routes::API::V1::Misc env.response.content_type = "application/json" if !CONFIG.statistics_enabled - return error_json(400, "Statistics are not enabled.") + return {"software" => SOFTWARE}.to_json + else + return Invidious::Jobs::StatisticsRefreshJob::STATISTICS.to_json end - - Invidious::Jobs::StatisticsRefreshJob::STATISTICS.to_json end # APIv1 currently uses the same logic for both From 9979a1b9101c13e9c86ffa94f8e3722ebf70b71c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9ry=20Mathieu=20=28Mathius=29?= Date: Sat, 19 Feb 2022 17:03:22 +0100 Subject: [PATCH 055/106] Add currentTimestamp in shared url by videojs-share --- assets/js/player.js | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/assets/js/player.js b/assets/js/player.js index 81a27009..42f00ef7 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -35,21 +35,11 @@ if (player_data.aspect_ratio) { var embed_url = new URL(location); embed_url.searchParams.delete('v'); -short_url = location.origin + '/' + video_data.id + embed_url.search; +var short_url = location.origin + '/' + video_data.id + embed_url.search; embed_url = location.origin + '/embed/' + video_data.id + embed_url.search; var save_player_pos_key = "save_player_pos"; -var shareOptions = { - socials: ['fbFeed', 'tw', 'reddit', 'email'], - - url: short_url, - title: player_data.title, - description: player_data.description, - image: player_data.thumbnail, - embedCode: "" -} - videojs.Vhs.xhr.beforeRequest = function(options) { if (options.uri.indexOf('videoplayback') === -1 && options.uri.indexOf('local=true') === -1) { options.uri = options.uri + '?local=true'; @@ -59,6 +49,38 @@ videojs.Vhs.xhr.beforeRequest = function(options) { var player = videojs('player', options); +/** + * Function for add time argument to url + * @param {String} url + * @returns urlWithTimeArg + */ +function addCurrentTimeToURL(url) { + var urlUsed = new URL(url); + urlUsed.searchParams.delete('start'); + var currentTime = Math.ceil(player.currentTime()); + if (currentTime > 0) + urlUsed.searchParams.set('t', currentTime); + else + if (urlUsed.searchParams.has('t')) + urlUsed.searchParams.delete('t'); + return urlUsed; +} + +var shareOptions = { + socials: ['fbFeed', 'tw', 'reddit', 'email'], + + get url() { + return addCurrentTimeToURL(short_url); + }, + title: player_data.title, + description: player_data.description, + image: player_data.thumbnail, + get embedCode() { + return ""; + } +}; + const storage = (() => { try { if (localStorage.length !== -1) return localStorage; } catch (e) { console.info('No storage available: ' + e); } From f75a81c9eeb792c0b99075bc47a1243a23b8700b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9ry=20Mathieu=20=28Mathius=29?= Date: Mon, 21 Feb 2022 10:53:20 +0100 Subject: [PATCH 056/106] Make configurable time between each RefreshChannelsJob --- config/config.example.yml | 8 ++++ docker-compose.yml | 2 + src/invidious/config.cr | 12 +++--- src/invidious/helpers/utils.cr | 44 +++++++++++++++------- src/invidious/jobs/refresh_channels_job.cr | 5 +-- 5 files changed, 49 insertions(+), 22 deletions(-) diff --git a/config/config.example.yml b/config/config.example.yml index 59cb486b..475f2703 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -314,6 +314,14 @@ https_only: false ## channel_threads: 1 +## +## Time between channel_refresh +## +## Accepted values: a valid time interval (hours:min:seconds) +## Default: 00:30:00 +## +channel_refresh_time: 00:30:00 + ## ## Forcefully dump and re-download the entire list of uploaded ## videos when crawling channel (during subscriptions update). diff --git a/docker-compose.yml b/docker-compose.yml index c76c314c..964bb702 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,7 +23,9 @@ services: environment: # Adapted from ./config/config.yml INVIDIOUS_CONFIG: | + log_level: Info channel_threads: 1 + channel_refresh_time: 00:30:00 check_tables: true feed_threads: 1 db: diff --git a/src/invidious/config.cr b/src/invidious/config.cr index 72e145da..150f8064 100644 --- a/src/invidious/config.cr +++ b/src/invidious/config.cr @@ -56,11 +56,13 @@ end class Config include YAML::Serializable - property channel_threads : Int32 = 1 # Number of threads to use for crawling videos from channels (for updating subscriptions) - property feed_threads : Int32 = 1 # Number of threads to use for updating feeds - property output : String = "STDOUT" # Log file path or STDOUT - property log_level : LogLevel = LogLevel::Info # Default log level, valid YAML values are ints and strings, see src/invidious/helpers/logger.cr - property db : DBConfig? = nil # Database configuration with separate parameters (username, hostname, etc) + property channel_threads : Int32 = 1 # Number of threads to use for crawling videos from channels (for updating subscriptions) + @[YAML::Field(converter: TimeSpanConverter)] + property channel_refresh_time : Time::Span = 30.minutes # Time between channel_refresh + property feed_threads : Int32 = 1 # Number of threads to use for updating feeds + property output : String = "STDOUT" # Log file path or STDOUT + property log_level : LogLevel = LogLevel::Info # Default log level, valid YAML values are ints and strings, see src/invidious/helpers/logger.cr + property db : DBConfig? = nil # Database configuration with separate parameters (username, hostname, etc) @[YAML::Field(converter: Preferences::URIConverter)] property database_url : URI = URI.parse("") # Database configuration using 12-Factor "Database URL" syntax diff --git a/src/invidious/helpers/utils.cr b/src/invidious/helpers/utils.cr index a58a21b1..2702c5e9 100644 --- a/src/invidious/helpers/utils.cr +++ b/src/invidious/helpers/utils.cr @@ -18,23 +18,39 @@ def elapsed_text(elapsed) "#{(millis * 1000).round(2)}µs" end -def decode_length_seconds(string) - length_seconds = string.gsub(/[^0-9:]/, "") - return 0_i32 if length_seconds.empty? +module TimeSpanConverter + def self.to_yaml(value : Time::Span, yaml : YAML::Nodes::Builder) + return yaml.scalar recode_length_seconds(value.total_seconds.to_i32) + end - length_seconds = length_seconds.split(":").map { |x| x.to_i? || 0 } - length_seconds = [0] * (3 - length_seconds.size) + length_seconds - - length_seconds = Time::Span.new( - hours: length_seconds[0], - minutes: length_seconds[1], - seconds: length_seconds[2] - ).total_seconds.to_i32 - - return length_seconds + def self.from_yaml(ctx : YAML::ParseContext, node : YAML::Nodes::Node) : Time::Span + if node.is_a?(YAML::Nodes::Scalar) + return decode_time_span(node.value) + else + node.raise "Expected scalar, not #{node.class}" + end + end end -def recode_length_seconds(time) +def decode_time_span(string : String) : Time::Span + time_span = string.gsub(/[^0-9:]/, "") + return Time::Span.new(seconds: 0) if time_span.empty? + + time_span = time_span.split(":").map { |x| x.to_i? || 0 } + time_span = [0] * (3 - time_span.size) + time_span + + return Time::Span.new( + hours: time_span[0], + minutes: time_span[1], + seconds: time_span[2] + ) +end + +def decode_length_seconds(string : String) : Int32 + return decode_time_span(string).total_seconds.to_i32 +end + +def recode_length_seconds(time : Int32) : String if time <= 0 return "" else diff --git a/src/invidious/jobs/refresh_channels_job.cr b/src/invidious/jobs/refresh_channels_job.cr index 55fb8154..3e04d1cd 100644 --- a/src/invidious/jobs/refresh_channels_job.cr +++ b/src/invidious/jobs/refresh_channels_job.cr @@ -58,9 +58,8 @@ class Invidious::Jobs::RefreshChannelsJob < Invidious::Jobs::BaseJob end end - # TODO: make this configurable - LOGGER.debug("RefreshChannelsJob: Done, sleeping for thirty minutes") - sleep 30.minutes + LOGGER.debug("RefreshChannelsJob: Done, sleeping for #{CONFIG.channel_refresh_time}") + sleep CONFIG.channel_refresh_time Fiber.yield end end From 18197e7e3eca53176e71b1dfe82dd2de85df175c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9ry=20Mathieu=20=28Mathius=29?= Date: Mon, 21 Feb 2022 11:13:24 +0100 Subject: [PATCH 057/106] Lint description of channel_refresh_time --- config/config.example.yml | 2 +- src/invidious/config.cr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/config.example.yml b/config/config.example.yml index 475f2703..5d4cea28 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -315,7 +315,7 @@ https_only: false channel_threads: 1 ## -## Time between channel_refresh +## Time between two jobs for crawling videos from channels ## ## Accepted values: a valid time interval (hours:min:seconds) ## Default: 00:30:00 diff --git a/src/invidious/config.cr b/src/invidious/config.cr index 150f8064..9ffd2cd8 100644 --- a/src/invidious/config.cr +++ b/src/invidious/config.cr @@ -58,7 +58,7 @@ class Config property channel_threads : Int32 = 1 # Number of threads to use for crawling videos from channels (for updating subscriptions) @[YAML::Field(converter: TimeSpanConverter)] - property channel_refresh_time : Time::Span = 30.minutes # Time between channel_refresh + property channel_refresh_time : Time::Span = 30.minutes # Time between two jobs for crawling videos from channels property feed_threads : Int32 = 1 # Number of threads to use for updating feeds property output : String = "STDOUT" # Log file path or STDOUT property log_level : LogLevel = LogLevel::Info # Default log level, valid YAML values are ints and strings, see src/invidious/helpers/logger.cr From d0d8ba00683b61f85edf5712afb67f1e22efb72a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9ry=20Mathieu=20=28Mathius=29?= Date: Tue, 22 Feb 2022 00:09:15 +0100 Subject: [PATCH 058/106] Remove useless config inside docker-compose Follow lint indications : https://github.com/iv-org/invidious/pull/2910#discussion_r811367959 --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1c853a08..c76c314c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,7 +34,6 @@ services: dbname: invidious full_refresh: false https_only: false - statistics_enabled: false domain: healthcheck: test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/comments/jNQXAC9IVRw || exit 1 From fd55b08a1dd7b1592d4298d2dc3c1ce3d412b3d3 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Tue, 22 Feb 2022 00:17:18 +0100 Subject: [PATCH 059/106] Add albanian to the locales list --- src/invidious/helpers/i18n.cr | 1 + 1 file changed, 1 insertion(+) diff --git a/src/invidious/helpers/i18n.cr b/src/invidious/helpers/i18n.cr index 6571dbe6..39e183f2 100644 --- a/src/invidious/helpers/i18n.cr +++ b/src/invidious/helpers/i18n.cr @@ -30,6 +30,7 @@ LOCALES_LIST = { "pt-PT" => "Português de Portugal", # Portuguese (Portugal) "ro" => "Română", # Romanian "ru" => "русский", # Russian + "sq" => "Shqip", # Albanian "sr" => "srpski (latinica)", # Serbian (Latin) "sr_Cyrl" => "српски (ћирилица)", # Serbian (Cyrillic) "sv-SE" => "Svenska", # Swedish From 3816f9209573b7c33ff3d794161c7879712967b8 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 22 Feb 2022 00:05:22 +0100 Subject: [PATCH 060/106] Update Russian translation Co-authored-by: AHOHNMYC --- locales/ru.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locales/ru.json b/locales/ru.json index 6d370b80..88f81395 100644 --- a/locales/ru.json +++ b/locales/ru.json @@ -374,7 +374,7 @@ "German (auto-generated)": "Немецкий (автоматический)", "Indonesian (auto-generated)": "Индонезийский (автоматический)", "Italian (auto-generated)": "Итальянский (автоматический)", - "Interlingue": "Интерлингва", + "Interlingue": "Окциденталь", "Russian (auto-generated)": "Русский (автоматический)", "Spanish (auto-generated)": "Испанский (автоматический)", "Spanish (Spain)": "Испанский (Испания)", From 18d68184a906853ec3ebd94e777ee541f1a27ff9 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 22 Feb 2022 00:05:22 +0100 Subject: [PATCH 061/106] Update Albanian translation Co-authored-by: Besnik Bleta --- locales/sq.json | 71 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) diff --git a/locales/sq.json b/locales/sq.json index 6b3b8daa..3e2a3fb1 100644 --- a/locales/sq.json +++ b/locales/sq.json @@ -379,5 +379,74 @@ "footer_donate_page": "Dhuroni", "footer_documentation": "Dokumentim", "footer_source_code": "Kod burim", - "footer_original_source_code": "Kodim burim origjinal" + "footer_original_source_code": "Kodim burim origjinal", + "generic_count_hours": "{{count}} orë", + "generic_count_hours_plural": "{{count}} orë", + "generic_videos_count": "{{count}} video", + "generic_videos_count_plural": "{{count}} video", + "generic_playlists_count": "{{count}} luajlistë", + "generic_playlists_count_plural": "{{count}} luajlista", + "generic_subscribers_count": "{{count}} pajtimtar", + "generic_subscribers_count_plural": "{{count}} pajtimtarë", + "subscriptions_unseen_notifs_count": "{{count}} njoftim që s’është parë", + "subscriptions_unseen_notifs_count_plural": "{{count}} njoftime që s’janë parë", + "comments_view_x_replies": "Shihni {{count}} përgjigje", + "comments_view_x_replies_plural": "Shihni {{count}} përgjigje", + "comments_points_count": "{{count}} pikë", + "comments_points_count_plural": "{{count}} pikë", + "generic_count_years": "{{count}} vit", + "generic_count_years_plural": "{{count}} vjet", + "generic_count_months": "{{count}} muaj", + "generic_count_months_plural": "{{count}} muaj", + "generic_count_weeks": "{{count}} javë", + "generic_count_weeks_plural": "{{count}} javë", + "generic_count_days": "{{count}} ditë", + "generic_count_days_plural": "{{count}} ditë", + "generic_count_minutes": "{{count}} minutë", + "generic_count_minutes_plural": "{{count}} minuta", + "generic_count_seconds": "{{count}} sekondë", + "generic_count_seconds_plural": "{{count}} sekonda", + "crash_page_you_found_a_bug": "Duket sikur gjetët një të metë në Invidious!", + "crash_page_before_reporting": "Para se të njoftoni një të metë, sigurohuni se keni:", + "crash_page_refresh": "provuar të rifreskoni faqen", + "crash_page_switch_instance": "provuar të përdorni tjetër instancë", + "crash_page_read_the_faq": "lexuar Pyetje të Bëra Rëndom (PBR)", + "generic_views_count": "{{count}} parje", + "generic_views_count_plural": "{{count}} parje", + "English (United Kingdom)": "Anglisht (Mbretëri e Bashkuar)", + "English (United States)": "Anglisht (Shtetet e Bashkuara)", + "Cantonese (Hong Kong)": "Kantoneze (Hong Kong)", + "Chinese": "Kinezçe", + "Chinese (China)": "Kinezçe (Kinë)", + "Chinese (Hong Kong)": "Kinezçe (Hong-Kong)", + "Chinese (Taiwan)": "Kinezçe (Tajvan)", + "Dutch (auto-generated)": "Holandisht (e prodhuar automatikisht)", + "French (auto-generated)": "Anglisht (të prodhuara automatikisht)", + "German (auto-generated)": "Gjermanisht (të prodhuara automatikisht)", + "Hmong": "Hmong", + "Indonesian (auto-generated)": "Indonezisht (të prodhuara automatikisht)", + "Interlingue": "Interlingue", + "Italian (auto-generated)": "Italisht (të prodhuara automatikisht)", + "Japanese (auto-generated)": "Japonisht (të prodhuara automatikisht)", + "Korean (auto-generated)": "Koreane (të prodhuara automatikisht)", + "Portuguese (auto-generated)": "Portugalisht (të prodhuara automatikisht)", + "Portuguese (Brazil)": "Portugeze (Brazil)", + "Russian (auto-generated)": "Rusisht (të prodhuara automatikisht)", + "Spanish (auto-generated)": "Spanjisht (të prodhuara automatikisht)", + "Spanish (Mexico)": "Spanjisht (Meksikë)", + "Spanish (Spain)": "Spanjisht (Spanjë)", + "Turkish (auto-generated)": "Turqisht (të prodhuara automatikisht)", + "Vietnamese (auto-generated)": "Vietnamisht (të prodhuara automatikisht)", + "crash_page_search_issue": "kërkuar për çështje ekzistuese në Github", + "crash_page_report_issue": "Nëse asnjë nga sa më sipër s’ndihmoi, ju lutemi, hapni një çështje në GitHub (mundësisht në anglisht) dhe përfshini në mesazhin tuaj tekstin vijues (MOS e përktheni këtë tekst):", + "generic_subscriptions_count": "{{count}} pajtim", + "generic_subscriptions_count_plural": "{{count}} pajtime", + "tokens_count": "{{count}} token", + "tokens_count_plural": "{{count}} tokenë", + "preferences_save_player_pos_label": "Mba mend pozicionin e luajtjes: ", + "Import Invidious data": "Importoni të dhëna JSON Invidious", + "Import YouTube subscriptions": "Importoni pajtime YouTube/OPML", + "Export data as JSON": "Eksportoji të dhënat Invidious si JSON", + "preferences_vr_mode_label": "Video me ndërveprim 360 gradë (lyp WebGL): ", + "Shared `x`": "Ndau me të tjerë `x`" } From 9031ca5c3fb4b6b515dd101c707b6dbf337b4542 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 22 Feb 2022 00:05:22 +0100 Subject: [PATCH 062/106] Update French translation Co-authored-by: Samantaz Fox --- locales/fr.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locales/fr.json b/locales/fr.json index b9732345..41b672b2 100644 --- a/locales/fr.json +++ b/locales/fr.json @@ -31,8 +31,8 @@ "No": "Non", "Import and Export Data": "Importer et exporter des données", "Import": "Importer", - "Import Invidious data": "Importer des données Invidious", - "Import YouTube subscriptions": "Importer des abonnements YouTube", + "Import Invidious data": "Importer des données Invidious au format JSON", + "Import YouTube subscriptions": "Importer des abonnements YouTube/OPML", "Import FreeTube subscriptions (.db)": "Importer des abonnements FreeTube (.db)", "Import NewPipe subscriptions (.json)": "Importer des abonnements NewPipe (.json)", "Import NewPipe data (.zip)": "Importer des données NewPipe (.zip)", From 926825877318ca59dc6501fca1f545a79c08d94b Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 22 Feb 2022 00:05:23 +0100 Subject: [PATCH 063/106] Update Croatian translation Co-authored-by: Milo Ivir --- locales/hr.json | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/locales/hr.json b/locales/hr.json index 2f5d3bcf..1de3fa79 100644 --- a/locales/hr.json +++ b/locales/hr.json @@ -21,15 +21,15 @@ "No": "Ne", "Import and Export Data": "Uvezi i izvezi podatke", "Import": "Uvezi", - "Import Invidious data": "Uvezi Invidious podatke", - "Import YouTube subscriptions": "Uvezi YouTube pretplate", + "Import Invidious data": "Uvezi Invidious JSON podatke", + "Import YouTube subscriptions": "Uvezi YouTube/OPML pretplate", "Import FreeTube subscriptions (.db)": "Uvezi FreeTube pretplate (.db)", "Import NewPipe subscriptions (.json)": "Uvezi NewPipe pretplate (.json)", "Import NewPipe data (.zip)": "Uvezi NewPipe podatke (.zip)", "Export": "Izvezi", "Export subscriptions as OPML": "Izvezi pretplate kao OPML", "Export subscriptions as OPML (for NewPipe & FreeTube)": "Izvezi pretplate kao OPML (za NewPipe i FreeTube)", - "Export data as JSON": "Izvezi podatke kao JSON", + "Export data as JSON": "Izvezi Invidious podatke kao JSON", "Delete account?": "Izbrisati račun?", "History": "Povijest", "An alternative front-end to YouTube": "Alternativa za YouTube", @@ -66,7 +66,7 @@ "preferences_related_videos_label": "Prikaži povezana videa: ", "preferences_annotations_label": "Standardno prikaži napomene: ", "preferences_extend_desc_label": "Automatski proširi opis videa: ", - "preferences_vr_mode_label": "Interaktivna videa od 360 stupnjeva: ", + "preferences_vr_mode_label": "Interaktivna videa od 360 stupnjeva (zahtijeva WebGL): ", "preferences_category_visual": "Postavke prikaza", "preferences_player_style_label": "Stil playera: ", "Dark mode: ": "Tamni modus: ", @@ -453,5 +453,28 @@ "crash_page_switch_instance": "pokušaj koristiti jednu drugu instancu", "crash_page_read_the_faq": "pročitaj Često postavljena pitanja (ČPP)", "crash_page_search_issue": "pretraži postojeće probleme na Github-u", - "crash_page_report_issue": "Ako ništa od gore navedenog ne pomaže, prijavi novi problem na GitHub-u (po mogućnosti na engleskom) i uključi sljedeći tekst u poruku (NEMOJ prevoditi taj tekst):" + "crash_page_report_issue": "Ako ništa od gore navedenog ne pomaže, prijavi novi problem na GitHub-u (po mogućnosti na engleskom) i uključi sljedeći tekst u poruku (NEMOJ prevoditi taj tekst):", + "English (United Kingdom)": "Engleski (Ujedinjeno Kraljevstvo)", + "English (United States)": "Engleski (Sjedinjene Američke Države)", + "Cantonese (Hong Kong)": "Kantonski (Hong Kong)", + "Chinese": "Kineski", + "Chinese (Taiwan)": "Kineski (Tajvan)", + "Dutch (auto-generated)": "Nizozemski (automatski generiran)", + "French (auto-generated)": "Francuski (automatski generiran)", + "Indonesian (auto-generated)": "Indonezijski (automatski generiran)", + "Interlingue": "Interlingua", + "Japanese (auto-generated)": "Japanski (automatski generiran)", + "Russian (auto-generated)": "Ruski (automatski generiran)", + "Turkish (auto-generated)": "Turski (automatski generiran)", + "Vietnamese (auto-generated)": "Vijetnamski (automatski generiran)", + "Spanish (Spain)": "Španjolski (Španjolska)", + "Italian (auto-generated)": "Talijanski (automatski generiran)", + "Portuguese (Brazil)": "Portugalski (Brazil)", + "Spanish (Mexico)": "Španjolski (Meksiko)", + "German (auto-generated)": "Njemački (automatski generiran)", + "Chinese (China)": "Kineski (Kina)", + "Chinese (Hong Kong)": "Kineski (Hong Kong)", + "Korean (auto-generated)": "Korejski (automatski generiran)", + "Portuguese (auto-generated)": "Portugalski (automatski generiran)", + "Spanish (auto-generated)": "Španjolski (automatski generiran)" } From dfee375b9817b3e6a55787a26e36b9b3c86944f1 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Tue, 22 Feb 2022 00:05:23 +0100 Subject: [PATCH 064/106] Update Greek translation Co-authored-by: THANOS SIOURDAKIS --- locales/el.json | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/locales/el.json b/locales/el.json index b33fc02f..36fc695b 100644 --- a/locales/el.json +++ b/locales/el.json @@ -21,15 +21,15 @@ "No": "Όχι", "Import and Export Data": "Εισαγωγή και Εξαγωγή Δεδομένων", "Import": "Εισαγωγή", - "Import Invidious data": "Εισαγωγή δεδομένων Invidious", - "Import YouTube subscriptions": "Εισαγωγή συνδρομών YouTube", + "Import Invidious data": "Εsαγωγή δεδομένων Invidious JSON", + "Import YouTube subscriptions": "Εισαγωγή συνδρομών YouTube/OPML", "Import FreeTube subscriptions (.db)": "Εισαγωγή συνδρομών FreeTube (.db)", "Import NewPipe subscriptions (.json)": "Εισαγωγή συνδρομών NewPipe (.json)", "Import NewPipe data (.zip)": "Εισαγωγή δεδομένων NewPipe (.zip)", "Export": "Εξαγωγή", "Export subscriptions as OPML": "Εξαγωγή συνδρομών ως OPML", "Export subscriptions as OPML (for NewPipe & FreeTube)": "Εξαγωγή συνδρομών ως OPML (για NewPipe & FreeTube)", - "Export data as JSON": "Εξαγωγή δεδομένων ως JSON", + "Export data as JSON": "Εξαγωγή δεδομένων Invidious ως JSON", "Delete account?": "Διαγραφή λογαριασμού;", "History": "Ιστορικό", "An alternative front-end to YouTube": "Μία εναλλακτική πλατφόρμα για το YouTube", @@ -419,7 +419,34 @@ "Search": "Αναζήτηση", "hdr": "HDR", "preferences_extend_desc_label": "Αυτόματη επέκταση της περιγραφής του βίντεο: ", - "preferences_vr_mode_label": "Διαδραστικά βίντεο 360 μοιρών: ", + "preferences_vr_mode_label": "Διαδραστικά βίντεο 360 μοιρών (απαιτεί WebGL): ", "Show less": "Εμφάνιση λιγότερων", - "footer_source_code": "Πηγαίος κώδικας" + "footer_source_code": "Πηγαίος κώδικας", + "Chinese (Taiwan)": "Κινέζικα (Ταϊβάν)", + "Portuguese (Brazil)": "Πορτογαλικά (Βραζιλία)", + "German (auto-generated)": "Γερμανικά (αυτόματη παραγωγή)", + "Korean (auto-generated)": "Κορεάτικα (αυτόματη παραγωγή)", + "Russian (auto-generated)": "Ρωσικά (αυτόματη παραγωγή)", + "Spanish (auto-generated)": "Ισπανικά (αυτόματη παραγωγή)", + "Vietnamese (auto-generated)": "Βιετναμέζικα (αυτόματη παραγωγή)", + "English (United Kingdom)": "Αγγλικά (Ηνωμένο Βασίλειο)", + "English (United States)": "Αγγλικά (Ηνωμένων Πολιτειών)", + "Cantonese (Hong Kong)": "Καντονέζικα (Χονγκ Κονγκ)", + "Chinese": "Κινεζικά", + "Chinese (China)": "Κινέζικα (Κίνα)", + "Chinese (Hong Kong)": "Κινεζικά (Χονγκ Κονγκ)", + "Dutch (auto-generated)": "Ολαμδικά (αυτόματη παραγωγή)", + "French (auto-generated)": "Γαλλικά (αυτόματη παραγωγή)", + "Interlingue": "Ιντερλίνγκουα", + "Indonesian (auto-generated)": "Ινδονησιακά (αυτόματη παραγωγή)", + "Italian (auto-generated)": "Ιταλικά (αυτόματη παραγωγή)", + "Japanese (auto-generated)": "Ιαπωνικά (αυτόματη παραγωγή)", + "Portuguese (auto-generated)": "Πορτογαλικά (αυτόματη παραγωγή)", + "Spanish (Mexico)": "Ισπανικά (Μεξικό)", + "Spanish (Spain)": "Ισπανικά (Ισπανία)", + "Turkish (auto-generated)": "Τούρκικα (αυτόματη παραγωγή)", + "none": "κανένα", + "videoinfo_youTube_embed_link": "Ενσωμάτωση", + "videoinfo_invidious_embed_link": "Σύνδεσμος Ενσωμάτωσης", + "show": "Μπάρα προόδου διαβάσματος" } From d77586d02d6b22a3568da501ab8cb22f87afdc41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9ry=20Mathieu=20=28Mathius=29?= Date: Tue, 22 Feb 2022 00:21:47 +0100 Subject: [PATCH 065/106] Remove extra space in shareOptions.embedCode of player script Follow lint indications : https://github.com/iv-org/invidious/pull/2912#discussion_r811367117 --- assets/js/player.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/player.js b/assets/js/player.js index 42f00ef7..eed26e5c 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -77,7 +77,7 @@ var shareOptions = { image: player_data.thumbnail, get embedCode() { return ""; + addCurrentTimeToURL(embed_url) + "' style='border:none;'>"; } }; From 36c7d4270b8bc46c555b92539628bbbe4f49cc7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9ry=20Mathieu=20=28Mathius=29?= Date: Tue, 22 Feb 2022 00:27:00 +0100 Subject: [PATCH 066/106] Lint conditional deletion of t in addCurrentTimeToURL inside player script Follow lint indications : https://github.com/iv-org/invidious/pull/2912#discussion_r811474927 --- assets/js/player.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/assets/js/player.js b/assets/js/player.js index eed26e5c..f0b616a0 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -60,9 +60,8 @@ function addCurrentTimeToURL(url) { var currentTime = Math.ceil(player.currentTime()); if (currentTime > 0) urlUsed.searchParams.set('t', currentTime); - else - if (urlUsed.searchParams.has('t')) - urlUsed.searchParams.delete('t'); + else if (urlUsed.searchParams.has('t')) + urlUsed.searchParams.delete('t'); return urlUsed; } From 31699468fc23b9bbfd607cb900cec7d65e69b8c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9ry=20Mathieu=20=28Mathius=29?= Date: Tue, 22 Feb 2022 00:44:36 +0100 Subject: [PATCH 067/106] Lint docs of addCurrentTimeToURL in player script Follow lint indications : https://github.com/iv-org/invidious/pull/2912#discussion_r811479583 --- assets/js/player.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/js/player.js b/assets/js/player.js index f0b616a0..a1a2cd16 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -51,7 +51,7 @@ var player = videojs('player', options); /** * Function for add time argument to url - * @param {String} url + * @param {String} url * @returns urlWithTimeArg */ function addCurrentTimeToURL(url) { From dfab62ce48ff1d2227d77c2fc61f7a4ea8da1988 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9ry=20Mathieu=20=28Mathius=29?= Date: Tue, 22 Feb 2022 00:46:26 +0100 Subject: [PATCH 068/106] Rename new property to channel_refresh_interval Follow indications : https://github.com/iv-org/invidious/pull/2915#discussion_r811373503 --- config/config.example.yml | 2 +- docker-compose.yml | 2 +- src/invidious/config.cr | 2 +- src/invidious/jobs/refresh_channels_job.cr | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/config.example.yml b/config/config.example.yml index 5d4cea28..9519f34a 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -320,7 +320,7 @@ channel_threads: 1 ## Accepted values: a valid time interval (hours:min:seconds) ## Default: 00:30:00 ## -channel_refresh_time: 00:30:00 +channel_refresh_interval: 00:30:00 ## ## Forcefully dump and re-download the entire list of uploaded diff --git a/docker-compose.yml b/docker-compose.yml index 964bb702..ab35a496 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,7 +25,7 @@ services: INVIDIOUS_CONFIG: | log_level: Info channel_threads: 1 - channel_refresh_time: 00:30:00 + channel_refresh_interval: 00:30:00 check_tables: true feed_threads: 1 db: diff --git a/src/invidious/config.cr b/src/invidious/config.cr index 9ffd2cd8..fc24c1e7 100644 --- a/src/invidious/config.cr +++ b/src/invidious/config.cr @@ -58,7 +58,7 @@ class Config property channel_threads : Int32 = 1 # Number of threads to use for crawling videos from channels (for updating subscriptions) @[YAML::Field(converter: TimeSpanConverter)] - property channel_refresh_time : Time::Span = 30.minutes # Time between two jobs for crawling videos from channels + property channel_refresh_interval : Time::Span = 30.minutes # Time between two jobs for crawling videos from channels property feed_threads : Int32 = 1 # Number of threads to use for updating feeds property output : String = "STDOUT" # Log file path or STDOUT property log_level : LogLevel = LogLevel::Info # Default log level, valid YAML values are ints and strings, see src/invidious/helpers/logger.cr diff --git a/src/invidious/jobs/refresh_channels_job.cr b/src/invidious/jobs/refresh_channels_job.cr index 3e04d1cd..92681408 100644 --- a/src/invidious/jobs/refresh_channels_job.cr +++ b/src/invidious/jobs/refresh_channels_job.cr @@ -58,8 +58,8 @@ class Invidious::Jobs::RefreshChannelsJob < Invidious::Jobs::BaseJob end end - LOGGER.debug("RefreshChannelsJob: Done, sleeping for #{CONFIG.channel_refresh_time}") - sleep CONFIG.channel_refresh_time + LOGGER.debug("RefreshChannelsJob: Done, sleeping for #{CONFIG.channel_refresh_interval}") + sleep CONFIG.channel_refresh_interval Fiber.yield end end From 5d2f2690e287d4fc1275dd9d3dc283e607117c0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9ry=20Mathieu=20=28Mathius=29?= Date: Tue, 22 Feb 2022 00:59:55 +0100 Subject: [PATCH 069/106] Lint config properties Follow lint indications : https://github.com/iv-org/invidious/pull/2915#discussion_r811375584 --- src/invidious/config.cr | 81 +++++++++++++++++++++++++++-------------- 1 file changed, 54 insertions(+), 27 deletions(-) diff --git a/src/invidious/config.cr b/src/invidious/config.cr index fc24c1e7..158a05cc 100644 --- a/src/invidious/config.cr +++ b/src/invidious/config.cr @@ -56,22 +56,35 @@ end class Config include YAML::Serializable - property channel_threads : Int32 = 1 # Number of threads to use for crawling videos from channels (for updating subscriptions) + # Number of threads to use for crawling videos from channels (for updating subscriptions) + property channel_threads : Int32 = 1 + # Time between two jobs for crawling videos from channels @[YAML::Field(converter: TimeSpanConverter)] - property channel_refresh_interval : Time::Span = 30.minutes # Time between two jobs for crawling videos from channels - property feed_threads : Int32 = 1 # Number of threads to use for updating feeds - property output : String = "STDOUT" # Log file path or STDOUT - property log_level : LogLevel = LogLevel::Info # Default log level, valid YAML values are ints and strings, see src/invidious/helpers/logger.cr - property db : DBConfig? = nil # Database configuration with separate parameters (username, hostname, etc) + property channel_refresh_interval : Time::Span = 30.minutes + # Number of threads to use for updating feeds + property feed_threads : Int32 = 1 + # Log file path or STDOUT + property output : String = "STDOUT" + # Default log level, valid YAML values are ints and strings, see src/invidious/helpers/logger.cr + property log_level : LogLevel = LogLevel::Info + # Database configuration with separate parameters (username, hostname, etc) + property db : DBConfig? = nil + # Database configuration using 12-Factor "Database URL" syntax @[YAML::Field(converter: Preferences::URIConverter)] - property database_url : URI = URI.parse("") # Database configuration using 12-Factor "Database URL" syntax - property decrypt_polling : Bool = true # Use polling to keep decryption function up to date - property full_refresh : Bool = false # Used for crawling channels: threads should check all videos uploaded by a channel - property https_only : Bool? # Used to tell Invidious it is behind a proxy, so links to resources should be https:// - property hmac_key : String? # HMAC signing key for CSRF tokens and verifying pubsub subscriptions - property domain : String? # Domain to be used for links to resources on the site where an absolute URL is required - property use_pubsub_feeds : Bool | Int32 = false # Subscribe to channels using PubSubHubbub (requires domain, hmac_key) + property database_url : URI = URI.parse("") + # Use polling to keep decryption function up to date + property decrypt_polling : Bool = true + # Used for crawling channels: threads should check all videos uploaded by a channel + property full_refresh : Bool = false + # Used to tell Invidious it is behind a proxy, so links to resources should be https:// + property https_only : Bool? + # HMAC signing key for CSRF tokens and verifying pubsub subscriptions + property hmac_key : String? + # Domain to be used for links to resources on the site where an absolute URL is required + property domain : String? + # Subscribe to channels using PubSubHubbub (requires domain, hmac_key) + property use_pubsub_feeds : Bool | Int32 = false property popular_enabled : Bool = true property captcha_enabled : Bool = true property login_enabled : Bool = true @@ -80,28 +93,42 @@ class Config property admins : Array(String) = [] of String property external_port : Int32? = nil property default_user_preferences : ConfigPreferences = ConfigPreferences.from_yaml("") - property dmca_content : Array(String) = [] of String # For compliance with DMCA, disables download widget using list of video IDs - property check_tables : Bool = false # Check table integrity, automatically try to add any missing columns, create tables, etc. - property cache_annotations : Bool = false # Cache annotations requested from IA, will not cache empty annotations or annotations that only contain cards - property banner : String? = nil # Optional banner to be displayed along top of page for announcements, etc. - property hsts : Bool? = true # Enables 'Strict-Transport-Security'. Ensure that `domain` and all subdomains are served securely - property disable_proxy : Bool? | Array(String)? = false # Disable proxying server-wide: options: 'dash', 'livestreams', 'downloads', 'local' + # For compliance with DMCA, disables download widget using list of video IDs + property dmca_content : Array(String) = [] of String + # Check table integrity, automatically try to add any missing columns, create tables, etc. + property check_tables : Bool = false + # Cache annotations requested from IA, will not cache empty annotations or annotations that only contain cards + property cache_annotations : Bool = false + # Optional banner to be displayed along top of page for announcements, etc. + property banner : String? = nil + # Enables 'Strict-Transport-Security'. Ensure that `domain` and all subdomains are served securely + property hsts : Bool? = true + # Disable proxying server-wide: options: 'dash', 'livestreams', 'downloads', 'local' + property disable_proxy : Bool? | Array(String)? = false # URL to the modified source code to be easily AGPL compliant # Will display in the footer, next to the main source code link property modified_source_code_url : String? = nil + # Connect to YouTube over 'ipv6', 'ipv4'. Will sometimes resolve fix issues with rate-limiting (see https://github.com/ytdl-org/youtube-dl/issues/21729) @[YAML::Field(converter: Preferences::FamilyConverter)] - property force_resolve : Socket::Family = Socket::Family::UNSPEC # Connect to YouTube over 'ipv6', 'ipv4'. Will sometimes resolve fix issues with rate-limiting (see https://github.com/ytdl-org/youtube-dl/issues/21729) - property port : Int32 = 3000 # Port to listen for connections (overridden by command line argument) - property host_binding : String = "0.0.0.0" # Host to bind (overridden by command line argument) - property pool_size : Int32 = 100 # Pool size for HTTP requests to youtube.com and ytimg.com (each domain has a separate pool of `pool_size`) - property use_quic : Bool = false # Use quic transport for youtube api + property force_resolve : Socket::Family = Socket::Family::UNSPEC + # Port to listen for connections (overridden by command line argument) + property port : Int32 = 3000 + # Host to bind (overridden by command line argument) + property host_binding : String = "0.0.0.0" + # Pool size for HTTP requests to youtube.com and ytimg.com (each domain has a separate pool of `pool_size`) + property pool_size : Int32 = 100 + # Use quic transport for youtube api + property use_quic : Bool = false + # Saved cookies in "name1=value1; name2=value2..." format @[YAML::Field(converter: Preferences::StringToCookies)] - property cookies : HTTP::Cookies = HTTP::Cookies.new # Saved cookies in "name1=value1; name2=value2..." format - property captcha_key : String? = nil # Key for Anti-Captcha - property captcha_api_url : String = "https://api.anti-captcha.com" # API URL for Anti-Captcha + property cookies : HTTP::Cookies = HTTP::Cookies.new + # Key for Anti-Captcha + property captcha_key : String? = nil + # API URL for Anti-Captcha + property captcha_api_url : String = "https://api.anti-captcha.com" def disabled?(option) case disabled = CONFIG.disable_proxy From f109d812a1d8ea92a4ebdeb7ce03ad93bcbd9a91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9ry=20Mathieu=20=28Mathius=29?= Date: Tue, 22 Feb 2022 01:34:19 +0100 Subject: [PATCH 070/106] Move TimeSpanConverter with another Converters Follow indications : https://github.com/iv-org/invidious/pull/2915#discussion_r811373953 --- src/invidious/config.cr | 2 +- src/invidious/helpers/utils.cr | 14 -------------- src/invidious/user/preferences.cr | 16 +++++++++++++++- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/invidious/config.cr b/src/invidious/config.cr index 158a05cc..cf705d21 100644 --- a/src/invidious/config.cr +++ b/src/invidious/config.cr @@ -59,7 +59,7 @@ class Config # Number of threads to use for crawling videos from channels (for updating subscriptions) property channel_threads : Int32 = 1 # Time between two jobs for crawling videos from channels - @[YAML::Field(converter: TimeSpanConverter)] + @[YAML::Field(converter: Preferences::TimeSpanConverter)] property channel_refresh_interval : Time::Span = 30.minutes # Number of threads to use for updating feeds property feed_threads : Int32 = 1 diff --git a/src/invidious/helpers/utils.cr b/src/invidious/helpers/utils.cr index 2702c5e9..22575c57 100644 --- a/src/invidious/helpers/utils.cr +++ b/src/invidious/helpers/utils.cr @@ -18,20 +18,6 @@ def elapsed_text(elapsed) "#{(millis * 1000).round(2)}µs" end -module TimeSpanConverter - def self.to_yaml(value : Time::Span, yaml : YAML::Nodes::Builder) - return yaml.scalar recode_length_seconds(value.total_seconds.to_i32) - end - - def self.from_yaml(ctx : YAML::ParseContext, node : YAML::Nodes::Node) : Time::Span - if node.is_a?(YAML::Nodes::Scalar) - return decode_time_span(node.value) - else - node.raise "Expected scalar, not #{node.class}" - end - end -end - def decode_time_span(string : String) : Time::Span time_span = string.gsub(/[^0-9:]/, "") return Time::Span.new(seconds: 0) if time_span.empty? diff --git a/src/invidious/user/preferences.cr b/src/invidious/user/preferences.cr index bf7ea401..c01bdd82 100644 --- a/src/invidious/user/preferences.cr +++ b/src/invidious/user/preferences.cr @@ -256,4 +256,18 @@ struct Preferences cookies end end -end + + module TimeSpanConverter + def self.to_yaml(value : Time::Span, yaml : YAML::Nodes::Builder) + return yaml.scalar recode_length_seconds(value.total_seconds.to_i32) + end + + def self.from_yaml(ctx : YAML::ParseContext, node : YAML::Nodes::Node) : Time::Span + if node.is_a?(YAML::Nodes::Scalar) + return decode_time_span(node.value) + else + node.raise "Expected scalar, not #{node.class}" + end + end + end +end \ No newline at end of file From fd0ac3a6719b3d6280ce2e784ad370c8d10a6129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9ry=20Mathieu=20=28Mathius=29?= Date: Tue, 22 Feb 2022 01:35:35 +0100 Subject: [PATCH 071/106] Update management of channel_refresh_interval Follow indications: https://github.com/iv-org/invidious/pull/2915#discussion_r811373503 --- config/config.example.yml | 6 +++--- docker-compose.yml | 2 +- src/invidious/helpers/utils.cr | 18 ++++++++++++++++++ src/invidious/user/preferences.cr | 6 +++--- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/config/config.example.yml b/config/config.example.yml index 9519f34a..a6440e3d 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -317,10 +317,10 @@ channel_threads: 1 ## ## Time between two jobs for crawling videos from channels ## -## Accepted values: a valid time interval (hours:min:seconds) -## Default: 00:30:00 +## Accepted values: a valid time interval (like 1h30m or 90min) +## Default: 30m ## -channel_refresh_interval: 00:30:00 +channel_refresh_interval: 30min ## ## Forcefully dump and re-download the entire list of uploaded diff --git a/docker-compose.yml b/docker-compose.yml index ab35a496..4fdad921 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,7 +25,7 @@ services: INVIDIOUS_CONFIG: | log_level: Info channel_threads: 1 - channel_refresh_interval: 00:30:00 + channel_refresh_interval: 30m check_tables: true feed_threads: 1 db: diff --git a/src/invidious/helpers/utils.cr b/src/invidious/helpers/utils.cr index 22575c57..53f64f4e 100644 --- a/src/invidious/helpers/utils.cr +++ b/src/invidious/helpers/utils.cr @@ -53,6 +53,24 @@ def recode_length_seconds(time : Int32) : String end end +def decode_interval(string : String) : Time::Span + rawMinutes = string.try &.to_i32? + + if !rawMinutes + hours = /(?\d+)h/.match(string).try &.["hours"].try &.to_i32 + hours ||= 0 + + minutes = /(?\d+)m(?!s)/.match(string).try &.["minutes"].try &.to_i32 + minutes ||= 0 + + time = Time::Span.new(hours: hours, minutes: minutes) + else + time = Time::Span.new(minutes: rawMinutes) + end + + return time +end + def decode_time(string) time = string.try &.to_f? diff --git a/src/invidious/user/preferences.cr b/src/invidious/user/preferences.cr index c01bdd82..9eeed53f 100644 --- a/src/invidious/user/preferences.cr +++ b/src/invidious/user/preferences.cr @@ -259,15 +259,15 @@ struct Preferences module TimeSpanConverter def self.to_yaml(value : Time::Span, yaml : YAML::Nodes::Builder) - return yaml.scalar recode_length_seconds(value.total_seconds.to_i32) + return yaml.scalar value.total_minutes.to_i32 end def self.from_yaml(ctx : YAML::ParseContext, node : YAML::Nodes::Node) : Time::Span if node.is_a?(YAML::Nodes::Scalar) - return decode_time_span(node.value) + return decode_interval(node.value) else node.raise "Expected scalar, not #{node.class}" end end end -end \ No newline at end of file +end From 05c5d293ebdd07e5cad2481216659e54ef4058eb Mon Sep 17 00:00:00 2001 From: TheFrenchGhosty Date: Tue, 22 Feb 2022 01:54:36 +0100 Subject: [PATCH 072/106] Enhance the development compose file --- docker-compose.yml | 48 ++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c76c314c..3935edfb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,18 +1,6 @@ -version: '3' +version: "3" services: - postgres: - image: postgres:10 - restart: unless-stopped - volumes: - - postgresdata:/var/lib/postgresql/data - - ./config/sql:/config/sql - - ./docker/init-invidious-db.sh:/docker-entrypoint-initdb.d/init-invidious-db.sh - environment: - POSTGRES_DB: invidious - POSTGRES_PASSWORD: kemal - POSTGRES_USER: kemal - healthcheck: - test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"] + invidious: build: context: . @@ -21,27 +9,41 @@ services: ports: - "127.0.0.1:3000:3000" environment: - # Adapted from ./config/config.yml INVIDIOUS_CONFIG: | - channel_threads: 1 + # Please read the following file for a comprehensive list of all available + # configuration options and their associated syntax: + # https://github.com/iv-org/invidious/blob/master/config/config.example.yml check_tables: true - feed_threads: 1 db: + dbname: invidious user: kemal password: kemal - host: postgres + host: invidious-postgres port: 5432 - dbname: invidious - full_refresh: false - https_only: false - domain: + # https_only: false + # domain: + # external_port: healthcheck: test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/comments/jNQXAC9IVRw || exit 1 interval: 30s timeout: 5s retries: 2 depends_on: - - postgres + - invidious-postgres + + invidious-postgres: + image: postgres:14 + restart: unless-stopped + volumes: + - postgresdata:/var/lib/postgresql/data + - ./config/sql:/config/sql + - ./docker/init-invidious-db.sh:/docker-entrypoint-initdb.d/init-invidious-db.sh + environment: + POSTGRES_DB: invidious + POSTGRES_USER: kemal + POSTGRES_PASSWORD: kemal + healthcheck: + test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"] volumes: postgresdata: From 86cb68413db8e399cc0b6ae7aa612fd46a964d37 Mon Sep 17 00:00:00 2001 From: TheFrenchGhosty Date: Tue, 22 Feb 2022 02:11:44 +0100 Subject: [PATCH 073/106] Add a comment explaining that it builds an image from source --- docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker-compose.yml b/docker-compose.yml index 3935edfb..c2cde9f2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,3 +1,5 @@ +# This docker-compose file is made for development purpose and build an image from source, if you want to use Invidious in production, see the documentation. + version: "3" services: From 7ec88741a6db2f85abf31d5827a408bc7e1d456b Mon Sep 17 00:00:00 2001 From: TheFrenchGhosty Date: Tue, 22 Feb 2022 02:24:43 +0100 Subject: [PATCH 074/106] Fix YAML syntax --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index c2cde9f2..1008960e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,10 +11,10 @@ services: ports: - "127.0.0.1:3000:3000" environment: - INVIDIOUS_CONFIG: | # Please read the following file for a comprehensive list of all available # configuration options and their associated syntax: # https://github.com/iv-org/invidious/blob/master/config/config.example.yml + INVIDIOUS_CONFIG: | check_tables: true db: dbname: invidious From 385fe4be22cd8ec15b886178b9aa05c3e1273ed6 Mon Sep 17 00:00:00 2001 From: TheFrenchGhosty Date: Tue, 22 Feb 2022 02:43:25 +0100 Subject: [PATCH 075/106] Move to an Alpine-based Postgres image --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1008960e..93ff5b6d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -34,7 +34,7 @@ services: - invidious-postgres invidious-postgres: - image: postgres:14 + image: postgres:14-alpine restart: unless-stopped volumes: - postgresdata:/var/lib/postgresql/data From d90d34700641aa8af0fa718287f2f3daa140ed4f Mon Sep 17 00:00:00 2001 From: TheFrenchGhosty Date: Tue, 22 Feb 2022 02:55:42 +0100 Subject: [PATCH 076/106] Re-order the configs in the order of the config file + add statistics_enabled --- docker-compose.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 93ff5b6d..a5da3bb5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,16 +15,17 @@ services: # configuration options and their associated syntax: # https://github.com/iv-org/invidious/blob/master/config/config.example.yml INVIDIOUS_CONFIG: | - check_tables: true db: dbname: invidious user: kemal password: kemal host: invidious-postgres port: 5432 - # https_only: false - # domain: + check_tables: true # external_port: + # domain: + # https_only: false + # statistics_enabled: false healthcheck: test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/comments/jNQXAC9IVRw || exit 1 interval: 30s From 9e91fd524111e5633de391dc5328f8d68124606a Mon Sep 17 00:00:00 2001 From: TheFrenchGhosty Date: Tue, 22 Feb 2022 03:02:14 +0100 Subject: [PATCH 077/106] Enforce a container_name and rename the postgres container --- docker-compose.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index a5da3bb5..96e15105 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,7 @@ version: "3" services: invidious: + container_name: invidious build: context: . dockerfile: docker/Dockerfile @@ -19,7 +20,7 @@ services: dbname: invidious user: kemal password: kemal - host: invidious-postgres + host: invidious-db port: 5432 check_tables: true # external_port: @@ -32,9 +33,10 @@ services: timeout: 5s retries: 2 depends_on: - - invidious-postgres + - invidious-db - invidious-postgres: + invidious-db: + container_name: invidious-db image: postgres:14-alpine restart: unless-stopped volumes: From afa3eff313428ad5cb9783a12ce4884d207c11c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9ry=20Mathieu=20=28Mathius=29?= Date: Tue, 22 Feb 2022 08:07:50 +0100 Subject: [PATCH 078/106] Remove useless config inside docker-compose Follow lint indications : https://github.com/iv-org/invidious/pull/2915#discussion_r811501709 --- docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4fdad921..c76c314c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,9 +23,7 @@ services: environment: # Adapted from ./config/config.yml INVIDIOUS_CONFIG: | - log_level: Info channel_threads: 1 - channel_refresh_interval: 30m check_tables: true feed_threads: 1 db: From 555bb711c9bb16f8a78a8b71146367438b81918e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9ry=20Mathieu=20=28Mathius=29?= Date: Tue, 22 Feb 2022 08:17:50 +0100 Subject: [PATCH 079/106] Removal of changes to methods now unrelated to the issue Unrelated to the issue since the change in management of channel_refresh_interval Cf this remark : https://github.com/iv-org/invidious/pull/2915#discussion_r811373503 --- src/invidious/helpers/utils.cr | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/invidious/helpers/utils.cr b/src/invidious/helpers/utils.cr index 53f64f4e..c1dc17db 100644 --- a/src/invidious/helpers/utils.cr +++ b/src/invidious/helpers/utils.cr @@ -18,25 +18,23 @@ def elapsed_text(elapsed) "#{(millis * 1000).round(2)}µs" end -def decode_time_span(string : String) : Time::Span - time_span = string.gsub(/[^0-9:]/, "") - return Time::Span.new(seconds: 0) if time_span.empty? +def decode_length_seconds(string) + length_seconds = string.gsub(/[^0-9:]/, "") + return 0_i32 if length_seconds.empty? - time_span = time_span.split(":").map { |x| x.to_i? || 0 } - time_span = [0] * (3 - time_span.size) + time_span + length_seconds = length_seconds.split(":").map { |x| x.to_i? || 0 } + length_seconds = [0] * (3 - length_seconds.size) + length_seconds - return Time::Span.new( - hours: time_span[0], - minutes: time_span[1], - seconds: time_span[2] - ) + length_seconds = Time::Span.new( + hours: length_seconds[0], + minutes: length_seconds[1], + seconds: length_seconds[2] + ).total_seconds.to_i32 + + return length_seconds end -def decode_length_seconds(string : String) : Int32 - return decode_time_span(string).total_seconds.to_i32 -end - -def recode_length_seconds(time : Int32) : String +def recode_length_seconds(time) if time <= 0 return "" else From 5e3fcad1fbea83048e75536c4861154d6d592acb Mon Sep 17 00:00:00 2001 From: TheFrenchGhosty Date: Tue, 22 Feb 2022 15:36:15 +0100 Subject: [PATCH 080/106] Remove the enforced container_name following suggestions --- docker-compose.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 96e15105..38ee0a96 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,6 @@ version: "3" services: invidious: - container_name: invidious build: context: . dockerfile: docker/Dockerfile @@ -36,7 +35,6 @@ services: - invidious-db invidious-db: - container_name: invidious-db image: postgres:14-alpine restart: unless-stopped volumes: From dfcaed93eaf5afc91dec3b2f89cda841aefadbd0 Mon Sep 17 00:00:00 2001 From: TheFrenchGhosty Date: Tue, 22 Feb 2022 15:40:11 +0100 Subject: [PATCH 081/106] Enforce the source of the image (mostly for Podman compatibility) --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 38ee0a96..321920bb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,7 +35,7 @@ services: - invidious-db invidious-db: - image: postgres:14-alpine + image: docker.io/library/postgres:14-alpine restart: unless-stopped volumes: - postgresdata:/var/lib/postgresql/data From fe057c78737458132248e39b7ee7572b67f26918 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Tue, 22 Feb 2022 17:42:41 +0100 Subject: [PATCH 082/106] Make a function that builds the download widget's HTML --- src/invidious.cr | 2 + src/invidious/frontend/watch_page.cr | 108 +++++++++++++++++++++++++++ src/invidious/routes/watch.cr | 8 ++ src/invidious/views/watch.ecr | 36 +-------- 4 files changed, 119 insertions(+), 35 deletions(-) create mode 100644 src/invidious/frontend/watch_page.cr diff --git a/src/invidious.cr b/src/invidious.cr index d4878759..d742cd59 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -29,6 +29,8 @@ require "protodec/utils" require "./invidious/database/*" require "./invidious/helpers/*" require "./invidious/yt_backend/*" +require "./invidious/frontend/*" + require "./invidious/*" require "./invidious/channels/*" require "./invidious/user/*" diff --git a/src/invidious/frontend/watch_page.cr b/src/invidious/frontend/watch_page.cr new file mode 100644 index 00000000..d3a50705 --- /dev/null +++ b/src/invidious/frontend/watch_page.cr @@ -0,0 +1,108 @@ +module Invidious::Frontend::WatchPage + extend self + + # A handy structure to pass many elements at + # once to the download widget function + struct VideoAssets + getter full_videos : Array(Hash(String, JSON::Any)) + getter video_streams : Array(Hash(String, JSON::Any)) + getter audio_streams : Array(Hash(String, JSON::Any)) + getter captions : Array(Caption) + + def initialize( + @full_videos, + @video_streams, + @audio_streams, + @captions + ) + end + end + + def download_widget(locale : String, video : Video, video_assets : VideoAssets) : String + if CONFIG.disabled?("downloads") + return "

#{translate(locale, "Download is disabled.")}

" + end + + return String.build(4000) do |str| + str << "" + str << '\n' + + str << "\t
\n" + + str << "\t\t\n" + + # TODO: remove inline style + str << "\t\t\n" + str << "\t
\n" + + str << "\t\n" + + str << "\n" + end + end +end diff --git a/src/invidious/routes/watch.cr b/src/invidious/routes/watch.cr index 42bc4219..c34ce715 100644 --- a/src/invidious/routes/watch.cr +++ b/src/invidious/routes/watch.cr @@ -189,6 +189,14 @@ module Invidious::Routes::Watch return env.redirect url end + # Structure used for the download widget + video_assets = Invidious::Frontend::WatchPage::VideoAssets.new( + full_videos: fmt_stream, + video_streams: video_streams, + audio_streams: audio_streams, + captions: video.captions + ) + templated "watch" end diff --git a/src/invidious/views/watch.ecr b/src/invidious/views/watch.ecr index 2e0aee99..0e4af3ab 100644 --- a/src/invidious/views/watch.ecr +++ b/src/invidious/views/watch.ecr @@ -168,41 +168,7 @@ we're going to need to do it here in order to allow for translations. <% end %> <% end %> - <% if CONFIG.dmca_content.includes?(video.id) || CONFIG.disabled?("downloads") %> -

<%= translate(locale, "Download is disabled.") %>

- <% else %> -
-
- - -
- - -
- <% end %> + <%= Invidious::Frontend::WatchPage.download_widget(locale, video, video_assets) %>

<%= number_with_separator(video.views) %>

<%= number_with_separator(video.likes) %>

From a9d2d2211a777699672519933d50b1f61a570a42 Mon Sep 17 00:00:00 2001 From: TheFrenchGhosty <47571719+TheFrenchGhosty@users.noreply.github.com> Date: Tue, 22 Feb 2022 17:31:45 +0000 Subject: [PATCH 083/106] Apply suggestion Co-authored-by: Samantaz Fox --- docker-compose.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 321920bb..4205792e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,8 @@ -# This docker-compose file is made for development purpose and build an image from source, if you want to use Invidious in production, see the documentation. +# Warning: This docker-compose file is made for development purposes. +# Using it will build an image from the locally cloned repository. +# +# If you want to use Invidious in production, see the docker-compose.yml file provided +# in the installation documentation: https://docs.invidious.io/Installation.md version: "3" services: From b58b0440d6bd314f1e9831f7c3924d8f6ea75b10 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Tue, 22 Feb 2022 19:44:41 +0100 Subject: [PATCH 084/106] Fix captions regex --- src/invidious/routes/api/v1/videos.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/invidious/routes/api/v1/videos.cr b/src/invidious/routes/api/v1/videos.cr index 2b23d2ad..2a4911db 100644 --- a/src/invidious/routes/api/v1/videos.cr +++ b/src/invidious/routes/api/v1/videos.cr @@ -136,7 +136,7 @@ module Invidious::Routes::API::V1::Videos # # See: https://github.com/iv-org/invidious/issues/2391 webvtt = YT_POOL.client &.get("#{url}&format=vtt").body - .gsub(/([0-9:.]+ --> [0-9:.]+).+/, "\\1") + .gsub(/([0-9:.]{12} --> [0-9:.]{12}).+/, "\\1") end if title = env.params.query["title"]? From e60a1836fe077fa00fbfc8e8f9e4401b7151192c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9ry=20Mathieu=20=28Mathius=29?= Date: Tue, 22 Feb 2022 23:19:59 +0100 Subject: [PATCH 085/106] Lint config.example.yml and config.cr Follow lint indications : - https://github.com/iv-org/invidious/pull/2915#discussion_r812396203 - https://github.com/iv-org/invidious/pull/2915#discussion_r812396807 --- config/config.example.yml | 7 ++++--- src/invidious/config.cr | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/config/config.example.yml b/config/config.example.yml index a6440e3d..866e8944 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -315,12 +315,13 @@ https_only: false channel_threads: 1 ## -## Time between two jobs for crawling videos from channels +## Time interval between two executions of the job that crawls +## channel videos (subscriptions update). ## -## Accepted values: a valid time interval (like 1h30m or 90min) +## Accepted values: a valid time interval (like 1h30m or 90m) ## Default: 30m ## -channel_refresh_interval: 30min +#channel_refresh_interval: 30m ## ## Forcefully dump and re-download the entire list of uploaded diff --git a/src/invidious/config.cr b/src/invidious/config.cr index cf705d21..bebb9ae5 100644 --- a/src/invidious/config.cr +++ b/src/invidious/config.cr @@ -58,7 +58,7 @@ class Config # Number of threads to use for crawling videos from channels (for updating subscriptions) property channel_threads : Int32 = 1 - # Time between two jobs for crawling videos from channels + # Time interval between two executions of the job that crawls channel videos (subscriptions update). @[YAML::Field(converter: Preferences::TimeSpanConverter)] property channel_refresh_interval : Time::Span = 30.minutes # Number of threads to use for updating feeds From 253256bf37f6eb86f3ad39035a659b44fb0cf327 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Wed, 23 Feb 2022 00:18:48 +0100 Subject: [PATCH 086/106] Clean make help Forgot to mute the echo commands :X --- Makefile | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index 7f56d722..7d09f39c 100644 --- a/Makefile +++ b/Makefile @@ -89,28 +89,28 @@ distclean: clean # ----------------------- help: - echo "Targets available in this Makefile:" - echo "" - echo "get-libs Fetch Crystal libraries" - echo "invidious Build Invidious" - echo "run Launch Invidious" - echo "" - echo "format Run the Crystal formatter" - echo "test Run tests" - echo "verify Just make sure that the code compiles, but without" - echo " generating any binaries. Useful to search for errors" - echo "" - echo "clean Remove build artifacts" - echo "distclean Remove build artifacts and libraries" - echo "" - echo "" - echo "Build options available for this Makefile:" - echo "" - echo "RELEASE Make a release build (Default: 1)" - echo "STATIC Link libraries statically (Default: 0)" - echo "" - echo "DISABLE_QUIC Disable support for QUIC (Default: 0)" - echo "NO_DBG_SYMBOLS Strip debug symbols (Default: 0)" + @echo "Targets available in this Makefile:" + @echo "" + @echo " get-libs Fetch Crystal libraries" + @echo " invidious Build Invidious" + @echo " run Launch Invidious" + @echo "" + @echo " format Run the Crystal formatter" + @echo " test Run tests" + @echo " verify Just make sure that the code compiles, but without" + @echo " generating any binaries. Useful to search for errors" + @echo "" + @echo " clean Remove build artifacts" + @echo " distclean Remove build artifacts and libraries" + @echo "" + @echo "" + @echo "Build options available for this Makefile:" + @echo "" + @echo " RELEASE Make a release build (Default: 1)" + @echo " STATIC Link libraries statically (Default: 0)" + @echo "" + @echo " DISABLE_QUIC Disable support for QUIC (Default: 0)" + @echo " NO_DBG_SYMBOLS Strip debug symbols (Default: 0)" From cc59de0c9310b31b002e836ffe055dfaf5cfafd7 Mon Sep 17 00:00:00 2001 From: matthewmcgarvey Date: Tue, 22 Feb 2022 23:04:30 -0600 Subject: [PATCH 087/106] Extract live endpoints to route --- src/invidious.cr | 41 ++++-------------------------------- src/invidious/routes/live.cr | 34 ++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 37 deletions(-) create mode 100644 src/invidious/routes/live.cr diff --git a/src/invidious.cr b/src/invidious.cr index d4878759..24f49930 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -399,6 +399,10 @@ Invidious::Routing.get "/s_p/:id/:name", Invidious::Routes::Images, :s_p_image Invidious::Routing.get "/yts/img/:name", Invidious::Routes::Images, :yts_image Invidious::Routing.get "/vi/:id/:name", Invidious::Routes::Images, :thumbnails +Invidious::Routing.get "/channel/:ucid/live", Invidious::Routes::Live, :check +Invidious::Routing.get "/user/:user/live", Invidious::Routes::Live, :check +Invidious::Routing.get "/c/:user/live", Invidious::Routes::Live, :check + # API routes (macro) define_v1_api_routes() @@ -406,43 +410,6 @@ define_v1_api_routes() define_api_manifest_routes() define_video_playback_routes() -# Channels - -{"/channel/:ucid/live", "/user/:user/live", "/c/:user/live"}.each do |route| - get route do |env| - locale = env.get("preferences").as(Preferences).locale - - # Appears to be a bug in routing, having several routes configured - # as `/a/:a`, `/b/:a`, `/c/:a` results in 404 - value = env.request.resource.split("/")[2] - body = "" - {"channel", "user", "c"}.each do |type| - response = YT_POOL.client &.get("/#{type}/#{value}/live?disable_polymer=1") - if response.status_code == 200 - body = response.body - end - end - - video_id = body.match(/'VIDEO_ID': "(?[a-zA-Z0-9_-]{11})"/).try &.["id"]? - if video_id - params = [] of String - env.params.query.each do |k, v| - params << "#{k}=#{v}" - end - params = params.join("&") - - url = "/watch?v=#{video_id}" - if !params.empty? - url += "&#{params}" - end - - env.redirect url - else - env.redirect "/channel/#{value}" - end - end -end - # Authenticated endpoints # The notification APIs can't be extracted yet diff --git a/src/invidious/routes/live.cr b/src/invidious/routes/live.cr new file mode 100644 index 00000000..e55111ce --- /dev/null +++ b/src/invidious/routes/live.cr @@ -0,0 +1,34 @@ +module Invidious::Routes::Live + def self.check(env) + locale = env.get("preferences").as(Preferences).locale + + # Appears to be a bug in routing, having several routes configured + # as `/a/:a`, `/b/:a`, `/c/:a` results in 404 + value = env.request.resource.split("/")[2] + body = "" + {"channel", "user", "c"}.each do |type| + response = YT_POOL.client &.get("/#{type}/#{value}/live?disable_polymer=1") + if response.status_code == 200 + body = response.body + end + end + + video_id = body.match(/'VIDEO_ID': "(?[a-zA-Z0-9_-]{11})"/).try &.["id"]? + if video_id + params = [] of String + env.params.query.each do |k, v| + params << "#{k}=#{v}" + end + params = params.join("&") + + url = "/watch?v=#{video_id}" + if !params.empty? + url += "&#{params}" + end + + env.redirect url + else + env.redirect "/channel/#{value}" + end + end +end From 3b1837a99b7abfcc3950605fa7e99f7e0c92ba4d Mon Sep 17 00:00:00 2001 From: matthewmcgarvey Date: Tue, 22 Feb 2022 23:20:09 -0600 Subject: [PATCH 088/106] Move remaining routes to new structure --- src/invidious.cr | 51 +++----------------- src/invidious/routes/api/v1/authenticated.cr | 18 +++++++ src/invidious/routes/captcha.cr | 8 +++ src/invidious/routes/playlists.cr | 11 +++++ 4 files changed, 44 insertions(+), 44 deletions(-) create mode 100644 src/invidious/routes/captcha.cr diff --git a/src/invidious.cr b/src/invidious.cr index 24f49930..dc055e59 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -154,8 +154,8 @@ if CONFIG.popular_enabled Invidious::Jobs.register Invidious::Jobs::PullPopularVideosJob.new(PG_DB) end -connection_channel = Channel({Bool, Channel(PQ::Notification)}).new(32) -Invidious::Jobs.register Invidious::Jobs::NotificationJob.new(connection_channel, CONFIG.database_url) +CONNECTION_CHANNEL = Channel({Bool, Channel(PQ::Notification)}).new(32) +Invidious::Jobs.register Invidious::Jobs::NotificationJob.new(CONNECTION_CHANNEL, CONFIG.database_url) Invidious::Jobs.start_all @@ -360,6 +360,7 @@ end Invidious::Routing.post "/playlist_ajax", Invidious::Routes::Playlists, :playlist_ajax Invidious::Routing.get "/playlist", Invidious::Routes::Playlists, :show Invidious::Routing.get "/mix", Invidious::Routes::Playlists, :mix + Invidious::Routing.get "/watch_videos", Invidious::Routes::Playlists, :watch_videos Invidious::Routing.get "/opensearch.xml", Invidious::Routes::Search, :opensearch Invidious::Routing.get "/results", Invidious::Routes::Search, :results @@ -390,6 +391,8 @@ end Invidious::Routing.post "/subscription_ajax", Invidious::Routes::Subscriptions, :toggle_subscription Invidious::Routing.get "/subscription_manager", Invidious::Routes::Subscriptions, :subscription_manager + + Invidious::Routing.get "/Captcha", Invidious::Routes::Captcha, :get {% end %} Invidious::Routing.get "/ggpht/*", Invidious::Routes::Images, :ggpht @@ -405,53 +408,13 @@ Invidious::Routing.get "/c/:user/live", Invidious::Routes::Live, :check # API routes (macro) define_v1_api_routes() +Invidious::Routing.get "/api/v1/auth/notifications", Invidious::Routes::API::V1::Authenticated, :notifications_get +Invidious::Routing.post "/api/v1/auth/notifications", Invidious::Routes::API::V1::Authenticated, :notifications_post # Video playback (macros) define_api_manifest_routes() define_video_playback_routes() -# Authenticated endpoints - -# The notification APIs can't be extracted yet -# due to the requirement of the `connection_channel` -# used by the `NotificationJob` - -get "/api/v1/auth/notifications" do |env| - env.response.content_type = "text/event-stream" - - topics = env.params.query["topics"]?.try &.split(",").uniq.first(1000) - topics ||= [] of String - - create_notification_stream(env, topics, connection_channel) -end - -post "/api/v1/auth/notifications" do |env| - env.response.content_type = "text/event-stream" - - topics = env.params.body["topics"]?.try &.split(",").uniq.first(1000) - topics ||= [] of String - - create_notification_stream(env, topics, connection_channel) -end - -get "/Captcha" do |env| - headers = HTTP::Headers{":authority" => "accounts.google.com"} - response = YT_POOL.client &.get(env.request.resource, headers) - env.response.headers["Content-Type"] = response.headers["Content-Type"] - response.body -end - -# Undocumented, creates anonymous playlist with specified 'video_ids', max 50 videos -get "/watch_videos" do |env| - response = YT_POOL.client &.get(env.request.resource) - if url = response.headers["Location"]? - url = URI.parse(url).request_target - next env.redirect url - end - - env.response.status_code = response.status_code -end - error 404 do |env| if md = env.request.path.match(/^\/(?([a-zA-Z0-9_-]{11})|(\w+))$/) item = md["id"] diff --git a/src/invidious/routes/api/v1/authenticated.cr b/src/invidious/routes/api/v1/authenticated.cr index c27853ca..6ced4edb 100644 --- a/src/invidious/routes/api/v1/authenticated.cr +++ b/src/invidious/routes/api/v1/authenticated.cr @@ -397,4 +397,22 @@ module Invidious::Routes::API::V1::Authenticated env.response.status_code = 204 end + + def self.notifications_get(env) + env.response.content_type = "text/event-stream" + + topics = env.params.query["topics"]?.try &.split(",").uniq.first(1000) + topics ||= [] of String + + create_notification_stream(env, topics, CONNECTION_CHANNEL) + end + + def self.notifications_post(env) + env.response.content_type = "text/event-stream" + + topics = env.params.body["topics"]?.try &.split(",").uniq.first(1000) + topics ||= [] of String + + create_notification_stream(env, topics, CONNECTION_CHANNEL) + end end diff --git a/src/invidious/routes/captcha.cr b/src/invidious/routes/captcha.cr new file mode 100644 index 00000000..a1d95a4f --- /dev/null +++ b/src/invidious/routes/captcha.cr @@ -0,0 +1,8 @@ +module Invidious::Routes::Captcha + def self.get(env) + headers = HTTP::Headers{":authority" => "accounts.google.com"} + response = YT_POOL.client &.get(env.request.resource, headers) + env.response.headers["Content-Type"] = response.headers["Content-Type"] + response.body + end +end diff --git a/src/invidious/routes/playlists.cr b/src/invidious/routes/playlists.cr index 1ed29e79..dbeb4f97 100644 --- a/src/invidious/routes/playlists.cr +++ b/src/invidious/routes/playlists.cr @@ -443,4 +443,15 @@ module Invidious::Routes::Playlists templated "mix" end + + # Undocumented, creates anonymous playlist with specified 'video_ids', max 50 videos + def self.watch_videos(env) + response = YT_POOL.client &.get(env.request.resource) + if url = response.headers["Location"]? + url = URI.parse(url).request_target + return env.redirect url + end + + env.response.status_code = response.status_code + end end From 2f335b3d2c2805d5de1b0204920c439b87f5646b Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Tue, 22 Feb 2022 18:11:11 +0100 Subject: [PATCH 089/106] Use a dedicated endpoind for downloads This allows us to not pass file name ("title") in the form data and to enforce some sanity checks --- src/invidious.cr | 3 ++ src/invidious/frontend/watch_page.cr | 20 +++++------ src/invidious/routes/api/v1/videos.cr | 6 +++- src/invidious/routes/video_playback.cr | 36 +++++++++---------- src/invidious/routes/watch.cr | 48 ++++++++++++++++++++++++++ 5 files changed, 82 insertions(+), 31 deletions(-) diff --git a/src/invidious.cr b/src/invidious.cr index d742cd59..d1c3ac83 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -236,6 +236,7 @@ before_all do |env| "/api/manifest/", "/videoplayback", "/latest_version", + "/download", }.any? { |r| env.request.resource.starts_with? r } if env.request.cookies.has_key? "SID" @@ -348,6 +349,8 @@ end Invidious::Routing.get "/e/:id", Invidious::Routes::Watch, :redirect Invidious::Routing.get "/redirect", Invidious::Routes::Misc, :cross_instance_redirect + Invidious::Routing.post "/download", Invidious::Routes::Watch, :download + Invidious::Routing.get "/embed/", Invidious::Routes::Embed, :redirect Invidious::Routing.get "/embed/:id", Invidious::Routes::Embed, :show diff --git a/src/invidious/frontend/watch_page.cr b/src/invidious/frontend/watch_page.cr index d3a50705..80b67641 100644 --- a/src/invidious/frontend/watch_page.cr +++ b/src/invidious/frontend/watch_page.cr @@ -26,12 +26,16 @@ module Invidious::Frontend::WatchPage return String.build(4000) do |str| str << "" str << '\n' + # Hidden inputs for video id and title + str << "\n" + str << "\n" + str << "\t
\n" str << "\t\t
+
+ + checked<% end %>> +
+
checked<% end %>> From 8da336b7aa201abea73b4b7844318ad323c6cd62 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Wed, 23 Feb 2022 16:42:34 +0100 Subject: [PATCH 091/106] Move the "watch history" checkbox under the "user" section --- src/invidious/views/user/preferences.ecr | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/invidious/views/user/preferences.ecr b/src/invidious/views/user/preferences.ecr index 1e16c5ec..a584cedb 100644 --- a/src/invidious/views/user/preferences.ecr +++ b/src/invidious/views/user/preferences.ecr @@ -22,11 +22,6 @@ checked<% end %>>
-
- - checked<% end %>> -
-
checked<% end %>> @@ -211,6 +206,11 @@ <% if env.get? "user" %> <%= translate(locale, "preferences_category_subscription") %> +
+ + checked<% end %>> +
+
checked<% end %>> From 60828870701fda890357ac6b9e91202ae24229a6 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Wed, 23 Feb 2022 16:43:59 +0100 Subject: [PATCH 092/106] Add missing '_label' suffix to translation identifier --- locales/en-US.json | 2 +- src/invidious/views/user/preferences.ecr | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/locales/en-US.json b/locales/en-US.json index 61e7840c..1335d384 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -65,7 +65,7 @@ "preferences_continue_autoplay_label": "Autoplay next video: ", "preferences_listen_label": "Listen by default: ", "preferences_local_label": "Proxy videos: ", - "preferences_watch_history": "Enable watch history: ", + "preferences_watch_history_label": "Enable watch history: ", "preferences_speed_label": "Default speed: ", "preferences_quality_label": "Preferred video quality: ", "preferences_quality_option_dash": "DASH (adaptative quality)", diff --git a/src/invidious/views/user/preferences.ecr b/src/invidious/views/user/preferences.ecr index a584cedb..dbb5e9db 100644 --- a/src/invidious/views/user/preferences.ecr +++ b/src/invidious/views/user/preferences.ecr @@ -207,7 +207,7 @@ <%= translate(locale, "preferences_category_subscription") %>
- + checked<% end %>>
From 16530ac6de4579201191314dafece81b7c38472e Mon Sep 17 00:00:00 2001 From: TheFrenchGhosty Date: Wed, 23 Feb 2022 21:01:12 +0100 Subject: [PATCH 093/106] Move back to a Debian-based Postgres image --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4205792e..cd1df4ff 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -39,7 +39,7 @@ services: - invidious-db invidious-db: - image: docker.io/library/postgres:14-alpine + image: docker.io/library/postgres:14 restart: unless-stopped volumes: - postgresdata:/var/lib/postgresql/data From d8bb75be635406b415f7fc114e69ef0f77bedf6f Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Wed, 23 Feb 2022 21:50:30 +0100 Subject: [PATCH 094/106] Document 'extend_desc' in config.example.yml Thanks to "Le Jester" on Matrix for noticing that it was missing! --- config/config.example.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/config/config.example.yml b/config/config.example.yml index 59cb486b..e9f0e8f1 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -847,3 +847,13 @@ default_user_preferences: ## Default: false ## #automatic_instance_redirect: false + + ## + ## Show the entire video description by default (when set to 'false', + ## only the first few lines of the description are shown and a + ## "show more" button allows to expand it). + ## + ## Accepted values: true, false + ## Default: false + ## + #extend_desc: false From 25c079fdedc39615a63259ed91768fbc2e2ffe93 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Wed, 23 Feb 2022 23:57:45 +0100 Subject: [PATCH 095/106] Update Spanish translation Co-authored-by: Hosted Weblate Co-authored-by: Jorge Maldonado Ventura --- locales/es.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/locales/es.json b/locales/es.json index 24f8dbdf..fbdb13ac 100644 --- a/locales/es.json +++ b/locales/es.json @@ -458,5 +458,6 @@ "Chinese (China)": "Chino (China)", "Korean (auto-generated)": "Coreano (generados automáticamente)", "Spanish (Mexico)": "Español (Méjico)", - "Spanish (auto-generated)": "Español (generados automáticamente)" + "Spanish (auto-generated)": "Español (generados automáticamente)", + "preferences_watch_history_label": "Habilitar historial de reproducciones: " } From ab7580c0da44071842a3d863192b25fb3c19e1b6 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Wed, 23 Feb 2022 23:57:45 +0100 Subject: [PATCH 096/106] Update Polish translation Co-authored-by: Hosted Weblate Co-authored-by: Tsuki --- locales/pl.json | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/locales/pl.json b/locales/pl.json index 5c4667f0..0f4e0927 100644 --- a/locales/pl.json +++ b/locales/pl.json @@ -21,15 +21,15 @@ "No": "Nie", "Import and Export Data": "Import i eksport danych", "Import": "Import", - "Import Invidious data": "Importuj dane Invidious", - "Import YouTube subscriptions": "Importuj subskrybcje z YouTube", + "Import Invidious data": "Importuj dane JSON Invidious", + "Import YouTube subscriptions": "Importuj subskrybcje z YouTube/OPML", "Import FreeTube subscriptions (.db)": "Importuj subskrybcje z FreeTube (.db)", "Import NewPipe subscriptions (.json)": "Importuj subskrybcje z NewPipe (.json)", "Import NewPipe data (.zip)": "Importuj dane NewPipe (.zip)", "Export": "Eksport", "Export subscriptions as OPML": "Eksportuj subskrybcje jako OPML", "Export subscriptions as OPML (for NewPipe & FreeTube)": "Eksportuj subskrybcje jako OPML (dla NewPipe i FreeTube)", - "Export data as JSON": "Eksportuj dane jako JSON", + "Export data as JSON": "Eksportuj dane Invidious jako JSON", "Delete account?": "Usunąć konto?", "History": "Historia", "An alternative front-end to YouTube": "Alternatywny front-end dla YouTube", @@ -66,7 +66,7 @@ "preferences_related_videos_label": "Pokaż powiązane filmy? ", "preferences_annotations_label": "Domyślnie pokazuj adnotacje: ", "preferences_extend_desc_label": "Automatycznie rozwijaj opisy filmów: ", - "preferences_vr_mode_label": "Interaktywne filmy 360 stopni: ", + "preferences_vr_mode_label": "Interaktywne filmy 360 stopni (wymaga WebGL): ", "preferences_category_visual": "Preferencje Wizualne", "preferences_player_style_label": "Styl odtwarzacza: ", "Dark mode: ": "Ciemny motyw: ", @@ -446,12 +446,35 @@ "Video unavailable": "Film niedostępny", "preferences_save_player_pos_label": "Zapisz pozycję odtwarzania: ", "preferences_region_label": "Region zawartości: ", - "Released under the AGPLv3 on Github.": "Wydane na licencji AGPLv3 na Github'ie.", + "Released under the AGPLv3 on Github.": "Wydany na licencji AGPLv3 na Github.", "short": "Krótkie (< 4 minutes)", "long": "Długie (> 20 minutes)", "footer_documentation": "Dokumentacja", "footer_source_code": "Kod źródłowy", "footer_modfied_source_code": "Zmodyfikowany Kod źródłowy", "footer_original_source_code": "Oryginalny kod źródłowy", - "adminprefs_modified_source_code_url_label": "Adres URL do repozytorium z zmodyfikowanym kodem źródłowym" + "adminprefs_modified_source_code_url_label": "Adres URL do repozytorium z zmodyfikowanym kodem źródłowym", + "English (United Kingdom)": "angielski (Wielka Brytania)", + "English (United States)": "angielski (Stany Zjednoczone)", + "Cantonese (Hong Kong)": "kantoński (Hong Kong)", + "Chinese": "chiński", + "Chinese (China)": "chiński (Chiny)", + "Chinese (Hong Kong)": "chiński (Hong Kong)", + "Chinese (Taiwan)": "chiński (Tajwan)", + "Dutch (auto-generated)": "niderlandzki (wygenerowany automatycznie)", + "French (auto-generated)": "francuski (wygenerowany automatycznie)", + "German (auto-generated)": "niemiecki (wygenerowany automatycznie)", + "Indonesian (auto-generated)": "indonezyjski (wygenerowany automatycznie)", + "Interlingue": "interlingue", + "Italian (auto-generated)": "włoski (wygenerowany automatycznie)", + "Korean (auto-generated)": "koreański (wygenerowany automatycznie)", + "Spanish (auto-generated)": "hiszpański (wygenerowany automatycznie)", + "Spanish (Mexico)": "hiszpański (Meksyk)", + "Spanish (Spain)": "hiszpański (Hiszpania)", + "Turkish (auto-generated)": "turecki (wygenerowany automatycznie)", + "Vietnamese (auto-generated)": "wietnamski (wygenerowany automatycznie)", + "Japanese (auto-generated)": "japoński (wygenerowany automatycznie)", + "Russian (auto-generated)": "rosyjski (wygenerowany automatycznie)", + "Portuguese (auto-generated)": "portugalski (wygenerowany automatycznie)", + "Portuguese (Brazil)": "portugalski (Brazylia)" } From 4c3529f3d56dec482238c17973ddc69ac93c998f Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Wed, 23 Feb 2022 23:57:45 +0100 Subject: [PATCH 097/106] Update Turkish translation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Hosted Weblate Co-authored-by: Oğuz Ersen --- locales/tr.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/locales/tr.json b/locales/tr.json index 65648fd7..094728fa 100644 --- a/locales/tr.json +++ b/locales/tr.json @@ -460,5 +460,6 @@ "German (auto-generated)": "Almanca (otomatik oluşturuldu)", "Portuguese (auto-generated)": "Portekizce (otomatik oluşturuldu)", "Spanish (Spain)": "İspanyolca (İspanya)", - "Vietnamese (auto-generated)": "Vietnamca (otomatik oluşturuldu)" + "Vietnamese (auto-generated)": "Vietnamca (otomatik oluşturuldu)", + "preferences_watch_history_label": "İzleme geçmişini etkinleştir: " } From 55b62f9fdefb7bb4925041d9a7f84df85c6003eb Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Wed, 23 Feb 2022 23:57:45 +0100 Subject: [PATCH 098/106] Update Icelandic translation Update translation files Updated by "Cleanup translation files" hook in Weblate. Co-authored-by: Hosted Weblate Co-authored-by: Samantaz Fox Translate-URL: https://hosted.weblate.org/projects/invidious/translations/ Translation: Invidious/Invidious Translations --- locales/is.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/locales/is.json b/locales/is.json index 8d565dae..99bd6574 100644 --- a/locales/is.json +++ b/locales/is.json @@ -55,7 +55,6 @@ "preferences_continue_autoplay_label": "Spila næst sjálfkrafa: ", "preferences_listen_label": "Hlusta sjálfgefið: ", "preferences_local_label": "Proxy myndbönd? ", - "preferences_watch_history": "Virkja áhorfssögu: ", "preferences_speed_label": "Sjálfgefinn hraði: ", "preferences_quality_label": "Æskilegt myndbands gæði: ", "preferences_volume_label": "Spilara hljóðstyrkur: ", @@ -319,5 +318,6 @@ "Videos": "Myndbönd", "Playlists": "Spilunarlistar", "Community": "Samfélag", - "Current version: ": "Núverandi útgáfa: " + "Current version: ": "Núverandi útgáfa: ", + "preferences_watch_history_label": "Virkja áhorfssögu: " } From 919413e2b90371d63d88c86305575c17cef6445d Mon Sep 17 00:00:00 2001 From: matthewmcgarvey Date: Wed, 23 Feb 2022 22:39:43 -0600 Subject: [PATCH 099/106] Move captcha endpoint into Login route --- src/invidious.cr | 2 -- src/invidious/routes/captcha.cr | 8 -------- src/invidious/routes/login.cr | 7 +++++++ src/invidious/routing.cr | 1 + 4 files changed, 8 insertions(+), 10 deletions(-) delete mode 100644 src/invidious/routes/captcha.cr diff --git a/src/invidious.cr b/src/invidious.cr index dc055e59..140a9f7b 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -391,8 +391,6 @@ end Invidious::Routing.post "/subscription_ajax", Invidious::Routes::Subscriptions, :toggle_subscription Invidious::Routing.get "/subscription_manager", Invidious::Routes::Subscriptions, :subscription_manager - - Invidious::Routing.get "/Captcha", Invidious::Routes::Captcha, :get {% end %} Invidious::Routing.get "/ggpht/*", Invidious::Routes::Images, :ggpht diff --git a/src/invidious/routes/captcha.cr b/src/invidious/routes/captcha.cr deleted file mode 100644 index a1d95a4f..00000000 --- a/src/invidious/routes/captcha.cr +++ /dev/null @@ -1,8 +0,0 @@ -module Invidious::Routes::Captcha - def self.get(env) - headers = HTTP::Headers{":authority" => "accounts.google.com"} - response = YT_POOL.client &.get(env.request.resource, headers) - env.response.headers["Content-Type"] = response.headers["Content-Type"] - response.body - end -end diff --git a/src/invidious/routes/login.cr b/src/invidious/routes/login.cr index 65b337d1..99fc13a2 100644 --- a/src/invidious/routes/login.cr +++ b/src/invidious/routes/login.cr @@ -481,4 +481,11 @@ module Invidious::Routes::Login env.redirect referer end + + def self.captcha(env) + headers = HTTP::Headers{":authority" => "accounts.google.com"} + response = YT_POOL.client &.get(env.request.resource, headers) + env.response.headers["Content-Type"] = response.headers["Content-Type"] + response.body + end end diff --git a/src/invidious/routing.cr b/src/invidious/routing.cr index 5efe1bd8..d539d891 100644 --- a/src/invidious/routing.cr +++ b/src/invidious/routing.cr @@ -15,6 +15,7 @@ macro define_user_routes Invidious::Routing.get "/login", Invidious::Routes::Login, :login_page Invidious::Routing.post "/login", Invidious::Routes::Login, :login Invidious::Routing.post "/signout", Invidious::Routes::Login, :signout + Invidious::Routing.get "/Captcha", Invidious::Routes::Login, :captcha # User preferences Invidious::Routing.get "/preferences", Invidious::Routes::PreferencesRoute, :show From e215a20a0ac3dd4a3141f842ec6dd90b54cb67c3 Mon Sep 17 00:00:00 2001 From: matthewmcgarvey Date: Wed, 23 Feb 2022 22:41:34 -0600 Subject: [PATCH 100/106] Move live endpoints into Channels route --- src/invidious.cr | 7 +++---- src/invidious/routes/channels.cr | 33 +++++++++++++++++++++++++++++++ src/invidious/routes/live.cr | 34 -------------------------------- 3 files changed, 36 insertions(+), 38 deletions(-) delete mode 100644 src/invidious/routes/live.cr diff --git a/src/invidious.cr b/src/invidious.cr index 140a9f7b..e32c1086 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -324,6 +324,9 @@ end Invidious::Routing.get "/channel/:ucid/playlists", Invidious::Routes::Channels, :playlists Invidious::Routing.get "/channel/:ucid/community", Invidious::Routes::Channels, :community Invidious::Routing.get "/channel/:ucid/about", Invidious::Routes::Channels, :about + Invidious::Routing.get "/channel/:ucid/live", Invidious::Routes::Channels, :live + Invidious::Routing.get "/user/:user/live", Invidious::Routes::Channels, :live + Invidious::Routing.get "/c/:user/live", Invidious::Routes::Channels, :live ["", "/videos", "/playlists", "/community", "/about"].each do |path| # /c/LinusTechTips @@ -400,10 +403,6 @@ Invidious::Routing.get "/s_p/:id/:name", Invidious::Routes::Images, :s_p_image Invidious::Routing.get "/yts/img/:name", Invidious::Routes::Images, :yts_image Invidious::Routing.get "/vi/:id/:name", Invidious::Routes::Images, :thumbnails -Invidious::Routing.get "/channel/:ucid/live", Invidious::Routes::Live, :check -Invidious::Routing.get "/user/:user/live", Invidious::Routes::Live, :check -Invidious::Routing.get "/c/:user/live", Invidious::Routes::Live, :check - # API routes (macro) define_v1_api_routes() Invidious::Routing.get "/api/v1/auth/notifications", Invidious::Routes::API::V1::Authenticated, :notifications_get diff --git a/src/invidious/routes/channels.cr b/src/invidious/routes/channels.cr index 6cb1e1f7..cd2e3323 100644 --- a/src/invidious/routes/channels.cr +++ b/src/invidious/routes/channels.cr @@ -147,6 +147,39 @@ module Invidious::Routes::Channels end end + def self.live(env) + locale = env.get("preferences").as(Preferences).locale + + # Appears to be a bug in routing, having several routes configured + # as `/a/:a`, `/b/:a`, `/c/:a` results in 404 + value = env.request.resource.split("/")[2] + body = "" + {"channel", "user", "c"}.each do |type| + response = YT_POOL.client &.get("/#{type}/#{value}/live?disable_polymer=1") + if response.status_code == 200 + body = response.body + end + end + + video_id = body.match(/'VIDEO_ID': "(?[a-zA-Z0-9_-]{11})"/).try &.["id"]? + if video_id + params = [] of String + env.params.query.each do |k, v| + params << "#{k}=#{v}" + end + params = params.join("&") + + url = "/watch?v=#{video_id}" + if !params.empty? + url += "&#{params}" + end + + env.redirect url + else + env.redirect "/channel/#{value}" + end + end + private def self.fetch_basic_information(env) locale = env.get("preferences").as(Preferences).locale diff --git a/src/invidious/routes/live.cr b/src/invidious/routes/live.cr deleted file mode 100644 index e55111ce..00000000 --- a/src/invidious/routes/live.cr +++ /dev/null @@ -1,34 +0,0 @@ -module Invidious::Routes::Live - def self.check(env) - locale = env.get("preferences").as(Preferences).locale - - # Appears to be a bug in routing, having several routes configured - # as `/a/:a`, `/b/:a`, `/c/:a` results in 404 - value = env.request.resource.split("/")[2] - body = "" - {"channel", "user", "c"}.each do |type| - response = YT_POOL.client &.get("/#{type}/#{value}/live?disable_polymer=1") - if response.status_code == 200 - body = response.body - end - end - - video_id = body.match(/'VIDEO_ID': "(?[a-zA-Z0-9_-]{11})"/).try &.["id"]? - if video_id - params = [] of String - env.params.query.each do |k, v| - params << "#{k}=#{v}" - end - params = params.join("&") - - url = "/watch?v=#{video_id}" - if !params.empty? - url += "&#{params}" - end - - env.redirect url - else - env.redirect "/channel/#{value}" - end - end -end From d5f43bae9222cd0ba8a418615272d3edd996a4a8 Mon Sep 17 00:00:00 2001 From: matthewmcgarvey Date: Wed, 23 Feb 2022 22:45:07 -0600 Subject: [PATCH 101/106] Combine notifications endpoints and move them --- src/invidious.cr | 2 -- src/invidious/routes/api/v1/authenticated.cr | 14 +++----------- src/invidious/routing.cr | 3 +++ 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/invidious.cr b/src/invidious.cr index e32c1086..db3921f6 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -405,8 +405,6 @@ Invidious::Routing.get "/vi/:id/:name", Invidious::Routes::Images, :thumbnails # API routes (macro) define_v1_api_routes() -Invidious::Routing.get "/api/v1/auth/notifications", Invidious::Routes::API::V1::Authenticated, :notifications_get -Invidious::Routing.post "/api/v1/auth/notifications", Invidious::Routes::API::V1::Authenticated, :notifications_post # Video playback (macros) define_api_manifest_routes() diff --git a/src/invidious/routes/api/v1/authenticated.cr b/src/invidious/routes/api/v1/authenticated.cr index 6ced4edb..b559a01a 100644 --- a/src/invidious/routes/api/v1/authenticated.cr +++ b/src/invidious/routes/api/v1/authenticated.cr @@ -398,19 +398,11 @@ module Invidious::Routes::API::V1::Authenticated env.response.status_code = 204 end - def self.notifications_get(env) + def self.notifications(env) env.response.content_type = "text/event-stream" - topics = env.params.query["topics"]?.try &.split(",").uniq.first(1000) - topics ||= [] of String - - create_notification_stream(env, topics, CONNECTION_CHANNEL) - end - - def self.notifications_post(env) - env.response.content_type = "text/event-stream" - - topics = env.params.body["topics"]?.try &.split(",").uniq.first(1000) + raw_topics = env.params.body["topics"]? || env.params.query["topics"]? + topics = raw_topics.try &.split(",").uniq.first(1000) topics ||= [] of String create_notification_stream(env, topics, CONNECTION_CHANNEL) diff --git a/src/invidious/routing.cr b/src/invidious/routing.cr index d539d891..bd72c577 100644 --- a/src/invidious/routing.cr +++ b/src/invidious/routing.cr @@ -96,6 +96,9 @@ macro define_v1_api_routes Invidious::Routing.post "/api/v1/auth/tokens/register", {{namespace}}::Authenticated, :register_token Invidious::Routing.post "/api/v1/auth/tokens/unregister", {{namespace}}::Authenticated, :unregister_token + Invidious::Routing.get "/api/v1/auth/notifications", {{namespace}}::Authenticated, :notifications + Invidious::Routing.post "/api/v1/auth/notifications", {{namespace}}::Authenticated, :notifications + # Misc Invidious::Routing.get "/api/v1/stats", {{namespace}}::Misc, :stats Invidious::Routing.get "/api/v1/playlists/:plid", {{namespace}}::Misc, :get_playlist From 004e37105106b980736aa026c65ae86c8dc8a828 Mon Sep 17 00:00:00 2001 From: Samantaz Fox Date: Thu, 24 Feb 2022 22:37:54 +0100 Subject: [PATCH 102/106] Don't double-encode file title --- src/invidious/routes/video_playback.cr | 4 +++- src/invidious/routes/watch.cr | 7 ++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/invidious/routes/video_playback.cr b/src/invidious/routes/video_playback.cr index df243945..3a92ef96 100644 --- a/src/invidious/routes/video_playback.cr +++ b/src/invidious/routes/video_playback.cr @@ -164,7 +164,9 @@ module Invidious::Routes::VideoPlayback if title = query_params["title"]? # https://blog.fastmail.com/2011/06/24/download-non-english-filenames/ - env.response.headers["Content-Disposition"] = "attachment; filename=\"#{URI.encode_www_form(title)}\"; filename*=UTF-8''#{URI.encode_www_form(title)}" + filename = URI.encode_www_form(title, space_to_plus: false) + header = "attachment; filename=\"#{filename}\"; filename*=UTF-8''#{filename}" + env.response.headers["Content-Disposition"] = header end if !resp.headers.includes_word?("Transfer-Encoding", "chunked") diff --git a/src/invidious/routes/watch.cr b/src/invidious/routes/watch.cr index 7688d2a8..94148bc0 100644 --- a/src/invidious/routes/watch.cr +++ b/src/invidious/routes/watch.cr @@ -304,12 +304,9 @@ module Invidious::Routes::Watch end download_widget = JSON.parse(selection) - extension = download_widget["ext"].as_s - filename = URI.encode_www_form( - "#{video_id}-#{title}.#{extension}", - space_to_plus: false - ) + extension = download_widget["ext"].as_s + filename = "#{video_id}-#{title}.#{extension}" # Pass form parameters as URL parameters for the handlers of both # /latest_version and /api/v1/captions. This avoids an un-necessary From c6df54a103a6eda3332902bc9c7b106dc3372fb0 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 24 Feb 2022 22:49:15 +0100 Subject: [PATCH 103/106] Update French translation Co-authored-by: Samantaz Fox --- locales/fr.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/locales/fr.json b/locales/fr.json index 41b672b2..96103580 100644 --- a/locales/fr.json +++ b/locales/fr.json @@ -39,7 +39,7 @@ "Export": "Exporter", "Export subscriptions as OPML": "Exporter les abonnements au format OPML", "Export subscriptions as OPML (for NewPipe & FreeTube)": "Exporter les abonnements au format OPML (pour NewPipe & FreeTube)", - "Export data as JSON": "Exporter les données au format JSON", + "Export data as JSON": "Exporter les données Invidious au format JSON", "Delete account?": "Êtes-vous sûr de vouloir supprimer votre compte ?", "History": "Historique", "An alternative front-end to YouTube": "Un front-end alternatif à YouTube", @@ -460,5 +460,6 @@ "Italian (auto-generated)": "Italien (auto-généré)", "Vietnamese (auto-generated)": "Vietnamien (auto-généré)", "Russian (auto-generated)": "Russe (auto-généré)", - "Spanish (Spain)": "Espagnol (Espagne)" + "Spanish (Spain)": "Espagnol (Espagne)", + "preferences_watch_history_label": "Activer l'historique de visionnage : " } From 56ee44ee090ba099973006d78114ebce2195e795 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 24 Feb 2022 22:49:16 +0100 Subject: [PATCH 104/106] Update Chinese (Simplified) translation Co-authored-by: Eric Co-authored-by: Hosted Weblate --- locales/zh-CN.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/locales/zh-CN.json b/locales/zh-CN.json index f21fe8da..4b760dd3 100644 --- a/locales/zh-CN.json +++ b/locales/zh-CN.json @@ -444,5 +444,6 @@ "Dutch (auto-generated)": "荷兰语 (自动生成)", "French (auto-generated)": "法语 (自动生成)", "Turkish (auto-generated)": "土耳其语 (自动生成)", - "Spanish (Spain)": "西班牙语 (西班牙)" + "Spanish (Spain)": "西班牙语 (西班牙)", + "preferences_watch_history_label": "启用观看历史: " } From a21c10e20997b5f68cb0a4568c18de0f948b5e88 Mon Sep 17 00:00:00 2001 From: Hosted Weblate Date: Thu, 24 Feb 2022 22:49:16 +0100 Subject: [PATCH 105/106] Update Chinese (Traditional) translation Co-authored-by: Hosted Weblate Co-authored-by: Jeff Huang --- locales/zh-TW.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/locales/zh-TW.json b/locales/zh-TW.json index 2fdb2036..84bd1dae 100644 --- a/locales/zh-TW.json +++ b/locales/zh-TW.json @@ -444,5 +444,6 @@ "Indonesian (auto-generated)": "印尼語(自動產生)", "Portuguese (Brazil)": "葡萄牙語(巴西)", "Japanese (auto-generated)": "日語(自動產生)", - "Portuguese (auto-generated)": "葡萄牙語(自動產生)" + "Portuguese (auto-generated)": "葡萄牙語(自動產生)", + "preferences_watch_history_label": "啟用觀看紀錄: " } From 7dcd5035c0592614365f8814629f90791cf359d8 Mon Sep 17 00:00:00 2001 From: TheFrenchGhosty Date: Fri, 25 Feb 2022 19:01:14 +0100 Subject: [PATCH 106/106] Fix the Dockerfile sed command (Closes #2938) --- docker/Dockerfile | 2 +- docker/Dockerfile.arm64 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index f336abcd..df35a179 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -42,7 +42,7 @@ RUN addgroup -g 1000 -S invidious && \ adduser -u 1000 -S invidious -G invidious COPY --chown=invidious ./config/config.* ./config/ RUN mv -n config/config.example.yml config/config.yml -RUN sed -i 's/host: \(127.0.0.1\|localhost\)/host: postgres/' config/config.yml +RUN sed -i 's/host: \(127.0.0.1\|localhost\)/host: invidious-db/' config/config.yml COPY ./config/sql/ ./config/sql/ COPY ./locales/ ./locales/ COPY --from=builder /invidious/assets ./assets/ diff --git a/docker/Dockerfile.arm64 b/docker/Dockerfile.arm64 index 686a9278..5f4d3793 100644 --- a/docker/Dockerfile.arm64 +++ b/docker/Dockerfile.arm64 @@ -41,7 +41,7 @@ RUN addgroup -g 1000 -S invidious && \ adduser -u 1000 -S invidious -G invidious COPY --chown=invidious ./config/config.* ./config/ RUN mv -n config/config.example.yml config/config.yml -RUN sed -i 's/host: \(127.0.0.1\|localhost\)/host: postgres/' config/config.yml +RUN sed -i 's/host: \(127.0.0.1\|localhost\)/host: invidious-db/' config/config.yml COPY ./config/sql/ ./config/sql/ COPY ./locales/ ./locales/ COPY --from=builder /invidious/assets ./assets/