diff --git a/Makefile b/Makefile index ef6c4e16..7f56d722 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 -Dskip_videojs_download \ + --no-codegen --progress --stats --error-trace # ----------------------- 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 == "/") { diff --git a/assets/js/player.js b/assets/js/player.js index a5ea08ec..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': @@ -612,16 +553,15 @@ 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; - 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': @@ -639,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); 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}} مشاهدة" } diff --git a/locales/en-US.json b/locales/en-US.json index f733f7db..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", @@ -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: ", @@ -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/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)" } 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)" } 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):" } 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)" } 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:" } 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" } 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)" } 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)": "西班牙语 (西班牙)" } 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)": "葡萄牙語(自動產生)" } diff --git a/src/invidious.cr b/src/invidious.cr index f4cae7ea..1ff70905 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? +{% 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. + # 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 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 # ------------------- 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 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" 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"]? 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 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", 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