Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

Remove multiple pet assets and their associated metadata from the Codex project, including Boba, Boxcat, Byte Bunny, Cache Capy, Cash Cuy, Crafternauta, Kebo, Noir Webling, Nukey, Pixel Panda, Prompt Penguin, Scoop, and Socksy. Additionally, delete the pet frame detection tool as it is no longer needed.

Tonho86ee13603aab
diff --git a/browser-extension/chrome/_locales/el/messages.json b/browser-extension/chrome/_locales/el/messages.json
index 3ad485d9..b54fb9fd 100644
--- a/browser-extension/chrome/_locales/el/messages.json
+++ b/browser-extension/chrome/_locales/el/messages.json
@@ -43,5 +43,56 @@
},
"error_launch_failed_detail": {
"message": "Βεβαιωθείτε ότι το OmniGet είναι εγκατεστημένο και δεν έχει αποκλειστεί από το σύστημά σας και δοκιμάστε ξανά."
- }
+ },
+ "popup_send_default": { "message": "Αποστολή στο OmniGet" },
+ "popup_send_audio": { "message": "Αποστολή ήχου" },
+ "popup_video_found_one": { "message": "Βρέθηκε βίντεο" },
+ "popup_videos_found": { "message": "Βρέθηκαν $count$ βίντεο", "placeholders": { "count": { "content": "$1" } } },
+ "popup_listening_title": { "message": "Ανίχνευση μέσων…" },
+ "popup_listening_hint": { "message": "Τα βίντεο και οι ήχοι θα εμφανίζονται εδώ καθώς οι σελίδες τα φορτώνουν." },
+ "popup_paused_title": { "message": "Η ανίχνευση μέσων σε παύση" },
+ "popup_paused_hint": { "message": "Ενεργοποίησε τον διακόπτη παραπάνω για ανίχνευση βίντεο σε αυτή τη σελίδα." },
+ "popup_send_all": { "message": "Αποστολή όλων ($count$ βίντεο)", "placeholders": { "count": { "content": "$1" } } },
+ "popup_detected_one": { "message": "1 βίντεο ανιχνεύθηκε" },
+ "popup_detected_many": { "message": "$count$ βίντεο ανιχνεύθηκαν", "placeholders": { "count": { "content": "$1" } } },
+ "popup_video_n": { "message": "Βίντεο $n$", "placeholders": { "n": { "content": "$1" } } },
+ "popup_kind_audio": { "message": "Ήχος" },
+ "popup_kind_video": { "message": "Βίντεο" },
+ "popup_download_aria": { "message": "Λήψη $name$", "placeholders": { "name": { "content": "$1" } } },
+ "popup_sending": { "message": "Αποστολή…" },
+ "popup_sent": { "message": "Στάλθηκε!" },
+ "popup_sending_n": { "message": "Αποστολή $count$ βίντεο…", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_n": { "message": "Στάλθηκαν $count$ βίντεο!", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_failed": { "message": "Στάλθηκαν $sent$, απέτυχαν $failed$", "placeholders": { "sent": { "content": "$1" }, "failed": { "content": "$2" } } },
+ "popup_not_running": { "message": "Το OmniGet δεν εκτελείται" },
+ "popup_try_again": { "message": "Δοκιμή ξανά" },
+ "popup_get_app": { "message": "Λήψη OmniGet" },
+ "popup_lbl_course": { "message": "Αποστολή μαθήματος στο OmniGet" },
+ "popup_lbl_playlist": { "message": "Αποστολή λίστας στο OmniGet" },
+ "popup_lbl_video": { "message": "Αποστολή βίντεο στο OmniGet" },
+ "popup_lbl_reel": { "message": "Αποστολή reel στο OmniGet" },
+ "popup_lbl_post": { "message": "Αποστολή ανάρτησης στο OmniGet" },
+ "popup_lbl_short": { "message": "Αποστολή short στο OmniGet" },
+ "popup_lbl_clip": { "message": "Αποστολή κλιπ στο OmniGet" },
+ "popup_lbl_image": { "message": "Αποστολή εικόνας στο OmniGet" },
+ "popup_lbl_audio": { "message": "Αποστολή ήχου στο OmniGet" },
+ "popup_lbl_profile": { "message": "Αποστολή προφίλ στο OmniGet" },
+ "popup_lbl_page": { "message": "Αποστολή σελίδας στο OmniGet" },
+ "popup_ck_saving": { "message": "Αποθήκευση cookies…" },
+ "popup_ck_saved": { "message": "Αποθηκεύτηκαν $count$ cookies", "placeholders": { "count": { "content": "$1" } } },
+ "popup_ck_btn": { "message": "Αποθήκευση cookies ιστότοπου" },
+ "popup_ck_meta": { "message": "$domain$ • $kind$", "placeholders": { "domain": { "content": "$1" }, "kind": { "content": "$2" } } },
+ "popup_ck_hint": { "message": "Στέλνει τα cookies αυτού του ιστότοπου στον διαχειριστή cookies του OmniGet." },
+ "popup_ckerr_no_url": { "message": "Καμία ενεργή καρτέλα" },
+ "popup_ckerr_invalid_url": { "message": "Η σελίδα δεν μπορεί να ελεγχθεί" },
+ "popup_ckerr_unsupported": { "message": "Μόνο σελίδες http/https" },
+ "popup_ckerr_no_api": { "message": "Το API cookies αποκλείστηκε" },
+ "popup_ckerr_no_cookies": { "message": "Χωρίς cookies για αυτόν τον ιστότοπο" },
+ "popup_ckerr_missing_token": { "message": "Σύνδεσε πρώτα το OmniGet" },
+ "popup_ckerr_missing_endpoint": { "message": "Το OmniGet δεν εντοπίστηκε" },
+ "popup_ckerr_fetch_failed": { "message": "Το OmniGet δεν εκτελείται" },
+ "popup_ckerr_unauthorized": { "message": "Μη έγκυρο διακριτικό σύνδεσης" },
+ "popup_ckerr_default": { "message": "Δεν ήταν δυνατή η αποθήκευση cookies" },
+ "popup_open_app_label": { "message": "Άνοιγμα εφαρμογής κατά τη λήψη" },
+ "popup_sniffer_label": { "message": "Ανίχνευση μέσων" }
}
diff --git a/browser-extension/chrome/_locales/en/messages.json b/browser-extension/chrome/_locales/en/messages.json
index 40360b69..6313816e 100644
--- a/browser-extension/chrome/_locales/en/messages.json
+++ b/browser-extension/chrome/_locales/en/messages.json
@@ -43,5 +43,56 @@
},
"error_launch_failed_detail": {
"message": "Check that OmniGet is installed and not blocked by your system, then try again."
- }
+ },
+ "popup_send_default": { "message": "Send to OmniGet" },
+ "popup_send_audio": { "message": "Send audio" },
+ "popup_video_found_one": { "message": "Video found" },
+ "popup_videos_found": { "message": "$count$ videos found", "placeholders": { "count": { "content": "$1" } } },
+ "popup_listening_title": { "message": "Listening for media…" },
+ "popup_listening_hint": { "message": "Videos and audio will appear here as pages load them." },
+ "popup_paused_title": { "message": "Media detection is paused" },
+ "popup_paused_hint": { "message": "Turn on the toggle above to detect videos on this page." },
+ "popup_send_all": { "message": "Send all ($count$ videos)", "placeholders": { "count": { "content": "$1" } } },
+ "popup_detected_one": { "message": "1 video detected" },
+ "popup_detected_many": { "message": "$count$ videos detected", "placeholders": { "count": { "content": "$1" } } },
+ "popup_video_n": { "message": "Video $n$", "placeholders": { "n": { "content": "$1" } } },
+ "popup_kind_audio": { "message": "Audio" },
+ "popup_kind_video": { "message": "Video" },
+ "popup_download_aria": { "message": "Download $name$", "placeholders": { "name": { "content": "$1" } } },
+ "popup_sending": { "message": "Sending…" },
+ "popup_sent": { "message": "Sent!" },
+ "popup_sending_n": { "message": "Sending $count$ videos…", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_n": { "message": "$count$ videos sent!", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_failed": { "message": "Sent $sent$, failed $failed$", "placeholders": { "sent": { "content": "$1" }, "failed": { "content": "$2" } } },
+ "popup_not_running": { "message": "OmniGet is not running" },
+ "popup_try_again": { "message": "Try again" },
+ "popup_get_app": { "message": "Get OmniGet" },
+ "popup_lbl_course": { "message": "Send course to OmniGet" },
+ "popup_lbl_playlist": { "message": "Send playlist to OmniGet" },
+ "popup_lbl_video": { "message": "Send video to OmniGet" },
+ "popup_lbl_reel": { "message": "Send reel to OmniGet" },
+ "popup_lbl_post": { "message": "Send post to OmniGet" },
+ "popup_lbl_short": { "message": "Send short to OmniGet" },
+ "popup_lbl_clip": { "message": "Send clip to OmniGet" },
+ "popup_lbl_image": { "message": "Send image to OmniGet" },
+ "popup_lbl_audio": { "message": "Send audio to OmniGet" },
+ "popup_lbl_profile": { "message": "Send profile to OmniGet" },
+ "popup_lbl_page": { "message": "Send page to OmniGet" },
+ "popup_ck_saving": { "message": "Saving cookies…" },
+ "popup_ck_saved": { "message": "$count$ cookies saved", "placeholders": { "count": { "content": "$1" } } },
+ "popup_ck_btn": { "message": "Save site cookies" },
+ "popup_ck_meta": { "message": "$domain$ • $kind$", "placeholders": { "domain": { "content": "$1" }, "kind": { "content": "$2" } } },
+ "popup_ck_hint": { "message": "Sends cookies of this site to OmniGet's cookie manager." },
+ "popup_ckerr_no_url": { "message": "No active tab" },
+ "popup_ckerr_invalid_url": { "message": "Page can't be inspected" },
+ "popup_ckerr_unsupported": { "message": "Only http/https pages" },
+ "popup_ckerr_no_api": { "message": "Cookies API blocked" },
+ "popup_ckerr_no_cookies": { "message": "No cookies for this site" },
+ "popup_ckerr_missing_token": { "message": "Pair OmniGet first" },
+ "popup_ckerr_missing_endpoint": { "message": "OmniGet not detected" },
+ "popup_ckerr_fetch_failed": { "message": "OmniGet isn't running" },
+ "popup_ckerr_unauthorized": { "message": "Bad pairing token" },
+ "popup_ckerr_default": { "message": "Couldn't save cookies" },
+ "popup_open_app_label": { "message": "Open app when downloading" },
+ "popup_sniffer_label": { "message": "Media detection" }
}
diff --git a/browser-extension/chrome/_locales/es/messages.json b/browser-extension/chrome/_locales/es/messages.json
new file mode 100644
index 00000000..ba0b334b
--- /dev/null
+++ b/browser-extension/chrome/_locales/es/messages.json
@@ -0,0 +1,98 @@
+{
+ "action_title_supported": {
+ "message": "Enviar esta página de medios a OmniGet"
+ },
+ "action_title_unsupported": {
+ "message": "No se detectaron medios compatibles en esta página"
+ },
+ "error_page_document_title": {
+ "message": "Extensión OmniGet"
+ },
+ "error_page_eyebrow": {
+ "message": "Extensión OmniGet"
+ },
+ "error_page_install_cta": {
+ "message": "Instalar OmniGet"
+ },
+ "error_page_open_extensions": {
+ "message": "Abrir extensiones de Chrome"
+ },
+ "error_host_missing_title": {
+ "message": "Abre OmniGet una vez para terminar la configuración de Chrome"
+ },
+ "error_host_missing_body": {
+ "message": "Chrome aún no pudo encontrar el puente de OmniGet en este equipo."
+ },
+ "error_host_missing_detail": {
+ "message": "Instala OmniGet si es necesario, luego abre la app de escritorio una vez y vuelve a hacer clic en la extensión."
+ },
+ "error_invalid_url_title": {
+ "message": "Esta URL de página no se puede enviar a OmniGet"
+ },
+ "error_invalid_url_body": {
+ "message": "La página actual no es una página de medios compatible con la extensión de OmniGet."
+ },
+ "error_invalid_url_detail": {
+ "message": "Inténtalo de nuevo desde una página de vídeo directo, reel, publicación, lista o curso."
+ },
+ "error_launch_failed_title": {
+ "message": "No se pudo iniciar OmniGet desde Chrome"
+ },
+ "error_launch_failed_body": {
+ "message": "La extensión se comunicó con el host nativo, pero la app de escritorio no se inició correctamente."
+ },
+ "error_launch_failed_detail": {
+ "message": "Comprueba que OmniGet esté instalado y no bloqueado por tu sistema, luego inténtalo de nuevo."
+ },
+ "popup_send_default": { "message": "Enviar a OmniGet" },
+ "popup_send_audio": { "message": "Enviar audio" },
+ "popup_video_found_one": { "message": "Vídeo encontrado" },
+ "popup_videos_found": { "message": "$count$ vídeos encontrados", "placeholders": { "count": { "content": "$1" } } },
+ "popup_listening_title": { "message": "Buscando medios…" },
+ "popup_listening_hint": { "message": "Los vídeos y audios aparecerán aquí a medida que las páginas los carguen." },
+ "popup_paused_title": { "message": "Detección de medios en pausa" },
+ "popup_paused_hint": { "message": "Activa el interruptor de arriba para detectar vídeos en esta página." },
+ "popup_send_all": { "message": "Enviar todo ($count$ vídeos)", "placeholders": { "count": { "content": "$1" } } },
+ "popup_detected_one": { "message": "1 vídeo detectado" },
+ "popup_detected_many": { "message": "$count$ vídeos detectados", "placeholders": { "count": { "content": "$1" } } },
+ "popup_video_n": { "message": "Vídeo $n$", "placeholders": { "n": { "content": "$1" } } },
+ "popup_kind_audio": { "message": "Audio" },
+ "popup_kind_video": { "message": "Vídeo" },
+ "popup_download_aria": { "message": "Descargar $name$", "placeholders": { "name": { "content": "$1" } } },
+ "popup_sending": { "message": "Enviando…" },
+ "popup_sent": { "message": "¡Enviado!" },
+ "popup_sending_n": { "message": "Enviando $count$ vídeos…", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_n": { "message": "¡$count$ vídeos enviados!", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_failed": { "message": "Enviados $sent$, fallaron $failed$", "placeholders": { "sent": { "content": "$1" }, "failed": { "content": "$2" } } },
+ "popup_not_running": { "message": "OmniGet no se está ejecutando" },
+ "popup_try_again": { "message": "Reintentar" },
+ "popup_get_app": { "message": "Obtener OmniGet" },
+ "popup_lbl_course": { "message": "Enviar curso a OmniGet" },
+ "popup_lbl_playlist": { "message": "Enviar lista a OmniGet" },
+ "popup_lbl_video": { "message": "Enviar vídeo a OmniGet" },
+ "popup_lbl_reel": { "message": "Enviar reel a OmniGet" },
+ "popup_lbl_post": { "message": "Enviar publicación a OmniGet" },
+ "popup_lbl_short": { "message": "Enviar short a OmniGet" },
+ "popup_lbl_clip": { "message": "Enviar clip a OmniGet" },
+ "popup_lbl_image": { "message": "Enviar imagen a OmniGet" },
+ "popup_lbl_audio": { "message": "Enviar audio a OmniGet" },
+ "popup_lbl_profile": { "message": "Enviar perfil a OmniGet" },
+ "popup_lbl_page": { "message": "Enviar página a OmniGet" },
+ "popup_ck_saving": { "message": "Guardando cookies…" },
+ "popup_ck_saved": { "message": "$count$ cookies guardadas", "placeholders": { "count": { "content": "$1" } } },
+ "popup_ck_btn": { "message": "Guardar cookies del sitio" },
+ "popup_ck_meta": { "message": "$domain$ • $kind$", "placeholders": { "domain": { "content": "$1" }, "kind": { "content": "$2" } } },
+ "popup_ck_hint": { "message": "Envía las cookies de este sitio al gestor de cookies de OmniGet." },
+ "popup_ckerr_no_url": { "message": "No hay pestaña activa" },
+ "popup_ckerr_invalid_url": { "message": "La página no se puede inspeccionar" },
+ "popup_ckerr_unsupported": { "message": "Solo páginas http/https" },
+ "popup_ckerr_no_api": { "message": "API de cookies bloqueada" },
+ "popup_ckerr_no_cookies": { "message": "Sin cookies para este sitio" },
+ "popup_ckerr_missing_token": { "message": "Vincula OmniGet primero" },
+ "popup_ckerr_missing_endpoint": { "message": "OmniGet no detectado" },
+ "popup_ckerr_fetch_failed": { "message": "OmniGet no se está ejecutando" },
+ "popup_ckerr_unauthorized": { "message": "Token de vinculación inválido" },
+ "popup_ckerr_default": { "message": "No se pudieron guardar las cookies" },
+ "popup_open_app_label": { "message": "Abrir la app al descargar" },
+ "popup_sniffer_label": { "message": "Detección de medios" }
+}
diff --git a/browser-extension/chrome/_locales/fr/messages.json b/browser-extension/chrome/_locales/fr/messages.json
index 6b8e6302..3e45bc2b 100644
--- a/browser-extension/chrome/_locales/fr/messages.json
+++ b/browser-extension/chrome/_locales/fr/messages.json
@@ -43,5 +43,56 @@
},
"error_launch_failed_detail": {
"message": "Vérifiez qu'OmniGet est installé et non bloqué par votre système, puis réessayez."
- }
+ },
+ "popup_send_default": { "message": "Envoyer vers OmniGet" },
+ "popup_send_audio": { "message": "Envoyer l'audio" },
+ "popup_video_found_one": { "message": "Vidéo trouvée" },
+ "popup_videos_found": { "message": "$count$ vidéos trouvées", "placeholders": { "count": { "content": "$1" } } },
+ "popup_listening_title": { "message": "Recherche de médias…" },
+ "popup_listening_hint": { "message": "Les vidéos et audios apparaîtront ici au fur et à mesure du chargement des pages." },
+ "popup_paused_title": { "message": "Détection de médias en pause" },
+ "popup_paused_hint": { "message": "Activez le bouton ci-dessus pour détecter les vidéos sur cette page." },
+ "popup_send_all": { "message": "Tout envoyer ($count$ vidéos)", "placeholders": { "count": { "content": "$1" } } },
+ "popup_detected_one": { "message": "1 vidéo détectée" },
+ "popup_detected_many": { "message": "$count$ vidéos détectées", "placeholders": { "count": { "content": "$1" } } },
+ "popup_video_n": { "message": "Vidéo $n$", "placeholders": { "n": { "content": "$1" } } },
+ "popup_kind_audio": { "message": "Audio" },
+ "popup_kind_video": { "message": "Vidéo" },
+ "popup_download_aria": { "message": "Télécharger $name$", "placeholders": { "name": { "content": "$1" } } },
+ "popup_sending": { "message": "Envoi…" },
+ "popup_sent": { "message": "Envoyé !" },
+ "popup_sending_n": { "message": "Envoi de $count$ vidéos…", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_n": { "message": "$count$ vidéos envoyées !", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_failed": { "message": "Envoyées $sent$, échouées $failed$", "placeholders": { "sent": { "content": "$1" }, "failed": { "content": "$2" } } },
+ "popup_not_running": { "message": "OmniGet n'est pas en cours d'exécution" },
+ "popup_try_again": { "message": "Réessayer" },
+ "popup_get_app": { "message": "Obtenir OmniGet" },
+ "popup_lbl_course": { "message": "Envoyer le cours vers OmniGet" },
+ "popup_lbl_playlist": { "message": "Envoyer la playlist vers OmniGet" },
+ "popup_lbl_video": { "message": "Envoyer la vidéo vers OmniGet" },
+ "popup_lbl_reel": { "message": "Envoyer le reel vers OmniGet" },
+ "popup_lbl_post": { "message": "Envoyer la publication vers OmniGet" },
+ "popup_lbl_short": { "message": "Envoyer le short vers OmniGet" },
+ "popup_lbl_clip": { "message": "Envoyer le clip vers OmniGet" },
+ "popup_lbl_image": { "message": "Envoyer l'image vers OmniGet" },
+ "popup_lbl_audio": { "message": "Envoyer l'audio vers OmniGet" },
+ "popup_lbl_profile": { "message": "Envoyer le profil vers OmniGet" },
+ "popup_lbl_page": { "message": "Envoyer la page vers OmniGet" },
+ "popup_ck_saving": { "message": "Enregistrement des cookies…" },
+ "popup_ck_saved": { "message": "$count$ cookies enregistrés", "placeholders": { "count": { "content": "$1" } } },
+ "popup_ck_btn": { "message": "Enregistrer les cookies du site" },
+ "popup_ck_meta": { "message": "$domain$ • $kind$", "placeholders": { "domain": { "content": "$1" }, "kind": { "content": "$2" } } },
+ "popup_ck_hint": { "message": "Envoie les cookies de ce site au gestionnaire de cookies d'OmniGet." },
+ "popup_ckerr_no_url": { "message": "Aucun onglet actif" },
+ "popup_ckerr_invalid_url": { "message": "La page ne peut pas être inspectée" },
+ "popup_ckerr_unsupported": { "message": "Pages http/https uniquement" },
+ "popup_ckerr_no_api": { "message": "API de cookies bloquée" },
+ "popup_ckerr_no_cookies": { "message": "Aucun cookie pour ce site" },
+ "popup_ckerr_missing_token": { "message": "Associez OmniGet d'abord" },
+ "popup_ckerr_missing_endpoint": { "message": "OmniGet non détecté" },
+ "popup_ckerr_fetch_failed": { "message": "OmniGet n'est pas en cours d'exécution" },
+ "popup_ckerr_unauthorized": { "message": "Jeton d'association invalide" },
+ "popup_ckerr_default": { "message": "Impossible d'enregistrer les cookies" },
+ "popup_open_app_label": { "message": "Ouvrir l'app au téléchargement" },
+ "popup_sniffer_label": { "message": "Détection de médias" }
}
diff --git a/browser-extension/chrome/_locales/it/messages.json b/browser-extension/chrome/_locales/it/messages.json
index ac286944..6feaafd6 100644
--- a/browser-extension/chrome/_locales/it/messages.json
+++ b/browser-extension/chrome/_locales/it/messages.json
@@ -43,5 +43,56 @@
},
"error_launch_failed_detail": {
"message": "Verifica che OmniGet sia installato e non bloccato dal sistema, poi riprova."
- }
+ },
+ "popup_send_default": { "message": "Invia a OmniGet" },
+ "popup_send_audio": { "message": "Invia audio" },
+ "popup_video_found_one": { "message": "Video trovato" },
+ "popup_videos_found": { "message": "$count$ video trovati", "placeholders": { "count": { "content": "$1" } } },
+ "popup_listening_title": { "message": "Ricerca di contenuti…" },
+ "popup_listening_hint": { "message": "Video e audio appariranno qui man mano che le pagine li caricano." },
+ "popup_paused_title": { "message": "Rilevamento contenuti in pausa" },
+ "popup_paused_hint": { "message": "Attiva l'interruttore sopra per rilevare i video in questa pagina." },
+ "popup_send_all": { "message": "Invia tutto ($count$ video)", "placeholders": { "count": { "content": "$1" } } },
+ "popup_detected_one": { "message": "1 video rilevato" },
+ "popup_detected_many": { "message": "$count$ video rilevati", "placeholders": { "count": { "content": "$1" } } },
+ "popup_video_n": { "message": "Video $n$", "placeholders": { "n": { "content": "$1" } } },
+ "popup_kind_audio": { "message": "Audio" },
+ "popup_kind_video": { "message": "Video" },
+ "popup_download_aria": { "message": "Scarica $name$", "placeholders": { "name": { "content": "$1" } } },
+ "popup_sending": { "message": "Invio…" },
+ "popup_sent": { "message": "Inviato!" },
+ "popup_sending_n": { "message": "Invio di $count$ video…", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_n": { "message": "$count$ video inviati!", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_failed": { "message": "Inviati $sent$, falliti $failed$", "placeholders": { "sent": { "content": "$1" }, "failed": { "content": "$2" } } },
+ "popup_not_running": { "message": "OmniGet non è in esecuzione" },
+ "popup_try_again": { "message": "Riprova" },
+ "popup_get_app": { "message": "Ottieni OmniGet" },
+ "popup_lbl_course": { "message": "Invia il corso a OmniGet" },
+ "popup_lbl_playlist": { "message": "Invia la playlist a OmniGet" },
+ "popup_lbl_video": { "message": "Invia il video a OmniGet" },
+ "popup_lbl_reel": { "message": "Invia il reel a OmniGet" },
+ "popup_lbl_post": { "message": "Invia il post a OmniGet" },
+ "popup_lbl_short": { "message": "Invia lo short a OmniGet" },
+ "popup_lbl_clip": { "message": "Invia la clip a OmniGet" },
+ "popup_lbl_image": { "message": "Invia l'immagine a OmniGet" },
+ "popup_lbl_audio": { "message": "Invia l'audio a OmniGet" },
+ "popup_lbl_profile": { "message": "Invia il profilo a OmniGet" },
+ "popup_lbl_page": { "message": "Invia la pagina a OmniGet" },
+ "popup_ck_saving": { "message": "Salvataggio cookie…" },
+ "popup_ck_saved": { "message": "$count$ cookie salvati", "placeholders": { "count": { "content": "$1" } } },
+ "popup_ck_btn": { "message": "Salva i cookie del sito" },
+ "popup_ck_meta": { "message": "$domain$ • $kind$", "placeholders": { "domain": { "content": "$1" }, "kind": { "content": "$2" } } },
+ "popup_ck_hint": { "message": "Invia i cookie di questo sito al gestore cookie di OmniGet." },
+ "popup_ckerr_no_url": { "message": "Nessuna scheda attiva" },
+ "popup_ckerr_invalid_url": { "message": "La pagina non può essere ispezionata" },
+ "popup_ckerr_unsupported": { "message": "Solo pagine http/https" },
+ "popup_ckerr_no_api": { "message": "API cookie bloccata" },
+ "popup_ckerr_no_cookies": { "message": "Nessun cookie per questo sito" },
+ "popup_ckerr_missing_token": { "message": "Abbina prima OmniGet" },
+ "popup_ckerr_missing_endpoint": { "message": "OmniGet non rilevato" },
+ "popup_ckerr_fetch_failed": { "message": "OmniGet non è in esecuzione" },
+ "popup_ckerr_unauthorized": { "message": "Token di abbinamento non valido" },
+ "popup_ckerr_default": { "message": "Impossibile salvare i cookie" },
+ "popup_open_app_label": { "message": "Apri l'app al download" },
+ "popup_sniffer_label": { "message": "Rilevamento contenuti" }
}
diff --git a/browser-extension/chrome/_locales/ja/messages.json b/browser-extension/chrome/_locales/ja/messages.json
index 2e2c8a64..382f0b21 100644
--- a/browser-extension/chrome/_locales/ja/messages.json
+++ b/browser-extension/chrome/_locales/ja/messages.json
@@ -43,5 +43,56 @@
},
"error_launch_failed_detail": {
"message": "OmniGet がインストールされていてシステムによってブロックされていないことを確認してから、もう一度お試しください。"
- }
+ },
+ "popup_send_default": { "message": "OmniGet に送信" },
+ "popup_send_audio": { "message": "音声を送信" },
+ "popup_video_found_one": { "message": "動画が見つかりました" },
+ "popup_videos_found": { "message": "$count$ 件の動画が見つかりました", "placeholders": { "count": { "content": "$1" } } },
+ "popup_listening_title": { "message": "メディアを検出中…" },
+ "popup_listening_hint": { "message": "ページが読み込むと、動画や音声がここに表示されます。" },
+ "popup_paused_title": { "message": "メディア検出は一時停止中" },
+ "popup_paused_hint": { "message": "上のスイッチをオンにして、このページの動画を検出します。" },
+ "popup_send_all": { "message": "すべて送信($count$ 件)", "placeholders": { "count": { "content": "$1" } } },
+ "popup_detected_one": { "message": "1 件の動画を検出" },
+ "popup_detected_many": { "message": "$count$ 件の動画を検出", "placeholders": { "count": { "content": "$1" } } },
+ "popup_video_n": { "message": "動画 $n$", "placeholders": { "n": { "content": "$1" } } },
+ "popup_kind_audio": { "message": "音声" },
+ "popup_kind_video": { "message": "動画" },
+ "popup_download_aria": { "message": "$name$ をダウンロード", "placeholders": { "name": { "content": "$1" } } },
+ "popup_sending": { "message": "送信中…" },
+ "popup_sent": { "message": "送信しました!" },
+ "popup_sending_n": { "message": "$count$ 件の動画を送信中…", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_n": { "message": "$count$ 件の動画を送信しました!", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_failed": { "message": "$sent$ 件送信、$failed$ 件失敗", "placeholders": { "sent": { "content": "$1" }, "failed": { "content": "$2" } } },
+ "popup_not_running": { "message": "OmniGet が起動していません" },
+ "popup_try_again": { "message": "再試行" },
+ "popup_get_app": { "message": "OmniGet を入手" },
+ "popup_lbl_course": { "message": "コースを OmniGet に送信" },
+ "popup_lbl_playlist": { "message": "プレイリストを OmniGet に送信" },
+ "popup_lbl_video": { "message": "動画を OmniGet に送信" },
+ "popup_lbl_reel": { "message": "リールを OmniGet に送信" },
+ "popup_lbl_post": { "message": "投稿を OmniGet に送信" },
+ "popup_lbl_short": { "message": "ショートを OmniGet に送信" },
+ "popup_lbl_clip": { "message": "クリップを OmniGet に送信" },
+ "popup_lbl_image": { "message": "画像を OmniGet に送信" },
+ "popup_lbl_audio": { "message": "音声を OmniGet に送信" },
+ "popup_lbl_profile": { "message": "プロフィールを OmniGet に送信" },
+ "popup_lbl_page": { "message": "ページを OmniGet に送信" },
+ "popup_ck_saving": { "message": "クッキーを保存中…" },
+ "popup_ck_saved": { "message": "$count$ 件のクッキーを保存", "placeholders": { "count": { "content": "$1" } } },
+ "popup_ck_btn": { "message": "サイトのクッキーを保存" },
+ "popup_ck_meta": { "message": "$domain$ • $kind$", "placeholders": { "domain": { "content": "$1" }, "kind": { "content": "$2" } } },
+ "popup_ck_hint": { "message": "このサイトのクッキーを OmniGet のクッキーマネージャーに送信します。" },
+ "popup_ckerr_no_url": { "message": "アクティブなタブがありません" },
+ "popup_ckerr_invalid_url": { "message": "このページは検査できません" },
+ "popup_ckerr_unsupported": { "message": "http/https ページのみ" },
+ "popup_ckerr_no_api": { "message": "クッキー API がブロックされています" },
+ "popup_ckerr_no_cookies": { "message": "このサイトのクッキーがありません" },
+ "popup_ckerr_missing_token": { "message": "先に OmniGet をペアリングしてください" },
+ "popup_ckerr_missing_endpoint": { "message": "OmniGet が見つかりません" },
+ "popup_ckerr_fetch_failed": { "message": "OmniGet が起動していません" },
+ "popup_ckerr_unauthorized": { "message": "ペアリングトークンが無効です" },
+ "popup_ckerr_default": { "message": "クッキーを保存できませんでした" },
+ "popup_open_app_label": { "message": "ダウンロード時にアプリを開く" },
+ "popup_sniffer_label": { "message": "メディア検出" }
}
diff --git a/browser-extension/chrome/_locales/pt/messages.json b/browser-extension/chrome/_locales/pt/messages.json
index e490c0ef..80069f93 100644
--- a/browser-extension/chrome/_locales/pt/messages.json
+++ b/browser-extension/chrome/_locales/pt/messages.json
@@ -43,5 +43,56 @@
},
"error_launch_failed_detail": {
"message": "Verifique se o OmniGet está instalado e não foi bloqueado pelo sistema, depois tente novamente."
- }
+ },
+ "popup_send_default": { "message": "Enviar para o OmniGet" },
+ "popup_send_audio": { "message": "Enviar áudio" },
+ "popup_video_found_one": { "message": "Vídeo encontrado" },
+ "popup_videos_found": { "message": "$count$ vídeos encontrados", "placeholders": { "count": { "content": "$1" } } },
+ "popup_listening_title": { "message": "Procurando mídia…" },
+ "popup_listening_hint": { "message": "Vídeos e áudios aparecerão aqui conforme as páginas carregam." },
+ "popup_paused_title": { "message": "Detecção de mídia pausada" },
+ "popup_paused_hint": { "message": "Ative o botão acima para detectar vídeos nesta página." },
+ "popup_send_all": { "message": "Enviar tudo ($count$ vídeos)", "placeholders": { "count": { "content": "$1" } } },
+ "popup_detected_one": { "message": "1 vídeo detectado" },
+ "popup_detected_many": { "message": "$count$ vídeos detectados", "placeholders": { "count": { "content": "$1" } } },
+ "popup_video_n": { "message": "Vídeo $n$", "placeholders": { "n": { "content": "$1" } } },
+ "popup_kind_audio": { "message": "Áudio" },
+ "popup_kind_video": { "message": "Vídeo" },
+ "popup_download_aria": { "message": "Baixar $name$", "placeholders": { "name": { "content": "$1" } } },
+ "popup_sending": { "message": "Enviando…" },
+ "popup_sent": { "message": "Enviado!" },
+ "popup_sending_n": { "message": "Enviando $count$ vídeos…", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_n": { "message": "$count$ vídeos enviados!", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_failed": { "message": "Enviados $sent$, falharam $failed$", "placeholders": { "sent": { "content": "$1" }, "failed": { "content": "$2" } } },
+ "popup_not_running": { "message": "O OmniGet não está em execução" },
+ "popup_try_again": { "message": "Tentar de novo" },
+ "popup_get_app": { "message": "Obter o OmniGet" },
+ "popup_lbl_course": { "message": "Enviar curso para o OmniGet" },
+ "popup_lbl_playlist": { "message": "Enviar playlist para o OmniGet" },
+ "popup_lbl_video": { "message": "Enviar vídeo para o OmniGet" },
+ "popup_lbl_reel": { "message": "Enviar reel para o OmniGet" },
+ "popup_lbl_post": { "message": "Enviar post para o OmniGet" },
+ "popup_lbl_short": { "message": "Enviar short para o OmniGet" },
+ "popup_lbl_clip": { "message": "Enviar clipe para o OmniGet" },
+ "popup_lbl_image": { "message": "Enviar imagem para o OmniGet" },
+ "popup_lbl_audio": { "message": "Enviar áudio para o OmniGet" },
+ "popup_lbl_profile": { "message": "Enviar perfil para o OmniGet" },
+ "popup_lbl_page": { "message": "Enviar página para o OmniGet" },
+ "popup_ck_saving": { "message": "Salvando cookies…" },
+ "popup_ck_saved": { "message": "$count$ cookies salvos", "placeholders": { "count": { "content": "$1" } } },
+ "popup_ck_btn": { "message": "Salvar cookies do site" },
+ "popup_ck_meta": { "message": "$domain$ • $kind$", "placeholders": { "domain": { "content": "$1" }, "kind": { "content": "$2" } } },
+ "popup_ck_hint": { "message": "Envia os cookies deste site para o gerenciador de cookies do OmniGet." },
+ "popup_ckerr_no_url": { "message": "Nenhuma aba ativa" },
+ "popup_ckerr_invalid_url": { "message": "A página não pode ser inspecionada" },
+ "popup_ckerr_unsupported": { "message": "Apenas páginas http/https" },
+ "popup_ckerr_no_api": { "message": "API de cookies bloqueada" },
+ "popup_ckerr_no_cookies": { "message": "Sem cookies para este site" },
+ "popup_ckerr_missing_token": { "message": "Pareie o OmniGet primeiro" },
+ "popup_ckerr_missing_endpoint": { "message": "OmniGet não detectado" },
+ "popup_ckerr_fetch_failed": { "message": "O OmniGet não está em execução" },
+ "popup_ckerr_unauthorized": { "message": "Token de pareamento inválido" },
+ "popup_ckerr_default": { "message": "Não foi possível salvar os cookies" },
+ "popup_open_app_label": { "message": "Abrir o app ao baixar" },
+ "popup_sniffer_label": { "message": "Detecção de mídia" }
}
diff --git a/browser-extension/chrome/_locales/zh_CN/messages.json b/browser-extension/chrome/_locales/zh_CN/messages.json
index 3413f103..1caab953 100644
--- a/browser-extension/chrome/_locales/zh_CN/messages.json
+++ b/browser-extension/chrome/_locales/zh_CN/messages.json
@@ -43,5 +43,56 @@
},
"error_launch_failed_detail": {
"message": "请确认 OmniGet 已安装且未被系统阻止,然后重试。"
- }
+ },
+ "popup_send_default": { "message": "发送到 OmniGet" },
+ "popup_send_audio": { "message": "发送音频" },
+ "popup_video_found_one": { "message": "找到视频" },
+ "popup_videos_found": { "message": "找到 $count$ 个视频", "placeholders": { "count": { "content": "$1" } } },
+ "popup_listening_title": { "message": "正在检测媒体…" },
+ "popup_listening_hint": { "message": "页面加载时,视频和音频会显示在这里。" },
+ "popup_paused_title": { "message": "媒体检测已暂停" },
+ "popup_paused_hint": { "message": "打开上方开关以检测此页面的视频。" },
+ "popup_send_all": { "message": "全部发送($count$ 个视频)", "placeholders": { "count": { "content": "$1" } } },
+ "popup_detected_one": { "message": "检测到 1 个视频" },
+ "popup_detected_many": { "message": "检测到 $count$ 个视频", "placeholders": { "count": { "content": "$1" } } },
+ "popup_video_n": { "message": "视频 $n$", "placeholders": { "n": { "content": "$1" } } },
+ "popup_kind_audio": { "message": "音频" },
+ "popup_kind_video": { "message": "视频" },
+ "popup_download_aria": { "message": "下载 $name$", "placeholders": { "name": { "content": "$1" } } },
+ "popup_sending": { "message": "发送中…" },
+ "popup_sent": { "message": "已发送!" },
+ "popup_sending_n": { "message": "正在发送 $count$ 个视频…", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_n": { "message": "已发送 $count$ 个视频!", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_failed": { "message": "已发送 $sent$ 个,失败 $failed$ 个", "placeholders": { "sent": { "content": "$1" }, "failed": { "content": "$2" } } },
+ "popup_not_running": { "message": "OmniGet 未运行" },
+ "popup_try_again": { "message": "重试" },
+ "popup_get_app": { "message": "获取 OmniGet" },
+ "popup_lbl_course": { "message": "发送课程到 OmniGet" },
+ "popup_lbl_playlist": { "message": "发送播放列表到 OmniGet" },
+ "popup_lbl_video": { "message": "发送视频到 OmniGet" },
+ "popup_lbl_reel": { "message": "发送 Reel 到 OmniGet" },
+ "popup_lbl_post": { "message": "发送帖子到 OmniGet" },
+ "popup_lbl_short": { "message": "发送 Shorts 到 OmniGet" },
+ "popup_lbl_clip": { "message": "发送片段到 OmniGet" },
+ "popup_lbl_image": { "message": "发送图片到 OmniGet" },
+ "popup_lbl_audio": { "message": "发送音频到 OmniGet" },
+ "popup_lbl_profile": { "message": "发送主页到 OmniGet" },
+ "popup_lbl_page": { "message": "发送页面到 OmniGet" },
+ "popup_ck_saving": { "message": "正在保存 Cookie…" },
+ "popup_ck_saved": { "message": "已保存 $count$ 个 Cookie", "placeholders": { "count": { "content": "$1" } } },
+ "popup_ck_btn": { "message": "保存站点 Cookie" },
+ "popup_ck_meta": { "message": "$domain$ • $kind$", "placeholders": { "domain": { "content": "$1" }, "kind": { "content": "$2" } } },
+ "popup_ck_hint": { "message": "将此站点的 Cookie 发送到 OmniGet 的 Cookie 管理器。" },
+ "popup_ckerr_no_url": { "message": "没有活动标签页" },
+ "popup_ckerr_invalid_url": { "message": "无法检查该页面" },
+ "popup_ckerr_unsupported": { "message": "仅支持 http/https 页面" },
+ "popup_ckerr_no_api": { "message": "Cookie API 被阻止" },
+ "popup_ckerr_no_cookies": { "message": "该站点没有 Cookie" },
+ "popup_ckerr_missing_token": { "message": "请先配对 OmniGet" },
+ "popup_ckerr_missing_endpoint": { "message": "未检测到 OmniGet" },
+ "popup_ckerr_fetch_failed": { "message": "OmniGet 未运行" },
+ "popup_ckerr_unauthorized": { "message": "配对令牌无效" },
+ "popup_ckerr_default": { "message": "无法保存 Cookie" },
+ "popup_open_app_label": { "message": "下载时打开应用" },
+ "popup_sniffer_label": { "message": "媒体检测" }
}
diff --git a/browser-extension/chrome/_locales/zh_TW/messages.json b/browser-extension/chrome/_locales/zh_TW/messages.json
index cba5aea9..afcdce1f 100644
--- a/browser-extension/chrome/_locales/zh_TW/messages.json
+++ b/browser-extension/chrome/_locales/zh_TW/messages.json
@@ -43,5 +43,56 @@
},
"error_launch_failed_detail": {
"message": "請確認 OmniGet 已安裝且未被系統封鎖,然後再試一次。"
- }
+ },
+ "popup_send_default": { "message": "傳送到 OmniGet" },
+ "popup_send_audio": { "message": "傳送音訊" },
+ "popup_video_found_one": { "message": "找到影片" },
+ "popup_videos_found": { "message": "找到 $count$ 個影片", "placeholders": { "count": { "content": "$1" } } },
+ "popup_listening_title": { "message": "正在偵測媒體…" },
+ "popup_listening_hint": { "message": "頁面載入時,影片與音訊會顯示在這裡。" },
+ "popup_paused_title": { "message": "媒體偵測已暫停" },
+ "popup_paused_hint": { "message": "開啟上方開關以偵測此頁面的影片。" },
+ "popup_send_all": { "message": "全部傳送($count$ 個影片)", "placeholders": { "count": { "content": "$1" } } },
+ "popup_detected_one": { "message": "偵測到 1 個影片" },
+ "popup_detected_many": { "message": "偵測到 $count$ 個影片", "placeholders": { "count": { "content": "$1" } } },
+ "popup_video_n": { "message": "影片 $n$", "placeholders": { "n": { "content": "$1" } } },
+ "popup_kind_audio": { "message": "音訊" },
+ "popup_kind_video": { "message": "影片" },
+ "popup_download_aria": { "message": "下載 $name$", "placeholders": { "name": { "content": "$1" } } },
+ "popup_sending": { "message": "傳送中…" },
+ "popup_sent": { "message": "已傳送!" },
+ "popup_sending_n": { "message": "正在傳送 $count$ 個影片…", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_n": { "message": "已傳送 $count$ 個影片!", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_failed": { "message": "已傳送 $sent$ 個,失敗 $failed$ 個", "placeholders": { "sent": { "content": "$1" }, "failed": { "content": "$2" } } },
+ "popup_not_running": { "message": "OmniGet 未執行" },
+ "popup_try_again": { "message": "重試" },
+ "popup_get_app": { "message": "取得 OmniGet" },
+ "popup_lbl_course": { "message": "傳送課程到 OmniGet" },
+ "popup_lbl_playlist": { "message": "傳送播放清單到 OmniGet" },
+ "popup_lbl_video": { "message": "傳送影片到 OmniGet" },
+ "popup_lbl_reel": { "message": "傳送 Reel 到 OmniGet" },
+ "popup_lbl_post": { "message": "傳送貼文到 OmniGet" },
+ "popup_lbl_short": { "message": "傳送 Shorts 到 OmniGet" },
+ "popup_lbl_clip": { "message": "傳送片段到 OmniGet" },
+ "popup_lbl_image": { "message": "傳送圖片到 OmniGet" },
+ "popup_lbl_audio": { "message": "傳送音訊到 OmniGet" },
+ "popup_lbl_profile": { "message": "傳送個人檔案到 OmniGet" },
+ "popup_lbl_page": { "message": "傳送頁面到 OmniGet" },
+ "popup_ck_saving": { "message": "正在儲存 Cookie…" },
+ "popup_ck_saved": { "message": "已儲存 $count$ 個 Cookie", "placeholders": { "count": { "content": "$1" } } },
+ "popup_ck_btn": { "message": "儲存網站 Cookie" },
+ "popup_ck_meta": { "message": "$domain$ • $kind$", "placeholders": { "domain": { "content": "$1" }, "kind": { "content": "$2" } } },
+ "popup_ck_hint": { "message": "將此網站的 Cookie 傳送到 OmniGet 的 Cookie 管理器。" },
+ "popup_ckerr_no_url": { "message": "沒有作用中的分頁" },
+ "popup_ckerr_invalid_url": { "message": "無法檢查此頁面" },
+ "popup_ckerr_unsupported": { "message": "僅支援 http/https 頁面" },
+ "popup_ckerr_no_api": { "message": "Cookie API 被封鎖" },
+ "popup_ckerr_no_cookies": { "message": "此網站沒有 Cookie" },
+ "popup_ckerr_missing_token": { "message": "請先配對 OmniGet" },
+ "popup_ckerr_missing_endpoint": { "message": "未偵測到 OmniGet" },
+ "popup_ckerr_fetch_failed": { "message": "OmniGet 未執行" },
+ "popup_ckerr_unauthorized": { "message": "配對權杖無效" },
+ "popup_ckerr_default": { "message": "無法儲存 Cookie" },
+ "popup_open_app_label": { "message": "下載時開啟應用程式" },
+ "popup_sniffer_label": { "message": "媒體偵測" }
}
diff --git a/browser-extension/chrome/manifest.json b/browser-extension/chrome/manifest.json
index d54f2b97..81be0b13 100644
--- a/browser-extension/chrome/manifest.json
+++ b/browser-extension/chrome/manifest.json
@@ -10,7 +10,8 @@
"cookies",
"webRequest",
"storage",
- "contextMenus"
+ "contextMenus",
+ "alarms"
],
"host_permissions": [
"http://127.0.0.1/*",
diff --git a/browser-extension/chrome/popup/popup.js b/browser-extension/chrome/popup/popup.js
index a990d0ad..ef2b5222 100644
--- a/browser-extension/chrome/popup/popup.js
+++ b/browser-extension/chrome/popup/popup.js
@@ -6,6 +6,9 @@ import { captureCookiesForTab } from "../src/cookie-capture.js";
const APP_URL = "https://github.com/tonhowtf/omniget/releases/latest";
+const tr = (k, ...subs) =>
+ (chrome.i18n?.getMessage?.(k, subs.length ? subs.map(String) : undefined) || k);
+
const SVG = {
play: `<svg viewBox="0 0 20 20" fill="currentColor"><path d="M6.5 4v12l10-6z"/></svg>`,
check: `<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path class="checkmark-path" d="M4 10.5l4 4 8-8"/></svg>`,
@@ -19,7 +22,23 @@ let currentData = null;
let pageTitle = "";
let pageThumbnail = "";
+function localizeStatic() {
+ const openApp = tr("popup_open_app_label");
+ const sniffer = tr("popup_sniffer_label");
+ const openWrap = document.getElementById("open-app-toggle")?.closest(".toggle-group");
+ if (openWrap) openWrap.title = openApp;
+ document.getElementById("open-app-toggle")?.setAttribute("aria-label", openApp);
+ const snifWrap = document.getElementById("sniffer-toggle")?.closest(".toggle-group");
+ if (snifWrap) snifWrap.title = sniffer;
+ document.getElementById("sniffer-toggle")?.setAttribute("aria-label", sniffer);
+ const ckLabel = document.getElementById("cookie-capture-label");
+ if (ckLabel) ckLabel.textContent = tr("popup_ck_btn");
+ const ckHint = document.getElementById("cookie-capture-hint");
+ if (ckHint) ckHint.textContent = tr("popup_ck_hint");
+}
+
async function init() {
+ localizeStatic();
const toggle = document.getElementById("sniffer-toggle");
const openAppToggle = document.getElementById("open-app-toggle");
@@ -122,8 +141,8 @@ function renderMediaDetected(container) {
const domain = getDomainFromUrl(currentData.tabUrl || best.url);
const title = pageTitle ? truncate(pageTitle, 40) : domain;
- const countText = totalVideos > 1 ? `${totalVideos} videos found` : "Video found";
- const label = best.mediaType === "audio" ? "Send audio" : "Send to OmniGet";
+ const countText = totalVideos > 1 ? tr("popup_videos_found", totalVideos) : tr("popup_video_found_one");
+ const label = best.mediaType === "audio" ? tr("popup_send_audio") : tr("popup_send_default");
appendPrimaryButton(container, label, title + " \u00b7 " + countText, (btn) => {
handleDownload(btn, best.url, "generic", best);
@@ -136,8 +155,8 @@ function renderListening(container) {
container.innerHTML = `
<div class="state-empty" role="status">
<div class="listening-dot" aria-hidden="true"></div>
- <span class="state-title">Listening for media\u2026</span>
- <span class="state-hint">Videos and audio will appear here<br>as pages load them.</span>
+ <span class="state-title">${escapeHtml(tr("popup_listening_title"))}</span>
+ <span class="state-hint">${escapeHtml(tr("popup_listening_hint"))}</span>
</div>
`;
}
@@ -145,8 +164,8 @@ function renderListening(container) {
function renderSnifferOff(container) {
container.innerHTML = `
<div class="state-empty" role="status">
- <span class="state-title">Media detection is paused</span>
- <span class="state-hint">Turn on the toggle above to<br>detect videos on this page.</span>
+ <span class="state-title">${escapeHtml(tr("popup_paused_title"))}</span>
+ <span class="state-hint">${escapeHtml(tr("popup_paused_hint"))}</span>
</div>
`;
}
@@ -184,11 +203,12 @@ function appendMediaControls(container, media) {
const btn = document.createElement("button");
btn.className = "secondary-btn";
- btn.setAttribute("aria-label", `Send all ${groups.length} videos`);
+ const sendAllLabel = tr("popup_send_all", groups.length);
+ btn.setAttribute("aria-label", sendAllLabel);
btn.innerHTML = `
<span class="btn-icon">${SVG.download}</span>
<div class="btn-content">
- <span class="btn-label">Send all (${groups.length} videos)</span>
+ <span class="btn-label">${escapeHtml(sendAllLabel)}</span>
</div>
`;
@@ -210,7 +230,7 @@ function appendMediaList(container, hlsGroups, directMedia, totalItems) {
toggleBtn.className = "media-toggle";
toggleBtn.setAttribute("aria-expanded", "false");
toggleBtn.innerHTML = `
- <span>${totalItems} video${totalItems !== 1 ? "s" : ""} detected</span>
+ <span>${escapeHtml(totalItems === 1 ? tr("popup_detected_one") : tr("popup_detected_many", totalItems))}</span>
<span class="media-toggle-arrow">\u25be</span>
`;
@@ -221,7 +241,7 @@ function appendMediaList(container, hlsGroups, directMedia, totalItems) {
for (const group of hlsGroups) {
const domain = getDomainFromUrl(group.master.url);
list.appendChild(createMediaItem(
- `Video ${idx}`, domain,
+ tr("popup_video_n", idx), domain,
() => sendToApp(group.master.url, "generic", group.master)
));
idx++;
@@ -230,7 +250,7 @@ function appendMediaList(container, hlsGroups, directMedia, totalItems) {
for (const entry of directMedia) {
const name = getFilenameFromUrl(entry.url);
const size = entry.sizeText || "";
- const meta = (entry.mediaType === "audio" ? "Audio" : "Video") + (size ? " \u00b7 " + size : "");
+ const meta = (entry.mediaType === "audio" ? tr("popup_kind_audio") : tr("popup_kind_video")) + (size ? " \u00b7 " + size : "");
list.appendChild(createMediaItem(name, meta, () => sendToApp(entry.url, "generic", entry)));
}
@@ -255,7 +275,7 @@ function createMediaItem(name, meta, sendFn) {
<span class="media-meta">${escapeHtml(meta)}</span>
</div>
</div>
- <button class="item-download-btn" aria-label="Download ${escapeHtml(name)}">${SVG.arrow}</button>
+ <button class="item-download-btn" aria-label="${escapeHtml(tr("popup_download_aria", name))}">${SVG.arrow}</button>
`;
const btn = item.querySelector(".item-download-btn");
@@ -282,7 +302,7 @@ async function handleDownload(btn, url, platform, mediaEntry) {
btn.dataset.busy = "1";
btn.classList.add("sending");
- btn.querySelector(".btn-label").textContent = "Sending\u2026";
+ btn.querySelector(".btn-label").textContent = tr("popup_sending");
btn.querySelector(".btn-meta").textContent = "";
const result = await sendToApp(url, platform, mediaEntry);
@@ -291,7 +311,7 @@ async function handleDownload(btn, url, platform, mediaEntry) {
btn.classList.remove("sending");
btn.classList.add("success");
btn.querySelector(".btn-icon").innerHTML = SVG.check;
- btn.querySelector(".btn-label").textContent = "Sent!";
+ btn.querySelector(".btn-label").textContent = tr("popup_sent");
const summaryText = formatCookieSummary(result.cookieSummary);
const metaEl = btn.querySelector(".btn-meta");
if (metaEl) metaEl.textContent = summaryText;
@@ -305,7 +325,7 @@ async function handleBatchDownload(btn, groups) {
if (btn.dataset.busy) return;
btn.dataset.busy = "1";
- btn.querySelector(".btn-label").textContent = `Sending ${groups.length} videos\u2026`;
+ btn.querySelector(".btn-label").textContent = tr("popup_sending_n", groups.length);
btn.classList.add("sending");
const result = await sendBatch(groups);
@@ -314,11 +334,11 @@ async function handleBatchDownload(btn, groups) {
btn.classList.remove("sending");
btn.classList.add("success");
btn.querySelector(".btn-icon").innerHTML = SVG.check;
- btn.querySelector(".btn-label").textContent = `${result.sent} videos sent!`;
+ btn.querySelector(".btn-label").textContent = tr("popup_sent_n", result.sent);
setTimeout(() => window.close(), 1200);
} else if (result.sent > 0) {
btn.classList.remove("sending");
- btn.querySelector(".btn-label").textContent = `Sent ${result.sent}, failed ${result.failed}`;
+ btn.querySelector(".btn-label").textContent = tr("popup_sent_failed", result.sent, result.failed);
delete btn.dataset.busy;
} else {
showError(btn.closest(".secondary-action") || btn.parentElement);
@@ -330,11 +350,11 @@ function showError(container) {
<div class="error-box">
<div class="error-header">
<span class="error-icon">${SVG.warning}</span>
- <span class="error-message">OmniGet is not running</span>
+ <span class="error-message">${escapeHtml(tr("popup_not_running"))}</span>
</div>
<div class="error-actions">
- <button class="error-btn error-btn-primary" data-action="retry">Try again</button>
- <button class="error-btn error-btn-secondary" data-action="open">Get OmniGet</button>
+ <button class="error-btn error-btn-primary" data-action="retry">${escapeHtml(tr("popup_try_again"))}</button>
+ <button class="error-btn error-btn-secondary" data-action="open">${escapeHtml(tr("popup_get_app"))}</button>
</div>
</div>
`;
@@ -458,17 +478,17 @@ function pickBestMedia(media) {
function getDownloadLabel(contentType) {
switch (contentType) {
- case "course": return "Send course to OmniGet";
- case "playlist": return "Send playlist to OmniGet";
- case "video": return "Send video to OmniGet";
- case "reel": return "Send reel to OmniGet";
- case "post": return "Send post to OmniGet";
- case "short": return "Send short to OmniGet";
- case "clip": return "Send clip to OmniGet";
- case "image": return "Send image to OmniGet";
- case "audio": return "Send audio to OmniGet";
- case "profile": return "Send profile to OmniGet";
- default: return "Send page to OmniGet";
+ case "course": return tr("popup_lbl_course");
+ case "playlist": return tr("popup_lbl_playlist");
+ case "video": return tr("popup_lbl_video");
+ case "reel": return tr("popup_lbl_reel");
+ case "post": return tr("popup_lbl_post");
+ case "short": return tr("popup_lbl_short");
+ case "clip": return tr("popup_lbl_clip");
+ case "image": return tr("popup_lbl_image");
+ case "audio": return tr("popup_lbl_audio");
+ case "profile": return tr("popup_lbl_profile");
+ default: return tr("popup_lbl_page");
}
}
@@ -533,7 +553,7 @@ function initCookieCapture(activeTab) {
busy = true;
btn.disabled = true;
btn.removeAttribute("data-state");
- label.textContent = "Saving cookies…";
+ label.textContent = tr("popup_ck_saving");
const result = await captureCookiesForTab(activeTab);
busy = false;
@@ -541,19 +561,19 @@ function initCookieCapture(activeTab) {
if (result.ok) {
btn.dataset.state = "success";
- label.textContent = `${result.cookie_count} cookies saved`;
- if (hint) hint.textContent = `${result.domain} • ${result.platform_kind.replace("_", " ")}`;
+ label.textContent = tr("popup_ck_saved", result.cookie_count);
+ if (hint) hint.textContent = tr("popup_ck_meta", result.domain, result.platform_kind.replace("_", " "));
setTimeout(() => {
btn.removeAttribute("data-state");
- label.textContent = "Save site cookies";
- if (hint) hint.textContent = "Sends cookies of this site to OmniGet's cookie manager.";
+ label.textContent = tr("popup_ck_btn");
+ if (hint) hint.textContent = tr("popup_ck_hint");
}, 3500);
} else {
btn.dataset.state = "error";
label.textContent = explainFailure(result);
setTimeout(() => {
btn.removeAttribute("data-state");
- label.textContent = "Save site cookies";
+ label.textContent = tr("popup_ck_btn");
}, 4000);
}
});
@@ -561,16 +581,16 @@ function initCookieCapture(activeTab) {
function explainFailure(result) {
switch (result?.reason) {
- case "no-url": return "No active tab";
- case "invalid-url": return "Page can't be inspected";
- case "unsupported-scheme": return "Only http/https pages";
- case "no-cookies-api": return "Cookies API blocked";
- case "no-cookies-for-domain": return "No cookies for this site";
- case "missing-token": return "Pair OmniGet first";
- case "missing-endpoint": return "OmniGet not detected";
- case "fetch-failed": return "OmniGet isn't running";
- case "unauthorized": return "Bad pairing token";
- default: return "Couldn't save cookies";
+ case "no-url": return tr("popup_ckerr_no_url");
+ case "invalid-url": return tr("popup_ckerr_invalid_url");
+ case "unsupported-scheme": return tr("popup_ckerr_unsupported");
+ case "no-cookies-api": return tr("popup_ckerr_no_api");
+ case "no-cookies-for-domain": return tr("popup_ckerr_no_cookies");
+ case "missing-token": return tr("popup_ckerr_missing_token");
+ case "missing-endpoint": return tr("popup_ckerr_missing_endpoint");
+ case "fetch-failed": return tr("popup_ckerr_fetch_failed");
+ case "unauthorized": return tr("popup_ckerr_unauthorized");
+ default: return tr("popup_ckerr_default");
}
}
diff --git a/browser-extension/chrome/src/background.js b/browser-extension/chrome/src/background.js
index ef8036f9..5aeea7d2 100644
--- a/browser-extension/chrome/src/background.js
+++ b/browser-extension/chrome/src/background.js
@@ -6,7 +6,55 @@ import { summarizeCookies } from "./cookie-summary.js";
import { loadSnifferState, isSnifferEnabled, setSnifferEnabled } from "./sniffer-toggle.js";
import { registerContextMenu, getContextMenuId } from "./context-menu.js";
import { openOmnigetScheme } from "./send-via-scheme.js";
-import { sendViaBridge, sendCookiesViaBridge } from "./bridge-client.js";
+import { sendViaBridge, sendCookiesViaBridge, autoPair, loadBridgeConfig } from "./bridge-client.js";
+
+const AUTOPAIR_ALARM = "omniget-autopair";
+
+async function isPaired() {
+ try {
+ const cfg = await loadBridgeConfig();
+ return Boolean(cfg.token);
+ } catch {
+ return false;
+ }
+}
+
+// Keep a low-frequency poll alive while unpaired so that, the moment the user
+// clicks "Pair extension" in the desktop app (which opens a ~120s single-use
+// window), the extension grabs the token on its own — no copy-paste, no
+// returning to the extension. The alarm clears itself once paired.
+async function runAutoPairTick() {
+ if (await isPaired()) {
+ try {
+ await chrome.alarms.clear(AUTOPAIR_ALARM);
+ } catch {}
+ return true;
+ }
+ const result = await autoPair().catch(() => ({ ok: false }));
+ if (result?.ok) {
+ try {
+ await chrome.alarms.clear(AUTOPAIR_ALARM);
+ } catch {}
+ refreshActiveTab().catch(() => {});
+ return true;
+ }
+ return false;
+}
+
+async function ensureAutoPairAlarm() {
+ if (await isPaired()) return;
+ try {
+ if (!(await chrome.alarms.get(AUTOPAIR_ALARM))) {
+ chrome.alarms.create(AUTOPAIR_ALARM, { periodInMinutes: 1 });
+ }
+ } catch {}
+}
+
+if (chrome.alarms?.onAlarm) {
+ chrome.alarms.onAlarm.addListener((alarm) => {
+ if (alarm?.name === AUTOPAIR_ALARM) void runAutoPairTick();
+ });
+}
const INSTALL_URL = "https://github.com/tonhowtf/omniget/releases/latest";
const PROTOCOL_VERSION = 1;
@@ -62,7 +110,11 @@ chrome.runtime.onInstalled.addListener(async (details) => {
const stored = await chrome.storage.local.get("bridge_token");
const token = typeof stored?.bridge_token === "string" ? stored.bridge_token.trim() : "";
if (!token) {
- chrome.runtime.openOptionsPage().catch(() => {});
+ const paired = await runAutoPairTick();
+ if (!paired) {
+ await ensureAutoPairAlarm();
+ chrome.runtime.openOptionsPage().catch(() => {});
+ }
}
} catch {
// storage unavailable — fall back to the previous behaviour and only
@@ -93,6 +145,8 @@ chrome.contextMenus.onClicked.addListener(async (info, tab) => {
chrome.runtime.onStartup.addListener(() => {
refreshActiveTab().catch(() => {});
+ void runAutoPairTick();
+ void ensureAutoPairAlarm();
});
if (chrome.commands && chrome.commands.onCommand) {
diff --git a/browser-extension/chrome/src/bridge-client.js b/browser-extension/chrome/src/bridge-client.js
index 99631876..8584ff37 100644
--- a/browser-extension/chrome/src/bridge-client.js
+++ b/browser-extension/chrome/src/bridge-client.js
@@ -138,6 +138,43 @@ export async function checkBridgeHealth(
}
}
+// One-shot auto-pair. If we don't have a token yet, discover the bridge and
+// ask `GET /v1/pair`. That endpoint only returns the token while the user has
+// an active, single-use, ~120s pairing window open in the desktop app — so
+// this turns "find the token, copy, paste" into a single click in the app.
+export async function autoPair({
+ fetchImpl = typeof fetch !== "undefined" ? fetch : null,
+ storage = globalThis.chrome?.storage?.local,
+ timeoutMs = HEALTH_TIMEOUT_MS,
+} = {}) {
+ if (!fetchImpl) return { ok: false, reason: "no-fetch" };
+ const current = await loadBridgeConfig({ storage });
+ if (current.token) return { ok: true, reason: "already-paired" };
+
+ let endpoint = current.endpoint;
+ const discovered = await discoverBridgeEndpoint({ fetchImpl, timeoutMs });
+ if (discovered?.endpoint) endpoint = discovered.endpoint;
+ endpoint = trimEndpoint(endpoint);
+ if (!endpoint) return { ok: false, reason: "no-endpoint" };
+
+ const controller = typeof AbortController !== "undefined" ? new AbortController() : null;
+ try {
+ const response = await withTimeout(
+ fetchImpl(`${endpoint}/v1/pair`, { method: "GET", signal: controller?.signal }),
+ timeoutMs,
+ controller
+ );
+ if (!response.ok) return { ok: false, reason: "window-closed" };
+ const parsed = await response.json().catch(() => null);
+ const token = typeof parsed?.token === "string" ? parsed.token.trim() : "";
+ if (!parsed?.ok || !token) return { ok: false, reason: "no-token" };
+ await saveBridgeConfig({ endpoint, token }, { storage });
+ return { ok: true, reason: "paired", endpoint };
+ } catch (error) {
+ return { ok: false, reason: "error", message: error?.message ?? String(error) };
+ }
+}
+
export async function sendViaBridge(
payload,
{
diff --git a/browser-extension/chrome/src/cookies-domains.json b/browser-extension/chrome/src/cookies-domains.json
index 40838072..819c7a5c 100644
--- a/browser-extension/chrome/src/cookies-domains.json
+++ b/browser-extension/chrome/src/cookies-domains.json
@@ -7,6 +7,7 @@
"twitch": [".twitch.tv", ".jtvnw.net"],
"vimeo": [".vimeo.com", ".vimeocdn.com"],
"bilibili": [".bilibili.com", ".bilivideo.com"],
+ "soundcloud": [".soundcloud.com", ".sndcdn.com"],
"pinterest": [".pinterest.com"],
"hotmart": [".hotmart.com"],
"udemy": [".udemy.com"],
diff --git a/browser-extension/firefox/_locales/el/messages.json b/browser-extension/firefox/_locales/el/messages.json
index 3ad485d9..b54fb9fd 100644
--- a/browser-extension/firefox/_locales/el/messages.json
+++ b/browser-extension/firefox/_locales/el/messages.json
@@ -43,5 +43,56 @@
},
"error_launch_failed_detail": {
"message": "Βεβαιωθείτε ότι το OmniGet είναι εγκατεστημένο και δεν έχει αποκλειστεί από το σύστημά σας και δοκιμάστε ξανά."
- }
+ },
+ "popup_send_default": { "message": "Αποστολή στο OmniGet" },
+ "popup_send_audio": { "message": "Αποστολή ήχου" },
+ "popup_video_found_one": { "message": "Βρέθηκε βίντεο" },
+ "popup_videos_found": { "message": "Βρέθηκαν $count$ βίντεο", "placeholders": { "count": { "content": "$1" } } },
+ "popup_listening_title": { "message": "Ανίχνευση μέσων…" },
+ "popup_listening_hint": { "message": "Τα βίντεο και οι ήχοι θα εμφανίζονται εδώ καθώς οι σελίδες τα φορτώνουν." },
+ "popup_paused_title": { "message": "Η ανίχνευση μέσων σε παύση" },
+ "popup_paused_hint": { "message": "Ενεργοποίησε τον διακόπτη παραπάνω για ανίχνευση βίντεο σε αυτή τη σελίδα." },
+ "popup_send_all": { "message": "Αποστολή όλων ($count$ βίντεο)", "placeholders": { "count": { "content": "$1" } } },
+ "popup_detected_one": { "message": "1 βίντεο ανιχνεύθηκε" },
+ "popup_detected_many": { "message": "$count$ βίντεο ανιχνεύθηκαν", "placeholders": { "count": { "content": "$1" } } },
+ "popup_video_n": { "message": "Βίντεο $n$", "placeholders": { "n": { "content": "$1" } } },
+ "popup_kind_audio": { "message": "Ήχος" },
+ "popup_kind_video": { "message": "Βίντεο" },
+ "popup_download_aria": { "message": "Λήψη $name$", "placeholders": { "name": { "content": "$1" } } },
+ "popup_sending": { "message": "Αποστολή…" },
+ "popup_sent": { "message": "Στάλθηκε!" },
+ "popup_sending_n": { "message": "Αποστολή $count$ βίντεο…", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_n": { "message": "Στάλθηκαν $count$ βίντεο!", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_failed": { "message": "Στάλθηκαν $sent$, απέτυχαν $failed$", "placeholders": { "sent": { "content": "$1" }, "failed": { "content": "$2" } } },
+ "popup_not_running": { "message": "Το OmniGet δεν εκτελείται" },
+ "popup_try_again": { "message": "Δοκιμή ξανά" },
+ "popup_get_app": { "message": "Λήψη OmniGet" },
+ "popup_lbl_course": { "message": "Αποστολή μαθήματος στο OmniGet" },
+ "popup_lbl_playlist": { "message": "Αποστολή λίστας στο OmniGet" },
+ "popup_lbl_video": { "message": "Αποστολή βίντεο στο OmniGet" },
+ "popup_lbl_reel": { "message": "Αποστολή reel στο OmniGet" },
+ "popup_lbl_post": { "message": "Αποστολή ανάρτησης στο OmniGet" },
+ "popup_lbl_short": { "message": "Αποστολή short στο OmniGet" },
+ "popup_lbl_clip": { "message": "Αποστολή κλιπ στο OmniGet" },
+ "popup_lbl_image": { "message": "Αποστολή εικόνας στο OmniGet" },
+ "popup_lbl_audio": { "message": "Αποστολή ήχου στο OmniGet" },
+ "popup_lbl_profile": { "message": "Αποστολή προφίλ στο OmniGet" },
+ "popup_lbl_page": { "message": "Αποστολή σελίδας στο OmniGet" },
+ "popup_ck_saving": { "message": "Αποθήκευση cookies…" },
+ "popup_ck_saved": { "message": "Αποθηκεύτηκαν $count$ cookies", "placeholders": { "count": { "content": "$1" } } },
+ "popup_ck_btn": { "message": "Αποθήκευση cookies ιστότοπου" },
+ "popup_ck_meta": { "message": "$domain$ • $kind$", "placeholders": { "domain": { "content": "$1" }, "kind": { "content": "$2" } } },
+ "popup_ck_hint": { "message": "Στέλνει τα cookies αυτού του ιστότοπου στον διαχειριστή cookies του OmniGet." },
+ "popup_ckerr_no_url": { "message": "Καμία ενεργή καρτέλα" },
+ "popup_ckerr_invalid_url": { "message": "Η σελίδα δεν μπορεί να ελεγχθεί" },
+ "popup_ckerr_unsupported": { "message": "Μόνο σελίδες http/https" },
+ "popup_ckerr_no_api": { "message": "Το API cookies αποκλείστηκε" },
+ "popup_ckerr_no_cookies": { "message": "Χωρίς cookies για αυτόν τον ιστότοπο" },
+ "popup_ckerr_missing_token": { "message": "Σύνδεσε πρώτα το OmniGet" },
+ "popup_ckerr_missing_endpoint": { "message": "Το OmniGet δεν εντοπίστηκε" },
+ "popup_ckerr_fetch_failed": { "message": "Το OmniGet δεν εκτελείται" },
+ "popup_ckerr_unauthorized": { "message": "Μη έγκυρο διακριτικό σύνδεσης" },
+ "popup_ckerr_default": { "message": "Δεν ήταν δυνατή η αποθήκευση cookies" },
+ "popup_open_app_label": { "message": "Άνοιγμα εφαρμογής κατά τη λήψη" },
+ "popup_sniffer_label": { "message": "Ανίχνευση μέσων" }
}
diff --git a/browser-extension/firefox/_locales/en/messages.json b/browser-extension/firefox/_locales/en/messages.json
index 40360b69..6313816e 100644
--- a/browser-extension/firefox/_locales/en/messages.json
+++ b/browser-extension/firefox/_locales/en/messages.json
@@ -43,5 +43,56 @@
},
"error_launch_failed_detail": {
"message": "Check that OmniGet is installed and not blocked by your system, then try again."
- }
+ },
+ "popup_send_default": { "message": "Send to OmniGet" },
+ "popup_send_audio": { "message": "Send audio" },
+ "popup_video_found_one": { "message": "Video found" },
+ "popup_videos_found": { "message": "$count$ videos found", "placeholders": { "count": { "content": "$1" } } },
+ "popup_listening_title": { "message": "Listening for media…" },
+ "popup_listening_hint": { "message": "Videos and audio will appear here as pages load them." },
+ "popup_paused_title": { "message": "Media detection is paused" },
+ "popup_paused_hint": { "message": "Turn on the toggle above to detect videos on this page." },
+ "popup_send_all": { "message": "Send all ($count$ videos)", "placeholders": { "count": { "content": "$1" } } },
+ "popup_detected_one": { "message": "1 video detected" },
+ "popup_detected_many": { "message": "$count$ videos detected", "placeholders": { "count": { "content": "$1" } } },
+ "popup_video_n": { "message": "Video $n$", "placeholders": { "n": { "content": "$1" } } },
+ "popup_kind_audio": { "message": "Audio" },
+ "popup_kind_video": { "message": "Video" },
+ "popup_download_aria": { "message": "Download $name$", "placeholders": { "name": { "content": "$1" } } },
+ "popup_sending": { "message": "Sending…" },
+ "popup_sent": { "message": "Sent!" },
+ "popup_sending_n": { "message": "Sending $count$ videos…", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_n": { "message": "$count$ videos sent!", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_failed": { "message": "Sent $sent$, failed $failed$", "placeholders": { "sent": { "content": "$1" }, "failed": { "content": "$2" } } },
+ "popup_not_running": { "message": "OmniGet is not running" },
+ "popup_try_again": { "message": "Try again" },
+ "popup_get_app": { "message": "Get OmniGet" },
+ "popup_lbl_course": { "message": "Send course to OmniGet" },
+ "popup_lbl_playlist": { "message": "Send playlist to OmniGet" },
+ "popup_lbl_video": { "message": "Send video to OmniGet" },
+ "popup_lbl_reel": { "message": "Send reel to OmniGet" },
+ "popup_lbl_post": { "message": "Send post to OmniGet" },
+ "popup_lbl_short": { "message": "Send short to OmniGet" },
+ "popup_lbl_clip": { "message": "Send clip to OmniGet" },
+ "popup_lbl_image": { "message": "Send image to OmniGet" },
+ "popup_lbl_audio": { "message": "Send audio to OmniGet" },
+ "popup_lbl_profile": { "message": "Send profile to OmniGet" },
+ "popup_lbl_page": { "message": "Send page to OmniGet" },
+ "popup_ck_saving": { "message": "Saving cookies…" },
+ "popup_ck_saved": { "message": "$count$ cookies saved", "placeholders": { "count": { "content": "$1" } } },
+ "popup_ck_btn": { "message": "Save site cookies" },
+ "popup_ck_meta": { "message": "$domain$ • $kind$", "placeholders": { "domain": { "content": "$1" }, "kind": { "content": "$2" } } },
+ "popup_ck_hint": { "message": "Sends cookies of this site to OmniGet's cookie manager." },
+ "popup_ckerr_no_url": { "message": "No active tab" },
+ "popup_ckerr_invalid_url": { "message": "Page can't be inspected" },
+ "popup_ckerr_unsupported": { "message": "Only http/https pages" },
+ "popup_ckerr_no_api": { "message": "Cookies API blocked" },
+ "popup_ckerr_no_cookies": { "message": "No cookies for this site" },
+ "popup_ckerr_missing_token": { "message": "Pair OmniGet first" },
+ "popup_ckerr_missing_endpoint": { "message": "OmniGet not detected" },
+ "popup_ckerr_fetch_failed": { "message": "OmniGet isn't running" },
+ "popup_ckerr_unauthorized": { "message": "Bad pairing token" },
+ "popup_ckerr_default": { "message": "Couldn't save cookies" },
+ "popup_open_app_label": { "message": "Open app when downloading" },
+ "popup_sniffer_label": { "message": "Media detection" }
}
diff --git a/browser-extension/firefox/_locales/es/messages.json b/browser-extension/firefox/_locales/es/messages.json
new file mode 100644
index 00000000..ba0b334b
--- /dev/null
+++ b/browser-extension/firefox/_locales/es/messages.json
@@ -0,0 +1,98 @@
+{
+ "action_title_supported": {
+ "message": "Enviar esta página de medios a OmniGet"
+ },
+ "action_title_unsupported": {
+ "message": "No se detectaron medios compatibles en esta página"
+ },
+ "error_page_document_title": {
+ "message": "Extensión OmniGet"
+ },
+ "error_page_eyebrow": {
+ "message": "Extensión OmniGet"
+ },
+ "error_page_install_cta": {
+ "message": "Instalar OmniGet"
+ },
+ "error_page_open_extensions": {
+ "message": "Abrir extensiones de Chrome"
+ },
+ "error_host_missing_title": {
+ "message": "Abre OmniGet una vez para terminar la configuración de Chrome"
+ },
+ "error_host_missing_body": {
+ "message": "Chrome aún no pudo encontrar el puente de OmniGet en este equipo."
+ },
+ "error_host_missing_detail": {
+ "message": "Instala OmniGet si es necesario, luego abre la app de escritorio una vez y vuelve a hacer clic en la extensión."
+ },
+ "error_invalid_url_title": {
+ "message": "Esta URL de página no se puede enviar a OmniGet"
+ },
+ "error_invalid_url_body": {
+ "message": "La página actual no es una página de medios compatible con la extensión de OmniGet."
+ },
+ "error_invalid_url_detail": {
+ "message": "Inténtalo de nuevo desde una página de vídeo directo, reel, publicación, lista o curso."
+ },
+ "error_launch_failed_title": {
+ "message": "No se pudo iniciar OmniGet desde Chrome"
+ },
+ "error_launch_failed_body": {
+ "message": "La extensión se comunicó con el host nativo, pero la app de escritorio no se inició correctamente."
+ },
+ "error_launch_failed_detail": {
+ "message": "Comprueba que OmniGet esté instalado y no bloqueado por tu sistema, luego inténtalo de nuevo."
+ },
+ "popup_send_default": { "message": "Enviar a OmniGet" },
+ "popup_send_audio": { "message": "Enviar audio" },
+ "popup_video_found_one": { "message": "Vídeo encontrado" },
+ "popup_videos_found": { "message": "$count$ vídeos encontrados", "placeholders": { "count": { "content": "$1" } } },
+ "popup_listening_title": { "message": "Buscando medios…" },
+ "popup_listening_hint": { "message": "Los vídeos y audios aparecerán aquí a medida que las páginas los carguen." },
+ "popup_paused_title": { "message": "Detección de medios en pausa" },
+ "popup_paused_hint": { "message": "Activa el interruptor de arriba para detectar vídeos en esta página." },
+ "popup_send_all": { "message": "Enviar todo ($count$ vídeos)", "placeholders": { "count": { "content": "$1" } } },
+ "popup_detected_one": { "message": "1 vídeo detectado" },
+ "popup_detected_many": { "message": "$count$ vídeos detectados", "placeholders": { "count": { "content": "$1" } } },
+ "popup_video_n": { "message": "Vídeo $n$", "placeholders": { "n": { "content": "$1" } } },
+ "popup_kind_audio": { "message": "Audio" },
+ "popup_kind_video": { "message": "Vídeo" },
+ "popup_download_aria": { "message": "Descargar $name$", "placeholders": { "name": { "content": "$1" } } },
+ "popup_sending": { "message": "Enviando…" },
+ "popup_sent": { "message": "¡Enviado!" },
+ "popup_sending_n": { "message": "Enviando $count$ vídeos…", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_n": { "message": "¡$count$ vídeos enviados!", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_failed": { "message": "Enviados $sent$, fallaron $failed$", "placeholders": { "sent": { "content": "$1" }, "failed": { "content": "$2" } } },
+ "popup_not_running": { "message": "OmniGet no se está ejecutando" },
+ "popup_try_again": { "message": "Reintentar" },
+ "popup_get_app": { "message": "Obtener OmniGet" },
+ "popup_lbl_course": { "message": "Enviar curso a OmniGet" },
+ "popup_lbl_playlist": { "message": "Enviar lista a OmniGet" },
+ "popup_lbl_video": { "message": "Enviar vídeo a OmniGet" },
+ "popup_lbl_reel": { "message": "Enviar reel a OmniGet" },
+ "popup_lbl_post": { "message": "Enviar publicación a OmniGet" },
+ "popup_lbl_short": { "message": "Enviar short a OmniGet" },
+ "popup_lbl_clip": { "message": "Enviar clip a OmniGet" },
+ "popup_lbl_image": { "message": "Enviar imagen a OmniGet" },
+ "popup_lbl_audio": { "message": "Enviar audio a OmniGet" },
+ "popup_lbl_profile": { "message": "Enviar perfil a OmniGet" },
+ "popup_lbl_page": { "message": "Enviar página a OmniGet" },
+ "popup_ck_saving": { "message": "Guardando cookies…" },
+ "popup_ck_saved": { "message": "$count$ cookies guardadas", "placeholders": { "count": { "content": "$1" } } },
+ "popup_ck_btn": { "message": "Guardar cookies del sitio" },
+ "popup_ck_meta": { "message": "$domain$ • $kind$", "placeholders": { "domain": { "content": "$1" }, "kind": { "content": "$2" } } },
+ "popup_ck_hint": { "message": "Envía las cookies de este sitio al gestor de cookies de OmniGet." },
+ "popup_ckerr_no_url": { "message": "No hay pestaña activa" },
+ "popup_ckerr_invalid_url": { "message": "La página no se puede inspeccionar" },
+ "popup_ckerr_unsupported": { "message": "Solo páginas http/https" },
+ "popup_ckerr_no_api": { "message": "API de cookies bloqueada" },
+ "popup_ckerr_no_cookies": { "message": "Sin cookies para este sitio" },
+ "popup_ckerr_missing_token": { "message": "Vincula OmniGet primero" },
+ "popup_ckerr_missing_endpoint": { "message": "OmniGet no detectado" },
+ "popup_ckerr_fetch_failed": { "message": "OmniGet no se está ejecutando" },
+ "popup_ckerr_unauthorized": { "message": "Token de vinculación inválido" },
+ "popup_ckerr_default": { "message": "No se pudieron guardar las cookies" },
+ "popup_open_app_label": { "message": "Abrir la app al descargar" },
+ "popup_sniffer_label": { "message": "Detección de medios" }
+}
diff --git a/browser-extension/firefox/_locales/fr/messages.json b/browser-extension/firefox/_locales/fr/messages.json
index 6b8e6302..3e45bc2b 100644
--- a/browser-extension/firefox/_locales/fr/messages.json
+++ b/browser-extension/firefox/_locales/fr/messages.json
@@ -43,5 +43,56 @@
},
"error_launch_failed_detail": {
"message": "Vérifiez qu'OmniGet est installé et non bloqué par votre système, puis réessayez."
- }
+ },
+ "popup_send_default": { "message": "Envoyer vers OmniGet" },
+ "popup_send_audio": { "message": "Envoyer l'audio" },
+ "popup_video_found_one": { "message": "Vidéo trouvée" },
+ "popup_videos_found": { "message": "$count$ vidéos trouvées", "placeholders": { "count": { "content": "$1" } } },
+ "popup_listening_title": { "message": "Recherche de médias…" },
+ "popup_listening_hint": { "message": "Les vidéos et audios apparaîtront ici au fur et à mesure du chargement des pages." },
+ "popup_paused_title": { "message": "Détection de médias en pause" },
+ "popup_paused_hint": { "message": "Activez le bouton ci-dessus pour détecter les vidéos sur cette page." },
+ "popup_send_all": { "message": "Tout envoyer ($count$ vidéos)", "placeholders": { "count": { "content": "$1" } } },
+ "popup_detected_one": { "message": "1 vidéo détectée" },
+ "popup_detected_many": { "message": "$count$ vidéos détectées", "placeholders": { "count": { "content": "$1" } } },
+ "popup_video_n": { "message": "Vidéo $n$", "placeholders": { "n": { "content": "$1" } } },
+ "popup_kind_audio": { "message": "Audio" },
+ "popup_kind_video": { "message": "Vidéo" },
+ "popup_download_aria": { "message": "Télécharger $name$", "placeholders": { "name": { "content": "$1" } } },
+ "popup_sending": { "message": "Envoi…" },
+ "popup_sent": { "message": "Envoyé !" },
+ "popup_sending_n": { "message": "Envoi de $count$ vidéos…", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_n": { "message": "$count$ vidéos envoyées !", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_failed": { "message": "Envoyées $sent$, échouées $failed$", "placeholders": { "sent": { "content": "$1" }, "failed": { "content": "$2" } } },
+ "popup_not_running": { "message": "OmniGet n'est pas en cours d'exécution" },
+ "popup_try_again": { "message": "Réessayer" },
+ "popup_get_app": { "message": "Obtenir OmniGet" },
+ "popup_lbl_course": { "message": "Envoyer le cours vers OmniGet" },
+ "popup_lbl_playlist": { "message": "Envoyer la playlist vers OmniGet" },
+ "popup_lbl_video": { "message": "Envoyer la vidéo vers OmniGet" },
+ "popup_lbl_reel": { "message": "Envoyer le reel vers OmniGet" },
+ "popup_lbl_post": { "message": "Envoyer la publication vers OmniGet" },
+ "popup_lbl_short": { "message": "Envoyer le short vers OmniGet" },
+ "popup_lbl_clip": { "message": "Envoyer le clip vers OmniGet" },
+ "popup_lbl_image": { "message": "Envoyer l'image vers OmniGet" },
+ "popup_lbl_audio": { "message": "Envoyer l'audio vers OmniGet" },
+ "popup_lbl_profile": { "message": "Envoyer le profil vers OmniGet" },
+ "popup_lbl_page": { "message": "Envoyer la page vers OmniGet" },
+ "popup_ck_saving": { "message": "Enregistrement des cookies…" },
+ "popup_ck_saved": { "message": "$count$ cookies enregistrés", "placeholders": { "count": { "content": "$1" } } },
+ "popup_ck_btn": { "message": "Enregistrer les cookies du site" },
+ "popup_ck_meta": { "message": "$domain$ • $kind$", "placeholders": { "domain": { "content": "$1" }, "kind": { "content": "$2" } } },
+ "popup_ck_hint": { "message": "Envoie les cookies de ce site au gestionnaire de cookies d'OmniGet." },
+ "popup_ckerr_no_url": { "message": "Aucun onglet actif" },
+ "popup_ckerr_invalid_url": { "message": "La page ne peut pas être inspectée" },
+ "popup_ckerr_unsupported": { "message": "Pages http/https uniquement" },
+ "popup_ckerr_no_api": { "message": "API de cookies bloquée" },
+ "popup_ckerr_no_cookies": { "message": "Aucun cookie pour ce site" },
+ "popup_ckerr_missing_token": { "message": "Associez OmniGet d'abord" },
+ "popup_ckerr_missing_endpoint": { "message": "OmniGet non détecté" },
+ "popup_ckerr_fetch_failed": { "message": "OmniGet n'est pas en cours d'exécution" },
+ "popup_ckerr_unauthorized": { "message": "Jeton d'association invalide" },
+ "popup_ckerr_default": { "message": "Impossible d'enregistrer les cookies" },
+ "popup_open_app_label": { "message": "Ouvrir l'app au téléchargement" },
+ "popup_sniffer_label": { "message": "Détection de médias" }
}
diff --git a/browser-extension/firefox/_locales/it/messages.json b/browser-extension/firefox/_locales/it/messages.json
index ac286944..6feaafd6 100644
--- a/browser-extension/firefox/_locales/it/messages.json
+++ b/browser-extension/firefox/_locales/it/messages.json
@@ -43,5 +43,56 @@
},
"error_launch_failed_detail": {
"message": "Verifica che OmniGet sia installato e non bloccato dal sistema, poi riprova."
- }
+ },
+ "popup_send_default": { "message": "Invia a OmniGet" },
+ "popup_send_audio": { "message": "Invia audio" },
+ "popup_video_found_one": { "message": "Video trovato" },
+ "popup_videos_found": { "message": "$count$ video trovati", "placeholders": { "count": { "content": "$1" } } },
+ "popup_listening_title": { "message": "Ricerca di contenuti…" },
+ "popup_listening_hint": { "message": "Video e audio appariranno qui man mano che le pagine li caricano." },
+ "popup_paused_title": { "message": "Rilevamento contenuti in pausa" },
+ "popup_paused_hint": { "message": "Attiva l'interruttore sopra per rilevare i video in questa pagina." },
+ "popup_send_all": { "message": "Invia tutto ($count$ video)", "placeholders": { "count": { "content": "$1" } } },
+ "popup_detected_one": { "message": "1 video rilevato" },
+ "popup_detected_many": { "message": "$count$ video rilevati", "placeholders": { "count": { "content": "$1" } } },
+ "popup_video_n": { "message": "Video $n$", "placeholders": { "n": { "content": "$1" } } },
+ "popup_kind_audio": { "message": "Audio" },
+ "popup_kind_video": { "message": "Video" },
+ "popup_download_aria": { "message": "Scarica $name$", "placeholders": { "name": { "content": "$1" } } },
+ "popup_sending": { "message": "Invio…" },
+ "popup_sent": { "message": "Inviato!" },
+ "popup_sending_n": { "message": "Invio di $count$ video…", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_n": { "message": "$count$ video inviati!", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_failed": { "message": "Inviati $sent$, falliti $failed$", "placeholders": { "sent": { "content": "$1" }, "failed": { "content": "$2" } } },
+ "popup_not_running": { "message": "OmniGet non è in esecuzione" },
+ "popup_try_again": { "message": "Riprova" },
+ "popup_get_app": { "message": "Ottieni OmniGet" },
+ "popup_lbl_course": { "message": "Invia il corso a OmniGet" },
+ "popup_lbl_playlist": { "message": "Invia la playlist a OmniGet" },
+ "popup_lbl_video": { "message": "Invia il video a OmniGet" },
+ "popup_lbl_reel": { "message": "Invia il reel a OmniGet" },
+ "popup_lbl_post": { "message": "Invia il post a OmniGet" },
+ "popup_lbl_short": { "message": "Invia lo short a OmniGet" },
+ "popup_lbl_clip": { "message": "Invia la clip a OmniGet" },
+ "popup_lbl_image": { "message": "Invia l'immagine a OmniGet" },
+ "popup_lbl_audio": { "message": "Invia l'audio a OmniGet" },
+ "popup_lbl_profile": { "message": "Invia il profilo a OmniGet" },
+ "popup_lbl_page": { "message": "Invia la pagina a OmniGet" },
+ "popup_ck_saving": { "message": "Salvataggio cookie…" },
+ "popup_ck_saved": { "message": "$count$ cookie salvati", "placeholders": { "count": { "content": "$1" } } },
+ "popup_ck_btn": { "message": "Salva i cookie del sito" },
+ "popup_ck_meta": { "message": "$domain$ • $kind$", "placeholders": { "domain": { "content": "$1" }, "kind": { "content": "$2" } } },
+ "popup_ck_hint": { "message": "Invia i cookie di questo sito al gestore cookie di OmniGet." },
+ "popup_ckerr_no_url": { "message": "Nessuna scheda attiva" },
+ "popup_ckerr_invalid_url": { "message": "La pagina non può essere ispezionata" },
+ "popup_ckerr_unsupported": { "message": "Solo pagine http/https" },
+ "popup_ckerr_no_api": { "message": "API cookie bloccata" },
+ "popup_ckerr_no_cookies": { "message": "Nessun cookie per questo sito" },
+ "popup_ckerr_missing_token": { "message": "Abbina prima OmniGet" },
+ "popup_ckerr_missing_endpoint": { "message": "OmniGet non rilevato" },
+ "popup_ckerr_fetch_failed": { "message": "OmniGet non è in esecuzione" },
+ "popup_ckerr_unauthorized": { "message": "Token di abbinamento non valido" },
+ "popup_ckerr_default": { "message": "Impossibile salvare i cookie" },
+ "popup_open_app_label": { "message": "Apri l'app al download" },
+ "popup_sniffer_label": { "message": "Rilevamento contenuti" }
}
diff --git a/browser-extension/firefox/_locales/ja/messages.json b/browser-extension/firefox/_locales/ja/messages.json
index 2e2c8a64..382f0b21 100644
--- a/browser-extension/firefox/_locales/ja/messages.json
+++ b/browser-extension/firefox/_locales/ja/messages.json
@@ -43,5 +43,56 @@
},
"error_launch_failed_detail": {
"message": "OmniGet がインストールされていてシステムによってブロックされていないことを確認してから、もう一度お試しください。"
- }
+ },
+ "popup_send_default": { "message": "OmniGet に送信" },
+ "popup_send_audio": { "message": "音声を送信" },
+ "popup_video_found_one": { "message": "動画が見つかりました" },
+ "popup_videos_found": { "message": "$count$ 件の動画が見つかりました", "placeholders": { "count": { "content": "$1" } } },
+ "popup_listening_title": { "message": "メディアを検出中…" },
+ "popup_listening_hint": { "message": "ページが読み込むと、動画や音声がここに表示されます。" },
+ "popup_paused_title": { "message": "メディア検出は一時停止中" },
+ "popup_paused_hint": { "message": "上のスイッチをオンにして、このページの動画を検出します。" },
+ "popup_send_all": { "message": "すべて送信($count$ 件)", "placeholders": { "count": { "content": "$1" } } },
+ "popup_detected_one": { "message": "1 件の動画を検出" },
+ "popup_detected_many": { "message": "$count$ 件の動画を検出", "placeholders": { "count": { "content": "$1" } } },
+ "popup_video_n": { "message": "動画 $n$", "placeholders": { "n": { "content": "$1" } } },
+ "popup_kind_audio": { "message": "音声" },
+ "popup_kind_video": { "message": "動画" },
+ "popup_download_aria": { "message": "$name$ をダウンロード", "placeholders": { "name": { "content": "$1" } } },
+ "popup_sending": { "message": "送信中…" },
+ "popup_sent": { "message": "送信しました!" },
+ "popup_sending_n": { "message": "$count$ 件の動画を送信中…", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_n": { "message": "$count$ 件の動画を送信しました!", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_failed": { "message": "$sent$ 件送信、$failed$ 件失敗", "placeholders": { "sent": { "content": "$1" }, "failed": { "content": "$2" } } },
+ "popup_not_running": { "message": "OmniGet が起動していません" },
+ "popup_try_again": { "message": "再試行" },
+ "popup_get_app": { "message": "OmniGet を入手" },
+ "popup_lbl_course": { "message": "コースを OmniGet に送信" },
+ "popup_lbl_playlist": { "message": "プレイリストを OmniGet に送信" },
+ "popup_lbl_video": { "message": "動画を OmniGet に送信" },
+ "popup_lbl_reel": { "message": "リールを OmniGet に送信" },
+ "popup_lbl_post": { "message": "投稿を OmniGet に送信" },
+ "popup_lbl_short": { "message": "ショートを OmniGet に送信" },
+ "popup_lbl_clip": { "message": "クリップを OmniGet に送信" },
+ "popup_lbl_image": { "message": "画像を OmniGet に送信" },
+ "popup_lbl_audio": { "message": "音声を OmniGet に送信" },
+ "popup_lbl_profile": { "message": "プロフィールを OmniGet に送信" },
+ "popup_lbl_page": { "message": "ページを OmniGet に送信" },
+ "popup_ck_saving": { "message": "クッキーを保存中…" },
+ "popup_ck_saved": { "message": "$count$ 件のクッキーを保存", "placeholders": { "count": { "content": "$1" } } },
+ "popup_ck_btn": { "message": "サイトのクッキーを保存" },
+ "popup_ck_meta": { "message": "$domain$ • $kind$", "placeholders": { "domain": { "content": "$1" }, "kind": { "content": "$2" } } },
+ "popup_ck_hint": { "message": "このサイトのクッキーを OmniGet のクッキーマネージャーに送信します。" },
+ "popup_ckerr_no_url": { "message": "アクティブなタブがありません" },
+ "popup_ckerr_invalid_url": { "message": "このページは検査できません" },
+ "popup_ckerr_unsupported": { "message": "http/https ページのみ" },
+ "popup_ckerr_no_api": { "message": "クッキー API がブロックされています" },
+ "popup_ckerr_no_cookies": { "message": "このサイトのクッキーがありません" },
+ "popup_ckerr_missing_token": { "message": "先に OmniGet をペアリングしてください" },
+ "popup_ckerr_missing_endpoint": { "message": "OmniGet が見つかりません" },
+ "popup_ckerr_fetch_failed": { "message": "OmniGet が起動していません" },
+ "popup_ckerr_unauthorized": { "message": "ペアリングトークンが無効です" },
+ "popup_ckerr_default": { "message": "クッキーを保存できませんでした" },
+ "popup_open_app_label": { "message": "ダウンロード時にアプリを開く" },
+ "popup_sniffer_label": { "message": "メディア検出" }
}
diff --git a/browser-extension/firefox/_locales/pt/messages.json b/browser-extension/firefox/_locales/pt/messages.json
index e490c0ef..80069f93 100644
--- a/browser-extension/firefox/_locales/pt/messages.json
+++ b/browser-extension/firefox/_locales/pt/messages.json
@@ -43,5 +43,56 @@
},
"error_launch_failed_detail": {
"message": "Verifique se o OmniGet está instalado e não foi bloqueado pelo sistema, depois tente novamente."
- }
+ },
+ "popup_send_default": { "message": "Enviar para o OmniGet" },
+ "popup_send_audio": { "message": "Enviar áudio" },
+ "popup_video_found_one": { "message": "Vídeo encontrado" },
+ "popup_videos_found": { "message": "$count$ vídeos encontrados", "placeholders": { "count": { "content": "$1" } } },
+ "popup_listening_title": { "message": "Procurando mídia…" },
+ "popup_listening_hint": { "message": "Vídeos e áudios aparecerão aqui conforme as páginas carregam." },
+ "popup_paused_title": { "message": "Detecção de mídia pausada" },
+ "popup_paused_hint": { "message": "Ative o botão acima para detectar vídeos nesta página." },
+ "popup_send_all": { "message": "Enviar tudo ($count$ vídeos)", "placeholders": { "count": { "content": "$1" } } },
+ "popup_detected_one": { "message": "1 vídeo detectado" },
+ "popup_detected_many": { "message": "$count$ vídeos detectados", "placeholders": { "count": { "content": "$1" } } },
+ "popup_video_n": { "message": "Vídeo $n$", "placeholders": { "n": { "content": "$1" } } },
+ "popup_kind_audio": { "message": "Áudio" },
+ "popup_kind_video": { "message": "Vídeo" },
+ "popup_download_aria": { "message": "Baixar $name$", "placeholders": { "name": { "content": "$1" } } },
+ "popup_sending": { "message": "Enviando…" },
+ "popup_sent": { "message": "Enviado!" },
+ "popup_sending_n": { "message": "Enviando $count$ vídeos…", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_n": { "message": "$count$ vídeos enviados!", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_failed": { "message": "Enviados $sent$, falharam $failed$", "placeholders": { "sent": { "content": "$1" }, "failed": { "content": "$2" } } },
+ "popup_not_running": { "message": "O OmniGet não está em execução" },
+ "popup_try_again": { "message": "Tentar de novo" },
+ "popup_get_app": { "message": "Obter o OmniGet" },
+ "popup_lbl_course": { "message": "Enviar curso para o OmniGet" },
+ "popup_lbl_playlist": { "message": "Enviar playlist para o OmniGet" },
+ "popup_lbl_video": { "message": "Enviar vídeo para o OmniGet" },
+ "popup_lbl_reel": { "message": "Enviar reel para o OmniGet" },
+ "popup_lbl_post": { "message": "Enviar post para o OmniGet" },
+ "popup_lbl_short": { "message": "Enviar short para o OmniGet" },
+ "popup_lbl_clip": { "message": "Enviar clipe para o OmniGet" },
+ "popup_lbl_image": { "message": "Enviar imagem para o OmniGet" },
+ "popup_lbl_audio": { "message": "Enviar áudio para o OmniGet" },
+ "popup_lbl_profile": { "message": "Enviar perfil para o OmniGet" },
+ "popup_lbl_page": { "message": "Enviar página para o OmniGet" },
+ "popup_ck_saving": { "message": "Salvando cookies…" },
+ "popup_ck_saved": { "message": "$count$ cookies salvos", "placeholders": { "count": { "content": "$1" } } },
+ "popup_ck_btn": { "message": "Salvar cookies do site" },
+ "popup_ck_meta": { "message": "$domain$ • $kind$", "placeholders": { "domain": { "content": "$1" }, "kind": { "content": "$2" } } },
+ "popup_ck_hint": { "message": "Envia os cookies deste site para o gerenciador de cookies do OmniGet." },
+ "popup_ckerr_no_url": { "message": "Nenhuma aba ativa" },
+ "popup_ckerr_invalid_url": { "message": "A página não pode ser inspecionada" },
+ "popup_ckerr_unsupported": { "message": "Apenas páginas http/https" },
+ "popup_ckerr_no_api": { "message": "API de cookies bloqueada" },
+ "popup_ckerr_no_cookies": { "message": "Sem cookies para este site" },
+ "popup_ckerr_missing_token": { "message": "Pareie o OmniGet primeiro" },
+ "popup_ckerr_missing_endpoint": { "message": "OmniGet não detectado" },
+ "popup_ckerr_fetch_failed": { "message": "O OmniGet não está em execução" },
+ "popup_ckerr_unauthorized": { "message": "Token de pareamento inválido" },
+ "popup_ckerr_default": { "message": "Não foi possível salvar os cookies" },
+ "popup_open_app_label": { "message": "Abrir o app ao baixar" },
+ "popup_sniffer_label": { "message": "Detecção de mídia" }
}
diff --git a/browser-extension/firefox/_locales/zh_CN/messages.json b/browser-extension/firefox/_locales/zh_CN/messages.json
index 3413f103..1caab953 100644
--- a/browser-extension/firefox/_locales/zh_CN/messages.json
+++ b/browser-extension/firefox/_locales/zh_CN/messages.json
@@ -43,5 +43,56 @@
},
"error_launch_failed_detail": {
"message": "请确认 OmniGet 已安装且未被系统阻止,然后重试。"
- }
+ },
+ "popup_send_default": { "message": "发送到 OmniGet" },
+ "popup_send_audio": { "message": "发送音频" },
+ "popup_video_found_one": { "message": "找到视频" },
+ "popup_videos_found": { "message": "找到 $count$ 个视频", "placeholders": { "count": { "content": "$1" } } },
+ "popup_listening_title": { "message": "正在检测媒体…" },
+ "popup_listening_hint": { "message": "页面加载时,视频和音频会显示在这里。" },
+ "popup_paused_title": { "message": "媒体检测已暂停" },
+ "popup_paused_hint": { "message": "打开上方开关以检测此页面的视频。" },
+ "popup_send_all": { "message": "全部发送($count$ 个视频)", "placeholders": { "count": { "content": "$1" } } },
+ "popup_detected_one": { "message": "检测到 1 个视频" },
+ "popup_detected_many": { "message": "检测到 $count$ 个视频", "placeholders": { "count": { "content": "$1" } } },
+ "popup_video_n": { "message": "视频 $n$", "placeholders": { "n": { "content": "$1" } } },
+ "popup_kind_audio": { "message": "音频" },
+ "popup_kind_video": { "message": "视频" },
+ "popup_download_aria": { "message": "下载 $name$", "placeholders": { "name": { "content": "$1" } } },
+ "popup_sending": { "message": "发送中…" },
+ "popup_sent": { "message": "已发送!" },
+ "popup_sending_n": { "message": "正在发送 $count$ 个视频…", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_n": { "message": "已发送 $count$ 个视频!", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_failed": { "message": "已发送 $sent$ 个,失败 $failed$ 个", "placeholders": { "sent": { "content": "$1" }, "failed": { "content": "$2" } } },
+ "popup_not_running": { "message": "OmniGet 未运行" },
+ "popup_try_again": { "message": "重试" },
+ "popup_get_app": { "message": "获取 OmniGet" },
+ "popup_lbl_course": { "message": "发送课程到 OmniGet" },
+ "popup_lbl_playlist": { "message": "发送播放列表到 OmniGet" },
+ "popup_lbl_video": { "message": "发送视频到 OmniGet" },
+ "popup_lbl_reel": { "message": "发送 Reel 到 OmniGet" },
+ "popup_lbl_post": { "message": "发送帖子到 OmniGet" },
+ "popup_lbl_short": { "message": "发送 Shorts 到 OmniGet" },
+ "popup_lbl_clip": { "message": "发送片段到 OmniGet" },
+ "popup_lbl_image": { "message": "发送图片到 OmniGet" },
+ "popup_lbl_audio": { "message": "发送音频到 OmniGet" },
+ "popup_lbl_profile": { "message": "发送主页到 OmniGet" },
+ "popup_lbl_page": { "message": "发送页面到 OmniGet" },
+ "popup_ck_saving": { "message": "正在保存 Cookie…" },
+ "popup_ck_saved": { "message": "已保存 $count$ 个 Cookie", "placeholders": { "count": { "content": "$1" } } },
+ "popup_ck_btn": { "message": "保存站点 Cookie" },
+ "popup_ck_meta": { "message": "$domain$ • $kind$", "placeholders": { "domain": { "content": "$1" }, "kind": { "content": "$2" } } },
+ "popup_ck_hint": { "message": "将此站点的 Cookie 发送到 OmniGet 的 Cookie 管理器。" },
+ "popup_ckerr_no_url": { "message": "没有活动标签页" },
+ "popup_ckerr_invalid_url": { "message": "无法检查该页面" },
+ "popup_ckerr_unsupported": { "message": "仅支持 http/https 页面" },
+ "popup_ckerr_no_api": { "message": "Cookie API 被阻止" },
+ "popup_ckerr_no_cookies": { "message": "该站点没有 Cookie" },
+ "popup_ckerr_missing_token": { "message": "请先配对 OmniGet" },
+ "popup_ckerr_missing_endpoint": { "message": "未检测到 OmniGet" },
+ "popup_ckerr_fetch_failed": { "message": "OmniGet 未运行" },
+ "popup_ckerr_unauthorized": { "message": "配对令牌无效" },
+ "popup_ckerr_default": { "message": "无法保存 Cookie" },
+ "popup_open_app_label": { "message": "下载时打开应用" },
+ "popup_sniffer_label": { "message": "媒体检测" }
}
diff --git a/browser-extension/firefox/_locales/zh_TW/messages.json b/browser-extension/firefox/_locales/zh_TW/messages.json
index cba5aea9..afcdce1f 100644
--- a/browser-extension/firefox/_locales/zh_TW/messages.json
+++ b/browser-extension/firefox/_locales/zh_TW/messages.json
@@ -43,5 +43,56 @@
},
"error_launch_failed_detail": {
"message": "請確認 OmniGet 已安裝且未被系統封鎖,然後再試一次。"
- }
+ },
+ "popup_send_default": { "message": "傳送到 OmniGet" },
+ "popup_send_audio": { "message": "傳送音訊" },
+ "popup_video_found_one": { "message": "找到影片" },
+ "popup_videos_found": { "message": "找到 $count$ 個影片", "placeholders": { "count": { "content": "$1" } } },
+ "popup_listening_title": { "message": "正在偵測媒體…" },
+ "popup_listening_hint": { "message": "頁面載入時,影片與音訊會顯示在這裡。" },
+ "popup_paused_title": { "message": "媒體偵測已暫停" },
+ "popup_paused_hint": { "message": "開啟上方開關以偵測此頁面的影片。" },
+ "popup_send_all": { "message": "全部傳送($count$ 個影片)", "placeholders": { "count": { "content": "$1" } } },
+ "popup_detected_one": { "message": "偵測到 1 個影片" },
+ "popup_detected_many": { "message": "偵測到 $count$ 個影片", "placeholders": { "count": { "content": "$1" } } },
+ "popup_video_n": { "message": "影片 $n$", "placeholders": { "n": { "content": "$1" } } },
+ "popup_kind_audio": { "message": "音訊" },
+ "popup_kind_video": { "message": "影片" },
+ "popup_download_aria": { "message": "下載 $name$", "placeholders": { "name": { "content": "$1" } } },
+ "popup_sending": { "message": "傳送中…" },
+ "popup_sent": { "message": "已傳送!" },
+ "popup_sending_n": { "message": "正在傳送 $count$ 個影片…", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_n": { "message": "已傳送 $count$ 個影片!", "placeholders": { "count": { "content": "$1" } } },
+ "popup_sent_failed": { "message": "已傳送 $sent$ 個,失敗 $failed$ 個", "placeholders": { "sent": { "content": "$1" }, "failed": { "content": "$2" } } },
+ "popup_not_running": { "message": "OmniGet 未執行" },
+ "popup_try_again": { "message": "重試" },
+ "popup_get_app": { "message": "取得 OmniGet" },
+ "popup_lbl_course": { "message": "傳送課程到 OmniGet" },
+ "popup_lbl_playlist": { "message": "傳送播放清單到 OmniGet" },
+ "popup_lbl_video": { "message": "傳送影片到 OmniGet" },
+ "popup_lbl_reel": { "message": "傳送 Reel 到 OmniGet" },
+ "popup_lbl_post": { "message": "傳送貼文到 OmniGet" },
+ "popup_lbl_short": { "message": "傳送 Shorts 到 OmniGet" },
+ "popup_lbl_clip": { "message": "傳送片段到 OmniGet" },
+ "popup_lbl_image": { "message": "傳送圖片到 OmniGet" },
+ "popup_lbl_audio": { "message": "傳送音訊到 OmniGet" },
+ "popup_lbl_profile": { "message": "傳送個人檔案到 OmniGet" },
+ "popup_lbl_page": { "message": "傳送頁面到 OmniGet" },
+ "popup_ck_saving": { "message": "正在儲存 Cookie…" },
+ "popup_ck_saved": { "message": "已儲存 $count$ 個 Cookie", "placeholders": { "count": { "content": "$1" } } },
+ "popup_ck_btn": { "message": "儲存網站 Cookie" },
+ "popup_ck_meta": { "message": "$domain$ • $kind$", "placeholders": { "domain": { "content": "$1" }, "kind": { "content": "$2" } } },
+ "popup_ck_hint": { "message": "將此網站的 Cookie 傳送到 OmniGet 的 Cookie 管理器。" },
+ "popup_ckerr_no_url": { "message": "沒有作用中的分頁" },
+ "popup_ckerr_invalid_url": { "message": "無法檢查此頁面" },
+ "popup_ckerr_unsupported": { "message": "僅支援 http/https 頁面" },
+ "popup_ckerr_no_api": { "message": "Cookie API 被封鎖" },
+ "popup_ckerr_no_cookies": { "message": "此網站沒有 Cookie" },
+ "popup_ckerr_missing_token": { "message": "請先配對 OmniGet" },
+ "popup_ckerr_missing_endpoint": { "message": "未偵測到 OmniGet" },
+ "popup_ckerr_fetch_failed": { "message": "OmniGet 未執行" },
+ "popup_ckerr_unauthorized": { "message": "配對權杖無效" },
+ "popup_ckerr_default": { "message": "無法儲存 Cookie" },
+ "popup_open_app_label": { "message": "下載時開啟應用程式" },
+ "popup_sniffer_label": { "message": "媒體偵測" }
}
diff --git a/browser-extension/firefox/manifest.json b/browser-extension/firefox/manifest.json
index 99604237..21ebadc5 100644
--- a/browser-extension/firefox/manifest.json
+++ b/browser-extension/firefox/manifest.json
@@ -15,7 +15,8 @@
"cookies",
"webRequest",
"storage",
- "menus"
+ "menus",
+ "alarms"
],
"host_permissions": [
"http://127.0.0.1/*",
diff --git a/browser-extension/firefox/popup/popup.js b/browser-extension/firefox/popup/popup.js
index a990d0ad..ef2b5222 100644
--- a/browser-extension/firefox/popup/popup.js
+++ b/browser-extension/firefox/popup/popup.js
@@ -6,6 +6,9 @@ import { captureCookiesForTab } from "../src/cookie-capture.js";
const APP_URL = "https://github.com/tonhowtf/omniget/releases/latest";
+const tr = (k, ...subs) =>
+ (chrome.i18n?.getMessage?.(k, subs.length ? subs.map(String) : undefined) || k);
+
const SVG = {
play: `<svg viewBox="0 0 20 20" fill="currentColor"><path d="M6.5 4v12l10-6z"/></svg>`,
check: `<svg viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path class="checkmark-path" d="M4 10.5l4 4 8-8"/></svg>`,
@@ -19,7 +22,23 @@ let currentData = null;
let pageTitle = "";
let pageThumbnail = "";
+function localizeStatic() {
+ const openApp = tr("popup_open_app_label");
+ const sniffer = tr("popup_sniffer_label");
+ const openWrap = document.getElementById("open-app-toggle")?.closest(".toggle-group");
+ if (openWrap) openWrap.title = openApp;
+ document.getElementById("open-app-toggle")?.setAttribute("aria-label", openApp);
+ const snifWrap = document.getElementById("sniffer-toggle")?.closest(".toggle-group");
+ if (snifWrap) snifWrap.title = sniffer;
+ document.getElementById("sniffer-toggle")?.setAttribute("aria-label", sniffer);
+ const ckLabel = document.getElementById("cookie-capture-label");
+ if (ckLabel) ckLabel.textContent = tr("popup_ck_btn");
+ const ckHint = document.getElementById("cookie-capture-hint");
+ if (ckHint) ckHint.textContent = tr("popup_ck_hint");
+}
+
async function init() {
+ localizeStatic();
const toggle = document.getElementById("sniffer-toggle");
const openAppToggle = document.getElementById("open-app-toggle");
@@ -122,8 +141,8 @@ function renderMediaDetected(container) {
const domain = getDomainFromUrl(currentData.tabUrl || best.url);
const title = pageTitle ? truncate(pageTitle, 40) : domain;
- const countText = totalVideos > 1 ? `${totalVideos} videos found` : "Video found";
- const label = best.mediaType === "audio" ? "Send audio" : "Send to OmniGet";
+ const countText = totalVideos > 1 ? tr("popup_videos_found", totalVideos) : tr("popup_video_found_one");
+ const label = best.mediaType === "audio" ? tr("popup_send_audio") : tr("popup_send_default");
appendPrimaryButton(container, label, title + " \u00b7 " + countText, (btn) => {
handleDownload(btn, best.url, "generic", best);
@@ -136,8 +155,8 @@ function renderListening(container) {
container.innerHTML = `
<div class="state-empty" role="status">
<div class="listening-dot" aria-hidden="true"></div>
- <span class="state-title">Listening for media\u2026</span>
- <span class="state-hint">Videos and audio will appear here<br>as pages load them.</span>
+ <span class="state-title">${escapeHtml(tr("popup_listening_title"))}</span>
+ <span class="state-hint">${escapeHtml(tr("popup_listening_hint"))}</span>
</div>
`;
}
@@ -145,8 +164,8 @@ function renderListening(container) {
function renderSnifferOff(container) {
container.innerHTML = `
<div class="state-empty" role="status">
- <span class="state-title">Media detection is paused</span>
- <span class="state-hint">Turn on the toggle above to<br>detect videos on this page.</span>
+ <span class="state-title">${escapeHtml(tr("popup_paused_title"))}</span>
+ <span class="state-hint">${escapeHtml(tr("popup_paused_hint"))}</span>
</div>
`;
}
@@ -184,11 +203,12 @@ function appendMediaControls(container, media) {
const btn = document.createElement("button");
btn.className = "secondary-btn";
- btn.setAttribute("aria-label", `Send all ${groups.length} videos`);
+ const sendAllLabel = tr("popup_send_all", groups.length);
+ btn.setAttribute("aria-label", sendAllLabel);
btn.innerHTML = `
<span class="btn-icon">${SVG.download}</span>
<div class="btn-content">
- <span class="btn-label">Send all (${groups.length} videos)</span>
+ <span class="btn-label">${escapeHtml(sendAllLabel)}</span>
</div>
`;
@@ -210,7 +230,7 @@ function appendMediaList(container, hlsGroups, directMedia, totalItems) {
toggleBtn.className = "media-toggle";
toggleBtn.setAttribute("aria-expanded", "false");
toggleBtn.innerHTML = `
- <span>${totalItems} video${totalItems !== 1 ? "s" : ""} detected</span>
+ <span>${escapeHtml(totalItems === 1 ? tr("popup_detected_one") : tr("popup_detected_many", totalItems))}</span>
<span class="media-toggle-arrow">\u25be</span>
`;
@@ -221,7 +241,7 @@ function appendMediaList(container, hlsGroups, directMedia, totalItems) {
for (const group of hlsGroups) {
const domain = getDomainFromUrl(group.master.url);
list.appendChild(createMediaItem(
- `Video ${idx}`, domain,
+ tr("popup_video_n", idx), domain,
() => sendToApp(group.master.url, "generic", group.master)
));
idx++;
@@ -230,7 +250,7 @@ function appendMediaList(container, hlsGroups, directMedia, totalItems) {
for (const entry of directMedia) {
const name = getFilenameFromUrl(entry.url);
const size = entry.sizeText || "";
- const meta = (entry.mediaType === "audio" ? "Audio" : "Video") + (size ? " \u00b7 " + size : "");
+ const meta = (entry.mediaType === "audio" ? tr("popup_kind_audio") : tr("popup_kind_video")) + (size ? " \u00b7 " + size : "");
list.appendChild(createMediaItem(name, meta, () => sendToApp(entry.url, "generic", entry)));
}
@@ -255,7 +275,7 @@ function createMediaItem(name, meta, sendFn) {
<span class="media-meta">${escapeHtml(meta)}</span>
</div>
</div>
- <button class="item-download-btn" aria-label="Download ${escapeHtml(name)}">${SVG.arrow}</button>
+ <button class="item-download-btn" aria-label="${escapeHtml(tr("popup_download_aria", name))}">${SVG.arrow}</button>
`;
const btn = item.querySelector(".item-download-btn");
@@ -282,7 +302,7 @@ async function handleDownload(btn, url, platform, mediaEntry) {
btn.dataset.busy = "1";
btn.classList.add("sending");
- btn.querySelector(".btn-label").textContent = "Sending\u2026";
+ btn.querySelector(".btn-label").textContent = tr("popup_sending");
btn.querySelector(".btn-meta").textContent = "";
const result = await sendToApp(url, platform, mediaEntry);
@@ -291,7 +311,7 @@ async function handleDownload(btn, url, platform, mediaEntry) {
btn.classList.remove("sending");
btn.classList.add("success");
btn.querySelector(".btn-icon").innerHTML = SVG.check;
- btn.querySelector(".btn-label").textContent = "Sent!";
+ btn.querySelector(".btn-label").textContent = tr("popup_sent");
const summaryText = formatCookieSummary(result.cookieSummary);
const metaEl = btn.querySelector(".btn-meta");
if (metaEl) metaEl.textContent = summaryText;
@@ -305,7 +325,7 @@ async function handleBatchDownload(btn, groups) {
if (btn.dataset.busy) return;
btn.dataset.busy = "1";
- btn.querySelector(".btn-label").textContent = `Sending ${groups.length} videos\u2026`;
+ btn.querySelector(".btn-label").textContent = tr("popup_sending_n", groups.length);
btn.classList.add("sending");
const result = await sendBatch(groups);
@@ -314,11 +334,11 @@ async function handleBatchDownload(btn, groups) {
btn.classList.remove("sending");
btn.classList.add("success");
btn.querySelector(".btn-icon").innerHTML = SVG.check;
- btn.querySelector(".btn-label").textContent = `${result.sent} videos sent!`;
+ btn.querySelector(".btn-label").textContent = tr("popup_sent_n", result.sent);
setTimeout(() => window.close(), 1200);
} else if (result.sent > 0) {
btn.classList.remove("sending");
- btn.querySelector(".btn-label").textContent = `Sent ${result.sent}, failed ${result.failed}`;
+ btn.querySelector(".btn-label").textContent = tr("popup_sent_failed", result.sent, result.failed);
delete btn.dataset.busy;
} else {
showError(btn.closest(".secondary-action") || btn.parentElement);
@@ -330,11 +350,11 @@ function showError(container) {
<div class="error-box">
<div class="error-header">
<span class="error-icon">${SVG.warning}</span>
- <span class="error-message">OmniGet is not running</span>
+ <span class="error-message">${escapeHtml(tr("popup_not_running"))}</span>
</div>
<div class="error-actions">
- <button class="error-btn error-btn-primary" data-action="retry">Try again</button>
- <button class="error-btn error-btn-secondary" data-action="open">Get OmniGet</button>
+ <button class="error-btn error-btn-primary" data-action="retry">${escapeHtml(tr("popup_try_again"))}</button>
+ <button class="error-btn error-btn-secondary" data-action="open">${escapeHtml(tr("popup_get_app"))}</button>
</div>
</div>
`;
@@ -458,17 +478,17 @@ function pickBestMedia(media) {
function getDownloadLabel(contentType) {
switch (contentType) {
- case "course": return "Send course to OmniGet";
- case "playlist": return "Send playlist to OmniGet";
- case "video": return "Send video to OmniGet";
- case "reel": return "Send reel to OmniGet";
- case "post": return "Send post to OmniGet";
- case "short": return "Send short to OmniGet";
- case "clip": return "Send clip to OmniGet";
- case "image": return "Send image to OmniGet";
- case "audio": return "Send audio to OmniGet";
- case "profile": return "Send profile to OmniGet";
- default: return "Send page to OmniGet";
+ case "course": return tr("popup_lbl_course");
+ case "playlist": return tr("popup_lbl_playlist");
+ case "video": return tr("popup_lbl_video");
+ case "reel": return tr("popup_lbl_reel");
+ case "post": return tr("popup_lbl_post");
+ case "short": return tr("popup_lbl_short");
+ case "clip": return tr("popup_lbl_clip");
+ case "image": return tr("popup_lbl_image");
+ case "audio": return tr("popup_lbl_audio");
+ case "profile": return tr("popup_lbl_profile");
+ default: return tr("popup_lbl_page");
}
}
@@ -533,7 +553,7 @@ function initCookieCapture(activeTab) {
busy = true;
btn.disabled = true;
btn.removeAttribute("data-state");
- label.textContent = "Saving cookies…";
+ label.textContent = tr("popup_ck_saving");
const result = await captureCookiesForTab(activeTab);
busy = false;
@@ -541,19 +561,19 @@ function initCookieCapture(activeTab) {
if (result.ok) {
btn.dataset.state = "success";
- label.textContent = `${result.cookie_count} cookies saved`;
- if (hint) hint.textContent = `${result.domain} • ${result.platform_kind.replace("_", " ")}`;
+ label.textContent = tr("popup_ck_saved", result.cookie_count);
+ if (hint) hint.textContent = tr("popup_ck_meta", result.domain, result.platform_kind.replace("_", " "));
setTimeout(() => {
btn.removeAttribute("data-state");
- label.textContent = "Save site cookies";
- if (hint) hint.textContent = "Sends cookies of this site to OmniGet's cookie manager.";
+ label.textContent = tr("popup_ck_btn");
+ if (hint) hint.textContent = tr("popup_ck_hint");
}, 3500);
} else {
btn.dataset.state = "error";
label.textContent = explainFailure(result);
setTimeout(() => {
btn.removeAttribute("data-state");
- label.textContent = "Save site cookies";
+ label.textContent = tr("popup_ck_btn");
}, 4000);
}
});
@@ -561,16 +581,16 @@ function initCookieCapture(activeTab) {
function explainFailure(result) {
switch (result?.reason) {
- case "no-url": return "No active tab";
- case "invalid-url": return "Page can't be inspected";
- case "unsupported-scheme": return "Only http/https pages";
- case "no-cookies-api": return "Cookies API blocked";
- case "no-cookies-for-domain": return "No cookies for this site";
- case "missing-token": return "Pair OmniGet first";
- case "missing-endpoint": return "OmniGet not detected";
- case "fetch-failed": return "OmniGet isn't running";
- case "unauthorized": return "Bad pairing token";
- default: return "Couldn't save cookies";
+ case "no-url": return tr("popup_ckerr_no_url");
+ case "invalid-url": return tr("popup_ckerr_invalid_url");
+ case "unsupported-scheme": return tr("popup_ckerr_unsupported");
+ case "no-cookies-api": return tr("popup_ckerr_no_api");
+ case "no-cookies-for-domain": return tr("popup_ckerr_no_cookies");
+ case "missing-token": return tr("popup_ckerr_missing_token");
+ case "missing-endpoint": return tr("popup_ckerr_missing_endpoint");
+ case "fetch-failed": return tr("popup_ckerr_fetch_failed");
+ case "unauthorized": return tr("popup_ckerr_unauthorized");
+ default: return tr("popup_ckerr_default");
}
}
diff --git a/browser-extension/firefox/src/background.js b/browser-extension/firefox/src/background.js
index d5d76213..5aeea7d2 100644
--- a/browser-extension/firefox/src/background.js
+++ b/browser-extension/firefox/src/background.js
@@ -6,7 +6,55 @@ import { summarizeCookies } from "./cookie-summary.js";
import { loadSnifferState, isSnifferEnabled, setSnifferEnabled } from "./sniffer-toggle.js";
import { registerContextMenu, getContextMenuId } from "./context-menu.js";
import { openOmnigetScheme } from "./send-via-scheme.js";
-import { sendViaBridge, sendCookiesViaBridge } from "./bridge-client.js";
+import { sendViaBridge, sendCookiesViaBridge, autoPair, loadBridgeConfig } from "./bridge-client.js";
+
+const AUTOPAIR_ALARM = "omniget-autopair";
+
+async function isPaired() {
+ try {
+ const cfg = await loadBridgeConfig();
+ return Boolean(cfg.token);
+ } catch {
+ return false;
+ }
+}
+
+// Keep a low-frequency poll alive while unpaired so that, the moment the user
+// clicks "Pair extension" in the desktop app (which opens a ~120s single-use
+// window), the extension grabs the token on its own — no copy-paste, no
+// returning to the extension. The alarm clears itself once paired.
+async function runAutoPairTick() {
+ if (await isPaired()) {
+ try {
+ await chrome.alarms.clear(AUTOPAIR_ALARM);
+ } catch {}
+ return true;
+ }
+ const result = await autoPair().catch(() => ({ ok: false }));
+ if (result?.ok) {
+ try {
+ await chrome.alarms.clear(AUTOPAIR_ALARM);
+ } catch {}
+ refreshActiveTab().catch(() => {});
+ return true;
+ }
+ return false;
+}
+
+async function ensureAutoPairAlarm() {
+ if (await isPaired()) return;
+ try {
+ if (!(await chrome.alarms.get(AUTOPAIR_ALARM))) {
+ chrome.alarms.create(AUTOPAIR_ALARM, { periodInMinutes: 1 });
+ }
+ } catch {}
+}
+
+if (chrome.alarms?.onAlarm) {
+ chrome.alarms.onAlarm.addListener((alarm) => {
+ if (alarm?.name === AUTOPAIR_ALARM) void runAutoPairTick();
+ });
+}
const INSTALL_URL = "https://github.com/tonhowtf/omniget/releases/latest";
const PROTOCOL_VERSION = 1;
@@ -62,7 +110,11 @@ chrome.runtime.onInstalled.addListener(async (details) => {
const stored = await chrome.storage.local.get("bridge_token");
const token = typeof stored?.bridge_token === "string" ? stored.bridge_token.trim() : "";
if (!token) {
- chrome.runtime.openOptionsPage().catch(() => {});
+ const paired = await runAutoPairTick();
+ if (!paired) {
+ await ensureAutoPairAlarm();
+ chrome.runtime.openOptionsPage().catch(() => {});
+ }
}
} catch {
// storage unavailable — fall back to the previous behaviour and only
@@ -93,6 +145,8 @@ chrome.contextMenus.onClicked.addListener(async (info, tab) => {
chrome.runtime.onStartup.addListener(() => {
refreshActiveTab().catch(() => {});
+ void runAutoPairTick();
+ void ensureAutoPairAlarm();
});
if (chrome.commands && chrome.commands.onCommand) {
@@ -506,12 +560,26 @@ async function scanOpenTabsForCookies() {
}
}
+// Scan every tracked platform — useful when the user logged into a service
+// before installing the extension (no cookies.onChanged event was ever fired
+// for that login, and they may not have a tab open right now).
async function scanAllPlatformsForCookies() {
if (!chrome.cookies?.getAll) return;
const allPlatforms = [
- "youtube", "instagram", "tiktok", "twitter", "reddit",
- "twitch", "vimeo", "bilibili", "soundcloud", "pinterest",
- "hotmart", "udemy", "bluesky", "telegram",
+ "youtube",
+ "instagram",
+ "tiktok",
+ "twitter",
+ "reddit",
+ "twitch",
+ "vimeo",
+ "bilibili",
+ "soundcloud",
+ "pinterest",
+ "hotmart",
+ "udemy",
+ "bluesky",
+ "telegram",
];
for (const platform of allPlatforms) {
try {
@@ -523,6 +591,9 @@ async function scanAllPlatformsForCookies() {
}
scanOpenTabsForCookies();
+// Also do a proactive sweep for users who logged in BEFORE installing the
+// extension (cookies.onChanged never fired, no tab open) — covers SoundCloud,
+// YouTube etc. when the user already had a session in their browser.
scanAllPlatformsForCookies();
if (chrome.runtime?.onStartup) {
diff --git a/browser-extension/firefox/src/bridge-client.js b/browser-extension/firefox/src/bridge-client.js
index 99631876..8584ff37 100644
--- a/browser-extension/firefox/src/bridge-client.js
+++ b/browser-extension/firefox/src/bridge-client.js
@@ -138,6 +138,43 @@ export async function checkBridgeHealth(
}
}
+// One-shot auto-pair. If we don't have a token yet, discover the bridge and
+// ask `GET /v1/pair`. That endpoint only returns the token while the user has
+// an active, single-use, ~120s pairing window open in the desktop app — so
+// this turns "find the token, copy, paste" into a single click in the app.
+export async function autoPair({
+ fetchImpl = typeof fetch !== "undefined" ? fetch : null,
+ storage = globalThis.chrome?.storage?.local,
+ timeoutMs = HEALTH_TIMEOUT_MS,
+} = {}) {
+ if (!fetchImpl) return { ok: false, reason: "no-fetch" };
+ const current = await loadBridgeConfig({ storage });
+ if (current.token) return { ok: true, reason: "already-paired" };
+
+ let endpoint = current.endpoint;
+ const discovered = await discoverBridgeEndpoint({ fetchImpl, timeoutMs });
+ if (discovered?.endpoint) endpoint = discovered.endpoint;
+ endpoint = trimEndpoint(endpoint);
+ if (!endpoint) return { ok: false, reason: "no-endpoint" };
+
+ const controller = typeof AbortController !== "undefined" ? new AbortController() : null;
+ try {
+ const response = await withTimeout(
+ fetchImpl(`${endpoint}/v1/pair`, { method: "GET", signal: controller?.signal }),
+ timeoutMs,
+ controller
+ );
+ if (!response.ok) return { ok: false, reason: "window-closed" };
+ const parsed = await response.json().catch(() => null);
+ const token = typeof parsed?.token === "string" ? parsed.token.trim() : "";
+ if (!parsed?.ok || !token) return { ok: false, reason: "no-token" };
+ await saveBridgeConfig({ endpoint, token }, { storage });
+ return { ok: true, reason: "paired", endpoint };
+ } catch (error) {
+ return { ok: false, reason: "error", message: error?.message ?? String(error) };
+ }
+}
+
export async function sendViaBridge(
payload,
{
diff --git a/browser-extension/firefox/src/cookies-domains.json b/browser-extension/firefox/src/cookies-domains.json
index 40838072..819c7a5c 100644
--- a/browser-extension/firefox/src/cookies-domains.json
+++ b/browser-extension/firefox/src/cookies-domains.json
@@ -7,6 +7,7 @@
"twitch": [".twitch.tv", ".jtvnw.net"],
"vimeo": [".vimeo.com", ".vimeocdn.com"],
"bilibili": [".bilibili.com", ".bilivideo.com"],
+ "soundcloud": [".soundcloud.com", ".sndcdn.com"],
"pinterest": [".pinterest.com"],
"hotmart": [".hotmart.com"],
"udemy": [".udemy.com"],
diff --git a/package-lock.json b/package-lock.json
index 32cca106..a04be942 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "omniget",
- "version": "0.6.1",
+ "version": "0.6.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "omniget",
- "version": "0.6.1",
+ "version": "0.6.2",
"license": "GPL-3.0",
"dependencies": {
"@fontsource-variable/bricolage-grotesque": "^5.2.10",
diff --git a/package.json b/package.json
index d0ff77b6..3c65237a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "omniget",
- "version": "0.6.1",
+ "version": "0.6.2",
"description": "",
"type": "module",
"packageManager": "[email protected]",
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index 6dc2a2a5..9a168abe 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -64,6 +64,43 @@ version = "1.0.102"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c"
+[[package]]
+name = "apple-bindgen"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "38f109ee76f68b4767848cb5dc93bfcc7c425deca849c4c81fa11cdce525e3d2"
+dependencies = [
+ "apple-sdk",
+ "bindgen",
+ "derive_more",
+ "regex",
+ "serde",
+ "thiserror 1.0.69",
+ "toml 0.6.0",
+]
+
+[[package]]
+name = "apple-sdk"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a04f192a700686ee70008ff4e4eb76fe7d11814ab93b7ee9d48c36b9a9f0bd2a"
+dependencies = [
+ "plist",
+ "serde",
+ "serde_json",
+]
+
+[[package]]
+name = "apple-sys"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "12b3a1c3342678cd72676d0c1644fde496c1f65ea41f51465f54a89cad3bdf34"
+dependencies = [
+ "apple-bindgen",
+ "apple-sdk",
+ "objc",
+]
+
[[package]]
name = "arbitrary"
version = "1.4.2"
@@ -112,13 +149,23 @@ dependencies = [
"const_panic",
]
+[[package]]
+name = "async-broadcast"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7c48ccdbf6ca6b121e0f586cbc0e73ae440e56c67c30fa0873b4e110d9c26d2b"
+dependencies = [
+ "event-listener 2.5.3",
+ "futures-core",
+]
+
[[package]]
name = "async-broadcast"
version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532"
dependencies = [
- "event-listener",
+ "event-listener 5.4.1",
"event-listener-strategy",
"futures-core",
"pin-project-lite",
@@ -156,12 +203,44 @@ checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a"
dependencies = [
"async-task",
"concurrent-queue",
- "fastrand",
- "futures-lite",
+ "fastrand 2.3.0",
+ "futures-lite 2.6.1",
"pin-project-lite",
"slab",
]
+[[package]]
+name = "async-fs"
+version = "1.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06"
+dependencies = [
+ "async-lock 2.8.0",
+ "autocfg",
+ "blocking",
+ "futures-lite 1.13.0",
+]
+
+[[package]]
+name = "async-io"
+version = "1.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af"
+dependencies = [
+ "async-lock 2.8.0",
+ "autocfg",
+ "cfg-if",
+ "concurrent-queue",
+ "futures-lite 1.13.0",
+ "log",
+ "parking",
+ "polling 2.8.0",
+ "rustix 0.37.28",
+ "slab",
+ "socket2 0.4.10",
+ "waker-fn",
+]
+
[[package]]
name = "async-io"
version = "2.6.0"
@@ -172,25 +251,51 @@ dependencies = [
"cfg-if",
"concurrent-queue",
"futures-io",
- "futures-lite",
+ "futures-lite 2.6.1",
"parking",
- "polling",
- "rustix",
+ "polling 3.11.0",
+ "rustix 1.1.3",
"slab",
"windows-sys 0.61.2",
]
+[[package]]
+name = "async-lock"
+version = "2.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b"
+dependencies = [
+ "event-listener 2.5.3",
+]
+
[[package]]
name = "async-lock"
version = "3.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311"
dependencies = [
- "event-listener",
+ "event-listener 5.4.1",
"event-listener-strategy",
"pin-project-lite",
]
+[[package]]
+name = "async-process"
+version = "1.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ea6438ba0a08d81529c69b36700fa2f95837bfe3e776ab39cde9c14d9149da88"
+dependencies = [
+ "async-io 1.13.0",
+ "async-lock 2.8.0",
+ "async-signal",
+ "blocking",
+ "cfg-if",
+ "event-listener 3.1.0",
+ "futures-lite 1.13.0",
+ "rustix 0.38.44",
+ "windows-sys 0.48.0",
+]
+
[[package]]
name = "async-process"
version = "2.5.0"
@@ -198,15 +303,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75"
dependencies = [
"async-channel",
- "async-io",
- "async-lock",
+ "async-io 2.6.0",
+ "async-lock 3.4.2",
"async-signal",
"async-task",
"blocking",
"cfg-if",
- "event-listener",
- "futures-lite",
- "rustix",
+ "event-listener 5.4.1",
+ "futures-lite 2.6.1",
+ "rustix 1.1.3",
]
[[package]]
@@ -226,13 +331,13 @@ version = "0.2.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43c070bbf59cd3570b6b2dd54cd772527c7c3620fce8be898406dd3ed6adc64c"
dependencies = [
- "async-io",
- "async-lock",
+ "async-io 2.6.0",
+ "async-lock 3.4.2",
"atomic-waker",
"cfg-if",
"futures-core",
"futures-io",
- "rustix",
+ "rustix 1.1.3",
"signal-hook-registry",
"slab",
"windows-sys 0.61.2",
@@ -423,6 +528,28 @@ dependencies = [
"virtue",
]
+[[package]]
+name = "bindgen"
+version = "0.63.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "36d860121800b2a9a94f9b5604b332d5cffb234ce17609ea479d723dbc9d3885"
+dependencies = [
+ "bitflags 1.3.2",
+ "cexpr",
+ "clang-sys",
+ "lazy_static",
+ "lazycell",
+ "log",
+ "peeking_take_while",
+ "proc-macro2",
+ "quote",
+ "regex",
+ "rustc-hash 1.1.0",
+ "shlex",
+ "syn 1.0.109",
+ "which 4.4.2",
+]
+
[[package]]
name = "bitflags"
version = "1.3.2"
@@ -486,7 +613,7 @@ dependencies = [
"async-channel",
"async-task",
"futures-io",
- "futures-lite",
+ "futures-lite 2.6.1",
"piper",
]
@@ -647,6 +774,15 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c"
+[[package]]
+name = "cexpr"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
+dependencies = [
+ "nom 7.1.3",
+]
+
[[package]]
name = "cfb"
version = "0.7.3"
@@ -715,6 +851,17 @@ dependencies = [
"inout",
]
+[[package]]
+name = "clang-sys"
+version = "1.8.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
+dependencies = [
+ "glob",
+ "libc",
+ "libloading 0.8.9",
+]
+
[[package]]
name = "clipboard-win"
version = "5.4.1"
@@ -849,6 +996,16 @@ dependencies = [
"url",
]
+[[package]]
+name = "core-foundation"
+version = "0.9.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f"
+dependencies = [
+ "core-foundation-sys",
+ "libc",
+]
+
[[package]]
name = "core-foundation"
version = "0.10.1"
@@ -872,7 +1029,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fa95a34622365fa5bbf40b20b75dba8dfa8c94c734aea8ac9a5ca38af14316f1"
dependencies = [
"bitflags 2.11.0",
- "core-foundation",
+ "core-foundation 0.10.1",
"core-graphics-types",
"foreign-types 0.5.0",
"libc",
@@ -885,7 +1042,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb"
dependencies = [
"bitflags 2.11.0",
- "core-foundation",
+ "core-foundation 0.10.1",
"libc",
]
@@ -996,14 +1153,38 @@ dependencies = [
"syn 2.0.117",
]
+[[package]]
+name = "darling"
+version = "0.14.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850"
+dependencies = [
+ "darling_core 0.14.4",
+ "darling_macro 0.14.4",
+]
+
[[package]]
name = "darling"
version = "0.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0"
dependencies = [
- "darling_core",
- "darling_macro",
+ "darling_core 0.21.3",
+ "darling_macro 0.21.3",
+]
+
+[[package]]
+name = "darling_core"
+version = "0.14.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0"
+dependencies = [
+ "fnv",
+ "ident_case",
+ "proc-macro2",
+ "quote",
+ "strsim 0.10.0",
+ "syn 1.0.109",
]
[[package]]
@@ -1016,17 +1197,28 @@ dependencies = [
"ident_case",
"proc-macro2",
"quote",
- "strsim",
+ "strsim 0.11.1",
"syn 2.0.117",
]
+[[package]]
+name = "darling_macro"
+version = "0.14.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e"
+dependencies = [
+ "darling_core 0.14.4",
+ "quote",
+ "syn 1.0.109",
+]
+
[[package]]
name = "darling_macro"
version = "0.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81"
dependencies = [
- "darling_core",
+ "darling_core 0.21.3",
"quote",
"syn 2.0.117",
]
@@ -1062,6 +1254,17 @@ dependencies = [
"serde_core",
]
+[[package]]
+name = "derivative"
+version = "2.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
[[package]]
name = "derive_arbitrary"
version = "1.4.2"
@@ -1073,6 +1276,37 @@ dependencies = [
"syn 2.0.117",
]
+[[package]]
+name = "derive_builder"
+version = "0.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f59169f400d8087f238c5c0c7db6a28af18681717f3b623227d92f397e938c7"
+dependencies = [
+ "derive_builder_macro",
+]
+
+[[package]]
+name = "derive_builder_core"
+version = "0.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a4ec317cc3e7ef0928b0ca6e4a634a4d6c001672ae210438cf114a83e56b018d"
+dependencies = [
+ "darling 0.14.4",
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+]
+
+[[package]]
+name = "derive_builder_macro"
+version = "0.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "870368c3fb35b8031abb378861d4460f573b92238ec2152c927a21f77e3e0127"
+dependencies = [
+ "derive_builder_core",
+ "syn 1.0.109",
+]
+
[[package]]
name = "derive_more"
version = "0.99.20"
@@ -1372,6 +1606,23 @@ version = "3.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dea2df4cf52843e0452895c455a1a2cfbb842a1e7329671acf418fdc53ed4c59"
+[[package]]
+name = "event-listener"
+version = "2.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
+
+[[package]]
+name = "event-listener"
+version = "3.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d93877bcde0eb80ca09131a08d23f0a5c18a620b01db137dba666d18cd9b30c2"
+dependencies = [
+ "concurrent-queue",
+ "parking",
+ "pin-project-lite",
+]
+
[[package]]
name = "event-listener"
version = "5.4.1"
@@ -1389,10 +1640,19 @@ version = "0.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93"
dependencies = [
- "event-listener",
+ "event-listener 5.4.1",
"pin-project-lite",
]
+[[package]]
+name = "fastrand"
+version = "1.9.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be"
+dependencies = [
+ "instant",
+]
+
[[package]]
name = "fastrand"
version = "2.3.0"
@@ -1434,7 +1694,7 @@ version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f"
dependencies = [
- "memoffset",
+ "memoffset 0.9.1",
"rustc_version",
]
@@ -1604,13 +1864,28 @@ version = "0.3.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cecba35d7ad927e23624b22ad55235f2239cfa44fd10428eecbeba6d6a717718"
+[[package]]
+name = "futures-lite"
+version = "1.13.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce"
+dependencies = [
+ "fastrand 1.9.0",
+ "futures-core",
+ "futures-io",
+ "memchr",
+ "parking",
+ "pin-project-lite",
+ "waker-fn",
+]
+
[[package]]
name = "futures-lite"
version = "2.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad"
dependencies = [
- "fastrand",
+ "fastrand 2.3.0",
"futures-core",
"futures-io",
"parking",
@@ -1796,7 +2071,7 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8"
dependencies = [
- "rustix",
+ "rustix 1.1.3",
"windows-link 0.2.1",
]
@@ -2115,6 +2390,12 @@ version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
+[[package]]
+name = "hermit-abi"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
+
[[package]]
name = "hermit-abi"
version = "0.5.2"
@@ -2133,6 +2414,15 @@ version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
+[[package]]
+name = "home"
+version = "0.5.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cc627f471c528ff0c4a49e1d5e60450c8f6461dd6d10ba9dcd3a61d3dff7728d"
+dependencies = [
+ "windows-sys 0.61.2",
+]
+
[[package]]
name = "html5ever"
version = "0.29.1"
@@ -2269,7 +2559,7 @@ dependencies = [
"libc",
"percent-encoding",
"pin-project-lite",
- "socket2",
+ "socket2 0.6.2",
"tokio",
"tower-service",
"tracing",
@@ -2497,6 +2787,17 @@ dependencies = [
"smallvec",
]
+[[package]]
+name = "io-lifetimes"
+version = "1.0.11"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
+dependencies = [
+ "hermit-abi 0.3.9",
+ "libc",
+ "windows-sys 0.48.0",
+]
+
[[package]]
name = "ipnet"
version = "2.11.0"
@@ -2624,6 +2925,21 @@ dependencies = [
"serde_json",
]
+[[package]]
+name = "keepawake"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2a1e324a09aa048770b565b4ab2970bb9d1a7dac1038c68c2d243d8f7b6b1c90"
+dependencies = [
+ "apple-sys",
+ "cfg-if",
+ "core-foundation 0.9.4",
+ "derive_builder",
+ "thiserror 1.0.69",
+ "windows 0.52.0",
+ "zbus 3.15.2",
+]
+
[[package]]
name = "keyboard-types"
version = "0.7.0"
@@ -2653,6 +2969,12 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
+[[package]]
+name = "lazycell"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
+
[[package]]
name = "leaky-bucket"
version = "1.1.2"
@@ -2947,6 +3269,18 @@ dependencies = [
"url",
]
+[[package]]
+name = "linux-raw-sys"
+version = "0.3.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519"
+
+[[package]]
+name = "linux-raw-sys"
+version = "0.4.15"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
+
[[package]]
name = "linux-raw-sys"
version = "0.11.0"
@@ -3025,6 +3359,15 @@ dependencies = [
"time",
]
+[[package]]
+name = "malloc_buf"
+version = "0.0.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
+dependencies = [
+ "libc",
+]
+
[[package]]
name = "markup5ever"
version = "0.14.1"
@@ -3077,6 +3420,15 @@ dependencies = [
"libc",
]
+[[package]]
+name = "memoffset"
+version = "0.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"
+dependencies = [
+ "autocfg",
+]
+
[[package]]
name = "memoffset"
version = "0.9.1"
@@ -3231,6 +3583,18 @@ version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
+[[package]]
+name = "nix"
+version = "0.26.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b"
+dependencies = [
+ "bitflags 1.3.2",
+ "cfg-if",
+ "libc",
+ "memoffset 0.7.1",
+]
+
[[package]]
name = "nodrop"
version = "0.1.14"
@@ -3251,7 +3615,16 @@ dependencies = [
name = "nom"
version = "8.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405"
+checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405"
+dependencies = [
+ "memchr",
+]
+
+[[package]]
+name = "nom8"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8"
dependencies = [
"memchr",
]
@@ -3268,12 +3641,12 @@ version = "4.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21af20a1b50be5ac5861f74af1a863da53a11c38684d9818d82f1c42f7fdc6c2"
dependencies = [
- "futures-lite",
+ "futures-lite 2.6.1",
"log",
"mac-notification-sys",
"serde",
"tauri-winrt-notification",
- "zbus",
+ "zbus 5.14.0",
]
[[package]]
@@ -3376,6 +3749,15 @@ dependencies = [
"syn 2.0.117",
]
+[[package]]
+name = "objc"
+version = "0.2.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
+dependencies = [
+ "malloc_buf",
+]
+
[[package]]
name = "objc2"
version = "0.6.3"
@@ -3602,7 +3984,7 @@ dependencies = [
[[package]]
name = "omniget"
-version = "0.6.1"
+version = "0.6.2"
dependencies = [
"aes",
"anyhow",
@@ -3616,6 +3998,7 @@ dependencies = [
"discord-rich-presence",
"filetime",
"futures",
+ "keepawake",
"libloading 0.8.9",
"librqbit",
"m3u8-rs",
@@ -3630,7 +4013,7 @@ dependencies = [
"serde",
"serde_json",
"sha2",
- "socket2",
+ "socket2 0.6.2",
"tar",
"tauri",
"tauri-build",
@@ -3656,8 +4039,8 @@ dependencies = [
"urlencoding",
"uuid 1.21.0",
"webview2-com",
- "which",
- "windows",
+ "which 7.0.3",
+ "windows 0.61.3",
"xz2",
"zip 2.4.2",
]
@@ -3879,6 +4262,12 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"
+[[package]]
+name = "peeking_take_while"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
+
[[package]]
name = "percent-encoding"
version = "2.3.2"
@@ -4049,7 +4438,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066"
dependencies = [
"atomic-waker",
- "fastrand",
+ "fastrand 2.3.0",
"futures-io",
]
@@ -4098,6 +4487,22 @@ dependencies = [
"miniz_oxide",
]
+[[package]]
+name = "polling"
+version = "2.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce"
+dependencies = [
+ "autocfg",
+ "bitflags 1.3.2",
+ "cfg-if",
+ "concurrent-queue",
+ "libc",
+ "log",
+ "pin-project-lite",
+ "windows-sys 0.48.0",
+]
+
[[package]]
name = "polling"
version = "3.11.0"
@@ -4106,9 +4511,9 @@ checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218"
dependencies = [
"cfg-if",
"concurrent-queue",
- "hermit-abi",
+ "hermit-abi 0.5.2",
"pin-project-lite",
- "rustix",
+ "rustix 1.1.3",
"windows-sys 0.61.2",
]
@@ -4302,9 +4707,9 @@ dependencies = [
"pin-project-lite",
"quinn-proto",
"quinn-udp",
- "rustc-hash",
+ "rustc-hash 2.1.1",
"rustls",
- "socket2",
+ "socket2 0.6.2",
"thiserror 2.0.18",
"tokio",
"tracing",
@@ -4322,7 +4727,7 @@ dependencies = [
"lru-slab",
"rand 0.9.2",
"ring",
- "rustc-hash",
+ "rustc-hash 2.1.1",
"rustls",
"rustls-pki-types",
"slab",
@@ -4341,7 +4746,7 @@ dependencies = [
"cfg_aliases",
"libc",
"once_cell",
- "socket2",
+ "socket2 0.6.2",
"tracing",
"windows-sys 0.60.2",
]
@@ -4620,6 +5025,7 @@ dependencies = [
"hyper-util",
"js-sys",
"log",
+ "mime_guess",
"native-tls",
"percent-encoding",
"pin-project-lite",
@@ -4741,6 +5147,12 @@ dependencies = [
"ordered-multimap",
]
+[[package]]
+name = "rustc-hash"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
+
[[package]]
name = "rustc-hash"
version = "2.1.1"
@@ -4756,6 +5168,33 @@ dependencies = [
"semver",
]
+[[package]]
+name = "rustix"
+version = "0.37.28"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "519165d378b97752ca44bbe15047d5d3409e875f39327546b42ac81d7e18c1b6"
+dependencies = [
+ "bitflags 1.3.2",
+ "errno",
+ "io-lifetimes",
+ "libc",
+ "linux-raw-sys 0.3.8",
+ "windows-sys 0.48.0",
+]
+
+[[package]]
+name = "rustix"
+version = "0.38.44"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
+dependencies = [
+ "bitflags 2.11.0",
+ "errno",
+ "libc",
+ "linux-raw-sys 0.4.15",
+ "windows-sys 0.59.0",
+]
+
[[package]]
name = "rustix"
version = "1.1.3"
@@ -4765,7 +5204,7 @@ dependencies = [
"bitflags 2.11.0",
"errno",
"libc",
- "linux-raw-sys",
+ "linux-raw-sys 0.11.0",
"windows-sys 0.61.2",
]
@@ -4811,7 +5250,7 @@ version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d99feebc72bae7ab76ba994bb5e121b8d83d910ca40b36e0921f53becc41784"
dependencies = [
- "core-foundation",
+ "core-foundation 0.10.1",
"core-foundation-sys",
"jni",
"log",
@@ -4946,7 +5385,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d"
dependencies = [
"bitflags 2.11.0",
- "core-foundation",
+ "core-foundation 0.10.1",
"core-foundation-sys",
"libc",
"security-framework-sys",
@@ -5133,7 +5572,7 @@ version = "3.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52a8e3ca0ca629121f70ab50f95249e5a6f925cc0f6ffe8256c45b728875706c"
dependencies = [
- "darling",
+ "darling 0.21.3",
"proc-macro2",
"quote",
"syn 2.0.117",
@@ -5171,6 +5610,17 @@ dependencies = [
"stable_deref_trait",
]
+[[package]]
+name = "sha1"
+version = "0.10.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba"
+dependencies = [
+ "cfg-if",
+ "cpufeatures 0.2.17",
+ "digest",
+]
+
[[package]]
name = "sha2"
version = "0.10.9"
@@ -5279,6 +5729,16 @@ version = "1.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
+[[package]]
+name = "socket2"
+version = "0.4.10"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d"
+dependencies = [
+ "libc",
+ "winapi",
+]
+
[[package]]
name = "socket2"
version = "0.6.2"
@@ -5352,6 +5812,12 @@ version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
+[[package]]
+name = "static_assertions"
+version = "1.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
+
[[package]]
name = "string_cache"
version = "0.8.9"
@@ -5377,6 +5843,12 @@ dependencies = [
"quote",
]
+[[package]]
+name = "strsim"
+version = "0.10.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
+
[[package]]
name = "strsim"
version = "0.11.1"
@@ -5463,7 +5935,7 @@ checksum = "f3a753bdc39c07b192151523a3f77cd0394aa75413802c883a0f6f6a0e5ee2e7"
dependencies = [
"bitflags 2.11.0",
"block2",
- "core-foundation",
+ "core-foundation 0.10.1",
"core-graphics",
"crossbeam-channel",
"dispatch",
@@ -5489,7 +5961,7 @@ dependencies = [
"tao-macros",
"unicode-segmentation",
"url",
- "windows",
+ "windows 0.61.3",
"windows-core 0.61.2",
"windows-version",
"x11-dl",
@@ -5578,7 +6050,7 @@ dependencies = [
"webkit2gtk",
"webview2-com",
"window-vibrancy",
- "windows",
+ "windows 0.61.3",
]
[[package]]
@@ -5828,7 +6300,7 @@ dependencies = [
"thiserror 2.0.18",
"tracing",
"windows-sys 0.60.2",
- "zbus",
+ "zbus 5.14.0",
]
[[package]]
@@ -5902,7 +6374,7 @@ dependencies = [
"url",
"webkit2gtk",
"webview2-com",
- "windows",
+ "windows 0.61.3",
]
[[package]]
@@ -5928,7 +6400,7 @@ dependencies = [
"url",
"webkit2gtk",
"webview2-com",
- "windows",
+ "windows 0.61.3",
"wry",
]
@@ -5989,7 +6461,7 @@ checksum = "0b1e66e07de489fe43a46678dd0b8df65e0c973909df1b60ba33874e297ba9b9"
dependencies = [
"quick-xml 0.37.5",
"thiserror 2.0.18",
- "windows",
+ "windows 0.61.3",
"windows-version",
]
@@ -5999,10 +6471,10 @@ version = "3.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0136791f7c95b1f6dd99f9cc786b91bb81c3800b639b3478e561ddb7be95e5f1"
dependencies = [
- "fastrand",
+ "fastrand 2.3.0",
"getrandom 0.4.1",
"once_cell",
- "rustix",
+ "rustix 1.1.3",
"windows-sys 0.61.2",
]
@@ -6157,7 +6629,7 @@ dependencies = [
"parking_lot",
"pin-project-lite",
"signal-hook-registry",
- "socket2",
+ "socket2 0.6.2",
"tokio-macros",
"windows-sys 0.61.2",
]
@@ -6231,6 +6703,18 @@ dependencies = [
"tokio",
]
+[[package]]
+name = "toml"
+version = "0.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4fb9d890e4dc9298b70f740f615f2e05b9db37dce531f6b24fb77ac993f9f217"
+dependencies = [
+ "serde",
+ "serde_spanned 0.6.9",
+ "toml_datetime 0.5.1",
+ "toml_edit 0.18.1",
+]
+
[[package]]
name = "toml"
version = "0.8.2"
@@ -6258,6 +6742,15 @@ dependencies = [
"winnow 0.7.14",
]
+[[package]]
+name = "toml_datetime"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5"
+dependencies = [
+ "serde",
+]
+
[[package]]
name = "toml_datetime"
version = "0.6.3"
@@ -6276,6 +6769,19 @@ dependencies = [
"serde_core",
]
+[[package]]
+name = "toml_edit"
+version = "0.18.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b"
+dependencies = [
+ "indexmap 1.9.3",
+ "nom8",
+ "serde",
+ "serde_spanned 0.6.9",
+ "toml_datetime 0.5.1",
+]
+
[[package]]
name = "toml_edit"
version = "0.19.15"
@@ -6497,7 +7003,7 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9"
dependencies = [
- "memoffset",
+ "memoffset 0.9.1",
"tempfile",
"winapi",
]
@@ -6702,6 +7208,12 @@ dependencies = [
"libc",
]
+[[package]]
+name = "waker-fn"
+version = "1.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7"
+
[[package]]
name = "walkdir"
version = "2.5.0"
@@ -6878,7 +7390,7 @@ checksum = "fee64194ccd96bf648f42a65a7e589547096dfa702f7cadef84347b66ad164f9"
dependencies = [
"cc",
"downcast-rs",
- "rustix",
+ "rustix 1.1.3",
"smallvec",
"wayland-sys",
]
@@ -6890,7 +7402,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8e6faa537fbb6c186cb9f1d41f2f811a4120d1b57ec61f50da451a0c5122bec"
dependencies = [
"bitflags 2.11.0",
- "rustix",
+ "rustix 1.1.3",
"wayland-backend",
"wayland-scanner",
]
@@ -7030,7 +7542,7 @@ checksum = "7130243a7a5b33c54a444e54842e6a9e133de08b5ad7b5861cd8ed9a6a5bc96a"
dependencies = [
"webview2-com-macros",
"webview2-com-sys",
- "windows",
+ "windows 0.61.3",
"windows-core 0.61.2",
"windows-implement",
"windows-interface",
@@ -7054,7 +7566,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "381336cfffd772377d291702245447a5251a2ffa5bad679c99e61bc48bacbf9c"
dependencies = [
"thiserror 2.0.18",
- "windows",
+ "windows 0.61.3",
"windows-core 0.61.2",
]
@@ -7064,6 +7576,18 @@ version = "0.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88"
+[[package]]
+name = "which"
+version = "4.4.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"
+dependencies = [
+ "either",
+ "home",
+ "once_cell",
+ "rustix 0.38.44",
+]
+
[[package]]
name = "which"
version = "7.0.3"
@@ -7072,7 +7596,7 @@ checksum = "24d643ce3fd3e5b54854602a080f34fb10ab75e0b813ee32d00ca2b44fa74762"
dependencies = [
"either",
"env_home",
- "rustix",
+ "rustix 1.1.3",
"winsafe",
]
@@ -7122,6 +7646,16 @@ dependencies = [
"windows-version",
]
+[[package]]
+name = "windows"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
+dependencies = [
+ "windows-core 0.52.0",
+ "windows-targets 0.52.6",
+]
+
[[package]]
name = "windows"
version = "0.61.3"
@@ -7144,6 +7678,15 @@ dependencies = [
"windows-core 0.61.2",
]
+[[package]]
+name = "windows-core"
+version = "0.52.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9"
+dependencies = [
+ "windows-targets 0.52.6",
+]
+
[[package]]
name = "windows-core"
version = "0.61.2"
@@ -7281,6 +7824,15 @@ dependencies = [
"windows-targets 0.42.2",
]
+[[package]]
+name = "windows-sys"
+version = "0.48.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
+dependencies = [
+ "windows-targets 0.48.5",
+]
+
[[package]]
name = "windows-sys"
version = "0.52.0"
@@ -7332,6 +7884,21 @@ dependencies = [
"windows_x86_64_msvc 0.42.2",
]
+[[package]]
+name = "windows-targets"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
+dependencies = [
+ "windows_aarch64_gnullvm 0.48.5",
+ "windows_aarch64_msvc 0.48.5",
+ "windows_i686_gnu 0.48.5",
+ "windows_i686_msvc 0.48.5",
+ "windows_x86_64_gnu 0.48.5",
+ "windows_x86_64_gnullvm 0.48.5",
+ "windows_x86_64_msvc 0.48.5",
+]
+
[[package]]
name = "windows-targets"
version = "0.52.6"
@@ -7389,6 +7956,12 @@ version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
+[[package]]
+name = "windows_aarch64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
+
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.52.6"
@@ -7407,6 +7980,12 @@ version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
+[[package]]
+name = "windows_aarch64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
+
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
@@ -7425,6 +8004,12 @@ version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
+[[package]]
+name = "windows_i686_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
+
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
@@ -7455,6 +8040,12 @@ version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
+[[package]]
+name = "windows_i686_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
+
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
@@ -7473,6 +8064,12 @@ version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
+[[package]]
+name = "windows_x86_64_gnu"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
+
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
@@ -7491,6 +8088,12 @@ version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
+[[package]]
+name = "windows_x86_64_gnullvm"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
+
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
@@ -7509,6 +8112,12 @@ version = "0.42.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
+[[package]]
+name = "windows_x86_64_msvc"
+version = "0.48.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
+
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
@@ -7661,7 +8270,7 @@ dependencies = [
"libc",
"log",
"os_pipe",
- "rustix",
+ "rustix 1.1.3",
"thiserror 2.0.18",
"tree_magic_mini",
"wayland-backend",
@@ -7715,7 +8324,7 @@ dependencies = [
"webkit2gtk",
"webkit2gtk-sys",
"webview2-com",
- "windows",
+ "windows 0.61.3",
"windows-core 0.61.2",
"windows-version",
"x11-dl",
@@ -7758,7 +8367,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9993aa5be5a26815fe2c3eacfc1fde061fc1a1f094bf1ad2a18bf9c495dd7414"
dependencies = [
"gethostname",
- "rustix",
+ "rustix 1.1.3",
"x11rb-protocol",
]
@@ -7775,7 +8384,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32e45ad4206f6d2479085147f02bc2ef834ac85886624a23575ae137c8aa8156"
dependencies = [
"libc",
- "rustix",
+ "rustix 1.1.3",
+]
+
+[[package]]
+name = "xdg-home"
+version = "1.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec1cdab258fb55c0da61328dc52c8764709b249011b2cad0454c72f0bf10a1f6"
+dependencies = [
+ "libc",
+ "windows-sys 0.59.0",
]
[[package]]
@@ -7816,29 +8435,70 @@ dependencies = [
"synstructure",
]
+[[package]]
+name = "zbus"
+version = "3.15.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "675d170b632a6ad49804c8cf2105d7c31eddd3312555cffd4b740e08e97c25e6"
+dependencies = [
+ "async-broadcast 0.5.1",
+ "async-executor",
+ "async-fs",
+ "async-io 1.13.0",
+ "async-lock 2.8.0",
+ "async-process 1.8.1",
+ "async-recursion",
+ "async-task",
+ "async-trait",
+ "blocking",
+ "byteorder",
+ "derivative",
+ "enumflags2",
+ "event-listener 2.5.3",
+ "futures-core",
+ "futures-sink",
+ "futures-util",
+ "hex 0.4.3",
+ "nix",
+ "once_cell",
+ "ordered-stream",
+ "rand 0.8.5",
+ "serde",
+ "serde_repr",
+ "sha1",
+ "static_assertions",
+ "tracing",
+ "uds_windows",
+ "winapi",
+ "xdg-home",
+ "zbus_macros 3.15.2",
+ "zbus_names 2.6.1",
+ "zvariant 3.15.2",
+]
+
[[package]]
name = "zbus"
version = "5.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca82f95dbd3943a40a53cfded6c2d0a2ca26192011846a1810c4256ef92c60bc"
dependencies = [
- "async-broadcast",
+ "async-broadcast 0.7.2",
"async-executor",
- "async-io",
- "async-lock",
- "async-process",
+ "async-io 2.6.0",
+ "async-lock 3.4.2",
+ "async-process 2.5.0",
"async-recursion",
"async-task",
"async-trait",
"blocking",
"enumflags2",
- "event-listener",
+ "event-listener 5.4.1",
"futures-core",
- "futures-lite",
+ "futures-lite 2.6.1",
"hex 0.4.3",
"libc",
"ordered-stream",
- "rustix",
+ "rustix 1.1.3",
"serde",
"serde_repr",
"tracing",
@@ -7846,9 +8506,23 @@ dependencies = [
"uuid 1.21.0",
"windows-sys 0.61.2",
"winnow 0.7.14",
- "zbus_macros",
- "zbus_names",
- "zvariant",
+ "zbus_macros 5.14.0",
+ "zbus_names 4.3.1",
+ "zvariant 5.10.0",
+]
+
+[[package]]
+name = "zbus_macros"
+version = "3.15.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7131497b0f887e8061b430c530240063d33bf9455fa34438f388a245da69e0a5"
+dependencies = [
+ "proc-macro-crate 1.3.1",
+ "proc-macro2",
+ "quote",
+ "regex",
+ "syn 1.0.109",
+ "zvariant_utils 1.0.1",
]
[[package]]
@@ -7861,9 +8535,20 @@ dependencies = [
"proc-macro2",
"quote",
"syn 2.0.117",
- "zbus_names",
- "zvariant",
- "zvariant_utils",
+ "zbus_names 4.3.1",
+ "zvariant 5.10.0",
+ "zvariant_utils 3.3.0",
+]
+
+[[package]]
+name = "zbus_names"
+version = "2.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "437d738d3750bed6ca9b8d423ccc7a8eb284f6b1d6d4e225a0e4e6258d864c8d"
+dependencies = [
+ "serde",
+ "static_assertions",
+ "zvariant 3.15.2",
]
[[package]]
@@ -7874,7 +8559,7 @@ checksum = "ffd8af6d5b78619bab301ff3c560a5bd22426150253db278f164d6cf3b72c50f"
dependencies = [
"serde",
"winnow 0.7.14",
- "zvariant",
+ "zvariant 5.10.0",
]
[[package]]
@@ -8019,6 +8704,20 @@ dependencies = [
"zune-core",
]
+[[package]]
+name = "zvariant"
+version = "3.15.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4eef2be88ba09b358d3b58aca6e41cd853631d44787f319a1383ca83424fb2db"
+dependencies = [
+ "byteorder",
+ "enumflags2",
+ "libc",
+ "serde",
+ "static_assertions",
+ "zvariant_derive 3.15.2",
+]
+
[[package]]
name = "zvariant"
version = "5.10.0"
@@ -8029,8 +8728,21 @@ dependencies = [
"enumflags2",
"serde",
"winnow 0.7.14",
- "zvariant_derive",
- "zvariant_utils",
+ "zvariant_derive 5.10.0",
+ "zvariant_utils 3.3.0",
+]
+
+[[package]]
+name = "zvariant_derive"
+version = "3.15.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "37c24dc0bed72f5f90d1f8bb5b07228cbf63b3c6e9f82d82559d4bae666e7ed9"
+dependencies = [
+ "proc-macro-crate 1.3.1",
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
+ "zvariant_utils 1.0.1",
]
[[package]]
@@ -8043,7 +8755,18 @@ dependencies = [
"proc-macro2",
"quote",
"syn 2.0.117",
- "zvariant_utils",
+ "zvariant_utils 3.3.0",
+]
+
+[[package]]
+name = "zvariant_utils"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7234f0d811589db492d16893e3f21e8e2fd282e6d01b0cddee310322062cc200"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn 1.0.109",
]
[[package]]
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index 251a080b..8a25ba35 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -4,7 +4,7 @@ resolver = "2"
[package]
name = "omniget"
-version = "0.6.1"
+version = "0.6.2"
description = "A Tauri App"
authors = ["you"]
edition = "2021"
@@ -61,6 +61,7 @@ omniget-plugin-sdk = { path = "omniget-plugin-sdk" }
libloading = "0.8"
which = "7"
librqbit = "8.1.1"
+keepawake = "0.5"
discord-rich-presence = "0.2"
once_cell = "1"
diff --git a/src-tauri/omniget-core/Cargo.toml b/src-tauri/omniget-core/Cargo.toml
index 6d03a9d3..771339ad 100644
--- a/src-tauri/omniget-core/Cargo.toml
+++ b/src-tauri/omniget-core/Cargo.toml
@@ -13,7 +13,7 @@ mobile = []
[dependencies]
tokio = { version = "1", features = ["full"] }
-reqwest = { version = "0.12", default-features = false, features = ["json", "cookies", "stream", "http2", "gzip", "brotli", "deflate", "rustls-tls"] }
+reqwest = { version = "0.12", default-features = false, features = ["json", "cookies", "stream", "http2", "gzip", "brotli", "deflate", "rustls-tls", "multipart"] }
futures = "0.3"
async-trait = "0.1"
serde = { version = "1", features = ["derive"] }
diff --git a/src-tauri/omniget-core/src/core/ai.rs b/src-tauri/omniget-core/src/core/ai.rs
new file mode 100644
index 00000000..8866c4dc
--- /dev/null
+++ b/src-tauri/omniget-core/src/core/ai.rs
@@ -0,0 +1,433 @@
+use serde::{Deserialize, Serialize};
+use std::sync::{Mutex, OnceLock};
+
+const AI_CONFIG_FILE: &str = "ai_config.json";
+
+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "lowercase")]
+pub enum AiProvider {
+ #[default]
+ None,
+ Openai,
+ Anthropic,
+ Local,
+}
+
+#[derive(Clone, Debug, Default, Serialize, Deserialize)]
+pub struct AiConfig {
+ #[serde(default)]
+ pub provider: AiProvider,
+ #[serde(default)]
+ pub openai_key: String,
+ #[serde(default)]
+ pub anthropic_key: String,
+ #[serde(default)]
+ pub local_base_url: String,
+ #[serde(default)]
+ pub model: String,
+}
+
+// Sent to the frontend instead of AiConfig: key material is replaced with
+// presence booleans so a raw key can never reach the UI, logs, or telemetry.
+#[derive(Clone, Debug, Serialize)]
+pub struct AiConfigView {
+ pub provider: AiProvider,
+ pub model: String,
+ pub local_base_url: String,
+ pub has_openai_key: bool,
+ pub has_anthropic_key: bool,
+}
+
+impl AiConfig {
+ pub fn view(&self) -> AiConfigView {
+ AiConfigView {
+ provider: self.provider,
+ model: self.model.clone(),
+ local_base_url: self.local_base_url.clone(),
+ has_openai_key: !self.openai_key.is_empty(),
+ has_anthropic_key: !self.anthropic_key.is_empty(),
+ }
+ }
+
+ pub fn is_configured(&self) -> bool {
+ match self.provider {
+ AiProvider::None => false,
+ AiProvider::Openai => !self.openai_key.is_empty(),
+ AiProvider::Anthropic => !self.anthropic_key.is_empty(),
+ AiProvider::Local => !self.local_base_url.is_empty(),
+ }
+ }
+}
+
+static STORE: OnceLock<Mutex<AiConfig>> = OnceLock::new();
+
+fn store() -> &'static Mutex<AiConfig> {
+ STORE.get_or_init(|| Mutex::new(load_from_disk()))
+}
+
+fn file_path() -> Option<std::path::PathBuf> {
+ crate::core::paths::app_data_dir().map(|d| d.join(AI_CONFIG_FILE))
+}
+
+fn load_from_disk() -> AiConfig {
+ let Some(path) = file_path() else {
+ return AiConfig::default();
+ };
+ match std::fs::read_to_string(&path) {
+ Ok(c) => serde_json::from_str(&c).unwrap_or_default(),
+ Err(_) => AiConfig::default(),
+ }
+}
+
+fn write_to_disk(cfg: &AiConfig) {
+ let Some(path) = file_path() else { return };
+ let Some(parent) = path.parent() else { return };
+ if let Err(e) = std::fs::create_dir_all(parent) {
+ tracing::warn!("[ai] create_dir_all failed: {}", e);
+ return;
+ }
+ let serialized = match serde_json::to_string_pretty(cfg) {
+ Ok(s) => s,
+ Err(e) => {
+ tracing::warn!("[ai] serialize failed: {}", e);
+ return;
+ }
+ };
+ let tmp = path.with_extension("json.tmp");
+ let result = (|| -> std::io::Result<()> {
+ use std::io::Write;
+ let mut f = std::fs::File::create(&tmp)?;
+ f.write_all(serialized.as_bytes())?;
+ f.sync_all()?;
+ Ok(())
+ })();
+ if let Err(e) = result {
+ tracing::warn!("[ai] write tmp failed: {}", e);
+ let _ = std::fs::remove_file(&tmp);
+ return;
+ }
+ if let Err(e) = std::fs::rename(&tmp, &path) {
+ tracing::warn!("[ai] rename failed: {}", e);
+ let _ = std::fs::remove_file(&tmp);
+ }
+}
+
+pub fn get() -> AiConfig {
+ store().lock().unwrap().clone()
+}
+
+// Key fields are Option: None keeps the stored key untouched (so the UI never
+// has to round-trip secrets), Some("") clears it.
+pub fn set(
+ provider: AiProvider,
+ model: String,
+ local_base_url: String,
+ openai_key: Option<String>,
+ anthropic_key: Option<String>,
+) -> AiConfig {
+ let mut guard = store().lock().unwrap();
+ guard.provider = provider;
+ guard.model = model.trim().to_string();
+ guard.local_base_url = local_base_url.trim().trim_end_matches('/').to_string();
+ if let Some(k) = openai_key {
+ guard.openai_key = k.trim().to_string();
+ }
+ if let Some(k) = anthropic_key {
+ guard.anthropic_key = k.trim().to_string();
+ }
+ write_to_disk(&guard);
+ guard.clone()
+}
+
+fn http_client() -> Result<reqwest::Client, String> {
+ let builder = reqwest::Client::builder().timeout(std::time::Duration::from_secs(120));
+ crate::core::http_client::apply_global_proxy(builder)
+ .build()
+ .map_err(|e| format!("HTTP client error: {}", e))
+}
+
+pub async fn chat(system: &str, user: &str) -> Result<String, String> {
+ let cfg = get();
+ if cfg.model.is_empty() {
+ return Err("No AI model configured".to_string());
+ }
+ match cfg.provider {
+ AiProvider::None => Err("AI is not configured".to_string()),
+ AiProvider::Openai => {
+ openai_chat(
+ "https://api.openai.com/v1/chat/completions",
+ &cfg.openai_key,
+ &cfg.model,
+ system,
+ user,
+ )
+ .await
+ }
+ AiProvider::Local => {
+ if cfg.local_base_url.is_empty() {
+ return Err("No local endpoint configured".to_string());
+ }
+ let endpoint = format!("{}/chat/completions", cfg.local_base_url);
+ openai_chat(&endpoint, &cfg.openai_key, &cfg.model, system, user).await
+ }
+ AiProvider::Anthropic => anthropic_chat(&cfg.anthropic_key, &cfg.model, system, user).await,
+ }
+}
+
+async fn openai_chat(
+ endpoint: &str,
+ key: &str,
+ model: &str,
+ system: &str,
+ user: &str,
+) -> Result<String, String> {
+ let client = http_client()?;
+ let body = serde_json::json!({
+ "model": model,
+ "messages": [
+ { "role": "system", "content": system },
+ { "role": "user", "content": user },
+ ],
+ });
+ let mut req = client.post(endpoint).json(&body);
+ if !key.is_empty() {
+ req = req.bearer_auth(key);
+ }
+ let resp = req
+ .send()
+ .await
+ .map_err(|e| format!("Request failed: {}", e))?;
+ let status = resp.status();
+ let text = resp
+ .text()
+ .await
+ .map_err(|e| format!("Read body failed: {}", e))?;
+ if !status.is_success() {
+ return Err(format!("AI error ({})", status.as_u16()));
+ }
+ let json: serde_json::Value =
+ serde_json::from_str(&text).map_err(|e| format!("Bad JSON: {}", e))?;
+ json.get("choices")
+ .and_then(|c| c.get(0))
+ .and_then(|c| c.get("message"))
+ .and_then(|m| m.get("content"))
+ .and_then(|c| c.as_str())
+ .map(|s| s.trim().to_string())
+ .ok_or_else(|| "Empty AI response".to_string())
+}
+
+async fn anthropic_chat(
+ key: &str,
+ model: &str,
+ system: &str,
+ user: &str,
+) -> Result<String, String> {
+ if key.is_empty() {
+ return Err("No Anthropic key configured".to_string());
+ }
+ let client = http_client()?;
+ let body = serde_json::json!({
+ "model": model,
+ "max_tokens": 1024,
+ "system": system,
+ "messages": [ { "role": "user", "content": user } ],
+ });
+ let resp = client
+ .post("https://api.anthropic.com/v1/messages")
+ .header("x-api-key", key)
+ .header("anthropic-version", "2023-06-01")
+ .json(&body)
+ .send()
+ .await
+ .map_err(|e| format!("Request failed: {}", e))?;
+ let status = resp.status();
+ let text = resp
+ .text()
+ .await
+ .map_err(|e| format!("Read body failed: {}", e))?;
+ if !status.is_success() {
+ return Err(format!("AI error ({})", status.as_u16()));
+ }
+ let json: serde_json::Value =
+ serde_json::from_str(&text).map_err(|e| format!("Bad JSON: {}", e))?;
+ json.get("content")
+ .and_then(|c| c.get(0))
+ .and_then(|c| c.get("text"))
+ .and_then(|t| t.as_str())
+ .map(|s| s.trim().to_string())
+ .ok_or_else(|| "Empty AI response".to_string())
+}
+
+// Whisper-style transcription via the OpenAI-compatible audio endpoint. Only
+// available for Openai/Local providers (Anthropic has no audio API). Reuses
+// the configured key/base so no separate model management is needed.
+pub async fn transcribe(audio_path: &std::path::Path) -> Result<String, String> {
+ let cfg = get();
+ let (endpoint, key) = match cfg.provider {
+ AiProvider::Openai => (
+ "https://api.openai.com/v1/audio/transcriptions".to_string(),
+ cfg.openai_key.clone(),
+ ),
+ AiProvider::Local => {
+ if cfg.local_base_url.is_empty() {
+ return Err("No local endpoint configured".to_string());
+ }
+ (
+ format!("{}/audio/transcriptions", cfg.local_base_url),
+ cfg.openai_key.clone(),
+ )
+ }
+ _ => return Err("Transcription needs an OpenAI-compatible provider".to_string()),
+ };
+
+ let bytes = tokio::fs::read(audio_path)
+ .await
+ .map_err(|e| format!("Read audio failed: {}", e))?;
+ let file_name = audio_path
+ .file_name()
+ .map(|n| n.to_string_lossy().to_string())
+ .unwrap_or_else(|| "audio.mp3".to_string());
+
+ let part = reqwest::multipart::Part::bytes(bytes)
+ .file_name(file_name)
+ .mime_str("application/octet-stream")
+ .map_err(|e| format!("Multipart error: {}", e))?;
+ let form = reqwest::multipart::Form::new()
+ .text("model", "whisper-1")
+ .text("response_format", "text")
+ .part("file", part);
+
+ let client = http_client()?;
+ let mut req = client.post(&endpoint).multipart(form);
+ if !key.is_empty() {
+ req = req.bearer_auth(&key);
+ }
+ let resp = req
+ .send()
+ .await
+ .map_err(|e| format!("Request failed: {}", e))?;
+ let status = resp.status();
+ let text = resp
+ .text()
+ .await
+ .map_err(|e| format!("Read body failed: {}", e))?;
+ if !status.is_success() {
+ return Err(format!("Transcription error ({})", status.as_u16()));
+ }
+ let trimmed = text.trim();
+ if trimmed.is_empty() {
+ return Err("Empty transcription".to_string());
+ }
+ Ok(trimmed.to_string())
+}
+
+const AI_HISTORY_FILE: &str = "ai_history.json";
+const MAX_HISTORY: usize = 100;
+
+#[derive(Clone, Debug, Serialize, Deserialize)]
+pub struct AiHistoryEntry {
+ pub id: u64,
+ pub kind: String,
+ pub url: String,
+ pub title: String,
+ pub content: String,
+ pub created_at_ms: u64,
+}
+
+#[derive(Clone, Debug, Default, Serialize, Deserialize)]
+struct AiHistoryFile {
+ #[serde(default)]
+ entries: Vec<AiHistoryEntry>,
+}
+
+fn history_path() -> Option<std::path::PathBuf> {
+ crate::core::paths::app_data_dir().map(|d| d.join(AI_HISTORY_FILE))
+}
+
+pub fn history_list() -> Vec<AiHistoryEntry> {
+ let Some(path) = history_path() else {
+ return Vec::new();
+ };
+ match std::fs::read_to_string(&path) {
+ Ok(c) => serde_json::from_str::<AiHistoryFile>(&c)
+ .map(|f| f.entries)
+ .unwrap_or_default(),
+ Err(_) => Vec::new(),
+ }
+}
+
+pub fn history_add(kind: &str, url: &str, title: &str, content: &str) {
+ let Some(path) = history_path() else { return };
+ let Some(parent) = path.parent() else { return };
+ let _ = std::fs::create_dir_all(parent);
+ let mut entries = history_list();
+ let id = std::time::SystemTime::now()
+ .duration_since(std::time::UNIX_EPOCH)
+ .map(|d| d.as_millis() as u64)
+ .unwrap_or(0);
+ entries.push(AiHistoryEntry {
+ id,
+ kind: kind.to_string(),
+ url: url.to_string(),
+ title: title.to_string(),
+ content: content.to_string(),
+ created_at_ms: id,
+ });
+ if entries.len() > MAX_HISTORY {
+ let overflow = entries.len() - MAX_HISTORY;
+ entries.drain(0..overflow);
+ }
+ if let Ok(s) = serde_json::to_string_pretty(&AiHistoryFile { entries }) {
+ let tmp = path.with_extension("json.tmp");
+ let ok = (|| -> std::io::Result<()> {
+ use std::io::Write;
+ let mut f = std::fs::File::create(&tmp)?;
+ f.write_all(s.as_bytes())?;
+ f.sync_all()?;
+ Ok(())
+ })()
+ .is_ok();
+ if ok {
+ let _ = std::fs::rename(&tmp, &path);
+ } else {
+ let _ = std::fs::remove_file(&tmp);
+ }
+ }
+}
+
+pub fn history_clear() {
+ if let Some(path) = history_path() {
+ let _ = std::fs::remove_file(path);
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn view_hides_keys() {
+ let cfg = AiConfig {
+ provider: AiProvider::Openai,
+ openai_key: "secret".to_string(),
+ anthropic_key: String::new(),
+ local_base_url: String::new(),
+ model: "m".to_string(),
+ };
+ let v = cfg.view();
+ assert!(v.has_openai_key);
+ assert!(!v.has_anthropic_key);
+ let json = serde_json::to_string(&v).unwrap();
+ assert!(!json.contains("secret"));
+ }
+
+ #[test]
+ fn is_configured_logic() {
+ let mut cfg = AiConfig::default();
+ assert!(!cfg.is_configured());
+ cfg.provider = AiProvider::Anthropic;
+ assert!(!cfg.is_configured());
+ cfg.anthropic_key = "k".to_string();
+ assert!(cfg.is_configured());
+ }
+}
diff --git a/src-tauri/omniget-core/src/core/ffmpeg_ops.rs b/src-tauri/omniget-core/src/core/ffmpeg_ops.rs
new file mode 100644
index 00000000..56816181
--- /dev/null
+++ b/src-tauri/omniget-core/src/core/ffmpeg_ops.rs
@@ -0,0 +1,435 @@
+// Security-critical: validates the *transform* portion of an ffmpeg command
+// (the args between the app-controlled input and output). AI/NL output is
+// never executed without passing this allowlist, and input/output paths are
+// injected by the app — never taken from the model — so this only has to
+// guarantee the middle args can't read arbitrary files or escape into a shell.
+
+const FLAGS_NO_VALUE: &[&str] = &["-y", "-vn", "-an", "-sn", "-dn", "-nostdin", "-shortest"];
+
+const FLAGS_WITH_VALUE: &[&str] = &[
+ "-ss",
+ "-to",
+ "-t",
+ "-r",
+ "-ar",
+ "-ac",
+ "-crf",
+ "-preset",
+ "-b:v",
+ "-b:a",
+ "-q:v",
+ "-q:a",
+ "-c",
+ "-c:v",
+ "-c:a",
+ "-codec",
+ "-pix_fmt",
+ "-s",
+ "-aspect",
+ "-movflags",
+ "-map",
+ "-vf",
+ "-af",
+ "-filter:v",
+ "-filter:a",
+ "-metadata",
+ "-threads",
+ "-g",
+ "-bf",
+ "-profile:v",
+ "-level",
+ "-maxrate",
+ "-bufsize",
+ "-tune",
+];
+
+const FILTER_FLAGS: &[&str] = &["-vf", "-af", "-filter:v", "-filter:a"];
+
+const ALLOWED_FILTERS: &[&str] = &[
+ "scale",
+ "crop",
+ "fps",
+ "transpose",
+ "hflip",
+ "vflip",
+ "rotate",
+ "pad",
+ "setpts",
+ "atempo",
+ "volume",
+ "aresample",
+ "loudnorm",
+ "afade",
+ "fade",
+ "format",
+ "eq",
+ "unsharp",
+ "deshake",
+ "setsar",
+ "setdar",
+ "lutyuv",
+ "hue",
+ "colorbalance",
+ "gblur",
+ "boxblur",
+ "noise",
+ "asetpts",
+ "anull",
+ "null",
+ "palettegen",
+ "paletteuse",
+ "split",
+];
+
+const FORBIDDEN_SUBSTR: &[&str] = &[
+ ";",
+ "|",
+ "&",
+ "`",
+ "$(",
+ "${",
+ "\n",
+ "\r",
+ ">",
+ "<",
+ "..",
+ "movie=",
+ "amovie=",
+ "subtitles=",
+ "ass=",
+ "concat:",
+ "file:",
+ "pipe:",
+ "\\",
+ "://",
+];
+
+fn token_is_safe(tok: &str) -> bool {
+ !FORBIDDEN_SUBSTR.iter().any(|bad| tok.contains(bad))
+}
+
+fn validate_filter_value(value: &str) -> Result<(), String> {
+ // filterchains are separated by ',' (chain) and ';' is already forbidden.
+ for filt in value.split(',') {
+ let filt = filt.trim();
+ if filt.is_empty() {
+ continue;
+ }
+ let name: String = filt
+ .chars()
+ .take_while(|c| c.is_ascii_alphanumeric() || *c == '_')
+ .collect();
+ if name.is_empty() || !ALLOWED_FILTERS.contains(&name.as_str()) {
+ return Err(format!("Filter not allowed: {}", name));
+ }
+ }
+ Ok(())
+}
+
+pub fn validate_transform_args(args: &[String]) -> Result<(), String> {
+ let mut i = 0;
+ while i < args.len() {
+ let a = &args[i];
+ if !token_is_safe(a) {
+ return Err(format!("Unsafe token: {}", a));
+ }
+ if !a.starts_with('-') {
+ return Err(format!("Unexpected positional argument: {}", a));
+ }
+ if FLAGS_NO_VALUE.contains(&a.as_str()) {
+ i += 1;
+ continue;
+ }
+ if FLAGS_WITH_VALUE.contains(&a.as_str()) {
+ let Some(value) = args.get(i + 1) else {
+ return Err(format!("Missing value for {}", a));
+ };
+ if !token_is_safe(value) {
+ return Err(format!("Unsafe value for {}", a));
+ }
+ if FILTER_FLAGS.contains(&a.as_str()) {
+ validate_filter_value(value)?;
+ }
+ i += 2;
+ continue;
+ }
+ return Err(format!("Flag not allowed: {}", a));
+ }
+ Ok(())
+}
+
+#[derive(Debug, Clone)]
+pub struct Preset {
+ pub args: Vec<String>,
+ pub out_ext: &'static str,
+}
+
+fn s(v: &str) -> String {
+ v.to_string()
+}
+
+// Deterministic, known-safe operations. These never go through the validator
+// because they are constructed here, but they also pass it (covered by tests).
+pub fn preset(action: &str, start: Option<&str>, end: Option<&str>) -> Result<Preset, String> {
+ match action {
+ "extract_audio" => Ok(Preset {
+ args: vec![s("-vn"), s("-c:a"), s("libmp3lame"), s("-q:a"), s("2")],
+ out_ext: "mp3",
+ }),
+ "mute" => Ok(Preset {
+ args: vec![s("-c"), s("copy"), s("-an")],
+ out_ext: "mp4",
+ }),
+ "to_mp4" => Ok(Preset {
+ args: vec![
+ s("-c:v"),
+ s("libx264"),
+ s("-c:a"),
+ s("aac"),
+ s("-preset"),
+ s("fast"),
+ s("-crf"),
+ s("23"),
+ s("-movflags"),
+ s("+faststart"),
+ ],
+ out_ext: "mp4",
+ }),
+ "to_gif" => Ok(Preset {
+ args: vec![s("-vf"), s("fps=12,scale=480:-1:flags=lanczos"), s("-an")],
+ out_ext: "gif",
+ }),
+ "trim" => {
+ let st = start.unwrap_or("").trim();
+ let en = end.unwrap_or("").trim();
+ if st.is_empty() && en.is_empty() {
+ return Err("Trim needs a start or end".to_string());
+ }
+ let valid = |v: &str| {
+ !v.is_empty()
+ && v.chars()
+ .all(|c| c.is_ascii_digit() || c == ':' || c == '.')
+ };
+ let mut args = Vec::new();
+ if !st.is_empty() {
+ if !valid(st) {
+ return Err("Invalid start time".to_string());
+ }
+ args.push(s("-ss"));
+ args.push(st.to_string());
+ }
+ if !en.is_empty() {
+ if !valid(en) {
+ return Err("Invalid end time".to_string());
+ }
+ args.push(s("-to"));
+ args.push(en.to_string());
+ }
+ args.push(s("-c"));
+ args.push(s("copy"));
+ Ok(Preset {
+ args,
+ out_ext: "mp4",
+ })
+ }
+ _ => Err(format!("Unknown action: {}", action)),
+ }
+}
+
+// Parses a model-proposed ffmpeg invocation into validated transform args.
+// Strips a leading "ffmpeg", drops any -i/input and the trailing output
+// (paths are app-controlled), then runs the allowlist.
+pub fn sanitize_ai_command(raw: &str) -> Result<Vec<String>, String> {
+ let raw = raw.trim();
+ if raw.contains('\n') || raw.contains('\r') {
+ return Err("Command must be a single line".to_string());
+ }
+ let toks: Vec<String> = raw.split_whitespace().map(|t| t.to_string()).collect();
+ if toks.is_empty() {
+ return Err("Empty command".to_string());
+ }
+ let mut out: Vec<String> = Vec::new();
+ let mut i = 0;
+ if toks[0].eq_ignore_ascii_case("ffmpeg") {
+ i = 1;
+ }
+ while i < toks.len() {
+ let t = &toks[i];
+ if t == "-i" {
+ // skip -i and its path (app injects the real input)
+ i += 2;
+ continue;
+ }
+ // drop a trailing bare output path (last token, not a flag/value)
+ if !t.starts_with('-') && i == toks.len() - 1 {
+ i += 1;
+ continue;
+ }
+ out.push(t.clone());
+ i += 1;
+ }
+ validate_transform_args(&out)?;
+ Ok(out)
+}
+
+// Pulls scene-change timestamps out of ffmpeg's showinfo stderr (lines like
+// "... showinfo ... pts_time:12.34 ...").
+pub fn parse_scene_times(stderr: &str) -> Vec<f64> {
+ let mut out = Vec::new();
+ for line in stderr.lines() {
+ if !line.contains("showinfo") && !line.contains("pts_time") {
+ continue;
+ }
+ if let Some(pos) = line.find("pts_time:") {
+ let rest = &line[pos + "pts_time:".len()..];
+ let num: String = rest
+ .chars()
+ .take_while(|c| c.is_ascii_digit() || *c == '.')
+ .collect();
+ if let Ok(v) = num.parse::<f64>() {
+ out.push(v);
+ }
+ }
+ }
+ out
+}
+
+// Reduces mono s16le PCM to `buckets` normalized peak values (0.0..=1.0).
+pub fn pcm_s16le_peaks(bytes: &[u8], buckets: usize) -> Vec<f32> {
+ if buckets == 0 || bytes.len() < 2 {
+ return Vec::new();
+ }
+ let sample_count = bytes.len() / 2;
+ let per_bucket = sample_count.div_ceil(buckets).max(1);
+ let mut peaks = Vec::with_capacity(buckets);
+ let mut cur_max: i32 = 0;
+ let mut in_bucket = 0usize;
+ for i in 0..sample_count {
+ let lo = bytes[i * 2] as i16;
+ let hi = bytes[i * 2 + 1] as i16;
+ let sample = ((hi << 8) | (lo & 0xff)) as i32;
+ let amp = sample.unsigned_abs() as i32;
+ if amp > cur_max {
+ cur_max = amp;
+ }
+ in_bucket += 1;
+ if in_bucket >= per_bucket {
+ peaks.push((cur_max as f32 / 32768.0).min(1.0));
+ cur_max = 0;
+ in_bucket = 0;
+ }
+ }
+ if in_bucket > 0 {
+ peaks.push((cur_max as f32 / 32768.0).min(1.0));
+ }
+ peaks
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn parses_scene_times() {
+ let stderr = "[Parsed_showinfo_1 @ 0x] n:0 pts_time:1.5 type:I\n\
+ garbage line\n\
+ [Parsed_showinfo_1 @ 0x] n:1 pts_time:42.0 type:P";
+ assert_eq!(parse_scene_times(stderr), vec![1.5, 42.0]);
+ }
+
+ #[test]
+ fn peaks_bucketize_and_normalize() {
+ // 4 samples: 0, 16384, -32768, 8192 (s16le little-endian bytes)
+ let bytes: Vec<u8> = vec![
+ 0x00, 0x00, // 0
+ 0x00, 0x40, // 16384
+ 0x00, 0x80, // -32768
+ 0x00, 0x20, // 8192
+ ];
+ let peaks = pcm_s16le_peaks(&bytes, 2);
+ assert_eq!(peaks.len(), 2);
+ assert!((peaks[1] - 1.0).abs() < 0.01);
+ assert!(peaks[0] <= 1.0 && peaks[0] >= 0.0);
+ }
+
+ #[test]
+ fn peaks_empty_safe() {
+ assert!(pcm_s16le_peaks(&[], 4).is_empty());
+ assert!(pcm_s16le_peaks(&[1, 2, 3, 4], 0).is_empty());
+ }
+
+ #[test]
+ fn allows_safe_transform() {
+ let args: Vec<String> = ["-c:v", "libx264", "-crf", "23", "-an"]
+ .iter()
+ .map(|s| s.to_string())
+ .collect();
+ assert!(validate_transform_args(&args).is_ok());
+ }
+
+ #[test]
+ fn rejects_unknown_flag() {
+ let args = vec!["-attach".to_string(), "x".to_string()];
+ assert!(validate_transform_args(&args).is_err());
+ }
+
+ #[test]
+ fn rejects_shell_metachars() {
+ let args = vec!["-vf".to_string(), "scale=2:2; rm -rf /".to_string()];
+ assert!(validate_transform_args(&args).is_err());
+ }
+
+ #[test]
+ fn rejects_file_reading_filters() {
+ let args = vec!["-vf".to_string(), "movie=/etc/passwd".to_string()];
+ assert!(validate_transform_args(&args).is_err());
+ let args2 = vec!["-vf".to_string(), "subtitles=secret.srt".to_string()];
+ assert!(validate_transform_args(&args2).is_err());
+ }
+
+ #[test]
+ fn rejects_input_flag_in_transform() {
+ let args = vec!["-i".to_string(), "/etc/passwd".to_string()];
+ assert!(validate_transform_args(&args).is_err());
+ }
+
+ #[test]
+ fn allows_known_filterchain() {
+ let args = vec![
+ "-vf".to_string(),
+ "fps=12,scale=480:-1:flags=lanczos".to_string(),
+ ];
+ assert!(validate_transform_args(&args).is_ok());
+ }
+
+ #[test]
+ fn presets_pass_validation() {
+ for action in ["extract_audio", "mute", "to_mp4", "to_gif"] {
+ let p = preset(action, None, None).unwrap();
+ assert!(
+ validate_transform_args(&p.args).is_ok(),
+ "preset {action} failed validation"
+ );
+ }
+ let trim = preset("trim", Some("00:00:01"), Some("00:00:05")).unwrap();
+ assert!(validate_transform_args(&trim.args).is_ok());
+ }
+
+ #[test]
+ fn trim_rejects_bad_time() {
+ assert!(preset("trim", Some("1; rm"), None).is_err());
+ }
+
+ #[test]
+ fn sanitize_strips_ffmpeg_io() {
+ let cmd = "ffmpeg -i input.mp4 -c:v libx264 -crf 20 out.mp4";
+ let args = sanitize_ai_command(cmd).unwrap();
+ assert_eq!(args, vec!["-c:v", "libx264", "-crf", "20"]);
+ }
+
+ #[test]
+ fn sanitize_rejects_dangerous_ai_output() {
+ assert!(sanitize_ai_command("ffmpeg -i in -vf subtitles=x.srt out").is_err());
+ assert!(sanitize_ai_command("ffmpeg -i in -c copy out && rm -rf /").is_err());
+ }
+}
diff --git a/src-tauri/omniget-core/src/core/livechat.rs b/src-tauri/omniget-core/src/core/livechat.rs
new file mode 100644
index 00000000..135944c0
--- /dev/null
+++ b/src-tauri/omniget-core/src/core/livechat.rs
@@ -0,0 +1,140 @@
+use serde::Serialize;
+use serde_json::Value;
+
+#[derive(Debug, Clone, Serialize)]
+pub struct LiveChatMessage {
+ pub idx: u64,
+ pub time: String,
+ pub timestamp_usec: i64,
+ pub author: String,
+ pub channel_id: String,
+ pub message: String,
+ pub msg_type: String,
+ pub amount: String,
+}
+
+fn runs_text(v: &Value) -> String {
+ v.as_array()
+ .map(|arr| {
+ arr.iter()
+ .filter_map(|r| r.get("text").and_then(|t| t.as_str()))
+ .collect::<String>()
+ })
+ .unwrap_or_default()
+}
+
+fn str_at<'a>(v: &'a Value, ptr: &str) -> &'a str {
+ v.pointer(ptr).and_then(|x| x.as_str()).unwrap_or("")
+}
+
+fn parse_renderer(renderer: &Value, msg_type: &str, idx: u64) -> LiveChatMessage {
+ let message = {
+ let m = renderer.pointer("/message/runs");
+ if m.is_some() {
+ runs_text(m.unwrap())
+ } else if let Some(h) = renderer.pointer("/headerSubtext/runs") {
+ runs_text(h)
+ } else {
+ String::new()
+ }
+ };
+ LiveChatMessage {
+ idx,
+ time: str_at(renderer, "/timestampText/simpleText").to_string(),
+ timestamp_usec: str_at(renderer, "/timestampUsec")
+ .parse::<i64>()
+ .unwrap_or(0),
+ author: str_at(renderer, "/authorName/simpleText").to_string(),
+ channel_id: renderer
+ .get("authorExternalChannelId")
+ .and_then(|v| v.as_str())
+ .unwrap_or("")
+ .to_string(),
+ message,
+ msg_type: msg_type.to_string(),
+ amount: str_at(renderer, "/purchaseAmountText/simpleText").to_string(),
+ }
+}
+
+/// Parses a yt-dlp `*.live_chat.json` file (newline-delimited JSON, one
+/// replay-chat action wrapper per line) into a flat message list.
+pub fn parse_live_chat(ndjson: &str) -> Vec<LiveChatMessage> {
+ let mut out = Vec::new();
+ let mut idx: u64 = 0;
+ for line in ndjson.lines() {
+ let line = line.trim();
+ if line.is_empty() {
+ continue;
+ }
+ let Ok(root) = serde_json::from_str::<Value>(line) else {
+ continue;
+ };
+ let Some(actions) = root
+ .pointer("/replayChatItemAction/actions")
+ .and_then(|a| a.as_array())
+ else {
+ continue;
+ };
+ for action in actions {
+ let Some(item) = action.pointer("/addChatItemAction/item") else {
+ continue;
+ };
+ if let Some(r) = item.get("liveChatTextMessageRenderer") {
+ idx += 1;
+ out.push(parse_renderer(r, "text", idx));
+ } else if let Some(r) = item.get("liveChatPaidMessageRenderer") {
+ idx += 1;
+ out.push(parse_renderer(r, "paid", idx));
+ } else if let Some(r) = item.get("liveChatMembershipItemRenderer") {
+ idx += 1;
+ out.push(parse_renderer(r, "membership", idx));
+ }
+ }
+ }
+ out
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn parses_text_message() {
+ let line = r#"{"replayChatItemAction":{"actions":[{"addChatItemAction":{"item":{"liveChatTextMessageRenderer":{"message":{"runs":[{"text":"hello "},{"text":"world"}]},"authorName":{"simpleText":"Alice"},"authorExternalChannelId":"UC123","timestampUsec":"1690000000000000","timestampText":{"simpleText":"1:23"}}}}}]}}"#;
+ let msgs = parse_live_chat(line);
+ assert_eq!(msgs.len(), 1);
+ let m = &msgs[0];
+ assert_eq!(m.author, "Alice");
+ assert_eq!(m.message, "hello world");
+ assert_eq!(m.time, "1:23");
+ assert_eq!(m.channel_id, "UC123");
+ assert_eq!(m.timestamp_usec, 1690000000000000);
+ assert_eq!(m.msg_type, "text");
+ assert_eq!(m.idx, 1);
+ }
+
+ #[test]
+ fn parses_paid_message_with_amount() {
+ let line = r#"{"replayChatItemAction":{"actions":[{"addChatItemAction":{"item":{"liveChatPaidMessageRenderer":{"message":{"runs":[{"text":"thanks"}]},"authorName":{"simpleText":"Bob"},"purchaseAmountText":{"simpleText":"$5.00"}}}}}]}}"#;
+ let msgs = parse_live_chat(line);
+ assert_eq!(msgs.len(), 1);
+ assert_eq!(msgs[0].msg_type, "paid");
+ assert_eq!(msgs[0].amount, "$5.00");
+ assert_eq!(msgs[0].message, "thanks");
+ }
+
+ #[test]
+ fn skips_invalid_and_unknown_lines() {
+ let input = "not json\n{}\n{\"replayChatItemAction\":{\"actions\":[{\"addChatItemAction\":{\"item\":{\"liveChatViewerEngagementMessageRenderer\":{}}}}]}}";
+ assert!(parse_live_chat(input).is_empty());
+ }
+
+ #[test]
+ fn membership_uses_header_subtext_fallback() {
+ let line = r#"{"replayChatItemAction":{"actions":[{"addChatItemAction":{"item":{"liveChatMembershipItemRenderer":{"headerSubtext":{"runs":[{"text":"Member for 6 months"}]},"authorName":{"simpleText":"Carol"}}}}}]}}"#;
+ let msgs = parse_live_chat(line);
+ assert_eq!(msgs.len(), 1);
+ assert_eq!(msgs[0].msg_type, "membership");
+ assert_eq!(msgs[0].message, "Member for 6 months");
+ }
+}
diff --git a/src-tauri/omniget-core/src/core/mod.rs b/src-tauri/omniget-core/src/core/mod.rs
index 08a36f4e..b589059f 100644
--- a/src-tauri/omniget-core/src/core/mod.rs
+++ b/src-tauri/omniget-core/src/core/mod.rs
@@ -1,3 +1,4 @@
+pub mod ai;
pub mod clipboard;
pub mod cookie_parser;
pub mod course_utils;
@@ -6,11 +7,13 @@ pub mod direct_downloader;
pub mod errors;
pub mod events;
pub mod ffmpeg;
+pub mod ffmpeg_ops;
pub mod filename;
pub mod hls_downloader;
pub mod http_client;
pub mod http_fetcher;
pub mod hwaccel;
+pub mod livechat;
pub mod log_hook;
pub mod media_processor;
pub mod paths;
@@ -19,4 +22,5 @@ pub mod pokemon_names;
pub mod process;
pub mod redirect;
pub mod registry;
+pub mod subtitle_merge;
pub mod ytdlp;
diff --git a/src-tauri/omniget-core/src/core/subtitle_merge.rs b/src-tauri/omniget-core/src/core/subtitle_merge.rs
new file mode 100644
index 00000000..2c7d844e
--- /dev/null
+++ b/src-tauri/omniget-core/src/core/subtitle_merge.rs
@@ -0,0 +1,307 @@
+struct SubBlock {
+ timing: String,
+ text: String,
+}
+
+fn parse_srt(content: &str) -> Vec<SubBlock> {
+ let normalized = content.replace('\r', "");
+ let mut blocks = Vec::new();
+ for part in normalized.split("\n\n") {
+ let lines: Vec<&str> = part.trim().split('\n').collect();
+ if lines.len() >= 3 {
+ blocks.push(SubBlock {
+ timing: lines[1].to_string(),
+ text: lines[2..].join("\n"),
+ });
+ }
+ }
+ blocks
+}
+
+fn parse_vtt(content: &str) -> Vec<SubBlock> {
+ let normalized = content.replace('\r', "");
+ let mut blocks = Vec::new();
+ for part in normalized.split("\n\n") {
+ let lines: Vec<&str> = part.trim().split('\n').collect();
+ if lines.is_empty() {
+ continue;
+ }
+ if let Some(idx) = lines.iter().position(|l| l.contains("-->")) {
+ if idx + 1 < lines.len() {
+ blocks.push(SubBlock {
+ timing: lines[idx].to_string(),
+ text: lines[idx + 1..].join("\n"),
+ });
+ }
+ }
+ }
+ blocks
+}
+
+fn merge(primary: &[SubBlock], secondary: &[SubBlock], header: &[&str], numbered: bool) -> String {
+ let max_len = primary.len().max(secondary.len());
+ let mut out: Vec<String> = header.iter().map(|s| s.to_string()).collect();
+ for i in 0..max_len {
+ if numbered {
+ out.push((i + 1).to_string());
+ }
+ match (primary.get(i), secondary.get(i)) {
+ (Some(pb), sb) => {
+ out.push(pb.timing.clone());
+ out.push(pb.text.clone());
+ if let Some(sb) = sb {
+ out.push(sb.text.clone());
+ }
+ }
+ (None, Some(sb)) => {
+ out.push(sb.timing.clone());
+ out.push(sb.text.clone());
+ }
+ (None, None) => {}
+ }
+ out.push(String::new());
+ }
+ out.join("\r\n")
+}
+
+pub fn merge_bilingual_srt(primary: &str, secondary: &str) -> String {
+ merge(&parse_srt(primary), &parse_srt(secondary), &[], true)
+}
+
+pub fn merge_bilingual_vtt(primary: &str, secondary: &str) -> String {
+ merge(
+ &parse_vtt(primary),
+ &parse_vtt(secondary),
+ &["WEBVTT", ""],
+ false,
+ )
+}
+
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+pub struct Cue {
+ pub start_ms: u64,
+ pub end_ms: u64,
+ pub text: String,
+}
+
+fn parse_ts(s: &str) -> Option<u64> {
+ // Accepts HH:MM:SS,mmm / HH:MM:SS.mmm / MM:SS.mmm
+ let s = s.trim();
+ let (hms, ms_part) = if let Some((a, b)) = s.split_once(',') {
+ (a, b)
+ } else if let Some((a, b)) = s.rsplit_once('.') {
+ (a, b)
+ } else {
+ (s, "0")
+ };
+ let ms: u64 = ms_part
+ .chars()
+ .take(3)
+ .collect::<String>()
+ .parse()
+ .ok()
+ .map(|v: u64| v * 10u64.pow(3u32.saturating_sub(ms_part.len().min(3) as u32)))
+ .unwrap_or(0);
+ let parts: Vec<&str> = hms.split(':').collect();
+ let (h, m, sec): (u64, u64, u64) = match parts.as_slice() {
+ [h, m, s] => (
+ h.trim().parse::<u64>().ok()?,
+ m.trim().parse::<u64>().ok()?,
+ s.trim().parse::<u64>().ok()?,
+ ),
+ [m, s] => (
+ 0,
+ m.trim().parse::<u64>().ok()?,
+ s.trim().parse::<u64>().ok()?,
+ ),
+ _ => return None,
+ };
+ Some(((h * 3600 + m * 60 + sec) * 1000) + ms)
+}
+
+fn fmt_ts(ms: u64) -> String {
+ let h = ms / 3_600_000;
+ let m = (ms % 3_600_000) / 60_000;
+ let s = (ms % 60_000) / 1000;
+ let milli = ms % 1000;
+ format!("{:02}:{:02}:{:02},{:03}", h, m, s, milli)
+}
+
+pub fn parse_cues(content: &str) -> Vec<Cue> {
+ let normalized = content.replace('\r', "");
+ let mut cues = Vec::new();
+ for part in normalized.split("\n\n") {
+ let lines: Vec<&str> = part.trim().split('\n').collect();
+ let Some(idx) = lines.iter().position(|l| l.contains("-->")) else {
+ continue;
+ };
+ let timing = lines[idx];
+ let Some((a, b)) = timing.split_once("-->") else {
+ continue;
+ };
+ let (Some(start_ms), Some(end_ms)) = (
+ parse_ts(a),
+ parse_ts(b.split_whitespace().next().unwrap_or(b)),
+ ) else {
+ continue;
+ };
+ let text = lines[idx + 1..].join("\n").trim().to_string();
+ if text.is_empty() {
+ continue;
+ }
+ cues.push(Cue {
+ start_ms,
+ end_ms,
+ text,
+ });
+ }
+ cues
+}
+
+pub fn cues_to_srt(cues: &[Cue]) -> String {
+ let mut out = String::new();
+ for (i, c) in cues.iter().enumerate() {
+ out.push_str(&(i + 1).to_string());
+ out.push('\n');
+ out.push_str(&fmt_ts(c.start_ms));
+ out.push_str(" --> ");
+ out.push_str(&fmt_ts(c.end_ms));
+ out.push('\n');
+ out.push_str(&c.text);
+ out.push_str("\n\n");
+ }
+ out
+}
+
+pub fn cues_to_vtt(cues: &[Cue]) -> String {
+ let mut out = String::from("WEBVTT\n\n");
+ for c in cues {
+ out.push_str(&fmt_ts(c.start_ms).replace(',', "."));
+ out.push_str(" --> ");
+ out.push_str(&fmt_ts(c.end_ms).replace(',', "."));
+ out.push('\n');
+ out.push_str(&c.text);
+ out.push_str("\n\n");
+ }
+ out
+}
+
+fn strip_tags(s: &str) -> String {
+ let mut out = String::with_capacity(s.len());
+ let mut in_tag = false;
+ for c in s.chars() {
+ match c {
+ '<' => in_tag = true,
+ '>' => in_tag = false,
+ _ if !in_tag => out.push(c),
+ _ => {}
+ }
+ }
+ out
+}
+
+// Flattens an SRT/VTT subtitle into plain transcript text. yt-dlp auto-subs
+// roll up and repeat lines heavily, so consecutive duplicate lines are
+// collapsed. Used to feed transcripts to the AI summarizer.
+pub fn extract_transcript(content: &str) -> String {
+ let blocks = if content.trim_start().starts_with("WEBVTT") {
+ parse_vtt(content)
+ } else {
+ parse_srt(content)
+ };
+ let mut lines: Vec<String> = Vec::new();
+ for b in blocks {
+ for raw in b.text.split('\n') {
+ let line = strip_tags(raw).trim().to_string();
+ if line.is_empty() {
+ continue;
+ }
+ if lines.last().map(|l| l == &line).unwrap_or(false) {
+ continue;
+ }
+ lines.push(line);
+ }
+ }
+ lines.join(" ")
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn srt_blocks_parsed_index_aligned() {
+ let p =
+ "1\n00:00:01,000 --> 00:00:02,000\nHello\n\n2\n00:00:03,000 --> 00:00:04,000\nWorld";
+ let s = "1\n00:00:01,000 --> 00:00:02,000\nOlá\n\n2\n00:00:03,000 --> 00:00:04,000\nMundo";
+ let merged = merge_bilingual_srt(p, s);
+ assert!(merged.contains("Hello\r\nOlá"));
+ assert!(merged.contains("World\r\nMundo"));
+ assert!(merged.starts_with("1\r\n"));
+ }
+
+ #[test]
+ fn vtt_has_header_and_no_index() {
+ let p = "WEBVTT\n\n00:00:01.000 --> 00:00:02.000\nHi";
+ let s = "WEBVTT\n\n00:00:01.000 --> 00:00:02.000\nOi";
+ let merged = merge_bilingual_vtt(p, s);
+ assert!(merged.starts_with("WEBVTT\r\n"));
+ assert!(merged.contains("Hi\r\nOi"));
+ assert!(!merged.contains("\r\n1\r\n"));
+ }
+
+ #[test]
+ fn uneven_lengths_fall_back_to_secondary_timing() {
+ let p = "1\n00:00:01,000 --> 00:00:02,000\nOne";
+ let s = "1\n00:00:01,000 --> 00:00:02,000\nUm\n\n2\n00:00:05,000 --> 00:00:06,000\nDois";
+ let merged = merge_bilingual_srt(p, s);
+ assert!(merged.contains("One\r\nUm"));
+ assert!(merged.contains("00:00:05,000 --> 00:00:06,000\r\nDois"));
+ }
+
+ #[test]
+ fn empty_inputs_are_safe() {
+ assert_eq!(merge_bilingual_srt("", ""), "");
+ assert_eq!(merge_bilingual_vtt("", ""), "WEBVTT\r\n");
+ }
+
+ #[test]
+ fn transcript_strips_tags_and_dedupes() {
+ let vtt = "WEBVTT\n\n00:00:01.000 --> 00:00:02.000\n<c>Hello</c> world\n\n00:00:02.000 --> 00:00:03.000\nHello world\n\n00:00:03.000 --> 00:00:04.000\nNext line";
+ let t = extract_transcript(vtt);
+ assert_eq!(t, "Hello world Next line");
+ }
+
+ #[test]
+ fn transcript_srt_plain() {
+ let srt =
+ "1\n00:00:01,000 --> 00:00:02,000\nFirst\n\n2\n00:00:03,000 --> 00:00:04,000\nSecond";
+ assert_eq!(extract_transcript(srt), "First Second");
+ }
+
+ #[test]
+ fn parse_cues_srt_roundtrip() {
+ let srt =
+ "1\n00:00:01,500 --> 00:00:02,250\nHello\n\n2\n00:01:00,000 --> 00:01:02,000\nWorld";
+ let cues = parse_cues(srt);
+ assert_eq!(cues.len(), 2);
+ assert_eq!(cues[0].start_ms, 1500);
+ assert_eq!(cues[0].end_ms, 2250);
+ assert_eq!(cues[1].start_ms, 60000);
+ assert_eq!(cues[0].text, "Hello");
+ let back = cues_to_srt(&cues);
+ let again = parse_cues(&back);
+ assert_eq!(again[1].start_ms, 60000);
+ assert_eq!(again[1].text, "World");
+ }
+
+ #[test]
+ fn parse_cues_vtt() {
+ let vtt = "WEBVTT\n\n00:00:01.000 --> 00:00:02.000\nHi there";
+ let cues = parse_cues(vtt);
+ assert_eq!(cues.len(), 1);
+ assert_eq!(cues[0].start_ms, 1000);
+ assert_eq!(cues[0].text, "Hi there");
+ assert!(cues_to_vtt(&cues).starts_with("WEBVTT"));
+ }
+}
diff --git a/src-tauri/omniget-core/src/core/ytdlp.rs b/src-tauri/omniget-core/src/core/ytdlp.rs
index 4f61b09c..aa66edcd 100644
--- a/src-tauri/omniget-core/src/core/ytdlp.rs
+++ b/src-tauri/omniget-core/src/core/ytdlp.rs
@@ -21,6 +21,14 @@ type IncludeAutoSubsFn = Box<dyn Fn() -> bool + Send + Sync>;
type TranslateMetadataFn = Box<dyn Fn() -> Option<String> + Send + Sync>;
type SponsorBlockFn = Box<dyn Fn() -> bool + Send + Sync>;
type SplitChaptersFn = Box<dyn Fn() -> bool + Send + Sync>;
+type EmbedMetadataFn = Box<dyn Fn() -> bool + Send + Sync>;
+type EmbedThumbnailFn = Box<dyn Fn() -> bool + Send + Sync>;
+type SpeedLimitFn = Box<dyn Fn() -> Option<String> + Send + Sync>;
+type LiveFromStartFn = Box<dyn Fn() -> bool + Send + Sync>;
+type ConcurrentFragmentsFn = Box<dyn Fn() -> u32 + Send + Sync>;
+type UserAgentFn = Box<dyn Fn() -> Option<String> + Send + Sync>;
+type SponsorBlockModeFn = Box<dyn Fn() -> String + Send + Sync>;
+type SponsorBlockCategoriesFn = Box<dyn Fn() -> Vec<String> + Send + Sync>;
type PerDomainCookieFn = Box<dyn Fn(&str) -> Option<PathBuf> + Send + Sync>;
type ManagedCookiesOnlyFn = Box<dyn Fn() -> bool + Send + Sync>;
@@ -35,6 +43,14 @@ static MANAGED_COOKIES_ONLY_FN: OnceLock<ManagedCookiesOnlyFn> = OnceLock::new()
static TRANSLATE_METADATA_FN: OnceLock<TranslateMetadataFn> = OnceLock::new();
static SPONSORBLOCK_FN: OnceLock<SponsorBlockFn> = OnceLock::new();
static SPLIT_CHAPTERS_FN: OnceLock<SplitChaptersFn> = OnceLock::new();
+static EMBED_METADATA_FN: OnceLock<EmbedMetadataFn> = OnceLock::new();
+static EMBED_THUMBNAIL_FN: OnceLock<EmbedThumbnailFn> = OnceLock::new();
+static SPEED_LIMIT_FN: OnceLock<SpeedLimitFn> = OnceLock::new();
+static LIVE_FROM_START_FN: OnceLock<LiveFromStartFn> = OnceLock::new();
+static CONCURRENT_FRAGMENTS_FN: OnceLock<ConcurrentFragmentsFn> = OnceLock::new();
+static USER_AGENT_FN: OnceLock<UserAgentFn> = OnceLock::new();
+static SPONSORBLOCK_MODE_FN: OnceLock<SponsorBlockModeFn> = OnceLock::new();
+static SPONSORBLOCK_CATEGORIES_FN: OnceLock<SponsorBlockCategoriesFn> = OnceLock::new();
pub fn set_ext_cookie_path_fn(f: impl Fn() -> PathBuf + Send + Sync + 'static) {
let _ = EXT_COOKIE_PATH_FN.set(Box::new(f));
@@ -92,6 +108,28 @@ fn sponsorblock_enabled() -> bool {
SPONSORBLOCK_FN.get().map(|f| f()).unwrap_or(false)
}
+pub fn set_sponsorblock_mode_fn(f: impl Fn() -> String + Send + Sync + 'static) {
+ let _ = SPONSORBLOCK_MODE_FN.set(Box::new(f));
+}
+
+fn sponsorblock_mode() -> String {
+ SPONSORBLOCK_MODE_FN
+ .get()
+ .map(|f| f())
+ .unwrap_or_else(|| "remove".to_string())
+}
+
+pub fn set_sponsorblock_categories_fn(f: impl Fn() -> Vec<String> + Send + Sync + 'static) {
+ let _ = SPONSORBLOCK_CATEGORIES_FN.set(Box::new(f));
+}
+
+fn sponsorblock_categories() -> Vec<String> {
+ SPONSORBLOCK_CATEGORIES_FN
+ .get()
+ .map(|f| f())
+ .unwrap_or_default()
+}
+
pub fn set_split_chapters_fn(f: impl Fn() -> bool + Send + Sync + 'static) {
let _ = SPLIT_CHAPTERS_FN.set(Box::new(f));
}
@@ -100,6 +138,54 @@ fn split_chapters_enabled() -> bool {
SPLIT_CHAPTERS_FN.get().map(|f| f()).unwrap_or(false)
}
+pub fn set_embed_metadata_fn(f: impl Fn() -> bool + Send + Sync + 'static) {
+ let _ = EMBED_METADATA_FN.set(Box::new(f));
+}
+
+fn embed_metadata_enabled() -> bool {
+ EMBED_METADATA_FN.get().map(|f| f()).unwrap_or(true)
+}
+
+pub fn set_embed_thumbnail_fn(f: impl Fn() -> bool + Send + Sync + 'static) {
+ let _ = EMBED_THUMBNAIL_FN.set(Box::new(f));
+}
+
+fn embed_thumbnail_enabled() -> bool {
+ EMBED_THUMBNAIL_FN.get().map(|f| f()).unwrap_or(true)
+}
+
+pub fn set_speed_limit_fn(f: impl Fn() -> Option<String> + Send + Sync + 'static) {
+ let _ = SPEED_LIMIT_FN.set(Box::new(f));
+}
+
+fn speed_limit_value() -> Option<String> {
+ SPEED_LIMIT_FN.get().and_then(|f| f())
+}
+
+pub fn set_live_from_start_fn(f: impl Fn() -> bool + Send + Sync + 'static) {
+ let _ = LIVE_FROM_START_FN.set(Box::new(f));
+}
+
+fn live_from_start_enabled() -> bool {
+ LIVE_FROM_START_FN.get().map(|f| f()).unwrap_or(false)
+}
+
+pub fn set_concurrent_fragments_fn(f: impl Fn() -> u32 + Send + Sync + 'static) {
+ let _ = CONCURRENT_FRAGMENTS_FN.set(Box::new(f));
+}
+
+fn concurrent_fragments_value() -> u32 {
+ CONCURRENT_FRAGMENTS_FN.get().map(|f| f()).unwrap_or(1)
+}
+
+pub fn set_user_agent_fn(f: impl Fn() -> Option<String> + Send + Sync + 'static) {
+ let _ = USER_AGENT_FN.set(Box::new(f));
+}
+
+fn user_agent_setting() -> Option<String> {
+ USER_AGENT_FN.get().and_then(|f| f())
+}
+
static EXT_UA_MAP: OnceLock<Mutex<HashMap<String, String>>> = OnceLock::new();
fn ext_ua_map() -> &'static Mutex<HashMap<String, String>> {
@@ -1518,7 +1604,9 @@ pub async fn download_video(
&& !manual_cookie_enabled
&& !explicit_cookie_header;
- let effective_ua = ext_user_agent_for_url(url).unwrap_or_else(|| CHROME_UA.to_string());
+ let effective_ua = ext_user_agent_for_url(url)
+ .or_else(user_agent_setting)
+ .unwrap_or_else(|| CHROME_UA.to_string());
base_args.extend([
"--no-check-certificate".to_string(),
"--no-warnings".to_string(),
@@ -1557,14 +1645,51 @@ pub async fn download_video(
}
if sponsorblock_enabled() && is_youtube_url(url) {
- base_args.push("--sponsorblock-remove".to_string());
- base_args.push("default".to_string());
+ let cats = sponsorblock_categories();
+ let cat_arg = if cats.is_empty() {
+ "default".to_string()
+ } else {
+ cats.join(",")
+ };
+ let flag = if sponsorblock_mode() == "mark" {
+ "--sponsorblock-mark"
+ } else {
+ "--sponsorblock-remove"
+ };
+ base_args.push(flag.to_string());
+ base_args.push(cat_arg);
}
if split_chapters_enabled() {
base_args.push("--split-chapters".to_string());
}
+ if embed_metadata_enabled() {
+ base_args.push("--embed-metadata".to_string());
+ }
+
+ if embed_thumbnail_enabled() {
+ base_args.push("--embed-thumbnail".to_string());
+ base_args.push("--convert-thumbnails".to_string());
+ base_args.push("jpg".to_string());
+ }
+
+ if let Some(rate) = speed_limit_value() {
+ base_args.push("--limit-rate".to_string());
+ base_args.push(rate);
+ }
+
+ let frag_count = concurrent_fragments_value();
+ if frag_count > 1 {
+ base_args.push("--concurrent-fragments".to_string());
+ base_args.push(frag_count.to_string());
+ }
+
+ if live_from_start_enabled() {
+ base_args.push("--live-from-start".to_string());
+ base_args.push("--no-part".to_string());
+ }
+
if cfg!(target_os = "windows") {
base_args.push("--windows-filenames".to_string());
}
diff --git a/src-tauri/omniget-core/src/models/media.rs b/src-tauri/omniget-core/src/models/media.rs
index 06a90fb0..552380aa 100644
--- a/src-tauri/omniget-core/src/models/media.rs
+++ b/src-tauri/omniget-core/src/models/media.rs
@@ -57,6 +57,9 @@ pub struct DownloadOptions {
pub torrent_listen_port: Option<u16>,
pub torrent_id_slot: Option<std::sync::Arc<tokio::sync::Mutex<Option<usize>>>>,
pub custom_ytdlp_args: Option<Vec<String>>,
+ pub torrent_files: Option<Vec<usize>>,
+ pub torrent_auto_trackers: bool,
+ pub torrent_upnp: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
diff --git a/src-tauri/omniget-core/src/models/settings.rs b/src-tauri/omniget-core/src/models/settings.rs
index dbfd0aa2..f1c8236e 100644
--- a/src-tauri/omniget-core/src/models/settings.rs
+++ b/src-tauri/omniget-core/src/models/settings.rs
@@ -109,9 +109,17 @@ pub struct DownloadSettings {
pub translate_metadata: bool,
#[serde(default)]
pub youtube_sponsorblock: bool,
+ #[serde(default = "default_sponsorblock_mode")]
+ pub sponsorblock_mode: String,
+ #[serde(default = "default_sponsorblock_categories")]
+ pub sponsorblock_categories: Vec<String>,
#[serde(default)]
pub split_by_chapters: bool,
#[serde(default)]
+ pub live_from_start: bool,
+ #[serde(default)]
+ pub speed_limit: String,
+ #[serde(default)]
pub hotkey_enabled: bool,
#[serde(default = "default_hotkey_binding")]
pub hotkey_binding: String,
@@ -149,16 +157,36 @@ pub struct AdvancedSettings {
pub stagger_delay_ms: u64,
#[serde(default = "default_torrent_listen_port")]
pub torrent_listen_port: u16,
+ #[serde(default = "default_torrent_auto_trackers")]
+ pub torrent_auto_trackers: bool,
+ #[serde(default = "default_torrent_upnp")]
+ pub torrent_upnp: bool,
+ #[serde(default = "default_prevent_sleep")]
+ pub prevent_sleep: bool,
#[serde(default)]
pub cookies_from_browser: String,
#[serde(default)]
pub twitter_manual_cookie: String,
+ #[serde(default)]
+ pub user_agent: String,
}
fn default_concurrent_fragments() -> u32 {
8
}
+fn default_sponsorblock_mode() -> String {
+ "remove".to_string()
+}
+
+fn default_sponsorblock_categories() -> Vec<String> {
+ vec![
+ "sponsor".to_string(),
+ "selfpromo".to_string(),
+ "interaction".to_string(),
+ ]
+}
+
fn default_max_concurrent_downloads() -> u32 {
2
}
@@ -167,6 +195,18 @@ fn default_stagger_delay_ms() -> u64 {
150
}
+fn default_torrent_auto_trackers() -> bool {
+ true
+}
+
+fn default_torrent_upnp() -> bool {
+ true
+}
+
+fn default_prevent_sleep() -> bool {
+ true
+}
+
fn default_torrent_listen_port() -> u16 {
6881
}
@@ -349,7 +389,15 @@ impl Default for AppSettings {
keep_vtt: false,
translate_metadata: false,
youtube_sponsorblock: false,
+ sponsorblock_mode: "remove".to_string(),
+ sponsorblock_categories: vec![
+ "sponsor".to_string(),
+ "selfpromo".to_string(),
+ "interaction".to_string(),
+ ],
split_by_chapters: false,
+ live_from_start: false,
+ speed_limit: String::new(),
hotkey_enabled: false,
hotkey_binding: default_hotkey_binding(),
clip_hotkey_enabled: false,
@@ -370,8 +418,12 @@ impl Default for AppSettings {
concurrent_fragments: 8,
stagger_delay_ms: 150,
torrent_listen_port: 6881,
+ torrent_auto_trackers: true,
+ torrent_upnp: true,
+ prevent_sleep: true,
cookies_from_browser: String::new(),
twitter_manual_cookie: String::new(),
+ user_agent: String::new(),
},
telegram: TelegramSettings::default(),
proxy: ProxySettings::default(),
diff --git a/src-tauri/src/commands/ai.rs b/src-tauri/src/commands/ai.rs
new file mode 100644
index 00000000..811a2a2f
--- /dev/null
+++ b/src-tauri/src/commands/ai.rs
@@ -0,0 +1,244 @@
+use omniget_core::core::ai::{self, AiConfigView, AiHistoryEntry, AiProvider};
+use serde::Serialize;
+
+const MAX_TRANSCRIPT_CHARS: usize = 12000;
+
+#[tauri::command]
+pub fn ai_get_config() -> AiConfigView {
+ ai::get().view()
+}
+
+#[tauri::command]
+pub fn ai_set_config(
+ provider: AiProvider,
+ model: String,
+ local_base_url: String,
+ openai_key: Option<String>,
+ anthropic_key: Option<String>,
+) -> AiConfigView {
+ ai::set(provider, model, local_base_url, openai_key, anthropic_key).view()
+}
+
+#[tauri::command]
+pub async fn ai_test() -> Result<String, String> {
+ ai::chat(
+ "You are a connectivity test. Reply with the single word: ok.",
+ "ping",
+ )
+ .await
+}
+
+#[derive(Clone, Serialize)]
+pub struct AiSummaryResult {
+ pub title: String,
+ pub summary: String,
+}
+
+#[cfg(not(target_os = "android"))]
+async fn transcribe_via_audio(
+ ytdlp: &std::path::Path,
+ url: &str,
+ tmp: &std::path::Path,
+) -> Result<String, String> {
+ let audio_tmpl = tmp.join("audio.%(ext)s");
+ let _ = omniget_core::core::process::command(ytdlp)
+ .arg("-f")
+ .arg("bestaudio/best")
+ .arg("--no-warnings")
+ .arg("-o")
+ .arg(audio_tmpl.to_string_lossy().to_string())
+ .arg(url)
+ .output()
+ .await
+ .map_err(|e| format!("yt-dlp audio failed: {}", e))?;
+
+ let mut src: Option<(u64, std::path::PathBuf)> = None;
+ let mut rd = tokio::fs::read_dir(tmp).await.map_err(|e| e.to_string())?;
+ while let Ok(Some(entry)) = rd.next_entry().await {
+ let p = entry.path();
+ let name = p
+ .file_name()
+ .map(|n| n.to_string_lossy().to_string())
+ .unwrap_or_default();
+ if name.starts_with("audio.") {
+ let len = entry.metadata().await.map(|m| m.len()).unwrap_or(0);
+ if src.as_ref().map(|(l, _)| len > *l).unwrap_or(true) {
+ src = Some((len, p));
+ }
+ }
+ }
+ let (_, src_path) = src.ok_or_else(|| "no audio".to_string())?;
+
+ let ffmpeg = omniget_core::core::dependencies::find_tool("ffmpeg")
+ .await
+ .ok_or_else(|| "ffmpeg unavailable".to_string())?;
+ let small = tmp.join("a16.mp3");
+ let status = omniget_core::core::process::command(&ffmpeg)
+ .arg("-y")
+ .arg("-i")
+ .arg(src_path.to_string_lossy().to_string())
+ .arg("-ac")
+ .arg("1")
+ .arg("-ar")
+ .arg("16000")
+ .arg("-b:a")
+ .arg("32k")
+ .arg(small.to_string_lossy().to_string())
+ .status()
+ .await
+ .map_err(|e| format!("ffmpeg failed: {}", e))?;
+ if !status.success() {
+ return Err("ffmpeg transcode failed".to_string());
+ }
+
+ omniget_core::core::ai::transcribe(&small).await
+}
+
+#[cfg(not(target_os = "android"))]
+async fn fetch_transcript(url: &str) -> Result<(String, String), String> {
+ let ytdlp = crate::core::ytdlp::find_ytdlp_cached()
+ .await
+ .ok_or_else(|| "yt-dlp unavailable".to_string())?;
+
+ let stamp = std::time::SystemTime::now()
+ .duration_since(std::time::UNIX_EPOCH)
+ .map(|d| d.as_millis())
+ .unwrap_or(0);
+ let tmp = std::env::temp_dir().join(format!("omniget-ai-{stamp}"));
+ tokio::fs::create_dir_all(&tmp)
+ .await
+ .map_err(|e| e.to_string())?;
+
+ let out_template = tmp.join("t.%(ext)s");
+ let result: Result<(String, String), String> = (|| async {
+ let output = omniget_core::core::process::command(&ytdlp)
+ .arg("--skip-download")
+ .arg("--write-subs")
+ .arg("--write-auto-subs")
+ .arg("--sub-langs")
+ .arg("en.*,en,.*-orig,.*")
+ .arg("--convert-subs")
+ .arg("srt")
+ .arg("--no-warnings")
+ .arg("--print")
+ .arg("title")
+ .arg("-o")
+ .arg(out_template.to_string_lossy().to_string())
+ .arg(url)
+ .output()
+ .await
+ .map_err(|e| format!("yt-dlp failed: {}", e))?;
+
+ let title = String::from_utf8_lossy(&output.stdout)
+ .lines()
+ .next()
+ .unwrap_or("")
+ .trim()
+ .to_string();
+
+ let mut best: Option<(u64, std::path::PathBuf)> = None;
+ let mut rd = tokio::fs::read_dir(&tmp).await.map_err(|e| e.to_string())?;
+ while let Ok(Some(entry)) = rd.next_entry().await {
+ let p = entry.path();
+ let ext = p
+ .extension()
+ .map(|e| e.to_string_lossy().to_lowercase())
+ .unwrap_or_default();
+ if ext == "srt" || ext == "vtt" {
+ let len = entry.metadata().await.map(|m| m.len()).unwrap_or(0);
+ if best.as_ref().map(|(l, _)| len > *l).unwrap_or(true) {
+ best = Some((len, p));
+ }
+ }
+ }
+
+ if let Some((_, sub_path)) = best {
+ let content = tokio::fs::read_to_string(&sub_path)
+ .await
+ .map_err(|e| e.to_string())?;
+ let transcript = omniget_core::core::subtitle_merge::extract_transcript(&content);
+ if !transcript.trim().is_empty() {
+ return Ok((title, transcript));
+ }
+ }
+
+ // No usable subtitles — fall back to Whisper-style audio transcription
+ // (only works on OpenAI-compatible providers; surfaces as no_transcript
+ // otherwise so the UI hint stays accurate).
+ match transcribe_via_audio(&ytdlp, url, &tmp).await {
+ Ok(t) if !t.trim().is_empty() => Ok((title, t)),
+ _ => Err("no_transcript".to_string()),
+ }
+ })()
+ .await;
+
+ let _ = tokio::fs::remove_dir_all(&tmp).await;
+ result
+}
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn ai_summarize_url(
+ url: String,
+ style: Option<String>,
+ lang: Option<String>,
+) -> Result<AiSummaryResult, String> {
+ if !ai::get().is_configured() {
+ return Err("ai_not_configured".to_string());
+ }
+ let (title, mut transcript) = fetch_transcript(&url).await?;
+ if transcript.chars().count() > MAX_TRANSCRIPT_CHARS {
+ transcript = transcript.chars().take(MAX_TRANSCRIPT_CHARS).collect();
+ }
+ let shape = match style.as_deref() {
+ Some("short") => "in one short paragraph (no bullet points)",
+ Some("detailed") => "as a thorough overview with sections and 8-12 detailed bullet points",
+ _ => "as a short paragraph followed by 3-6 key bullet points",
+ };
+ let language = match lang.as_deref().map(str::trim) {
+ Some(l) if !l.is_empty() => format!("Write the summary in {}.", l),
+ _ => "Write the summary in the transcript's own language.".to_string(),
+ };
+ let system = format!(
+ "You are a concise assistant. Summarize the following video transcript {}. {}",
+ shape, language
+ );
+ let summary = ai::chat(&system, &transcript).await?;
+ ai::history_add("summary", &url, &title, &summary);
+ Ok(AiSummaryResult { title, summary })
+}
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn whisper_generate(url: String) -> Result<String, String> {
+ let cfg = ai::get();
+ if !matches!(cfg.provider, AiProvider::Openai | AiProvider::Local) {
+ return Err("ai_not_configured".to_string());
+ }
+ let ytdlp = crate::core::ytdlp::find_ytdlp_cached()
+ .await
+ .ok_or_else(|| "yt-dlp unavailable".to_string())?;
+ let stamp = std::time::SystemTime::now()
+ .duration_since(std::time::UNIX_EPOCH)
+ .map(|d| d.as_millis())
+ .unwrap_or(0);
+ let tmp = std::env::temp_dir().join(format!("omniget-whisper-{stamp}"));
+ tokio::fs::create_dir_all(&tmp)
+ .await
+ .map_err(|e| e.to_string())?;
+ let result = transcribe_via_audio(&ytdlp, &url, &tmp).await;
+ let _ = tokio::fs::remove_dir_all(&tmp).await;
+ let transcript = result?;
+ ai::history_add("transcript", &url, "", &transcript);
+ Ok(transcript)
+}
+
+#[tauri::command]
+pub fn ai_history_list() -> Vec<AiHistoryEntry> {
+ ai::history_list()
+}
+
+#[tauri::command]
+pub fn ai_history_clear() {
+ ai::history_clear();
+}
diff --git a/src-tauri/src/commands/app_lifecycle.rs b/src-tauri/src/commands/app_lifecycle.rs
index 43214b2e..6b721b87 100644
--- a/src-tauri/src/commands/app_lifecycle.rs
+++ b/src-tauri/src/commands/app_lifecycle.rs
@@ -1,16 +1,6 @@
use serde::Serialize;
use tauri::AppHandle;
-#[tauri::command]
-pub fn get_active_download_count(app: AppHandle) -> u32 {
- crate::tray::compute_total_active(&app)
-}
-
-#[tauri::command]
-pub fn request_app_quit(app: AppHandle) {
- crate::tray::request_quit(&app);
-}
-
#[tauri::command]
pub fn force_exit_app(app: AppHandle) {
app.exit(0);
diff --git a/src-tauri/src/commands/autostart.rs b/src-tauri/src/commands/autostart.rs
index af56a4c7..6cfd9efc 100644
--- a/src-tauri/src/commands/autostart.rs
+++ b/src-tauri/src/commands/autostart.rs
@@ -16,23 +16,3 @@ pub fn apply_autostart(app: &tauri::AppHandle, enabled: bool) -> Result<(), Stri
}
Ok(())
}
-
-pub fn get_autostart_enabled(app: &tauri::AppHandle) -> Result<bool, String> {
- app.autolaunch()
- .is_enabled()
- .map_err(|e| format!("Failed to query autostart: {e}"))
-}
-
-#[tauri::command]
-pub fn set_autostart(app: tauri::AppHandle, enabled: bool) -> Result<(), String> {
- apply_autostart(&app, enabled)?;
- let mut current = crate::storage::config::load_settings(&app);
- current.start_with_system = enabled;
- crate::storage::config::save_settings(&app, &current).map_err(|e| format!("Save: {e}"))?;
- Ok(())
-}
-
-#[tauri::command]
-pub fn get_autostart_status(app: tauri::AppHandle) -> Result<bool, String> {
- get_autostart_enabled(&app)
-}
diff --git a/src-tauri/src/commands/channels.rs b/src-tauri/src/commands/channels.rs
new file mode 100644
index 00000000..3b683be8
--- /dev/null
+++ b/src-tauri/src/commands/channels.rs
@@ -0,0 +1,56 @@
+use crate::core::channels::{self, ChannelFollow};
+
+#[tauri::command]
+pub fn channels_list() -> Vec<ChannelFollow> {
+ channels::list()
+}
+
+#[tauri::command]
+pub fn channel_add(url: String, title: Option<String>) -> Result<ChannelFollow, String> {
+ let url = url.trim().to_string();
+ if url.is_empty() {
+ return Err("Empty URL".to_string());
+ }
+ let title = title
+ .map(|t| t.trim().to_string())
+ .filter(|t| !t.is_empty())
+ .unwrap_or_else(|| url.clone());
+ Ok(channels::add(url, title))
+}
+
+#[tauri::command]
+pub fn channel_remove(id: String) -> Result<(), String> {
+ if channels::remove(&id) {
+ Ok(())
+ } else {
+ Err("Channel not found".to_string())
+ }
+}
+
+#[tauri::command]
+pub fn channel_update(
+ id: String,
+ enabled: Option<bool>,
+ auto_download: Option<bool>,
+ interval_minutes: Option<u32>,
+) -> Result<ChannelFollow, String> {
+ channels::update(&id, enabled, auto_download, interval_minutes)
+ .ok_or_else(|| "Channel not found".to_string())
+}
+
+#[tauri::command]
+pub async fn channel_check_now(app: tauri::AppHandle, id: String) -> Result<usize, String> {
+ crate::core::channel_poller::check_now(&app, &id).await
+}
+
+// The tray menu is built natively in Rust, so $t is unavailable there. The
+// frontend resolves the labels with $t and pushes them here; the backend just
+// rebuilds the submenu with whatever localized strings it receives.
+#[tauri::command]
+pub fn sync_channels_tray(
+ app: tauri::AppHandle,
+ header: String,
+ channels: Vec<(String, String)>,
+) -> Result<(), String> {
+ crate::tray::rebuild_menu(&app, header, channels).map_err(|e| e.to_string())
+}
diff --git a/src-tauri/src/commands/diagnostics.rs b/src-tauri/src/commands/diagnostics.rs
index 25fd90f3..22bcbd0a 100644
--- a/src-tauri/src/commands/diagnostics.rs
+++ b/src-tauri/src/commands/diagnostics.rs
@@ -1,8 +1,3 @@
-#[tauri::command]
-pub fn get_rate_limit_stats() -> serde_json::Value {
- crate::core::ytdlp::get_rate_limit_stats()
-}
-
#[tauri::command]
pub async fn get_hwaccel_info() -> omniget_core::core::hwaccel::HwAccelInfo {
omniget_core::core::hwaccel::detect_hwaccel().await
diff --git a/src-tauri/src/commands/downloads.rs b/src-tauri/src/commands/downloads.rs
index 5178cecd..caa0fb04 100644
--- a/src-tauri/src/commands/downloads.rs
+++ b/src-tauri/src/commands/downloads.rs
@@ -2,7 +2,7 @@ use std::sync::Arc;
use serde::Serialize;
-use crate::core::queue::{self, emit_queue_state_from_state, QueueItemInfo};
+use crate::core::queue::{self, emit_queue_state_from_state};
use crate::core::url_parser;
use crate::platforms::Platform;
use crate::storage::config;
@@ -11,7 +11,7 @@ use crate::AppState;
#[cfg(not(target_os = "android"))]
use crate::core::ytdlp;
#[cfg(not(target_os = "android"))]
-use crate::models::media::FormatInfo;
+use crate::models::media::{FormatInfo, MediaType};
#[derive(Clone, Serialize)]
pub struct PlatformInfo {
@@ -146,6 +146,693 @@ pub struct DownloadStarted {
pub title: String,
}
+fn is_valid_time_range(r: &str) -> bool {
+ let Some((a, b)) = r.split_once('-') else {
+ return false;
+ };
+ let part_ok = |s: &str| {
+ !s.is_empty()
+ && s.chars()
+ .all(|c| c.is_ascii_digit() || c == ':' || c == '.')
+ };
+ part_ok(a) && (b == "inf" || part_ok(b))
+}
+
+#[derive(Clone, Serialize)]
+pub struct PlaylistEntryInfo {
+ pub index: u32,
+ pub title: String,
+ pub url: String,
+}
+
+#[derive(Clone, Serialize)]
+pub struct MetadataFetchResult {
+ pub title: String,
+ pub saved: Vec<String>,
+}
+
+#[derive(Clone, Serialize)]
+pub struct TorrentFileEntry {
+ pub index: usize,
+ pub path: String,
+ pub size_bytes: u64,
+}
+
+#[cfg(not(target_os = "android"))]
+fn is_torrent_source(url: &str) -> bool {
+ url.starts_with("magnet:")
+ || url.ends_with(".torrent")
+ || (std::path::Path::new(url).exists()
+ && std::path::Path::new(url)
+ .extension()
+ .map(|e| e == "torrent")
+ .unwrap_or(false))
+}
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn torrent_contents(url: String) -> Result<Vec<TorrentFileEntry>, String> {
+ if !is_torrent_source(&url) {
+ return Err("Not a torrent source".to_string());
+ }
+
+ let add_torrent = if url.starts_with("magnet:")
+ || url.starts_with("http://")
+ || url.starts_with("https://")
+ {
+ librqbit::AddTorrent::from_url(&url)
+ } else {
+ let path = std::path::Path::new(&url);
+ if path.exists() && path.extension().map(|e| e == "torrent").unwrap_or(false) {
+ let bytes = tokio::fs::read(path)
+ .await
+ .map_err(|e| format!("Failed to read .torrent file: {}", e))?;
+ librqbit::AddTorrent::from_bytes(bytes)
+ } else {
+ librqbit::AddTorrent::from_url(&url)
+ }
+ };
+
+ let tmp_dir = std::env::temp_dir().join("omniget-torrent-list");
+ let session = librqbit::Session::new(tmp_dir)
+ .await
+ .map_err(|e| format!("Failed to init torrent session: {}", e))?;
+
+ let opts = librqbit::AddTorrentOptions {
+ list_only: true,
+ ..Default::default()
+ };
+
+ let resp = tokio::time::timeout(
+ std::time::Duration::from_secs(60),
+ session.add_torrent(add_torrent, Some(opts)),
+ )
+ .await
+ .map_err(|_| "Timed out resolving torrent metadata".to_string())?
+ .map_err(|e| format!("Failed to resolve torrent: {}", e))?;
+
+ let list = match resp {
+ librqbit::AddTorrentResponse::ListOnly(l) => l,
+ _ => return Err("Torrent did not return a file listing".to_string()),
+ };
+
+ let entries: Vec<TorrentFileEntry> = match list.info.iter_file_details() {
+ Ok(iter) => iter
+ .enumerate()
+ .map(|(index, d)| TorrentFileEntry {
+ index,
+ path: d
+ .filename
+ .to_string()
+ .unwrap_or_else(|_| format!("file {}", index + 1)),
+ size_bytes: d.len,
+ })
+ .collect(),
+ Err(e) => return Err(format!("Failed to read torrent files: {}", e)),
+ };
+
+ Ok(entries)
+}
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn metadata_fetch(
+ url: String,
+ output_dir: String,
+) -> Result<MetadataFetchResult, String> {
+ let ytdlp_path = ytdlp::find_ytdlp_cached()
+ .await
+ .ok_or_else(|| "yt-dlp unavailable".to_string())?;
+ let json = ytdlp::get_video_info(&ytdlp_path, &url, &[])
+ .await
+ .map_err(|e| e.to_string())?;
+
+ let raw_title = json
+ .get("title")
+ .and_then(|v| v.as_str())
+ .filter(|s| !s.trim().is_empty())
+ .unwrap_or("metadata");
+ let title = sanitize_filename::sanitize(raw_title);
+ let dir = std::path::Path::new(&output_dir);
+ tokio::fs::create_dir_all(dir)
+ .await
+ .map_err(|e| e.to_string())?;
+
+ let mut saved = Vec::new();
+
+ let info_name = format!("{title}.info.json");
+ let info_body = serde_json::to_vec_pretty(&json).map_err(|e| e.to_string())?;
+ tokio::fs::write(dir.join(&info_name), info_body)
+ .await
+ .map_err(|e| e.to_string())?;
+ saved.push(info_name);
+
+ if let Some(desc) = json.get("description").and_then(|v| v.as_str()) {
+ if !desc.trim().is_empty() {
+ let dname = format!("{title}.description.txt");
+ if tokio::fs::write(dir.join(&dname), desc).await.is_ok() {
+ saved.push(dname);
+ }
+ }
+ }
+
+ if let Some(thumb) = json.get("thumbnail").and_then(|v| v.as_str()) {
+ if let Ok(client) =
+ crate::core::http_client::apply_global_proxy(reqwest::Client::builder()).build()
+ {
+ if let Ok(resp) = client.get(thumb).send().await {
+ if resp.status().is_success() {
+ if let Ok(bytes) = resp.bytes().await {
+ let tname = format!("{title}.jpg");
+ if tokio::fs::write(dir.join(&tname), &bytes).await.is_ok() {
+ saved.push(tname);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ Ok(MetadataFetchResult { title, saved })
+}
+
+#[derive(Clone, Serialize)]
+pub struct ThumbnailInfo {
+ pub url: String,
+ pub width: u32,
+ pub height: u32,
+}
+
+#[derive(Clone, Serialize)]
+pub struct ThumbnailListResult {
+ pub title: String,
+ pub thumbnails: Vec<ThumbnailInfo>,
+}
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn thumbnails_list(url: String) -> Result<ThumbnailListResult, String> {
+ let ytdlp_path = ytdlp::find_ytdlp_cached()
+ .await
+ .ok_or_else(|| "yt-dlp unavailable".to_string())?;
+ let json = ytdlp::get_video_info(&ytdlp_path, &url, &[])
+ .await
+ .map_err(|e| e.to_string())?;
+
+ let raw_title = json
+ .get("title")
+ .and_then(|v| v.as_str())
+ .filter(|s| !s.trim().is_empty())
+ .unwrap_or("thumbnail");
+ let title = sanitize_filename::sanitize(raw_title);
+
+ let mut seen: std::collections::HashSet<(u32, u32)> = std::collections::HashSet::new();
+ let mut thumbnails: Vec<ThumbnailInfo> = Vec::new();
+ if let Some(arr) = json.get("thumbnails").and_then(|v| v.as_array()) {
+ for entry in arr {
+ let u = entry.get("url").and_then(|v| v.as_str()).unwrap_or("");
+ let w = entry.get("width").and_then(|v| v.as_u64()).unwrap_or(0) as u32;
+ let h = entry.get("height").and_then(|v| v.as_u64()).unwrap_or(0) as u32;
+ if u.is_empty() || w == 0 || h == 0 {
+ continue;
+ }
+ if seen.insert((w, h)) {
+ thumbnails.push(ThumbnailInfo {
+ url: u.to_string(),
+ width: w,
+ height: h,
+ });
+ }
+ }
+ }
+ thumbnails.sort_by(|a, b| (b.width * b.height).cmp(&(a.width * a.height)));
+
+ if thumbnails.is_empty() {
+ if let Some(single) = json.get("thumbnail").and_then(|v| v.as_str()) {
+ if !single.is_empty() {
+ thumbnails.push(ThumbnailInfo {
+ url: single.to_string(),
+ width: 0,
+ height: 0,
+ });
+ }
+ }
+ }
+
+ Ok(ThumbnailListResult { title, thumbnails })
+}
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn thumbnail_save(
+ thumb_url: String,
+ output_dir: String,
+ file_name: String,
+) -> Result<String, String> {
+ let client = crate::core::http_client::apply_global_proxy(reqwest::Client::builder())
+ .build()
+ .map_err(|e| e.to_string())?;
+ let resp = client
+ .get(&thumb_url)
+ .send()
+ .await
+ .map_err(|e| e.to_string())?;
+ if !resp.status().is_success() {
+ return Err(format!("HTTP {}", resp.status()));
+ }
+ let bytes = resp.bytes().await.map_err(|e| e.to_string())?;
+ let safe = sanitize_filename::sanitize(&file_name);
+ let safe = if safe.to_lowercase().ends_with(".jpg") || safe.to_lowercase().ends_with(".webp") {
+ safe
+ } else {
+ format!("{safe}.jpg")
+ };
+ let dir = std::path::Path::new(&output_dir);
+ tokio::fs::create_dir_all(dir)
+ .await
+ .map_err(|e| e.to_string())?;
+ tokio::fs::write(dir.join(&safe), &bytes)
+ .await
+ .map_err(|e| e.to_string())?;
+ Ok(safe)
+}
+
+#[derive(Clone, Serialize)]
+pub struct SubtitleFormat {
+ pub ext: String,
+ pub url: String,
+}
+
+#[derive(Clone, Serialize)]
+pub struct SubtitleTrack {
+ pub lang: String,
+ pub name: String,
+ pub auto: bool,
+ pub formats: Vec<SubtitleFormat>,
+}
+
+#[derive(Clone, Serialize)]
+pub struct SubtitleListResult {
+ pub title: String,
+ pub tracks: Vec<SubtitleTrack>,
+}
+
+#[cfg(not(target_os = "android"))]
+fn collect_sub_tracks(map: Option<&serde_json::Value>, auto: bool, out: &mut Vec<SubtitleTrack>) {
+ let Some(obj) = map.and_then(|v| v.as_object()) else {
+ return;
+ };
+ for (lang, arr) in obj {
+ let Some(items) = arr.as_array() else {
+ continue;
+ };
+ let mut formats = Vec::new();
+ for f in items {
+ let ext = f
+ .get("ext")
+ .and_then(|v| v.as_str())
+ .unwrap_or("")
+ .to_string();
+ let url = f
+ .get("url")
+ .and_then(|v| v.as_str())
+ .unwrap_or("")
+ .to_string();
+ if !url.is_empty() {
+ formats.push(SubtitleFormat { ext, url });
+ }
+ }
+ if formats.is_empty() {
+ continue;
+ }
+ let name = items
+ .first()
+ .and_then(|f| f.get("name"))
+ .and_then(|v| v.as_str())
+ .unwrap_or(lang)
+ .to_string();
+ out.push(SubtitleTrack {
+ lang: lang.clone(),
+ name,
+ auto,
+ formats,
+ });
+ }
+}
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn subtitles_list(url: String) -> Result<SubtitleListResult, String> {
+ let ytdlp_path = ytdlp::find_ytdlp_cached()
+ .await
+ .ok_or_else(|| "yt-dlp unavailable".to_string())?;
+ let json = ytdlp::get_video_info(&ytdlp_path, &url, &[])
+ .await
+ .map_err(|e| e.to_string())?;
+ let title = sanitize_filename::sanitize(
+ json.get("title")
+ .and_then(|v| v.as_str())
+ .filter(|s| !s.trim().is_empty())
+ .unwrap_or("subtitles"),
+ );
+ let mut tracks = Vec::new();
+ collect_sub_tracks(json.get("subtitles"), false, &mut tracks);
+ collect_sub_tracks(json.get("automatic_captions"), true, &mut tracks);
+ Ok(SubtitleListResult { title, tracks })
+}
+
+#[cfg(not(target_os = "android"))]
+async fn fetch_text(client: &reqwest::Client, url: &str) -> Result<String, String> {
+ let resp = client.get(url).send().await.map_err(|e| e.to_string())?;
+ if !resp.status().is_success() {
+ return Err(format!("HTTP {}", resp.status()));
+ }
+ resp.text().await.map_err(|e| e.to_string())
+}
+
+#[cfg(not(target_os = "android"))]
+fn ensure_ext(name: &str, ext: &str) -> String {
+ let safe = sanitize_filename::sanitize(name);
+ if safe
+ .to_lowercase()
+ .ends_with(&format!(".{}", ext.to_lowercase()))
+ {
+ safe
+ } else {
+ format!("{safe}.{ext}")
+ }
+}
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn subtitles_save(
+ sub_url: String,
+ ext: String,
+ output_dir: String,
+ file_name: String,
+) -> Result<String, String> {
+ let client = crate::core::http_client::apply_global_proxy(reqwest::Client::builder())
+ .build()
+ .map_err(|e| e.to_string())?;
+ let body = fetch_text(&client, &sub_url).await?;
+ let dir = std::path::Path::new(&output_dir);
+ tokio::fs::create_dir_all(dir)
+ .await
+ .map_err(|e| e.to_string())?;
+ let safe = ensure_ext(&file_name, if ext.is_empty() { "srt" } else { &ext });
+ tokio::fs::write(dir.join(&safe), body)
+ .await
+ .map_err(|e| e.to_string())?;
+ Ok(safe)
+}
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn subtitles_merge(
+ primary_url: String,
+ secondary_url: String,
+ format: String,
+ output_dir: String,
+ file_name: String,
+) -> Result<String, String> {
+ let client = crate::core::http_client::apply_global_proxy(reqwest::Client::builder())
+ .build()
+ .map_err(|e| e.to_string())?;
+ let primary = fetch_text(&client, &primary_url).await?;
+ let secondary = fetch_text(&client, &secondary_url).await?;
+ let is_vtt = format.eq_ignore_ascii_case("vtt");
+ let merged = if is_vtt {
+ omniget_core::core::subtitle_merge::merge_bilingual_vtt(&primary, &secondary)
+ } else {
+ omniget_core::core::subtitle_merge::merge_bilingual_srt(&primary, &secondary)
+ };
+ let dir = std::path::Path::new(&output_dir);
+ tokio::fs::create_dir_all(dir)
+ .await
+ .map_err(|e| e.to_string())?;
+ let safe = ensure_ext(&file_name, if is_vtt { "vtt" } else { "srt" });
+ tokio::fs::write(dir.join(&safe), merged)
+ .await
+ .map_err(|e| e.to_string())?;
+ Ok(safe)
+}
+
+#[derive(Clone, Serialize)]
+pub struct VideoComment {
+ pub id: String,
+ pub parent: String,
+ pub author: String,
+ pub text: String,
+ pub timestamp: i64,
+ pub like_count: i64,
+ pub is_uploader: bool,
+}
+
+#[derive(Clone, Serialize)]
+pub struct CommentsResult {
+ pub title: String,
+ pub count: i64,
+ pub comments: Vec<VideoComment>,
+}
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn comments_fetch(
+ url: String,
+ max_comments: u32,
+ sort: String,
+) -> Result<CommentsResult, String> {
+ let ytdlp_path = ytdlp::find_ytdlp_cached()
+ .await
+ .ok_or_else(|| "yt-dlp unavailable".to_string())?;
+ let sort_v = if sort.eq_ignore_ascii_case("new") {
+ "new"
+ } else {
+ "top"
+ };
+ let ea = format!(
+ "youtube:max_comments={};comment_sort={}",
+ max_comments.max(1),
+ sort_v
+ );
+ let flags = vec![
+ "--write-comments".to_string(),
+ "--extractor-args".to_string(),
+ ea,
+ ];
+ let json = ytdlp::get_video_info(&ytdlp_path, &url, &flags)
+ .await
+ .map_err(|e| e.to_string())?;
+ let title = json
+ .get("title")
+ .and_then(|v| v.as_str())
+ .unwrap_or("comments")
+ .to_string();
+ let count = json
+ .get("comment_count")
+ .and_then(|v| v.as_i64())
+ .unwrap_or(0);
+ let mut comments = Vec::new();
+ if let Some(arr) = json.get("comments").and_then(|v| v.as_array()) {
+ for c in arr {
+ comments.push(VideoComment {
+ id: c
+ .get("id")
+ .and_then(|v| v.as_str())
+ .unwrap_or("")
+ .to_string(),
+ parent: c
+ .get("parent")
+ .and_then(|v| v.as_str())
+ .unwrap_or("root")
+ .to_string(),
+ author: c
+ .get("author")
+ .and_then(|v| v.as_str())
+ .unwrap_or("")
+ .to_string(),
+ text: c
+ .get("text")
+ .and_then(|v| v.as_str())
+ .unwrap_or("")
+ .to_string(),
+ timestamp: c.get("timestamp").and_then(|v| v.as_i64()).unwrap_or(0),
+ like_count: c.get("like_count").and_then(|v| v.as_i64()).unwrap_or(0),
+ is_uploader: c
+ .get("author_is_uploader")
+ .and_then(|v| v.as_bool())
+ .unwrap_or(false),
+ });
+ }
+ }
+ Ok(CommentsResult {
+ title,
+ count,
+ comments,
+ })
+}
+
+#[derive(Clone, Serialize)]
+pub struct Chapter {
+ pub start: f64,
+ pub end: f64,
+ pub title: String,
+}
+
+#[derive(Clone, Serialize)]
+pub struct ChaptersResult {
+ pub title: String,
+ pub chapters: Vec<Chapter>,
+}
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn chapters_fetch(url: String) -> Result<ChaptersResult, String> {
+ let ytdlp_path = ytdlp::find_ytdlp_cached()
+ .await
+ .ok_or_else(|| "yt-dlp unavailable".to_string())?;
+ let json = ytdlp::get_video_info(&ytdlp_path, &url, &[])
+ .await
+ .map_err(|e| e.to_string())?;
+ let title = json
+ .get("title")
+ .and_then(|v| v.as_str())
+ .unwrap_or("chapters")
+ .to_string();
+ let mut chapters = Vec::new();
+ if let Some(arr) = json.get("chapters").and_then(|v| v.as_array()) {
+ for ch in arr {
+ chapters.push(Chapter {
+ start: ch.get("start_time").and_then(|v| v.as_f64()).unwrap_or(0.0),
+ end: ch.get("end_time").and_then(|v| v.as_f64()).unwrap_or(0.0),
+ title: ch
+ .get("title")
+ .and_then(|v| v.as_str())
+ .unwrap_or("")
+ .to_string(),
+ });
+ }
+ }
+ Ok(ChaptersResult { title, chapters })
+}
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn tools_save_text(
+ output_dir: String,
+ file_name: String,
+ content: String,
+) -> Result<String, String> {
+ let safe = sanitize_filename::sanitize(&file_name);
+ if safe.is_empty() {
+ return Err("invalid file name".to_string());
+ }
+ let dir = std::path::Path::new(&output_dir);
+ tokio::fs::create_dir_all(dir)
+ .await
+ .map_err(|e| e.to_string())?;
+ tokio::fs::write(dir.join(&safe), content)
+ .await
+ .map_err(|e| e.to_string())?;
+ Ok(safe)
+}
+
+#[derive(Clone, Serialize)]
+pub struct LiveChatResult {
+ pub count: usize,
+ pub messages: Vec<omniget_core::core::livechat::LiveChatMessage>,
+}
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn livechat_fetch(url: String) -> Result<LiveChatResult, String> {
+ let ytdlp_path = ytdlp::find_ytdlp_cached()
+ .await
+ .ok_or_else(|| "yt-dlp unavailable".to_string())?;
+
+ let stamp = std::time::SystemTime::now()
+ .duration_since(std::time::UNIX_EPOCH)
+ .map(|d| d.as_millis())
+ .unwrap_or(0);
+ let tmp = std::env::temp_dir().join(format!("omniget-livechat-{stamp}"));
+ tokio::fs::create_dir_all(&tmp)
+ .await
+ .map_err(|e| e.to_string())?;
+
+ let out_template = tmp.join("chat.%(ext)s");
+ let result = (|| async {
+ let output = omniget_core::core::process::command(&ytdlp_path)
+ .arg("--skip-download")
+ .arg("--write-subs")
+ .arg("--sub-langs")
+ .arg("live_chat")
+ .arg("--no-warnings")
+ .arg("-o")
+ .arg(&out_template)
+ .arg(&url)
+ .output()
+ .await
+ .map_err(|e| e.to_string())?;
+ if !output.status.success() {
+ let err = String::from_utf8_lossy(&output.stderr);
+ let line = err
+ .lines()
+ .find(|l| l.contains("ERROR"))
+ .unwrap_or("yt-dlp failed");
+ return Err(line.chars().take(240).collect::<String>());
+ }
+
+ let mut entries = tokio::fs::read_dir(&tmp).await.map_err(|e| e.to_string())?;
+ let mut chat_file: Option<std::path::PathBuf> = None;
+ while let Ok(Some(entry)) = entries.next_entry().await {
+ let p = entry.path();
+ let name = p.file_name().and_then(|n| n.to_str()).unwrap_or("");
+ if name.ends_with(".live_chat.json") {
+ chat_file = Some(p);
+ break;
+ }
+ if chat_file.is_none() && name.ends_with(".json") {
+ chat_file = Some(p);
+ }
+ }
+ let Some(chat_file) = chat_file else {
+ return Err("no live chat available for this video".to_string());
+ };
+ let body = tokio::fs::read_to_string(&chat_file)
+ .await
+ .map_err(|e| e.to_string())?;
+ let messages = omniget_core::core::livechat::parse_live_chat(&body);
+ Ok(LiveChatResult {
+ count: messages.len(),
+ messages,
+ })
+ })()
+ .await;
+
+ let _ = tokio::fs::remove_dir_all(&tmp).await;
+ result
+}
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn playlist_entries(url: String) -> Result<Vec<PlaylistEntryInfo>, String> {
+ let ytdlp_path = ytdlp::find_ytdlp_cached()
+ .await
+ .ok_or_else(|| "yt-dlp unavailable".to_string())?;
+ let (_title, entries) = ytdlp::get_playlist_info(&ytdlp_path, &url, &[])
+ .await
+ .map_err(|e| e.to_string())?;
+ Ok(entries
+ .into_iter()
+ .enumerate()
+ .map(|(i, e)| PlaylistEntryInfo {
+ index: (i + 1) as u32,
+ title: e.title,
+ url: e.url,
+ })
+ .collect())
+}
+
#[cfg(not(target_os = "android"))]
#[allow(clippy::too_many_arguments)]
#[tauri::command]
@@ -159,10 +846,22 @@ pub async fn download_from_url(
format_id: Option<String>,
referer: Option<String>,
cookie_slug: Option<String>,
+ time_range: Option<String>,
+ playlist_items: Option<Vec<u32>>,
+ torrent_files: Option<Vec<usize>>,
+ scheduled_at: Option<u64>,
+ stop_at: Option<u64>,
) -> Result<DownloadStarted, String> {
let _timer_start = std::time::Instant::now();
let platform = Platform::from_url(&url);
+ let custom_ytdlp_args = match time_range.as_deref().map(str::trim) {
+ Some(r) if !r.is_empty() && is_valid_time_range(r) => {
+ Some(vec!["--download-sections".to_string(), format!("*{}", r)])
+ }
+ _ => None,
+ };
+
if let Err(err) = crate::core::path_limits::validate_output_dir(&output_dir) {
return Err(format!(
"PathTooLong|{}|{}|{}",
@@ -203,7 +902,28 @@ pub async fn download_from_url(
let title = url.clone();
let ytdlp_path = ytdlp::find_ytdlp_cached().await;
- let cached_info = queue::try_get_cached_info(&url).await;
+ let cached_info = {
+ let info = queue::try_get_cached_info(&url).await;
+ match (info, &playlist_items) {
+ (Some(mut info), Some(sel))
+ if !sel.is_empty() && info.media_type == MediaType::Playlist =>
+ {
+ let set: std::collections::HashSet<u32> = sel.iter().copied().collect();
+ let filtered: Vec<_> = info
+ .available_qualities
+ .iter()
+ .enumerate()
+ .filter(|(i, _)| set.contains(&((*i as u32) + 1)))
+ .map(|(_, q)| q.clone())
+ .collect();
+ if !filtered.is_empty() {
+ info.available_qualities = filtered;
+ }
+ Some(info)
+ }
+ (info, _) => info,
+ }
+ };
let state_to_emit = {
let mut q = download_queue.lock().await;
@@ -227,7 +947,10 @@ pub async fn download_from_url(
ytdlp_path,
false,
cookie_slug,
- None,
+ custom_ytdlp_args,
+ torrent_files,
+ scheduled_at,
+ stop_at,
);
let next_ids = q.next_queued_ids();
@@ -341,6 +1064,9 @@ pub async fn download_with_custom_args(
false,
cookie_slug,
Some(custom_args),
+ None,
+ None,
+ None,
);
let next_ids = q.next_queued_ids();
for nid in &next_ids {
@@ -501,17 +1227,58 @@ pub async fn retry_download(
}
}
+// Deletes only the exact recorded final path (file → unlink, dir → recursive)
+// when it exists, plus http_fetcher sidecars derived from that exact path.
+// Bounded by construction: every target is derived from the stored file_path,
+// so it can never touch an unrelated file. Best-effort: failures here never
+// fail the list removal.
+fn delete_downloaded_path(path: &str) {
+ let p = std::path::Path::new(path);
+ if !p.is_absolute() {
+ return;
+ }
+ match p.metadata() {
+ Ok(meta) if meta.is_dir() => {
+ if let Err(e) = std::fs::remove_dir_all(p) {
+ tracing::warn!("[remove] failed to delete directory: {}", e);
+ }
+ }
+ Ok(_) => {
+ if let Err(e) = std::fs::remove_file(p) {
+ tracing::warn!("[remove] failed to delete file: {}", e);
+ }
+ }
+ Err(_) => {}
+ }
+ for suffix in [".part", ".resume.json"] {
+ let sidecar = format!("{}{}", path, suffix);
+ let sp = std::path::Path::new(&sidecar);
+ if sp.is_file() {
+ let _ = std::fs::remove_file(sp);
+ }
+ }
+}
+
#[tauri::command]
pub async fn remove_download(
app: tauri::AppHandle,
state: tauri::State<'_, AppState>,
download_id: u64,
+ delete_file: Option<bool>,
) -> Result<String, String> {
- let (state_to_emit, seeding_torrent_id) = {
+ let (state_to_emit, seeding_torrent_id, file_path) = {
let mut q = state.download_queue.lock().await;
+ let path = if delete_file.unwrap_or(false) {
+ q.items
+ .iter()
+ .find(|i| i.id == download_id)
+ .and_then(|i| i.file_path.clone())
+ } else {
+ None
+ };
match q.remove(download_id) {
- Some(torrent_id) => (Some(q.get_state()), torrent_id),
- None => (None, None),
+ Some(torrent_id) => (Some(q.get_state()), torrent_id, path),
+ None => (None, None, None),
}
};
if let Some(tid) = seeding_torrent_id {
@@ -521,6 +1288,9 @@ pub async fn remove_download(
.await;
}
}
+ if let Some(path) = file_path {
+ delete_downloaded_path(&path);
+ }
if let Some(s) = state_to_emit {
crate::core::download_log::clear(download_id);
emit_queue_state_from_state(&app, s);
@@ -536,11 +1306,6 @@ pub fn get_download_log(download_id: u64) -> Vec<String> {
crate::core::download_log::get(download_id)
}
-#[tauri::command]
-pub fn clear_download_log(download_id: u64) {
- crate::core::download_log::clear(download_id);
-}
-
#[tauri::command]
pub fn get_recovery_items() -> Vec<crate::core::recovery::RecoveryItem> {
crate::core::recovery::list()
@@ -580,6 +1345,11 @@ pub async fn restore_recovery(
item.format_id,
item.referer,
None,
+ None,
+ None,
+ None,
+ None,
+ None,
)
.await
{
@@ -611,14 +1381,6 @@ pub fn parse_batch_file(path: String) -> Result<Vec<String>, String> {
Ok(urls)
}
-#[tauri::command]
-pub async fn get_queue_state(
- state: tauri::State<'_, AppState>,
-) -> Result<Vec<QueueItemInfo>, String> {
- let q = state.download_queue.lock().await;
- Ok(q.get_state())
-}
-
#[tauri::command]
pub async fn update_max_concurrent(
app: tauri::AppHandle,
diff --git a/src-tauri/src/commands/extension_cookies.rs b/src-tauri/src/commands/extension_cookies.rs
deleted file mode 100644
index 150db0d2..00000000
--- a/src-tauri/src/commands/extension_cookies.rs
+++ /dev/null
@@ -1,215 +0,0 @@
-use std::collections::BTreeMap;
-
-use serde::Serialize;
-
-use crate::extension_storage::extension_cookie_file_path;
-
-#[derive(Debug, Serialize)]
-pub struct ExtensionCookiesStatus {
- pub file_exists: bool,
- pub file_path: String,
- pub last_modified_secs: Option<i64>,
- pub age_seconds: Option<i64>,
- pub total_cookies: i64,
- pub domains: Vec<String>,
-}
-
-#[tauri::command]
-pub async fn extension_cookies_status() -> Result<ExtensionCookiesStatus, String> {
- let path = extension_cookie_file_path();
- let file_path = path.to_string_lossy().into_owned();
- if !path.exists() {
- return Ok(ExtensionCookiesStatus {
- file_exists: false,
- file_path,
- last_modified_secs: None,
- age_seconds: None,
- total_cookies: 0,
- domains: Vec::new(),
- });
- }
- let metadata = std::fs::metadata(&path).map_err(|e| e.to_string())?;
- let last_modified = metadata
- .modified()
- .ok()
- .and_then(|t| t.duration_since(std::time::UNIX_EPOCH).ok())
- .map(|d| d.as_secs() as i64);
- let now = std::time::SystemTime::now()
- .duration_since(std::time::UNIX_EPOCH)
- .ok()
- .map(|d| d.as_secs() as i64);
- let age = match (now, last_modified) {
- (Some(n), Some(m)) => Some(n - m),
- _ => None,
- };
- let content = std::fs::read_to_string(&path).map_err(|e| e.to_string())?;
- let mut total = 0i64;
- let mut domains: std::collections::BTreeSet<String> = std::collections::BTreeSet::new();
- for line in content.lines() {
- let line = line.trim();
- if line.is_empty() {
- continue;
- }
- let effective = if line.starts_with("#HttpOnly_") {
- &line["#HttpOnly_".len()..]
- } else if line.starts_with('#') {
- continue;
- } else {
- line
- };
- let parts: Vec<&str> = effective.split('\t').collect();
- if parts.len() < 7 {
- continue;
- }
- total += 1;
- let domain = parts[0].trim_start_matches('.').to_lowercase();
- domains.insert(domain);
- }
- Ok(ExtensionCookiesStatus {
- file_exists: true,
- file_path,
- last_modified_secs: last_modified,
- age_seconds: age,
- total_cookies: total,
- domains: domains.into_iter().collect(),
- })
-}
-
-#[derive(Debug, Clone, Serialize)]
-pub struct ExtensionCookieEntry {
- pub name: String,
- pub value: String,
- pub domain: String,
- pub path: String,
- pub secure: bool,
- pub http_only: bool,
-}
-
-#[derive(Debug, Serialize)]
-pub struct ExtensionCookieBundle {
- pub domain: String,
- pub cookies: Vec<ExtensionCookieEntry>,
- pub cookie_string: String,
- pub fetched_at: i64,
- pub source_path: String,
- pub well_known: BTreeMap<String, String>,
-}
-
-const WELL_KNOWN_NAMES: &[&str] = &[
- "__Secure-3PAPISID",
- "__Secure-1PAPISID",
- "__Secure-3PSID",
- "__Secure-1PSID",
- "SAPISID",
- "SID",
- "HSID",
- "SSID",
- "APISID",
- "LOGIN_INFO",
- "VISITOR_INFO1_LIVE",
- "PREF",
-];
-
-fn cookie_domain_matches(
- request_domain: &str,
- cookie_domain: &str,
- include_subdomains: bool,
-) -> bool {
- if include_subdomains {
- request_domain == cookie_domain || request_domain.ends_with(&format!(".{}", cookie_domain))
- } else {
- request_domain == cookie_domain
- }
-}
-
-#[tauri::command]
-pub async fn read_extension_cookies(
- domain: String,
-) -> Result<Option<ExtensionCookieBundle>, String> {
- let path = extension_cookie_file_path();
- if !path.exists() {
- return Ok(None);
- }
- let content = std::fs::read_to_string(&path).map_err(|e| e.to_string())?;
- let request_domain = domain.trim_start_matches('.').to_lowercase();
-
- let mut cookies: Vec<ExtensionCookieEntry> = Vec::new();
- for line in content.lines() {
- let line = line.trim();
- if line.is_empty() {
- continue;
- }
- let is_http_only_line = line.starts_with("#HttpOnly_");
- let effective = if is_http_only_line {
- &line["#HttpOnly_".len()..]
- } else if line.starts_with('#') {
- continue;
- } else {
- line
- };
- let parts: Vec<&str> = effective.split('\t').collect();
- if parts.len() < 7 {
- continue;
- }
- let raw_domain = parts[0];
- let include_subdomains = parts[1].eq_ignore_ascii_case("TRUE");
- let cookie_domain = raw_domain.trim_start_matches('.').to_lowercase();
- if !cookie_domain_matches(&request_domain, &cookie_domain, include_subdomains) {
- continue;
- }
- let path_field = parts[2].to_string();
- let secure = parts[3].eq_ignore_ascii_case("TRUE");
- let name = parts[5].to_string();
- let value = parts[6].to_string();
- cookies.push(ExtensionCookieEntry {
- name,
- value,
- domain: raw_domain.to_string(),
- path: path_field,
- secure,
- http_only: is_http_only_line,
- });
- }
-
- if cookies.is_empty() {
- return Ok(None);
- }
-
- let mut seen = std::collections::HashSet::new();
- let mut deduped: Vec<&ExtensionCookieEntry> = Vec::new();
- for c in cookies.iter().rev() {
- if seen.insert(c.name.clone()) {
- deduped.push(c);
- }
- }
- deduped.reverse();
-
- let cookie_string = deduped
- .iter()
- .map(|c| format!("{}={}", c.name, c.value))
- .collect::<Vec<_>>()
- .join("; ");
-
- let mut well_known = BTreeMap::new();
- for c in &deduped {
- if WELL_KNOWN_NAMES.iter().any(|w| *w == c.name) {
- well_known.insert(c.name.clone(), c.value.clone());
- }
- }
-
- let fetched_at = std::fs::metadata(&path)
- .and_then(|m| m.modified())
- .ok()
- .and_then(|t| t.duration_since(std::time::UNIX_EPOCH).ok())
- .map(|d| d.as_secs() as i64)
- .unwrap_or(0);
-
- Ok(Some(ExtensionCookieBundle {
- domain: request_domain,
- cookies: deduped.into_iter().cloned().collect(),
- cookie_string,
- fetched_at,
- source_path: path.to_string_lossy().into_owned(),
- well_known,
- }))
-}
diff --git a/src-tauri/src/commands/host_queue.rs b/src-tauri/src/commands/host_queue.rs
index 57629b9e..31aeb7dd 100644
--- a/src-tauri/src/commands/host_queue.rs
+++ b/src-tauri/src/commands/host_queue.rs
@@ -96,6 +96,9 @@ pub async fn enqueue_external_inner(
eta_seconds: None,
cookie_slug: None,
custom_ytdlp_args: None,
+ torrent_files: None,
+ scheduled_at_ms: None,
+ stop_at_ms: None,
};
{
diff --git a/src-tauri/src/commands/mod.rs b/src-tauri/src/commands/mod.rs
index 83cbd8ad..06b8c8fd 100644
--- a/src-tauri/src/commands/mod.rs
+++ b/src-tauri/src/commands/mod.rs
@@ -1,11 +1,12 @@
+pub mod ai;
pub mod app_lifecycle;
pub mod auth_webview;
pub mod autostart;
pub mod browser_extension;
+pub mod channels;
pub mod clip;
pub mod diagnostics;
pub mod downloads;
-pub mod extension_cookies;
pub mod host_queue;
pub mod integration;
pub mod p2p;
@@ -13,6 +14,8 @@ pub mod plugins;
pub mod reencode;
pub mod rpc;
pub mod settings;
+pub mod subtitle_ws;
+pub mod video_ops;
pub mod yt_templates;
#[cfg(not(target_os = "android"))]
diff --git a/src-tauri/src/commands/p2p.rs b/src-tauri/src/commands/p2p.rs
index 59d627fd..b8efb729 100644
--- a/src-tauri/src/commands/p2p.rs
+++ b/src-tauri/src/commands/p2p.rs
@@ -208,17 +208,3 @@ pub async fn p2p_resume_send(
None => Err("No active send with this code".to_string()),
}
}
-
-#[cfg(not(target_os = "android"))]
-#[tauri::command]
-pub async fn p2p_get_active_sends(
- state: tauri::State<'_, AppState>,
-) -> Result<Vec<String>, String> {
- let sends = state.active_p2p_sends.lock().await;
- Ok(sends.keys().cloned().collect())
-}
-
-#[tauri::command]
-pub fn p2p_validate_code(code: String) -> Result<bool, String> {
- Ok(p2p::words::is_valid_code(&code))
-}
diff --git a/src-tauri/src/commands/settings.rs b/src-tauri/src/commands/settings.rs
index 81bc5c8d..c2bea531 100644
--- a/src-tauri/src/commands/settings.rs
+++ b/src-tauri/src/commands/settings.rs
@@ -123,6 +123,37 @@ pub fn rotate_bridge_token(app: tauri::AppHandle) -> Result<BridgeInfo, String>
get_bridge_info(app)
}
+#[derive(serde::Serialize)]
+pub struct BridgePairStatus {
+ pub ok: bool,
+ pub window_secs: i64,
+ pub port: u16,
+ pub enabled: bool,
+}
+
+/// Opens a short, single-use, user-consented pairing window so an installed
+/// browser extension can fetch the bearer token from `GET /v1/pair` without
+/// the user copy-pasting it.
+#[tauri::command]
+pub fn bridge_open_pairing(app: tauri::AppHandle) -> Result<BridgePairStatus, String> {
+ let settings = config::load_settings(&app);
+ if !settings.bridge.enabled {
+ return Ok(BridgePairStatus {
+ ok: false,
+ window_secs: 0,
+ port: settings.bridge.port,
+ enabled: false,
+ });
+ }
+ let window_secs = crate::local_bridge::open_pairing_window();
+ Ok(BridgePairStatus {
+ ok: true,
+ window_secs,
+ port: settings.bridge.port,
+ enabled: true,
+ })
+}
+
fn merge_json(base: &mut serde_json::Value, patch: &serde_json::Value) {
if let (Some(base_obj), Some(patch_obj)) = (base.as_object_mut(), patch.as_object()) {
for (key, value) in patch_obj {
diff --git a/src-tauri/src/commands/subtitle_ws.rs b/src-tauri/src/commands/subtitle_ws.rs
new file mode 100644
index 00000000..4a8c52ed
--- /dev/null
+++ b/src-tauri/src/commands/subtitle_ws.rs
@@ -0,0 +1,76 @@
+use omniget_core::core::subtitle_merge::{self, Cue};
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn subtitle_load(path: String) -> Result<Vec<Cue>, String> {
+ let content = tokio::fs::read_to_string(&path)
+ .await
+ .map_err(|e| format!("Read failed: {}", e))?;
+ let cues = subtitle_merge::parse_cues(&content);
+ if cues.is_empty() {
+ return Err("No cues found".to_string());
+ }
+ Ok(cues)
+}
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn subtitle_save(path: String, cues: Vec<Cue>, format: String) -> Result<(), String> {
+ let body = if format == "vtt" {
+ subtitle_merge::cues_to_vtt(&cues)
+ } else {
+ subtitle_merge::cues_to_srt(&cues)
+ };
+ tokio::fs::write(&path, body)
+ .await
+ .map_err(|e| format!("Write failed: {}", e))
+}
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn subtitle_translate(cues: Vec<Cue>, target_lang: String) -> Result<Vec<Cue>, String> {
+ if !omniget_core::core::ai::get().is_configured() {
+ return Err("ai_not_configured".to_string());
+ }
+ if cues.is_empty() {
+ return Ok(cues);
+ }
+ // Numbered lines keep the model aligned; multi-line cues are flattened with
+ // a sentinel so we can restore line breaks after translation.
+ let joined: String = cues
+ .iter()
+ .enumerate()
+ .map(|(i, c)| format!("{}\u{241F}{}", i + 1, c.text.replace('\n', "\u{2424}")))
+ .collect::<Vec<_>>()
+ .join("\n");
+ let system = format!(
+ "Translate each numbered line into {}. Keep the exact same numbering and \
+line count. Preserve the \u{2424} markers as line breaks. Output ONLY the \
+translated numbered lines, nothing else.",
+ target_lang
+ );
+ let out = omniget_core::core::ai::chat(&system, &joined).await?;
+
+ let mut map: std::collections::HashMap<usize, String> = std::collections::HashMap::new();
+ for line in out.lines() {
+ let line = line.trim();
+ if line.is_empty() {
+ continue;
+ }
+ if let Some((num, rest)) = line.split_once('\u{241F}') {
+ if let Ok(idx) = num.trim().parse::<usize>() {
+ map.insert(idx, rest.replace('\u{2424}', "\n"));
+ }
+ }
+ }
+ if map.len() != cues.len() {
+ return Err("translation_mismatch".to_string());
+ }
+ let mut result = cues;
+ for (i, c) in result.iter_mut().enumerate() {
+ if let Some(t) = map.get(&(i + 1)) {
+ c.text = t.trim().to_string();
+ }
+ }
+ Ok(result)
+}
diff --git a/src-tauri/src/commands/video_ops.rs b/src-tauri/src/commands/video_ops.rs
new file mode 100644
index 00000000..0668e056
--- /dev/null
+++ b/src-tauri/src/commands/video_ops.rs
@@ -0,0 +1,192 @@
+use omniget_core::core::ffmpeg_ops;
+use serde::Serialize;
+use std::path::{Path, PathBuf};
+use tauri::Emitter;
+
+#[derive(Clone, Serialize)]
+pub struct VideoOpProposal {
+ pub args: Vec<String>,
+ pub out_ext: String,
+}
+
+#[derive(Clone, Serialize)]
+pub struct VideoOpResult {
+ pub output_path: String,
+}
+
+fn ensure_input(input: &str) -> Result<PathBuf, String> {
+ let p = PathBuf::from(input);
+ if !p.is_file() {
+ return Err("Input file not found".to_string());
+ }
+ Ok(p)
+}
+
+fn output_for(input: &Path, tag: &str, ext: &str) -> PathBuf {
+ let stem = input
+ .file_stem()
+ .map(|s| s.to_string_lossy().to_string())
+ .unwrap_or_else(|| "output".to_string());
+ let dir = input.parent().map(PathBuf::from).unwrap_or_default();
+ dir.join(format!("{stem}.{tag}.{ext}"))
+}
+
+#[cfg(not(target_os = "android"))]
+async fn run_ffmpeg(
+ app: &tauri::AppHandle,
+ input: &Path,
+ args: &[String],
+ output: &Path,
+) -> Result<(), String> {
+ let ffmpeg = omniget_core::core::dependencies::find_tool("ffmpeg")
+ .await
+ .ok_or_else(|| "ffmpeg unavailable".to_string())?;
+
+ let _ = app.emit("video-op-progress", "running");
+
+ let mut cmd = omniget_core::core::process::command(&ffmpeg);
+ cmd.arg("-y")
+ .arg("-i")
+ .arg(input.to_string_lossy().to_string());
+ for a in args {
+ cmd.arg(a);
+ }
+ cmd.arg(output.to_string_lossy().to_string());
+
+ let status = cmd
+ .status()
+ .await
+ .map_err(|e| format!("ffmpeg failed to start: {}", e))?;
+
+ if !status.success() {
+ let _ = app.emit("video-op-progress", "error");
+ return Err("ffmpeg processing failed".to_string());
+ }
+ let _ = app.emit("video-op-progress", "done");
+ Ok(())
+}
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn detect_shot_changes(
+ input: String,
+ threshold: Option<f64>,
+) -> Result<Vec<f64>, String> {
+ let input_path = ensure_input(&input)?;
+ let ffmpeg = omniget_core::core::dependencies::find_tool("ffmpeg")
+ .await
+ .ok_or_else(|| "ffmpeg unavailable".to_string())?;
+ let thr = threshold.unwrap_or(0.4).clamp(0.1, 0.9);
+ let output = omniget_core::core::process::command(&ffmpeg)
+ .arg("-i")
+ .arg(input_path.to_string_lossy().to_string())
+ .arg("-filter:v")
+ .arg(format!("select='gt(scene,{})',showinfo", thr))
+ .arg("-an")
+ .arg("-f")
+ .arg("null")
+ .arg("-")
+ .output()
+ .await
+ .map_err(|e| format!("ffmpeg failed: {}", e))?;
+ let stderr = String::from_utf8_lossy(&output.stderr);
+ Ok(ffmpeg_ops::parse_scene_times(&stderr))
+}
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn waveform_peaks(input: String, buckets: Option<usize>) -> Result<Vec<f32>, String> {
+ let input_path = ensure_input(&input)?;
+ let ffmpeg = omniget_core::core::dependencies::find_tool("ffmpeg")
+ .await
+ .ok_or_else(|| "ffmpeg unavailable".to_string())?;
+ let n = buckets.unwrap_or(2000).clamp(100, 20000);
+ let output = omniget_core::core::process::command(&ffmpeg)
+ .arg("-i")
+ .arg(input_path.to_string_lossy().to_string())
+ .arg("-ac")
+ .arg("1")
+ .arg("-ar")
+ .arg("2000")
+ .arg("-f")
+ .arg("s16le")
+ .arg("-")
+ .output()
+ .await
+ .map_err(|e| format!("ffmpeg failed: {}", e))?;
+ if !output.status.success() {
+ return Err("ffmpeg audio extraction failed".to_string());
+ }
+ Ok(ffmpeg_ops::pcm_s16le_peaks(&output.stdout, n))
+}
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn video_op_preset(
+ app: tauri::AppHandle,
+ input: String,
+ action: String,
+ start: Option<String>,
+ end: Option<String>,
+) -> Result<VideoOpResult, String> {
+ let input_path = ensure_input(&input)?;
+ let p = ffmpeg_ops::preset(&action, start.as_deref(), end.as_deref())?;
+ // Defense in depth: presets are built safely but still re-validated.
+ ffmpeg_ops::validate_transform_args(&p.args)?;
+ let output = output_for(&input_path, &action, p.out_ext);
+ run_ffmpeg(&app, &input_path, &p.args, &output).await?;
+ Ok(VideoOpResult {
+ output_path: output.to_string_lossy().to_string(),
+ })
+}
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn video_op_propose(instruction: String) -> Result<VideoOpProposal, String> {
+ let cfg = omniget_core::core::ai::get();
+ if !cfg.is_configured() {
+ return Err("ai_not_configured".to_string());
+ }
+ let system = "You convert a user's video-editing request into a single-line ffmpeg command. \
+Use exactly 'ffmpeg -i input <options> output.<ext>'. Choose a sensible output extension. \
+Only use codec/filter/trim options. No shell operators, no extra text, output ONLY the command.";
+ let raw = omniget_core::core::ai::chat(system, &instruction).await?;
+ let args = ffmpeg_ops::sanitize_ai_command(&raw)?;
+ // Best-effort extension guess from the model's output line.
+ let out_ext = raw
+ .rsplit('.')
+ .next()
+ .map(|e| e.trim().to_lowercase())
+ .filter(|e| e.chars().all(|c| c.is_ascii_alphanumeric()) && e.len() <= 4)
+ .unwrap_or_else(|| "mp4".to_string());
+ Ok(VideoOpProposal { args, out_ext })
+}
+
+#[cfg(not(target_os = "android"))]
+#[tauri::command]
+pub async fn video_op_run(
+ app: tauri::AppHandle,
+ input: String,
+ args: Vec<String>,
+ out_ext: String,
+) -> Result<VideoOpResult, String> {
+ let input_path = ensure_input(&input)?;
+ // The args came back from the frontend after user review — never trust
+ // them; re-run the allowlist before touching ffmpeg.
+ ffmpeg_ops::validate_transform_args(&args)?;
+ let ext: String = out_ext
+ .chars()
+ .filter(|c| c.is_ascii_alphanumeric())
+ .take(4)
+ .collect();
+ let ext = if ext.is_empty() {
+ "mp4".to_string()
+ } else {
+ ext
+ };
+ let output = output_for(&input_path, "ai", &ext);
+ run_ffmpeg(&app, &input_path, &args, &output).await?;
+ Ok(VideoOpResult {
+ output_path: output.to_string_lossy().to_string(),
+ })
+}
diff --git a/src-tauri/src/cookies/commands.rs b/src-tauri/src/cookies/commands.rs
index 22fd990a..6cb4fe29 100644
--- a/src-tauri/src/cookies/commands.rs
+++ b/src-tauri/src/cookies/commands.rs
@@ -141,17 +141,6 @@ pub async fn cookies_rename(request: RenameRequest) -> Result<OkResponse, String
Ok(OkResponse { ok: true })
}
-#[tauri::command]
-pub async fn cookies_migrate_legacy() -> Result<OkResponse, String> {
- storage::migrate_legacy_if_needed().map_err(|e| e.to_string())?;
- Ok(OkResponse { ok: true })
-}
-
-#[tauri::command]
-pub async fn cookies_detect_platform(domain: String) -> Result<String, String> {
- Ok(PlatformKind::from_domain(&domain).as_str().to_string())
-}
-
#[derive(Debug, Serialize)]
pub struct AccountsForUrlResponse {
pub domain: String,
@@ -320,12 +309,102 @@ pub async fn cookies_export_to(request: ExportToRequest) -> Result<OkResponse, S
Ok(OkResponse { ok: true })
}
-#[allow(dead_code)]
-pub fn list_accounts_for_domain(domain: &str) -> Vec<AccountEntry> {
+const COOKIE_FRESH_DAYS: i64 = 7;
+const COOKIE_EXPIRE_DAYS: i64 = 28;
+
+#[derive(Debug, Serialize)]
+pub struct CookieHealthItem {
+ pub domain: String,
+ pub slug: String,
+ pub status: String,
+ pub age_days: i64,
+ pub expires_in_days: i64,
+ pub cookie_count: usize,
+}
+
+#[derive(Debug, Serialize)]
+pub struct CookieHealthResponse {
+ pub items: Vec<CookieHealthItem>,
+ pub fresh_days: i64,
+ pub expire_days: i64,
+}
+
+#[tauri::command]
+pub async fn cookies_health() -> Result<CookieHealthResponse, String> {
let registry = storage::load_registry();
- registry
- .buckets
- .get(domain)
- .map(|b| b.accounts.clone())
- .unwrap_or_default()
+ let now = storage::current_unix_ms();
+ let mut items = Vec::new();
+ for (domain, bucket) in &registry.buckets {
+ for acc in &bucket.accounts {
+ let age_days = (now - acc.captured_at_ms).max(0) / 86_400_000;
+ let status = if age_days >= COOKIE_EXPIRE_DAYS {
+ "expired"
+ } else if age_days >= COOKIE_FRESH_DAYS {
+ "stale"
+ } else {
+ "fresh"
+ };
+ items.push(CookieHealthItem {
+ domain: domain.clone(),
+ slug: acc.slug.clone(),
+ status: status.to_string(),
+ age_days,
+ expires_in_days: (COOKIE_EXPIRE_DAYS - age_days).max(0),
+ cookie_count: acc.cookie_count,
+ });
+ }
+ }
+ Ok(CookieHealthResponse {
+ items,
+ fresh_days: COOKIE_FRESH_DAYS,
+ expire_days: COOKIE_EXPIRE_DAYS,
+ })
+}
+
+#[derive(Debug, Deserialize)]
+pub struct CookieTestRequest {
+ pub url: String,
+ #[serde(default)]
+ pub slug: Option<String>,
+}
+
+#[derive(Debug, Serialize)]
+pub struct CookieTestResponse {
+ pub ok: bool,
+ pub message: String,
+}
+
+#[tauri::command]
+pub async fn cookies_test(request: CookieTestRequest) -> Result<CookieTestResponse, String> {
+ let ytdlp = crate::core::ytdlp::find_ytdlp_cached()
+ .await
+ .ok_or_else(|| "yt-dlp unavailable".to_string())?;
+ let url = request.url.clone();
+ let flags = vec!["--no-warnings".to_string()];
+ let result = omniget_core::core::log_hook::CURRENT_COOKIE_SLUG
+ .scope(request.slug.clone(), async move {
+ crate::core::ytdlp::get_video_info(&ytdlp, &url, &flags).await
+ })
+ .await;
+ match result {
+ Ok(_) => Ok(CookieTestResponse {
+ ok: true,
+ message: "ok".to_string(),
+ }),
+ Err(e) => {
+ let raw = e.to_string();
+ let summary = raw
+ .lines()
+ .find(|l| l.contains("ERROR"))
+ .unwrap_or_else(|| raw.lines().next().unwrap_or("failed"))
+ .trim()
+ .chars()
+ .take(240)
+ .collect::<String>();
+ Ok(CookieTestResponse {
+ ok: false,
+ message: summary,
+ })
+ }
+ }
}
diff --git a/src-tauri/src/core/awake.rs b/src-tauri/src/core/awake.rs
new file mode 100644
index 00000000..92843972
--- /dev/null
+++ b/src-tauri/src/core/awake.rs
@@ -0,0 +1,40 @@
+use std::sync::{Mutex, OnceLock};
+
+// Holds the OS keep-awake guard while downloads are active. Dropping the
+// guard releases the lock. The settings check happens only on transitions
+// (acquire), never on every queue tick.
+static GUARD: OnceLock<Mutex<Option<keepawake::KeepAwake>>> = OnceLock::new();
+
+fn cell() -> &'static Mutex<Option<keepawake::KeepAwake>> {
+ GUARD.get_or_init(|| Mutex::new(None))
+}
+
+pub fn sync(active: bool) {
+ let Ok(mut held) = cell().lock() else {
+ return;
+ };
+ if active && held.is_none() {
+ let enabled = crate::storage::config::load_settings_standalone()
+ .advanced
+ .prevent_sleep;
+ if !enabled {
+ return;
+ }
+ match keepawake::Builder::default()
+ .idle(true)
+ .sleep(true)
+ .app_name("OmniGet")
+ .reason("Active downloads")
+ .create()
+ {
+ Ok(g) => {
+ *held = Some(g);
+ tracing::debug!("[awake] sleep prevention engaged");
+ }
+ Err(e) => tracing::warn!("[awake] could not prevent sleep: {}", e),
+ }
+ } else if !active && held.is_some() {
+ *held = None;
+ tracing::debug!("[awake] sleep prevention released");
+ }
+}
diff --git a/src-tauri/src/core/channel_poller.rs b/src-tauri/src/core/channel_poller.rs
new file mode 100644
index 00000000..b085a6bf
--- /dev/null
+++ b/src-tauri/src/core/channel_poller.rs
@@ -0,0 +1,143 @@
+use serde::Serialize;
+use std::time::{SystemTime, UNIX_EPOCH};
+use tauri::{AppHandle, Emitter};
+use tauri_plugin_notification::NotificationExt;
+
+use crate::core::channels::{self, ChannelFollow};
+
+const TICK_SECONDS: u64 = 60;
+const PLAYLIST_END: &str = "30";
+
+#[derive(Clone, Serialize)]
+pub struct NewVideo {
+ pub id: String,
+ pub title: String,
+ pub url: String,
+}
+
+#[derive(Clone, Serialize)]
+pub struct ChannelNewVideos {
+ pub channel_id: String,
+ pub channel_title: String,
+ pub auto_download: bool,
+ pub videos: Vec<NewVideo>,
+}
+
+fn now_ms() -> u64 {
+ SystemTime::now()
+ .duration_since(UNIX_EPOCH)
+ .map(|d| d.as_millis() as u64)
+ .unwrap_or(0)
+}
+
+fn is_due(ch: &ChannelFollow, now: u64) -> bool {
+ if !ch.enabled {
+ return false;
+ }
+ match ch.last_checked_ms {
+ None => true,
+ Some(last) => now.saturating_sub(last) >= (ch.interval_minutes as u64) * 60_000,
+ }
+}
+
+async fn poll_channel(ch: &ChannelFollow) -> Option<Vec<NewVideo>> {
+ let ytdlp = crate::core::ytdlp::find_ytdlp_cached().await?;
+ let extra = vec!["--playlist-end".to_string(), PLAYLIST_END.to_string()];
+ match crate::core::ytdlp::get_playlist_info(&ytdlp, &ch.url, &extra).await {
+ Ok((_title, entries)) => {
+ let fetched_ids: Vec<String> = entries.iter().map(|e| e.id.clone()).collect();
+ let new_ids = channels::record_poll(&ch.id, &fetched_ids);
+ if new_ids.is_empty() {
+ return Some(Vec::new());
+ }
+ let new_set: std::collections::HashSet<&String> = new_ids.iter().collect();
+ let videos = entries
+ .into_iter()
+ .filter(|e| new_set.contains(&e.id))
+ .map(|e| NewVideo {
+ id: e.id,
+ title: e.title,
+ url: e.url,
+ })
+ .collect();
+ Some(videos)
+ }
+ Err(e) => {
+ tracing::warn!("[channels] poll failed for {}: {}", ch.id, e);
+ // Bump last_checked so a persistently failing channel is not
+ // hammered every tick; seen set is untouched.
+ channels::record_poll(&ch.id, &[]);
+ None
+ }
+ }
+}
+
+pub fn start(app: AppHandle) {
+ tauri::async_runtime::spawn(async move {
+ // Small delay so startup work (history hydrate, recovery) settles first.
+ tokio::time::sleep(std::time::Duration::from_secs(20)).await;
+ loop {
+ let now = now_ms();
+ let due: Vec<ChannelFollow> = channels::list()
+ .into_iter()
+ .filter(|c| is_due(c, now))
+ .collect();
+
+ for ch in due {
+ if let Some(videos) = poll_channel(&ch).await {
+ handle_new_videos(&app, &ch, videos).await;
+ }
+ // Gentle spacing between channels to avoid bursty yt-dlp load.
+ tokio::time::sleep(std::time::Duration::from_secs(2)).await;
+ }
+
+ tokio::time::sleep(std::time::Duration::from_secs(TICK_SECONDS)).await;
+ }
+ });
+}
+
+async fn handle_new_videos(app: &AppHandle, ch: &ChannelFollow, videos: Vec<NewVideo>) {
+ if videos.is_empty() {
+ return;
+ }
+ tracing::info!("[channels] {} new video(s) in {}", videos.len(), ch.id);
+
+ if ch.auto_download {
+ for v in &videos {
+ if let Err(e) =
+ crate::external_url::queue_url_with_defaults(app, v.url.clone(), false, None).await
+ {
+ tracing::warn!("[channels] auto-download enqueue failed: {}", e);
+ }
+ }
+ }
+
+ let _ = app
+ .notification()
+ .builder()
+ .title(ch.title.clone())
+ .body(format!("{} new video(s)", videos.len()))
+ .show();
+
+ let payload = ChannelNewVideos {
+ channel_id: ch.id.clone(),
+ channel_title: ch.title.clone(),
+ auto_download: ch.auto_download,
+ videos,
+ };
+ let _ = app.emit("channel-new-videos", &payload);
+}
+
+// Forces an immediate poll of one channel, ignoring its interval. Returns the
+// number of new videos found. Used by the tray submenu and the settings UI.
+pub async fn check_now(app: &AppHandle, id: &str) -> Result<usize, String> {
+ let ch = channels::get(id).ok_or_else(|| "Channel not found".to_string())?;
+ match poll_channel(&ch).await {
+ Some(videos) => {
+ let n = videos.len();
+ handle_new_videos(app, &ch, videos).await;
+ Ok(n)
+ }
+ None => Err("Channel check failed".to_string()),
+ }
+}
diff --git a/src-tauri/src/core/channels.rs b/src-tauri/src/core/channels.rs
new file mode 100644
index 00000000..a2f8c00d
--- /dev/null
+++ b/src-tauri/src/core/channels.rs
@@ -0,0 +1,242 @@
+use serde::{Deserialize, Serialize};
+use std::collections::hash_map::DefaultHasher;
+use std::collections::HashMap;
+use std::hash::{Hash, Hasher};
+use std::io::Write;
+use std::path::PathBuf;
+use std::sync::{Mutex, OnceLock};
+use std::time::{SystemTime, UNIX_EPOCH};
+
+const CHANNELS_FILE: &str = "channels.json";
+const MAX_SEEN_IDS: usize = 500;
+
+fn default_true() -> bool {
+ true
+}
+
+fn default_interval() -> u32 {
+ 60
+}
+
+fn now_ms() -> u64 {
+ SystemTime::now()
+ .duration_since(UNIX_EPOCH)
+ .map(|d| d.as_millis() as u64)
+ .unwrap_or(0)
+}
+
+#[derive(Debug, Clone, Serialize, Deserialize)]
+pub struct ChannelFollow {
+ pub id: String,
+ pub url: String,
+ pub title: String,
+ pub added_at_ms: u64,
+ #[serde(default)]
+ pub last_checked_ms: Option<u64>,
+ #[serde(default)]
+ pub seen_ids: Vec<String>,
+ #[serde(default = "default_true")]
+ pub enabled: bool,
+ #[serde(default)]
+ pub auto_download: bool,
+ #[serde(default = "default_interval")]
+ pub interval_minutes: u32,
+}
+
+#[derive(Debug, Clone, Default, Serialize, Deserialize)]
+struct ChannelsFile {
+ #[serde(default)]
+ channels: Vec<ChannelFollow>,
+}
+
+static STORE: OnceLock<Mutex<HashMap<String, ChannelFollow>>> = OnceLock::new();
+
+fn store() -> &'static Mutex<HashMap<String, ChannelFollow>> {
+ STORE.get_or_init(|| Mutex::new(HashMap::new()))
+}
+
+fn file_path() -> Option<PathBuf> {
+ crate::core::paths::app_data_dir().map(|d| d.join(CHANNELS_FILE))
+}
+
+pub fn id_for_url(url: &str) -> String {
+ let mut hasher = DefaultHasher::new();
+ url.trim().hash(&mut hasher);
+ format!("ch{:016x}", hasher.finish())
+}
+
+fn write_to_disk(channels: &HashMap<String, ChannelFollow>) {
+ let Some(path) = file_path() else { return };
+ let Some(parent) = path.parent() else { return };
+ if let Err(e) = std::fs::create_dir_all(parent) {
+ tracing::warn!("[channels] create_dir_all failed: {}", e);
+ return;
+ }
+ let file_data = ChannelsFile {
+ channels: channels.values().cloned().collect(),
+ };
+ let serialized = match serde_json::to_string_pretty(&file_data) {
+ Ok(s) => s,
+ Err(e) => {
+ tracing::warn!("[channels] serialize failed: {}", e);
+ return;
+ }
+ };
+ let tmp = path.with_extension("json.tmp");
+ let write_result = (|| -> std::io::Result<()> {
+ let mut f = std::fs::File::create(&tmp)?;
+ f.write_all(serialized.as_bytes())?;
+ f.sync_all()?;
+ Ok(())
+ })();
+ if let Err(e) = write_result {
+ tracing::warn!("[channels] write tmp failed: {}", e);
+ let _ = std::fs::remove_file(&tmp);
+ return;
+ }
+ if let Err(e) = std::fs::rename(&tmp, &path) {
+ tracing::warn!("[channels] rename failed: {}", e);
+ let _ = std::fs::remove_file(&tmp);
+ }
+}
+
+pub fn init_from_disk() {
+ let Some(path) = file_path() else { return };
+ let content = match std::fs::read_to_string(&path) {
+ Ok(c) => c,
+ Err(_) => return,
+ };
+ let parsed: ChannelsFile = match serde_json::from_str(&content) {
+ Ok(v) => v,
+ Err(e) => {
+ tracing::warn!("[channels] parse failed: {}", e);
+ return;
+ }
+ };
+ let mut guard = store().lock().unwrap();
+ guard.clear();
+ for ch in parsed.channels {
+ guard.insert(ch.id.clone(), ch);
+ }
+}
+
+pub fn list() -> Vec<ChannelFollow> {
+ let guard = store().lock().unwrap();
+ let mut v: Vec<ChannelFollow> = guard.values().cloned().collect();
+ v.sort_by(|a, b| a.added_at_ms.cmp(&b.added_at_ms));
+ v
+}
+
+pub fn get(id: &str) -> Option<ChannelFollow> {
+ store().lock().unwrap().get(id).cloned()
+}
+
+pub fn add(url: String, title: String) -> ChannelFollow {
+ let id = id_for_url(&url);
+ let mut guard = store().lock().unwrap();
+ let entry = guard.entry(id.clone()).or_insert_with(|| ChannelFollow {
+ id: id.clone(),
+ url: url.trim().to_string(),
+ title: title.clone(),
+ added_at_ms: now_ms(),
+ last_checked_ms: None,
+ seen_ids: Vec::new(),
+ enabled: true,
+ auto_download: false,
+ interval_minutes: default_interval(),
+ });
+ if !title.is_empty() {
+ entry.title = title;
+ }
+ let result = entry.clone();
+ write_to_disk(&guard);
+ result
+}
+
+pub fn remove(id: &str) -> bool {
+ let mut guard = store().lock().unwrap();
+ if guard.remove(id).is_some() {
+ write_to_disk(&guard);
+ true
+ } else {
+ false
+ }
+}
+
+pub fn update(
+ id: &str,
+ enabled: Option<bool>,
+ auto_download: Option<bool>,
+ interval_minutes: Option<u32>,
+) -> Option<ChannelFollow> {
+ let mut guard = store().lock().unwrap();
+ let ch = guard.get_mut(id)?;
+ if let Some(v) = enabled {
+ ch.enabled = v;
+ }
+ if let Some(v) = auto_download {
+ ch.auto_download = v;
+ }
+ if let Some(v) = interval_minutes {
+ ch.interval_minutes = v.max(5);
+ }
+ let result = ch.clone();
+ write_to_disk(&guard);
+ Some(result)
+}
+
+// Records the poll result: marks checked-now and folds newly seen video ids
+// into the channel's bounded seen set. Returns the ids that were NOT seen
+// before (the genuinely new videos) so the caller can notify/auto-download.
+pub fn record_poll(id: &str, fetched_ids: &[String]) -> Vec<String> {
+ let mut guard = store().lock().unwrap();
+ let Some(ch) = guard.get_mut(id) else {
+ return Vec::new();
+ };
+ ch.last_checked_ms = Some(now_ms());
+
+ // First successful poll establishes a baseline without flagging the whole
+ // back catalogue as "new".
+ let first_poll = ch.seen_ids.is_empty();
+ let known: std::collections::HashSet<&String> = ch.seen_ids.iter().collect();
+ let new_ids: Vec<String> = fetched_ids
+ .iter()
+ .filter(|fid| !known.contains(fid))
+ .cloned()
+ .collect();
+
+ for fid in fetched_ids {
+ if !ch.seen_ids.iter().any(|s| s == fid) {
+ ch.seen_ids.push(fid.clone());
+ }
+ }
+ if ch.seen_ids.len() > MAX_SEEN_IDS {
+ let overflow = ch.seen_ids.len() - MAX_SEEN_IDS;
+ ch.seen_ids.drain(0..overflow);
+ }
+
+ write_to_disk(&guard);
+ if first_poll {
+ Vec::new()
+ } else {
+ new_ids
+ }
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn id_is_stable_and_trimmed() {
+ assert_eq!(
+ id_for_url("https://x.test/c"),
+ id_for_url(" https://x.test/c ")
+ );
+ assert_ne!(
+ id_for_url("https://x.test/a"),
+ id_for_url("https://x.test/b")
+ );
+ assert!(id_for_url("https://x.test/c").starts_with("ch"));
+ }
+}
diff --git a/src-tauri/src/core/mod.rs b/src-tauri/src/core/mod.rs
index 8d112953..12685787 100644
--- a/src-tauri/src/core/mod.rs
+++ b/src-tauri/src/core/mod.rs
@@ -17,6 +17,9 @@ pub use omniget_core::core::redirect;
pub use omniget_core::core::registry;
pub use omniget_core::core::ytdlp;
+pub mod awake;
+pub mod channel_poller;
+pub mod channels;
pub mod download_log;
pub mod events;
pub mod host_limiter;
@@ -25,4 +28,5 @@ pub mod queue;
pub mod queue_history;
pub mod recovery;
pub mod rpc;
+pub mod trackers;
pub mod url_parser;
diff --git a/src-tauri/src/core/queue.rs b/src-tauri/src/core/queue.rs
index fa883d57..e3b41603 100644
--- a/src-tauri/src/core/queue.rs
+++ b/src-tauri/src/core/queue.rs
@@ -5,6 +5,13 @@ use std::sync::{Arc, OnceLock};
static EMIT_COUNT: AtomicU64 = AtomicU64::new(0);
+pub fn now_ms() -> u64 {
+ std::time::SystemTime::now()
+ .duration_since(std::time::UNIX_EPOCH)
+ .map(|d| d.as_millis() as u64)
+ .unwrap_or(0)
+}
+
use serde::Serialize;
use tauri::{Emitter, Manager};
use tokio::sync::mpsc;
@@ -170,6 +177,9 @@ pub struct QueueItem {
pub eta_seconds: Option<u64>,
pub cookie_slug: Option<String>,
pub custom_ytdlp_args: Option<Vec<String>>,
+ pub torrent_files: Option<Vec<usize>>,
+ pub scheduled_at_ms: Option<u64>,
+ pub stop_at_ms: Option<u64>,
}
impl QueueItem {
@@ -241,6 +251,9 @@ impl DownloadQueue {
from_hotkey: bool,
cookie_slug: Option<String>,
custom_ytdlp_args: Option<Vec<String>>,
+ torrent_files: Option<Vec<usize>>,
+ scheduled_at_ms: Option<u64>,
+ stop_at_ms: Option<u64>,
) {
let computed_kind = Some(kind_from_platform(&platform));
let item = QueueItem {
@@ -281,6 +294,9 @@ impl DownloadQueue {
eta_seconds: None,
cookie_slug,
custom_ytdlp_args,
+ torrent_files,
+ scheduled_at_ms,
+ stop_at_ms,
};
crate::core::recovery::persist(crate::core::recovery::RecoveryItem {
id: item.id,
@@ -364,6 +380,9 @@ impl DownloadQueue {
eta_seconds: None,
cookie_slug: None,
custom_ytdlp_args: None,
+ torrent_files: None,
+ scheduled_at_ms: None,
+ stop_at_ms: None,
};
self.items.push(item);
}
@@ -378,9 +397,11 @@ impl DownloadQueue {
pub fn next_queued_ids(&self) -> Vec<u64> {
let slots = self.max_concurrent.saturating_sub(self.active_count()) as usize;
+ let now = now_ms();
self.items
.iter()
.filter(|i| i.status == QueueStatus::Queued)
+ .filter(|i| i.scheduled_at_ms.map(|t| now >= t).unwrap_or(true))
.take(slots)
.map(|i| i.id)
.collect()
@@ -803,6 +824,7 @@ pub fn emit_queue_state_from_state(app: &tauri::AppHandle, state: Vec<QueueItemI
let _ = app.emit("queue-state-update", &state);
let total = crate::tray::compute_total_active(app);
crate::tray::update_active_count(app, total);
+ crate::core::awake::sync(total > 0);
let active_items: Vec<_> = state
.iter()
@@ -814,6 +836,8 @@ pub fn emit_queue_state_from_state(app: &tauri::AppHandle, state: Vec<QueueItemI
} else {
0.0
};
+ let total_speed: f64 = active_items.iter().map(|i| i.speed_bytes_per_sec).sum();
+ crate::tray::update_speed_tooltip(app, total, total_speed);
crate::tray::update_taskbar_badge(app, total, avg_percent);
if let Some(window) = app.get_webview_window("main") {
@@ -975,6 +999,7 @@ async fn spawn_download_inner(
from_hotkey,
cookie_slug,
custom_ytdlp_args,
+ torrent_files,
) = {
let q = queue.lock().await;
let item = match q.items.iter().find(|i| i.id == item_id) {
@@ -999,6 +1024,7 @@ async fn spawn_download_inner(
item.from_hotkey,
item.cookie_slug.clone(),
item.custom_ytdlp_args.clone(),
+ item.torrent_files.clone(),
)
};
@@ -1147,6 +1173,9 @@ async fn spawn_download_inner(
torrent_listen_port: Some(settings.advanced.torrent_listen_port),
torrent_id_slot: Some(torrent_id_slot.clone()),
custom_ytdlp_args: custom_ytdlp_args.clone(),
+ torrent_files: torrent_files.clone(),
+ torrent_auto_trackers: settings.advanced.torrent_auto_trackers,
+ torrent_upnp: settings.advanced.torrent_upnp,
};
let total_bytes = info.file_size_bytes;
@@ -1625,6 +1654,43 @@ pub async fn try_start_next(app: tauri::AppHandle, queue: Arc<tokio::sync::Mutex
tracing::debug!("[perf] try_start_next took {:?}", _timer_start.elapsed());
}
+// Periodic tick so a future-scheduled download still starts when its time
+// arrives even if the queue is otherwise idle, and so a download with a
+// stop time is cancelled when that time passes.
+pub fn start_scheduler(app: tauri::AppHandle) {
+ tauri::async_runtime::spawn(async move {
+ tokio::time::sleep(std::time::Duration::from_secs(15)).await;
+ loop {
+ let state = app.state::<crate::AppState>();
+ let queue = state.download_queue.clone();
+ let (has_due, stopped_any) = {
+ let q = queue.lock().await;
+ let now = now_ms();
+ let mut stopped = false;
+ for item in &q.items {
+ if item.status == QueueStatus::Active {
+ if let Some(stop) = item.stop_at_ms {
+ if now >= stop {
+ item.cancel_token.cancel();
+ stopped = true;
+ }
+ }
+ }
+ }
+ let due = q.items.iter().any(|i| {
+ i.status == QueueStatus::Queued
+ && i.scheduled_at_ms.map(|t| now >= t).unwrap_or(false)
+ });
+ (due, stopped)
+ };
+ if has_due || stopped_any {
+ try_start_next(app.clone(), queue.clone()).await;
+ }
+ tokio::time::sleep(std::time::Duration::from_secs(15)).await;
+ }
+ });
+}
+
fn is_generic_title(title: &str) -> bool {
let t = title.to_lowercase();
let t = t.trim();
diff --git a/src-tauri/src/core/trackers.rs b/src-tauri/src/core/trackers.rs
new file mode 100644
index 00000000..3ef82bb5
--- /dev/null
+++ b/src-tauri/src/core/trackers.rs
@@ -0,0 +1,57 @@
+// Curated set of long-lived public BitTorrent trackers. Many magnet links
+// carry few or dead trackers; injecting these stable open trackers materially
+// improves peer discovery so downloads actually start. Kept as a static list
+// (no runtime fetch) to avoid an external dependency, scheduler, and the
+// SSRF/privacy surface of pulling a remote list at runtime.
+const PUBLIC_TRACKERS: &[&str] = &[
+ "udp://tracker.opentrackr.org:1337/announce",
+ "udp://open.tracker.cl:1337/announce",
+ "udp://tracker.openbittorrent.com:6969/announce",
+ "udp://exodus.desync.com:6969/announce",
+ "udp://tracker.torrent.eu.org:451/announce",
+ "udp://open.demonii.com:1337/announce",
+ "udp://tracker.dler.org:6969/announce",
+ "udp://explodie.org:6969/announce",
+ "https://tracker.tamersunion.org:443/announce",
+ "udp://opentracker.io:6969/announce",
+];
+
+pub fn extra_trackers() -> Vec<String> {
+ PUBLIC_TRACKERS.iter().map(|s| s.to_string()).collect()
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn list_is_non_empty() {
+ assert!(!extra_trackers().is_empty());
+ }
+
+ #[test]
+ fn all_have_supported_scheme() {
+ for t in extra_trackers() {
+ assert!(
+ t.starts_with("udp://") || t.starts_with("http://") || t.starts_with("https://"),
+ "unexpected tracker scheme: {t}"
+ );
+ }
+ }
+
+ #[test]
+ fn all_end_with_announce() {
+ for t in extra_trackers() {
+ assert!(t.ends_with("/announce"), "tracker missing /announce: {t}");
+ }
+ }
+
+ #[test]
+ fn no_duplicates() {
+ let mut v = extra_trackers();
+ let before = v.len();
+ v.sort();
+ v.dedup();
+ assert_eq!(before, v.len(), "tracker list has duplicates");
+ }
+}
diff --git a/src-tauri/src/external_url.rs b/src-tauri/src/external_url.rs
index 6ba77a66..885dcc45 100644
--- a/src-tauri/src/external_url.rs
+++ b/src-tauri/src/external_url.rs
@@ -259,6 +259,9 @@ pub async fn queue_url_with_defaults(
from_hotkey,
None,
None,
+ None,
+ None,
+ None,
);
let next_ids = q.next_queued_ids();
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index ebe75b34..30b43e99 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -19,7 +19,6 @@ pub mod external_url;
pub mod hotkey;
pub mod local_bridge;
pub mod models;
-pub mod pets;
pub mod platforms;
pub mod plugin_host;
pub mod plugin_loader;
@@ -96,7 +95,6 @@ pub fn run() {
}
}))
.manage(state)
- .manage(pets::PetsState::default())
.manage(Arc::new(tokio::sync::RwLock::new(
plugin_loader::PluginManager::new(
core::paths::app_data_dir()
@@ -195,11 +193,63 @@ pub fn run() {
.download
.youtube_sponsorblock
});
+ core::ytdlp::set_sponsorblock_mode_fn(|| {
+ storage::config::load_settings_standalone()
+ .download
+ .sponsorblock_mode
+ });
+ core::ytdlp::set_sponsorblock_categories_fn(|| {
+ storage::config::load_settings_standalone()
+ .download
+ .sponsorblock_categories
+ });
core::ytdlp::set_split_chapters_fn(|| {
storage::config::load_settings_standalone()
.download
.split_by_chapters
});
+ core::ytdlp::set_embed_metadata_fn(|| {
+ storage::config::load_settings_standalone()
+ .download
+ .embed_metadata
+ });
+ core::ytdlp::set_embed_thumbnail_fn(|| {
+ storage::config::load_settings_standalone()
+ .download
+ .embed_thumbnail
+ });
+ core::ytdlp::set_speed_limit_fn(|| {
+ let v = storage::config::load_settings_standalone()
+ .download
+ .speed_limit;
+ let t = v.trim();
+ if t.is_empty() {
+ None
+ } else {
+ Some(t.to_string())
+ }
+ });
+ core::ytdlp::set_live_from_start_fn(|| {
+ storage::config::load_settings_standalone()
+ .download
+ .live_from_start
+ });
+ core::ytdlp::set_concurrent_fragments_fn(|| {
+ storage::config::load_settings_standalone()
+ .advanced
+ .concurrent_fragments
+ });
+ core::ytdlp::set_user_agent_fn(|| {
+ let v = storage::config::load_settings_standalone()
+ .advanced
+ .user_agent;
+ let t = v.trim();
+ if t.is_empty() {
+ None
+ } else {
+ Some(t.to_string())
+ }
+ });
{
let app_handle = app.handle().clone();
omniget_core::core::log_hook::set_log_sink(std::sync::Arc::new(move |id, line| {
@@ -215,6 +265,9 @@ pub fn run() {
}
core::recovery::init_from_disk();
core::queue_history::init_from_disk();
+ core::channels::init_from_disk();
+ core::channel_poller::start(app.handle().clone());
+ core::queue::start_scheduler(app.handle().clone());
{
let app_handle = app.handle().clone();
tauri::async_runtime::spawn(async move {
@@ -407,23 +460,20 @@ pub fn run() {
commands::browser_extension::browser_extension_status,
commands::browser_extension::browser_extension_export,
commands::browser_extension::browser_extension_open_folder,
- commands::extension_cookies::read_extension_cookies,
- commands::extension_cookies::extension_cookies_status,
cookies::commands::cookies_list,
cookies::commands::cookies_read,
cookies::commands::cookies_import,
cookies::commands::cookies_clear,
cookies::commands::cookies_rename,
- cookies::commands::cookies_migrate_legacy,
- cookies::commands::cookies_detect_platform,
cookies::commands::cookies_accounts_for_url,
cookies::commands::cookies_read_as_json,
cookies::commands::cookies_import_file,
cookies::commands::cookies_export_to,
cookies::commands::cookies_add_account,
+ cookies::commands::cookies_health,
+ cookies::commands::cookies_test,
commands::clip::clip_video,
commands::reencode::reencode_video,
- commands::diagnostics::get_rate_limit_stats,
commands::diagnostics::get_hwaccel_info,
commands::downloads::detect_platform,
commands::downloads::check_cookie_error,
@@ -431,6 +481,39 @@ pub fn run() {
commands::downloads::get_media_formats,
commands::downloads::prefetch_media_info,
commands::downloads::download_from_url,
+ commands::downloads::playlist_entries,
+ commands::downloads::torrent_contents,
+ commands::channels::channels_list,
+ commands::channels::channel_add,
+ commands::channels::channel_remove,
+ commands::channels::channel_update,
+ commands::channels::channel_check_now,
+ commands::channels::sync_channels_tray,
+ commands::ai::ai_get_config,
+ commands::ai::ai_set_config,
+ commands::ai::ai_test,
+ commands::ai::ai_summarize_url,
+ commands::ai::whisper_generate,
+ commands::ai::ai_history_list,
+ commands::ai::ai_history_clear,
+ commands::video_ops::video_op_preset,
+ commands::video_ops::video_op_propose,
+ commands::video_ops::video_op_run,
+ commands::video_ops::detect_shot_changes,
+ commands::video_ops::waveform_peaks,
+ commands::subtitle_ws::subtitle_load,
+ commands::subtitle_ws::subtitle_save,
+ commands::subtitle_ws::subtitle_translate,
+ commands::downloads::metadata_fetch,
+ commands::downloads::thumbnails_list,
+ commands::downloads::thumbnail_save,
+ commands::downloads::subtitles_list,
+ commands::downloads::subtitles_save,
+ commands::downloads::subtitles_merge,
+ commands::downloads::comments_fetch,
+ commands::downloads::chapters_fetch,
+ commands::downloads::tools_save_text,
+ commands::downloads::livechat_fetch,
commands::downloads::download_with_custom_args,
commands::downloads::cancel_generic_download,
commands::yt_templates::yt_templates_list,
@@ -443,11 +526,9 @@ pub fn run() {
commands::downloads::reorder_queue,
commands::downloads::retry_download,
commands::downloads::remove_download,
- commands::downloads::get_queue_state,
commands::downloads::update_max_concurrent,
commands::downloads::clear_finished_downloads,
commands::downloads::get_download_log,
- commands::downloads::clear_download_log,
commands::downloads::parse_batch_file,
commands::downloads::get_recovery_items,
commands::downloads::discard_recovery,
@@ -471,8 +552,7 @@ pub fn run() {
commands::rpc::rpc_set_idle_stats,
commands::settings::get_bridge_info,
commands::settings::rotate_bridge_token,
- commands::autostart::set_autostart,
- commands::autostart::get_autostart_status,
+ commands::settings::bridge_open_pairing,
commands::dependencies::check_dependencies,
commands::dependencies::check_ytdlp_available,
commands::dependencies::install_dependency,
@@ -495,25 +575,8 @@ pub fn run() {
commands::p2p::p2p_cancel_send,
commands::p2p::p2p_pause_send,
commands::p2p::p2p_resume_send,
- commands::p2p::p2p_get_active_sends,
- commands::p2p::p2p_validate_code,
- commands::app_lifecycle::get_active_download_count,
- commands::app_lifecycle::request_app_quit,
commands::app_lifecycle::force_exit_app,
commands::app_lifecycle::get_debug_info,
- pets::pets_get_local_index,
- pets::pets_fetch_remote_manifest,
- pets::pets_diff,
- pets::pets_install_bundle,
- pets::pets_install_missing,
- pets::pets_force_refresh,
- pets::pets_uninstall,
- pets::pets_open_folder,
- pets::pets_set_active,
- pets::pets_get_active,
- pets::pets_resolve_path,
- pets::pets_get_display_prefs,
- pets::pets_set_display_prefs,
])
.build(tauri::generate_context!())
.expect("error while building tauri application")
diff --git a/src-tauri/src/local_bridge.rs b/src-tauri/src/local_bridge.rs
index 79d25df8..d355b50e 100644
--- a/src-tauri/src/local_bridge.rs
+++ b/src-tauri/src/local_bridge.rs
@@ -19,6 +19,7 @@
//! the URL through `external_url::handle_external_url`.
use std::net::SocketAddr;
+use std::sync::atomic::{AtomicI64, Ordering};
use std::sync::Arc;
use axum::{
@@ -206,6 +207,7 @@ pub async fn spawn(app: AppHandle) {
let router = Router::new()
.route("/v1/health", get(health))
+ .route("/v1/pair", get(pair))
.route("/v1/enqueue", post(enqueue))
.route("/v1/cookies", post(cookies_export))
.with_state(state)
@@ -227,6 +229,61 @@ async fn health() -> Json<HealthResponse> {
})
}
+/// Seconds the pairing window stays open after the user clicks "Pair" in the
+/// app. The window is single-use (closed on the first successful hand-out).
+pub const PAIR_WINDOW_SECS: i64 = 120;
+
+/// Unix-ms deadline until which `GET /v1/pair` will return the token.
+/// `0` means the pairing window is closed.
+static PAIR_OPEN_UNTIL_MS: AtomicI64 = AtomicI64::new(0);
+
+fn now_ms() -> i64 {
+ std::time::SystemTime::now()
+ .duration_since(std::time::UNIX_EPOCH)
+ .map(|d| d.as_millis() as i64)
+ .unwrap_or(0)
+}
+
+/// Opens the user-consented pairing window. Returns the window length (s).
+pub fn open_pairing_window() -> i64 {
+ PAIR_OPEN_UNTIL_MS.store(now_ms() + PAIR_WINDOW_SECS * 1000, Ordering::SeqCst);
+ PAIR_WINDOW_SECS
+}
+
+fn pairing_open() -> bool {
+ PAIR_OPEN_UNTIL_MS.load(Ordering::SeqCst) > now_ms()
+}
+
+#[derive(Debug, Serialize)]
+struct PairResponse {
+ ok: bool,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ token: Option<String>,
+}
+
+async fn pair(State(state): State<BridgeState>) -> Response {
+ if !pairing_open() {
+ return (
+ StatusCode::FORBIDDEN,
+ Json(PairResponse {
+ ok: false,
+ token: None,
+ }),
+ )
+ .into_response();
+ }
+ PAIR_OPEN_UNTIL_MS.store(0, Ordering::SeqCst);
+ tracing::info!("[bridge] pairing token handed out (window closed, single-use)");
+ (
+ StatusCode::OK,
+ Json(PairResponse {
+ ok: true,
+ token: Some((*state.token).clone()),
+ }),
+ )
+ .into_response()
+}
+
fn unauthorized() -> Response {
let body = Json(EnqueueResponse {
ok: false,
diff --git a/src-tauri/src/pets/download.rs b/src-tauri/src/pets/download.rs
deleted file mode 100644
index 97240848..00000000
--- a/src-tauri/src/pets/download.rs
+++ /dev/null
@@ -1,209 +0,0 @@
-use std::time::Duration;
-
-use serde::{Deserialize, Serialize};
-
-const MANIFEST_URL: &str = "https://petdex.crafter.run/api/manifest";
-const FALLBACK_BUNDLE_URL: &str =
- "https://pub-94495283df974cfea5e98d6a9e3fa462.r2.dev/packs/petdex-approved.zip";
-const USER_AGENT: &str = "omniget-pets/1.0";
-
-const MIN_SPRITE_BYTES: usize = 10 * 1024;
-const MAX_SPRITE_BYTES: usize = 5 * 1024 * 1024;
-const MAX_PET_JSON_BYTES: usize = 64 * 1024;
-
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct RemoteManifest {
- #[serde(rename = "generatedAt")]
- pub generated_at: Option<String>,
- pub total: u32,
- #[serde(default)]
- pub featured: u32,
- #[serde(rename = "allPetsPackPath")]
- pub all_pets_pack_path: Option<String>,
- pub pets: Vec<RemotePet>,
-}
-
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct RemotePet {
- pub slug: String,
- #[serde(rename = "displayName")]
- pub display_name: String,
- #[serde(default)]
- pub description: Option<String>,
- #[serde(default)]
- pub kind: Option<String>,
- #[serde(default)]
- pub vibes: Vec<String>,
- #[serde(default)]
- pub tags: Vec<String>,
- #[serde(default)]
- pub featured: bool,
- #[serde(default, rename = "spritesheetUrl")]
- pub spritesheet_url: Option<String>,
- #[serde(default, rename = "petJsonUrl")]
- pub pet_json_url: Option<String>,
- #[serde(default, rename = "zipUrl")]
- pub zip_url: Option<String>,
- #[serde(default, rename = "submittedBy")]
- pub submitted_by: Option<String>,
-}
-
-fn build_client(timeout_secs: u64) -> reqwest::Result<reqwest::Client> {
- reqwest::Client::builder()
- .user_agent(USER_AGENT)
- .timeout(Duration::from_secs(timeout_secs))
- .connect_timeout(Duration::from_secs(30))
- .build()
-}
-
-fn is_retryable(status: Option<u16>) -> bool {
- match status {
- Some(s) => s >= 500 || s == 408 || s == 429,
- None => true,
- }
-}
-
-async fn with_retry<F, Fut, T>(label: &str, mut op: F) -> anyhow::Result<T>
-where
- F: FnMut() -> Fut,
- Fut: std::future::Future<Output = Result<T, RetryError>>,
-{
- let mut backoff_ms: u64 = 1000;
- for attempt in 0..3 {
- match op().await {
- Ok(v) => return Ok(v),
- Err(err) => {
- let last = attempt == 2;
- if last || !err.retryable {
- return Err(anyhow::anyhow!("{}: {}", label, err.message));
- }
- tokio::time::sleep(Duration::from_millis(backoff_ms)).await;
- backoff_ms *= 2;
- }
- }
- }
- anyhow::bail!("{}: retry exhausted", label)
-}
-
-pub struct RetryError {
- pub message: String,
- pub retryable: bool,
-}
-
-pub async fn fetch_manifest() -> anyhow::Result<RemoteManifest> {
- with_retry("fetch_manifest", || async {
- let client = build_client(60).map_err(|e| RetryError {
- message: e.to_string(),
- retryable: true,
- })?;
- let res = client
- .get(MANIFEST_URL)
- .send()
- .await
- .map_err(|e| RetryError {
- message: e.to_string(),
- retryable: true,
- })?;
- let status = res.status();
- if !status.is_success() {
- let retryable = is_retryable(Some(status.as_u16()));
- return Err(RetryError {
- message: format!("status {}", status),
- retryable,
- });
- }
- let text = res.text().await.map_err(|e| RetryError {
- message: e.to_string(),
- retryable: true,
- })?;
- let parsed: RemoteManifest = serde_json::from_str(&text).map_err(|e| RetryError {
- message: format!("parse: {}", e),
- retryable: false,
- })?;
- Ok(parsed)
- })
- .await
-}
-
-pub fn fallback_bundle_url() -> &'static str {
- FALLBACK_BUNDLE_URL
-}
-
-pub async fn fetch_bytes(
- url: &str,
- max_bytes: usize,
- timeout_secs: u64,
-) -> anyhow::Result<Vec<u8>> {
- let label = format!("GET {}", url);
- with_retry(&label, || async {
- let client = build_client(timeout_secs).map_err(|e| RetryError {
- message: e.to_string(),
- retryable: true,
- })?;
- let res = client.get(url).send().await.map_err(|e| RetryError {
- message: e.to_string(),
- retryable: true,
- })?;
- let status = res.status();
- if !status.is_success() {
- let retryable = is_retryable(Some(status.as_u16()));
- return Err(RetryError {
- message: format!("status {}", status),
- retryable,
- });
- }
- let bytes = res.bytes().await.map_err(|e| RetryError {
- message: e.to_string(),
- retryable: true,
- })?;
- if bytes.len() > max_bytes {
- return Err(RetryError {
- message: format!("payload {} > limit {}", bytes.len(), max_bytes),
- retryable: false,
- });
- }
- Ok(bytes.to_vec())
- })
- .await
-}
-
-pub async fn fetch_pet_json(url: &str) -> anyhow::Result<Vec<u8>> {
- fetch_bytes(url, MAX_PET_JSON_BYTES, 60).await
-}
-
-pub async fn fetch_spritesheet(url: &str) -> anyhow::Result<Vec<u8>> {
- let bytes = fetch_bytes(url, MAX_SPRITE_BYTES, 60).await?;
- if bytes.len() < MIN_SPRITE_BYTES {
- anyhow::bail!("spritesheet too small ({} bytes)", bytes.len());
- }
- if !is_webp_or_png(&bytes) {
- anyhow::bail!("spritesheet is not webp or png");
- }
- Ok(bytes)
-}
-
-fn is_webp_or_png(b: &[u8]) -> bool {
- if b.len() < 12 {
- return false;
- }
- if &b[0..4] == b"RIFF" && &b[8..12] == b"WEBP" {
- return true;
- }
- if b.starts_with(&[0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A]) {
- return true;
- }
- false
-}
-
-pub async fn fetch_bundle_zip(url: &str) -> anyhow::Result<Vec<u8>> {
- fetch_bytes(url, 200 * 1024 * 1024, 600).await
-}
-
-pub fn extract_ext_from_url(url: &str) -> &'static str {
- let lower = url.to_ascii_lowercase();
- if lower.ends_with(".png") {
- "png"
- } else {
- "webp"
- }
-}
diff --git a/src-tauri/src/pets/install.rs b/src-tauri/src/pets/install.rs
deleted file mode 100644
index 7c2b851e..00000000
--- a/src-tauri/src/pets/install.rs
+++ /dev/null
@@ -1,642 +0,0 @@
-use std::collections::BTreeMap;
-use std::io::{Cursor, Read, Write};
-use std::path::Path;
-use std::sync::Arc;
-
-use futures::stream::{FuturesUnordered, StreamExt};
-use serde::Serialize;
-use tauri::{AppHandle, Emitter};
-use tokio::sync::Mutex;
-
-use super::download::{
- extract_ext_from_url, fallback_bundle_url, fetch_bundle_zip, fetch_pet_json, fetch_spritesheet,
- RemoteManifest, RemotePet,
-};
-use super::manifest::{
- discover_local_pets, ensure_root, load, manifest_path, now_iso, pet_dir, save_atomic,
- LocalManifest, LocalPetEntry,
-};
-
-#[derive(Debug, Serialize, Clone)]
-pub struct DiffReport {
- pub new_remote: Vec<String>,
- pub in_both: Vec<String>,
- pub only_local: Vec<String>,
- pub total_remote: u32,
- pub total_local: u32,
-}
-
-#[derive(Debug, Serialize, Clone)]
-pub struct InstallReport {
- pub added: Vec<String>,
- pub skipped: Vec<String>,
- pub failed: Vec<FailedInstall>,
- pub total_bytes: u64,
- pub duration_ms: u64,
-}
-
-#[derive(Debug, Serialize, Clone)]
-pub struct FailedInstall {
- pub slug: String,
- pub reason: String,
-}
-
-#[derive(Debug, Serialize, Clone)]
-pub struct LocalIndex {
- pub pets: Vec<LocalPetEntry>,
- pub last_synced_at: Option<String>,
- pub total: usize,
-}
-
-#[derive(Debug, Serialize, Clone)]
-pub struct ProgressEvent<'a> {
- pub slug: &'a str,
- pub current: u32,
- pub total: u32,
- pub bytes_downloaded: u64,
- pub bytes_total: u64,
-}
-
-#[derive(Debug, Serialize, Clone)]
-pub struct StartedEvent {
- pub kind: String,
- pub expected: u32,
-}
-
-pub fn refresh_index(app_data_dir: &Path) -> std::io::Result<LocalIndex> {
- let _ = ensure_root(app_data_dir)?;
- let mut manifest = load(app_data_dir);
- discover_local_pets(app_data_dir, &mut manifest)?;
- save_atomic(app_data_dir, &manifest)?;
- let mut pets: Vec<LocalPetEntry> = manifest.pets.values().cloned().collect();
- pets.sort_by(|a, b| {
- a.display_name
- .to_lowercase()
- .cmp(&b.display_name.to_lowercase())
- });
- let total = pets.len();
- Ok(LocalIndex {
- pets,
- last_synced_at: manifest.last_synced_at.clone(),
- total,
- })
-}
-
-pub fn diff(local: &LocalIndex, remote: &RemoteManifest) -> DiffReport {
- let local_set: std::collections::HashSet<String> =
- local.pets.iter().map(|p| p.slug.clone()).collect();
- let remote_set: std::collections::HashSet<String> =
- remote.pets.iter().map(|p| p.slug.clone()).collect();
- let mut new_remote: Vec<String> = remote
- .pets
- .iter()
- .filter(|p| !local_set.contains(&p.slug))
- .map(|p| p.slug.clone())
- .collect();
- let mut in_both: Vec<String> = remote
- .pets
- .iter()
- .filter(|p| local_set.contains(&p.slug))
- .map(|p| p.slug.clone())
- .collect();
- let mut only_local: Vec<String> = local
- .pets
- .iter()
- .filter(|p| !remote_set.contains(&p.slug))
- .map(|p| p.slug.clone())
- .collect();
- new_remote.sort();
- in_both.sort();
- only_local.sort();
- DiffReport {
- new_remote,
- in_both,
- only_local,
- total_remote: remote.total,
- total_local: local.pets.len() as u32,
- }
-}
-
-async fn install_one(
- app_data_dir: Arc<std::path::PathBuf>,
- pet: RemotePet,
- overwrite: bool,
-) -> Result<(String, u64, LocalPetEntry), FailedInstall> {
- let slug = pet.slug.clone();
- let dir = pet_dir(app_data_dir.as_path(), &slug);
- if dir.exists() && !overwrite {
- return Err(FailedInstall {
- slug,
- reason: "already installed".to_string(),
- });
- }
- let sprite_url = match pet.spritesheet_url.as_ref() {
- Some(u) => u.clone(),
- None => {
- return Err(FailedInstall {
- slug,
- reason: "missing spritesheet url".to_string(),
- });
- }
- };
- let pet_json_url = match pet.pet_json_url.as_ref() {
- Some(u) => u.clone(),
- None => {
- return Err(FailedInstall {
- slug,
- reason: "missing pet.json url".to_string(),
- });
- }
- };
-
- let pet_json_bytes = match fetch_pet_json(&pet_json_url).await {
- Ok(b) => b,
- Err(e) => {
- return Err(FailedInstall {
- slug,
- reason: format!("pet.json: {}", e),
- });
- }
- };
- if serde_json::from_slice::<serde_json::Value>(&pet_json_bytes).is_err() {
- return Err(FailedInstall {
- slug,
- reason: "pet.json invalid".to_string(),
- });
- }
-
- let sprite_bytes = match fetch_spritesheet(&sprite_url).await {
- Ok(b) => b,
- Err(e) => {
- return Err(FailedInstall {
- slug,
- reason: format!("sprite: {}", e),
- });
- }
- };
-
- if let Err(e) = std::fs::create_dir_all(&dir) {
- return Err(FailedInstall {
- slug,
- reason: format!("mkdir: {}", e),
- });
- }
- let sprite_ext = extract_ext_from_url(&sprite_url);
- let sprite_path = dir.join(format!("spritesheet.{}", sprite_ext));
- let pet_json_path = dir.join("pet.json");
- let metadata_path = dir.join("metadata.json");
- if let Err(e) = atomic_write(&sprite_path, &sprite_bytes) {
- return Err(FailedInstall {
- slug,
- reason: format!("sprite write: {}", e),
- });
- }
- if let Err(e) = atomic_write(&pet_json_path, &pet_json_bytes) {
- return Err(FailedInstall {
- slug,
- reason: format!("pet.json write: {}", e),
- });
- }
- let metadata = serde_json::json!({
- "id": &slug,
- "slug": &slug,
- "displayName": &pet.display_name,
- "description": pet.description.clone().unwrap_or_default(),
- "spritesheetPath": format!("/pets/{}/spritesheet.{}", slug, sprite_ext),
- "petJsonPath": format!("/pets/{}/pet.json", slug),
- "kind": pet.kind.clone().unwrap_or_default(),
- "vibes": pet.vibes.clone(),
- "tags": pet.tags.clone(),
- "featured": pet.featured,
- "submittedBy": pet.submitted_by.clone(),
- "importedAt": now_iso(),
- });
- let metadata_bytes = serde_json::to_vec_pretty(&metadata).unwrap_or_default();
- let _ = atomic_write(&metadata_path, &metadata_bytes);
-
- let bytes_total = sprite_bytes.len() as u64 + pet_json_bytes.len() as u64;
- let mut sizes: BTreeMap<String, u64> = BTreeMap::new();
- sizes.insert("spritesheet".into(), sprite_bytes.len() as u64);
- sizes.insert("pet.json".into(), pet_json_bytes.len() as u64);
- let entry = LocalPetEntry {
- slug: slug.clone(),
- display_name: pet.display_name.clone(),
- source: "manifest".to_string(),
- installed_at: now_iso(),
- vibes: pet.vibes.clone(),
- tags: pet.tags.clone(),
- kind: pet.kind.clone(),
- sprite_ext: sprite_ext.to_string(),
- file_sizes: sizes,
- remote_checked_at: Some(now_iso()),
- };
- Ok((slug, bytes_total, entry))
-}
-
-fn atomic_write(path: &Path, bytes: &[u8]) -> std::io::Result<()> {
- if let Some(parent) = path.parent() {
- std::fs::create_dir_all(parent)?;
- }
- let tmp = path.with_extension(format!(
- "{}.tmp",
- path.extension().and_then(|s| s.to_str()).unwrap_or("dat")
- ));
- {
- let mut f = std::fs::File::create(&tmp)?;
- f.write_all(bytes)?;
- f.sync_all()?;
- }
- if path.exists() {
- std::fs::remove_file(path)?;
- }
- std::fs::rename(&tmp, path)?;
- Ok(())
-}
-
-pub async fn install_missing(
- app: AppHandle,
- app_data_dir: std::path::PathBuf,
- remote: RemoteManifest,
- requested: Option<Vec<String>>,
-) -> InstallReport {
- let started = std::time::Instant::now();
- let _ = ensure_root(&app_data_dir);
- let manifest_arc: Arc<Mutex<LocalManifest>> = Arc::new(Mutex::new(load(&app_data_dir)));
- let app_data_arc = Arc::new(app_data_dir.clone());
-
- let local_known: std::collections::HashSet<String> = {
- let g = manifest_arc.lock().await;
- g.pets.keys().cloned().collect()
- };
-
- let target_pets: Vec<RemotePet> = remote
- .pets
- .into_iter()
- .filter(|p| {
- if local_known.contains(&p.slug) {
- return false;
- }
- match &requested {
- Some(list) => list.iter().any(|s| s == &p.slug),
- None => true,
- }
- })
- .collect();
-
- let total = target_pets.len() as u32;
- let _ = app.emit(
- "pets:sync:started",
- StartedEvent {
- kind: "incremental".to_string(),
- expected: total,
- },
- );
-
- let mut added: Vec<String> = Vec::new();
- let mut skipped: Vec<String> = Vec::new();
- let mut failed: Vec<FailedInstall> = Vec::new();
- let mut total_bytes: u64 = 0;
-
- let mut futures = FuturesUnordered::new();
- let max_parallel = 4;
-
- let mut iter = target_pets.into_iter();
- for _ in 0..max_parallel {
- if let Some(pet) = iter.next() {
- let app_data_arc = app_data_arc.clone();
- futures.push(install_one(app_data_arc, pet, false));
- }
- }
-
- let mut current: u32 = 0;
- while let Some(result) = futures.next().await {
- current += 1;
- match result {
- Ok((slug, bytes, entry)) => {
- total_bytes += bytes;
- let mut g = manifest_arc.lock().await;
- g.pets.insert(slug.clone(), entry);
- g.last_synced_at = Some(now_iso());
- let _ = save_atomic(&app_data_dir, &g);
- drop(g);
- let _ = app.emit(
- "pets:sync:progress",
- ProgressEvent {
- slug: &slug,
- current,
- total,
- bytes_downloaded: total_bytes,
- bytes_total: 0,
- },
- );
- added.push(slug);
- }
- Err(err) => {
- if err.reason == "already installed" {
- skipped.push(err.slug);
- } else {
- let _ = app.emit(
- "pets:sync:error",
- serde_json::json!({
- "slug": err.slug,
- "message": err.reason,
- "retryable": false,
- }),
- );
- failed.push(err);
- }
- }
- }
- if let Some(pet) = iter.next() {
- let app_data_arc = app_data_arc.clone();
- futures.push(install_one(app_data_arc, pet, false));
- }
- }
-
- {
- let mut g = manifest_arc.lock().await;
- g.last_synced_at = Some(now_iso());
- g.last_remote_manifest_at = remote.generated_at.clone();
- let _ = save_atomic(&app_data_dir, &g);
- }
-
- let report = InstallReport {
- added,
- skipped,
- failed,
- total_bytes,
- duration_ms: started.elapsed().as_millis() as u64,
- };
- let _ = app.emit("pets:sync:finished", &report);
- report
-}
-
-pub async fn install_bundle(
- app: AppHandle,
- app_data_dir: std::path::PathBuf,
- remote: RemoteManifest,
-) -> InstallReport {
- let started = std::time::Instant::now();
- let _ = ensure_root(&app_data_dir);
- let bundle_url = remote
- .all_pets_pack_path
- .clone()
- .unwrap_or_else(|| fallback_bundle_url().to_string());
- let _ = app.emit(
- "pets:sync:started",
- StartedEvent {
- kind: "bundle".to_string(),
- expected: remote.total,
- },
- );
-
- let zip_bytes = match fetch_bundle_zip(&bundle_url).await {
- Ok(b) => b,
- Err(e) => {
- let report = InstallReport {
- added: vec![],
- skipped: vec![],
- failed: vec![FailedInstall {
- slug: "bundle".to_string(),
- reason: format!("bundle download: {}", e),
- }],
- total_bytes: 0,
- duration_ms: started.elapsed().as_millis() as u64,
- };
- let _ = app.emit("pets:sync:finished", &report);
- return report;
- }
- };
-
- let mut manifest = load(&app_data_dir);
- let local_known: std::collections::HashSet<String> = manifest.pets.keys().cloned().collect();
- let mut added: Vec<String> = Vec::new();
- let mut skipped: Vec<String> = Vec::new();
- let mut failed: Vec<FailedInstall> = Vec::new();
- let mut total_bytes: u64 = 0;
-
- let result = (|| -> anyhow::Result<()> {
- let cursor = Cursor::new(zip_bytes);
- let mut archive = zip::ZipArchive::new(cursor)?;
- let mut by_slug: std::collections::BTreeMap<String, Vec<(String, Vec<u8>)>> =
- std::collections::BTreeMap::new();
- for i in 0..archive.len() {
- let mut entry = archive.by_index(i)?;
- if !entry.is_file() {
- continue;
- }
- let raw_name = match entry.enclosed_name() {
- Some(n) => n.to_path_buf(),
- None => continue,
- };
- let parts: Vec<String> = raw_name
- .components()
- .filter_map(|c| c.as_os_str().to_str().map(|s| s.to_string()))
- .collect();
- if parts.len() < 2 {
- continue;
- }
- let slug = parts[parts.len() - 2].clone();
- let file_name = parts[parts.len() - 1].clone();
- let mut bytes: Vec<u8> = Vec::new();
- entry.read_to_end(&mut bytes)?;
- by_slug.entry(slug).or_default().push((file_name, bytes));
- }
-
- for (slug, files) in by_slug {
- if local_known.contains(&slug) {
- skipped.push(slug);
- continue;
- }
- let dir = pet_dir(&app_data_dir, &slug);
- if let Err(e) = std::fs::create_dir_all(&dir) {
- failed.push(FailedInstall {
- slug: slug.clone(),
- reason: format!("mkdir: {}", e),
- });
- continue;
- }
- let mut sprite_ext = "webp".to_string();
- let mut sizes: BTreeMap<String, u64> = BTreeMap::new();
- let mut display_name = slug.clone();
- let mut vibes: Vec<String> = Vec::new();
- let mut tags: Vec<String> = Vec::new();
- let mut kind: Option<String> = None;
- let mut wrote_sprite = false;
- for (name, bytes) in files {
- let lower = name.to_lowercase();
- let dest = dir.join(&name);
- if lower == "spritesheet.webp" || lower == "spritesheet.png" {
- sprite_ext = if lower.ends_with(".png") {
- "png".into()
- } else {
- "webp".into()
- };
- if atomic_write(&dest, &bytes).is_ok() {
- sizes.insert("spritesheet".into(), bytes.len() as u64);
- wrote_sprite = true;
- }
- } else if lower == "pet.json" {
- if atomic_write(&dest, &bytes).is_ok() {
- sizes.insert("pet.json".into(), bytes.len() as u64);
- if let Ok(v) = serde_json::from_slice::<serde_json::Value>(&bytes) {
- if let Some(name) = v.get("displayName").and_then(|s| s.as_str()) {
- display_name = name.to_string();
- }
- }
- }
- } else if lower == "metadata.json" {
- if atomic_write(&dest, &bytes).is_ok() {
- if let Ok(v) = serde_json::from_slice::<serde_json::Value>(&bytes) {
- if let Some(name) = v.get("displayName").and_then(|s| s.as_str()) {
- display_name = name.to_string();
- }
- if let Some(arr) = v.get("vibes").and_then(|s| s.as_array()) {
- vibes = arr
- .iter()
- .filter_map(|x| x.as_str().map(|s| s.to_string()))
- .collect();
- }
- if let Some(arr) = v.get("tags").and_then(|s| s.as_array()) {
- tags = arr
- .iter()
- .filter_map(|x| x.as_str().map(|s| s.to_string()))
- .collect();
- }
- if let Some(k) = v.get("kind").and_then(|s| s.as_str()) {
- kind = Some(k.to_string());
- }
- }
- }
- } else {
- let _ = atomic_write(&dest, &bytes);
- }
- total_bytes += bytes.len() as u64;
- }
- if !wrote_sprite {
- failed.push(FailedInstall {
- slug: slug.clone(),
- reason: "no spritesheet in bundle entry".to_string(),
- });
- continue;
- }
- let entry = LocalPetEntry {
- slug: slug.clone(),
- display_name,
- source: "bundle".to_string(),
- installed_at: now_iso(),
- vibes,
- tags,
- kind,
- sprite_ext,
- file_sizes: sizes,
- remote_checked_at: Some(now_iso()),
- };
- manifest.pets.insert(slug.clone(), entry);
- let _ = app.emit(
- "pets:sync:progress",
- ProgressEvent {
- slug: &slug,
- current: added.len() as u32 + 1,
- total: remote.total,
- bytes_downloaded: total_bytes,
- bytes_total: 0,
- },
- );
- added.push(slug);
- let _ = save_atomic(&app_data_dir, &manifest);
- }
- Ok(())
- })();
-
- if let Err(e) = result {
- failed.push(FailedInstall {
- slug: "bundle".to_string(),
- reason: format!("zip: {}", e),
- });
- }
-
- manifest.last_synced_at = Some(now_iso());
- manifest.last_remote_manifest_at = remote.generated_at.clone();
- let _ = save_atomic(&app_data_dir, &manifest);
-
- let report = InstallReport {
- added,
- skipped,
- failed,
- total_bytes,
- duration_ms: started.elapsed().as_millis() as u64,
- };
- let _ = app.emit("pets:sync:finished", &report);
- report
-}
-
-pub async fn force_refresh(
- app: AppHandle,
- app_data_dir: std::path::PathBuf,
- remote: RemoteManifest,
- slug: String,
-) -> InstallReport {
- let started = std::time::Instant::now();
- let pet = remote.pets.into_iter().find(|p| p.slug == slug);
- let Some(pet) = pet else {
- let _ = app.emit(
- "pets:sync:error",
- serde_json::json!({
- "slug": slug,
- "message": "slug not in remote manifest",
- "retryable": false,
- }),
- );
- return InstallReport {
- added: vec![],
- skipped: vec![],
- failed: vec![FailedInstall {
- slug,
- reason: "not in remote manifest".to_string(),
- }],
- total_bytes: 0,
- duration_ms: started.elapsed().as_millis() as u64,
- };
- };
- let app_data_arc = Arc::new(app_data_dir.clone());
- let result = install_one(app_data_arc, pet, true).await;
- let mut manifest = load(&app_data_dir);
- let mut added = vec![];
- let mut failed = vec![];
- let mut total_bytes = 0u64;
- match result {
- Ok((s, bytes, entry)) => {
- total_bytes = bytes;
- manifest.pets.insert(s.clone(), entry);
- manifest.last_synced_at = Some(now_iso());
- let _ = save_atomic(&app_data_dir, &manifest);
- added.push(s);
- }
- Err(e) => failed.push(e),
- }
- let report = InstallReport {
- added,
- skipped: vec![],
- failed,
- total_bytes,
- duration_ms: started.elapsed().as_millis() as u64,
- };
- let _ = app.emit("pets:sync:finished", &report);
- report
-}
-
-pub fn uninstall(app_data_dir: &Path, slug: &str) -> std::io::Result<()> {
- let dir = pet_dir(app_data_dir, slug);
- if dir.exists() {
- std::fs::remove_dir_all(&dir)?;
- }
- let mut manifest = load(app_data_dir);
- manifest.pets.remove(slug);
- save_atomic(app_data_dir, &manifest)?;
- Ok(())
-}
-
-pub fn manifest_file(app_data_dir: &Path) -> std::path::PathBuf {
- manifest_path(app_data_dir)
-}
diff --git a/src-tauri/src/pets/manifest.rs b/src-tauri/src/pets/manifest.rs
deleted file mode 100644
index ca14ddcd..00000000
--- a/src-tauri/src/pets/manifest.rs
+++ /dev/null
@@ -1,160 +0,0 @@
-use std::collections::BTreeMap;
-use std::path::{Path, PathBuf};
-
-use serde::{Deserialize, Serialize};
-
-pub const MANIFEST_VERSION: u32 = 1;
-const MANIFEST_NAME: &str = "manifest.local.json";
-
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct LocalManifest {
- pub version: u32,
- pub last_synced_at: Option<String>,
- pub last_remote_manifest_at: Option<String>,
- pub pets: BTreeMap<String, LocalPetEntry>,
-}
-
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct LocalPetEntry {
- pub slug: String,
- pub display_name: String,
- pub source: String,
- pub installed_at: String,
- #[serde(default)]
- pub vibes: Vec<String>,
- #[serde(default)]
- pub tags: Vec<String>,
- #[serde(default)]
- pub kind: Option<String>,
- pub sprite_ext: String,
- #[serde(default)]
- pub file_sizes: BTreeMap<String, u64>,
- #[serde(default)]
- pub remote_checked_at: Option<String>,
-}
-
-impl Default for LocalManifest {
- fn default() -> Self {
- Self {
- version: MANIFEST_VERSION,
- last_synced_at: None,
- last_remote_manifest_at: None,
- pets: BTreeMap::new(),
- }
- }
-}
-
-pub fn pets_root(app_data_dir: &Path) -> PathBuf {
- app_data_dir.join("pets")
-}
-
-pub fn manifest_path(app_data_dir: &Path) -> PathBuf {
- pets_root(app_data_dir).join(MANIFEST_NAME)
-}
-
-pub fn pet_dir(app_data_dir: &Path, slug: &str) -> PathBuf {
- pets_root(app_data_dir).join(slug)
-}
-
-pub fn ensure_root(app_data_dir: &Path) -> std::io::Result<PathBuf> {
- let root = pets_root(app_data_dir);
- std::fs::create_dir_all(&root)?;
- Ok(root)
-}
-
-pub fn load(app_data_dir: &Path) -> LocalManifest {
- let path = manifest_path(app_data_dir);
- let raw = std::fs::read_to_string(&path).unwrap_or_default();
- if raw.is_empty() {
- return LocalManifest::default();
- }
- serde_json::from_str(&raw).unwrap_or_default()
-}
-
-pub fn save_atomic(app_data_dir: &Path, manifest: &LocalManifest) -> std::io::Result<()> {
- let _ = ensure_root(app_data_dir)?;
- let final_path = manifest_path(app_data_dir);
- let tmp_path = final_path.with_extension("json.tmp");
- let bytes = serde_json::to_vec_pretty(manifest)
- .map_err(|e| std::io::Error::new(std::io::ErrorKind::InvalidData, e))?;
- std::fs::write(&tmp_path, bytes)?;
- if final_path.exists() {
- std::fs::remove_file(&final_path)?;
- }
- std::fs::rename(&tmp_path, &final_path)?;
- Ok(())
-}
-
-pub fn now_iso() -> String {
- chrono::Utc::now().to_rfc3339()
-}
-
-pub fn discover_local_pets(
- app_data_dir: &Path,
- manifest: &mut LocalManifest,
-) -> std::io::Result<()> {
- let root = pets_root(app_data_dir);
- let mut existing_slugs: Vec<String> = manifest.pets.keys().cloned().collect();
- if !root.exists() {
- return Ok(());
- }
- let entries = match std::fs::read_dir(&root) {
- Ok(it) => it,
- Err(_) => return Ok(()),
- };
- let mut seen_on_disk: Vec<String> = Vec::new();
- for entry in entries.flatten() {
- if !entry.file_type().map(|t| t.is_dir()).unwrap_or(false) {
- continue;
- }
- let slug = match entry.file_name().to_str().map(|s| s.to_string()) {
- Some(s) => s,
- None => continue,
- };
- let dir = entry.path();
- let webp = dir.join("spritesheet.webp");
- let png = dir.join("spritesheet.png");
- let ext = if webp.is_file() {
- Some("webp")
- } else if png.is_file() {
- Some("png")
- } else {
- None
- };
- let Some(ext) = ext else { continue };
- seen_on_disk.push(slug.clone());
- if manifest.pets.contains_key(&slug) {
- continue;
- }
- let pet_json = dir.join("pet.json");
- let display_name = std::fs::read_to_string(&pet_json)
- .ok()
- .and_then(|raw| serde_json::from_str::<serde_json::Value>(&raw).ok())
- .and_then(|v| {
- v.get("displayName")
- .or_else(|| v.get("display_name"))
- .and_then(|s| s.as_str().map(|s| s.to_string()))
- })
- .unwrap_or_else(|| slug.clone());
- manifest.pets.insert(
- slug.clone(),
- LocalPetEntry {
- slug: slug.clone(),
- display_name,
- source: "manual".to_string(),
- installed_at: now_iso(),
- vibes: Vec::new(),
- tags: Vec::new(),
- kind: None,
- sprite_ext: ext.to_string(),
- file_sizes: BTreeMap::new(),
- remote_checked_at: None,
- },
- );
- }
- existing_slugs.retain(|slug| !seen_on_disk.contains(slug));
- for orphan in existing_slugs {
- manifest.pets.remove(&orphan);
- }
- Ok(())
-}
diff --git a/src-tauri/src/pets/mod.rs b/src-tauri/src/pets/mod.rs
deleted file mode 100644
index 81c6bdbc..00000000
--- a/src-tauri/src/pets/mod.rs
+++ /dev/null
@@ -1,290 +0,0 @@
-pub mod download;
-pub mod install;
-pub mod manifest;
-
-use std::path::PathBuf;
-
-use serde::{Deserialize, Serialize};
-use tauri::{AppHandle, Emitter, Manager};
-use tokio::sync::Mutex;
-
-use download::{fetch_manifest, RemoteManifest};
-use install::{
- diff as compute_diff, force_refresh as install_force_refresh,
- install_bundle as install_bundle_impl, install_missing as install_missing_impl, refresh_index,
- uninstall as uninstall_impl, DiffReport, InstallReport, LocalIndex,
-};
-use manifest::{ensure_root, load, now_iso, pets_root, save_atomic};
-
-#[derive(Default)]
-pub struct PetsState {
- pub active_slug: Mutex<Option<String>>,
- pub remote_cache: Mutex<Option<RemoteManifest>>,
- pub display_prefs_cache: Mutex<Option<DisplayPrefs>>,
-}
-
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct DisplayPrefs {
- pub enabled: bool,
- pub motion_enabled: bool,
- pub default_state: String,
- pub event_overrides: serde_json::Map<String, serde_json::Value>,
-}
-
-impl Default for DisplayPrefs {
- fn default() -> Self {
- Self {
- enabled: true,
- motion_enabled: true,
- default_state: "idle".to_string(),
- event_overrides: serde_json::Map::new(),
- }
- }
-}
-
-fn prefs_file(app: &AppHandle) -> Result<PathBuf, String> {
- let dir = app_data_path(app)?;
- Ok(pets_root(&dir).join("display_prefs.json"))
-}
-
-fn read_prefs(app: &AppHandle) -> DisplayPrefs {
- let Ok(path) = prefs_file(app) else {
- return DisplayPrefs::default();
- };
- let raw = match std::fs::read_to_string(&path) {
- Ok(s) => s,
- Err(_) => return DisplayPrefs::default(),
- };
- serde_json::from_str(&raw).unwrap_or_default()
-}
-
-fn write_prefs(app: &AppHandle, prefs: &DisplayPrefs) -> Result<(), String> {
- let dir = app_data_path(app)?;
- ensure_root(&dir).map_err(|e| e.to_string())?;
- let path = prefs_file(app)?;
- let body = serde_json::to_vec_pretty(prefs).map_err(|e| e.to_string())?;
- std::fs::write(&path, body).map_err(|e| e.to_string())
-}
-
-#[derive(Debug, Clone, Serialize, Deserialize)]
-pub struct ActivePref {
- pub slug: String,
-}
-
-fn app_data_path(app: &AppHandle) -> Result<PathBuf, String> {
- app.path()
- .app_data_dir()
- .map_err(|e| format!("app_data_dir: {}", e))
-}
-
-fn pref_file(app: &AppHandle) -> Result<PathBuf, String> {
- let dir = app_data_path(app)?;
- Ok(pets_root(&dir).join("active.json"))
-}
-
-fn read_active(app: &AppHandle) -> Option<String> {
- let path = pref_file(app).ok()?;
- let raw = std::fs::read_to_string(&path).ok()?;
- let v: serde_json::Value = serde_json::from_str(&raw).ok()?;
- v.get("slug")
- .and_then(|s| s.as_str())
- .map(|s| s.to_string())
-}
-
-fn write_active(app: &AppHandle, slug: &str) -> Result<(), String> {
- let dir = app_data_path(app)?;
- ensure_root(&dir).map_err(|e| e.to_string())?;
- let path = pref_file(app)?;
- let body = serde_json::json!({ "slug": slug });
- std::fs::write(&path, serde_json::to_vec_pretty(&body).unwrap_or_default())
- .map_err(|e| e.to_string())
-}
-
-#[tauri::command]
-pub async fn pets_get_local_index(app: AppHandle) -> Result<LocalIndex, String> {
- let dir = app_data_path(&app)?;
- refresh_index(&dir).map_err(|e| e.to_string())
-}
-
-#[tauri::command]
-pub async fn pets_fetch_remote_manifest(
- app: AppHandle,
- state: tauri::State<'_, PetsState>,
-) -> Result<RemoteManifest, String> {
- let manifest = fetch_manifest().await.map_err(|e| e.to_string())?;
- *state.remote_cache.lock().await = Some(manifest.clone());
- let _ = app;
- Ok(manifest)
-}
-
-#[tauri::command]
-pub async fn pets_diff(
- app: AppHandle,
- state: tauri::State<'_, PetsState>,
-) -> Result<DiffReport, String> {
- let dir = app_data_path(&app)?;
- let local = refresh_index(&dir).map_err(|e| e.to_string())?;
- let remote = fetch_manifest().await.map_err(|e| e.to_string())?;
- *state.remote_cache.lock().await = Some(remote.clone());
- let mut local_manifest = load(&dir);
- local_manifest.last_remote_manifest_at = remote.generated_at.clone();
- let _ = save_atomic(&dir, &local_manifest);
- Ok(compute_diff(&local, &remote))
-}
-
-#[tauri::command]
-pub async fn pets_install_bundle(
- app: AppHandle,
- state: tauri::State<'_, PetsState>,
-) -> Result<InstallReport, String> {
- let dir = app_data_path(&app)?;
- let remote = match state.remote_cache.lock().await.clone() {
- Some(m) => m,
- None => fetch_manifest().await.map_err(|e| e.to_string())?,
- };
- Ok(install_bundle_impl(app, dir, remote).await)
-}
-
-#[tauri::command]
-pub async fn pets_install_missing(
- app: AppHandle,
- state: tauri::State<'_, PetsState>,
- slugs: Option<Vec<String>>,
-) -> Result<InstallReport, String> {
- let dir = app_data_path(&app)?;
- let remote = match state.remote_cache.lock().await.clone() {
- Some(m) => m,
- None => fetch_manifest().await.map_err(|e| e.to_string())?,
- };
- Ok(install_missing_impl(app, dir, remote, slugs).await)
-}
-
-#[tauri::command]
-pub async fn pets_force_refresh(
- app: AppHandle,
- state: tauri::State<'_, PetsState>,
- slug: String,
-) -> Result<InstallReport, String> {
- let dir = app_data_path(&app)?;
- let remote = match state.remote_cache.lock().await.clone() {
- Some(m) => m,
- None => fetch_manifest().await.map_err(|e| e.to_string())?,
- };
- Ok(install_force_refresh(app, dir, remote, slug).await)
-}
-
-#[tauri::command]
-pub async fn pets_uninstall(app: AppHandle, slug: String) -> Result<(), String> {
- let dir = app_data_path(&app)?;
- uninstall_impl(&dir, &slug).map_err(|e| e.to_string())
-}
-
-#[tauri::command]
-pub async fn pets_open_folder(app: AppHandle) -> Result<(), String> {
- let dir = app_data_path(&app)?;
- let root = pets_root(&dir);
- ensure_root(&dir).map_err(|e| e.to_string())?;
- open_native_folder(&root)
-}
-
-fn open_native_folder(path: &std::path::Path) -> Result<(), String> {
- #[cfg(target_os = "windows")]
- {
- std::process::Command::new("explorer")
- .arg(path)
- .spawn()
- .map(|_| ())
- .map_err(|e| e.to_string())
- }
- #[cfg(target_os = "macos")]
- {
- std::process::Command::new("open")
- .arg(path)
- .spawn()
- .map(|_| ())
- .map_err(|e| e.to_string())
- }
- #[cfg(target_os = "linux")]
- {
- std::process::Command::new("xdg-open")
- .arg(path)
- .spawn()
- .map(|_| ())
- .map_err(|e| e.to_string())
- }
-}
-
-#[tauri::command]
-pub async fn pets_set_active(
- app: AppHandle,
- state: tauri::State<'_, PetsState>,
- slug: String,
-) -> Result<(), String> {
- write_active(&app, &slug)?;
- *state.active_slug.lock().await = Some(slug);
- Ok(())
-}
-
-#[tauri::command]
-pub async fn pets_get_active(
- app: AppHandle,
- state: tauri::State<'_, PetsState>,
-) -> Result<Option<String>, String> {
- {
- let g = state.active_slug.lock().await;
- if let Some(s) = g.clone() {
- return Ok(Some(s));
- }
- }
- let stored = read_active(&app);
- *state.active_slug.lock().await = stored.clone();
- Ok(stored)
-}
-
-#[tauri::command]
-pub async fn pets_get_display_prefs(
- app: AppHandle,
- state: tauri::State<'_, PetsState>,
-) -> Result<DisplayPrefs, String> {
- {
- let g = state.display_prefs_cache.lock().await;
- if let Some(p) = g.clone() {
- return Ok(p);
- }
- }
- let prefs = read_prefs(&app);
- *state.display_prefs_cache.lock().await = Some(prefs.clone());
- Ok(prefs)
-}
-
-#[tauri::command]
-pub async fn pets_set_display_prefs(
- app: AppHandle,
- state: tauri::State<'_, PetsState>,
- prefs: DisplayPrefs,
-) -> Result<DisplayPrefs, String> {
- write_prefs(&app, &prefs)?;
- *state.display_prefs_cache.lock().await = Some(prefs.clone());
- let _ = app.emit("pets:prefs:changed", &prefs);
- Ok(prefs)
-}
-
-#[tauri::command]
-pub async fn pets_resolve_path(app: AppHandle, slug: String) -> Result<String, String> {
- let dir = app_data_path(&app)?;
- let pet_dir = pets_root(&dir).join(&slug);
- let webp = pet_dir.join("spritesheet.webp");
- let png = pet_dir.join("spritesheet.png");
- let path = if webp.is_file() {
- webp
- } else if png.is_file() {
- png
- } else {
- return Err(format!("no spritesheet for slug '{}'", slug));
- };
- Ok(path.to_string_lossy().into_owned())
-}
-
-pub fn _now_iso_export() -> String {
- now_iso()
-}
diff --git a/src-tauri/src/platforms/instagram/mod.rs b/src-tauri/src/platforms/instagram/mod.rs
index 743417a8..97747c68 100644
--- a/src-tauri/src/platforms/instagram/mod.rs
+++ b/src-tauri/src/platforms/instagram/mod.rs
@@ -896,6 +896,9 @@ mod tests {
torrent_listen_port: None,
torrent_id_slot: None,
custom_ytdlp_args: None,
+ torrent_files: None,
+ torrent_auto_trackers: false,
+ torrent_upnp: false,
}
}
diff --git a/src-tauri/src/platforms/magnet/mod.rs b/src-tauri/src/platforms/magnet/mod.rs
index ab74f3a2..ee0d60a6 100644
--- a/src-tauri/src/platforms/magnet/mod.rs
+++ b/src-tauri/src/platforms/magnet/mod.rs
@@ -117,10 +117,12 @@ impl PlatformDownloader for MagnetDownloader {
listen_port,
output_dir.display()
);
+ let enable_upnp = opts.torrent_upnp;
let make_opts = |disable_dht_persistence: bool, disable_dht: bool| SessionOptions {
listen_port_range: Some(listen_port..listen_port.saturating_add(10)),
disable_dht,
disable_dht_persistence,
+ enable_upnp_port_forwarding: enable_upnp,
..Default::default()
};
let cancel_rx = opts.cancel_token.clone();
@@ -178,8 +180,25 @@ impl PlatformDownloader for MagnetDownloader {
AddTorrent::from_url(url)
}
};
+ let only_files = opts
+ .torrent_files
+ .as_ref()
+ .filter(|v| !v.is_empty())
+ .cloned();
+ if let Some(sel) = &only_files {
+ tracing::info!("[magnet] selective download: {} file(s)", sel.len());
+ }
+ let trackers = if opts.torrent_auto_trackers {
+ let list = crate::core::trackers::extra_trackers();
+ tracing::info!("[magnet] injecting {} public trackers", list.len());
+ Some(list)
+ } else {
+ None
+ };
let torrent_opts = AddTorrentOptions {
overwrite: true,
+ only_files,
+ trackers,
..Default::default()
};
diff --git a/src-tauri/src/tray.rs b/src-tauri/src/tray.rs
index 6b0c479f..5c532346 100644
--- a/src-tauri/src/tray.rs
+++ b/src-tauri/src/tray.rs
@@ -1,21 +1,27 @@
use std::collections::hash_map::DefaultHasher;
use std::collections::HashMap;
use std::hash::{Hash, Hasher};
-use std::sync::atomic::{AtomicU32, Ordering};
+use std::sync::atomic::{AtomicU32, AtomicU64, Ordering};
use std::sync::Mutex;
use std::sync::OnceLock;
+use std::time::{SystemTime, UNIX_EPOCH};
use tauri::{
image::Image,
- menu::{MenuBuilder, MenuItem, MenuItemBuilder},
+ menu::{MenuBuilder, MenuItem, MenuItemBuilder, Submenu, SubmenuBuilder},
tray::TrayIconBuilder,
AppHandle, Emitter, Manager, Wry,
};
static DOWNLOADS_ITEM: OnceLock<MenuItem<Wry>> = OnceLock::new();
+static CHANNELS_SUBMENU: OnceLock<Submenu<Wry>> = OnceLock::new();
static BASE_ICON: OnceLock<(Vec<u8>, u32, u32)> = OnceLock::new();
static LAST_ACTIVE: AtomicU32 = AtomicU32::new(0);
static ICON_COUNT: AtomicU32 = AtomicU32::new(0);
+static LAST_TOOLTIP_MS: AtomicU64 = AtomicU64::new(0);
+static LAST_SPEED_BUCKET: AtomicU64 = AtomicU64::new(u64::MAX);
+
+const SPEED_TOOLTIP_MIN_INTERVAL_MS: u64 = 2000;
static BADGE_CACHE: OnceLock<Mutex<BadgeCache>> = OnceLock::new();
struct BadgeCache {
@@ -60,10 +66,17 @@ pub fn setup(app: &AppHandle) -> tauri::Result<()> {
DOWNLOADS_ITEM.set(downloads_item.clone()).ok();
let quit_item = MenuItemBuilder::with_id("quit", "Quit").build(app)?;
+ // Empty, hidden until the frontend pushes localized channel labels via
+ // sync_channels_tray (the tray menu is native — $t is not reachable here).
+ let channels_submenu = SubmenuBuilder::new(app, "Channels").build()?;
+ channels_submenu.set_enabled(false).ok();
+ CHANNELS_SUBMENU.set(channels_submenu.clone()).ok();
+
let menu = MenuBuilder::new(app)
.item(&open_item)
.separator()
.item(&downloads_item)
+ .item(&channels_submenu)
.separator()
.item(&quit_item)
.build()?;
@@ -86,7 +99,15 @@ pub fn setup(app: &AppHandle) -> tauri::Result<()> {
"quit" => {
request_quit(app);
}
- _ => {}
+ other => {
+ if let Some(channel_id) = other.strip_prefix("chk:") {
+ let app = app.clone();
+ let channel_id = channel_id.to_string();
+ tauri::async_runtime::spawn(async move {
+ let _ = crate::core::channel_poller::check_now(&app, &channel_id).await;
+ });
+ }
+ }
})
.on_tray_icon_event(|tray, event| {
if let tauri::tray::TrayIconEvent::Click {
@@ -103,6 +124,30 @@ pub fn setup(app: &AppHandle) -> tauri::Result<()> {
Ok(())
}
+// Repopulates the Channels submenu with the localized labels the frontend
+// resolved via $t. Each entry id is "chk:{channel_id}" so on_menu_event can
+// route a click to an immediate check. Only the submenu is touched — the rest
+// of the tray menu (and DOWNLOADS_ITEM) is left intact.
+pub fn rebuild_menu(
+ app: &AppHandle,
+ header: String,
+ channels: Vec<(String, String)>,
+) -> tauri::Result<()> {
+ let Some(submenu) = CHANNELS_SUBMENU.get() else {
+ return Ok(());
+ };
+ submenu.set_text(header)?;
+ while !submenu.items()?.is_empty() {
+ submenu.remove_at(0)?;
+ }
+ for (id, title) in &channels {
+ let item = MenuItemBuilder::with_id(format!("chk:{}", id), title).build(app)?;
+ submenu.append(&item)?;
+ }
+ submenu.set_enabled(!channels.is_empty()).ok();
+ Ok(())
+}
+
pub fn update_active_count(app: &AppHandle, count: u32) {
if let Some(item) = DOWNLOADS_ITEM.get() {
let _ = item.set_text(active_label(count));
@@ -112,6 +157,9 @@ pub fn update_active_count(app: &AppHandle, count: u32) {
if prev == count {
return;
}
+ if count == 0 {
+ LAST_SPEED_BUCKET.store(u64::MAX, Ordering::Relaxed);
+ }
if let Some(tray) = app.tray_by_id("main-tray") {
let tooltip = if count > 0 {
@@ -137,6 +185,57 @@ pub fn update_active_count(app: &AppHandle, count: u32) {
}
}
+fn now_ms() -> u64 {
+ SystemTime::now()
+ .duration_since(UNIX_EPOCH)
+ .map(|d| d.as_millis() as u64)
+ .unwrap_or(0)
+}
+
+fn format_speed(bps: f64) -> String {
+ if bps < 1024.0 * 1024.0 {
+ format!("{:.0} KB/s", bps / 1024.0)
+ } else {
+ format!("{:.1} MB/s", bps / (1024.0 * 1024.0))
+ }
+}
+
+// Speed lives only in the tooltip (the discreet channel) — the icon stays
+// count-gated because icon re-render is expensive. Writes are hard-throttled
+// and deduped so frequent progress ticks can't flood the system tray.
+pub fn update_speed_tooltip(app: &AppHandle, count: u32, total_speed_bps: f64) {
+ if count == 0 {
+ return;
+ }
+
+ let now = now_ms();
+ let last = LAST_TOOLTIP_MS.load(Ordering::Relaxed);
+ if now.saturating_sub(last) < SPEED_TOOLTIP_MIN_INTERVAL_MS {
+ return;
+ }
+
+ let speed_tenths = (total_speed_bps / (1024.0 * 1024.0) * 10.0).round() as u64;
+ let bucket = (count as u64) << 32 | speed_tenths;
+ if LAST_SPEED_BUCKET.load(Ordering::Relaxed) == bucket {
+ return;
+ }
+ LAST_SPEED_BUCKET.store(bucket, Ordering::Relaxed);
+ LAST_TOOLTIP_MS.store(now, Ordering::Relaxed);
+
+ if let Some(tray) = app.tray_by_id("main-tray") {
+ let tooltip = if total_speed_bps > 0.0 {
+ format!(
+ "OmniGet — {} active · {}",
+ count,
+ format_speed(total_speed_bps)
+ )
+ } else {
+ format!("OmniGet — {} active", count)
+ };
+ let _ = tray.set_tooltip(Some(&tooltip));
+ }
+}
+
pub fn compute_total_active(app: &AppHandle) -> u32 {
let state = app.state::<crate::AppState>();
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index 5c0bae7e..6c622ee1 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "omniget",
- "version": "0.6.1",
+ "version": "0.6.2",
"identifier": "wtf.tonho.omniget",
"build": {
"beforeDevCommand": "pnpm dev",
diff --git a/src/components/downloads/SubtitleWorkshop.svelte b/src/components/downloads/SubtitleWorkshop.svelte
new file mode 100644
index 00000000..97f128be
--- /dev/null
+++ b/src/components/downloads/SubtitleWorkshop.svelte
@@ -0,0 +1,432 @@
+<script lang="ts">
+ import { invoke } from "@tauri-apps/api/core";
+ import { open as openDialog, save as saveDialog } from "@tauri-apps/plugin-dialog";
+ import { t } from "$lib/i18n";
+ import { showToast } from "$lib/stores/toast-store.svelte";
+
+ let { onClose }: { onClose: () => void } = $props();
+
+ type Cue = { start_ms: number; end_ms: number; text: string };
+
+ let cues = $state<Cue[]>([]);
+ let loadedPath = $state("");
+ let busy = $state(false);
+ let shiftMs = $state(0);
+ let findText = $state("");
+ let replaceText = $state("");
+ let targetLang = $state("");
+ let peaks = $state<number[]>([]);
+ let shots = $state<number[]>([]);
+ let durationMs = $derived(cues.length ? cues[cues.length - 1].end_ms : 0);
+
+ function err(e: unknown) {
+ const raw = typeof e === "string" ? e : ($t("common.error") as string);
+ const msg =
+ raw === "ai_not_configured"
+ ? ($t("downloads.sw.not_configured") as string)
+ : raw === "translation_mismatch"
+ ? ($t("downloads.sw.translate_mismatch") as string)
+ : raw;
+ showToast("error", msg);
+ }
+
+ function fmt(ms: number): string {
+ const s = Math.floor(ms / 1000);
+ const h = Math.floor(s / 3600);
+ const m = Math.floor((s % 3600) / 60);
+ const sec = s % 60;
+ const milli = ms % 1000;
+ const p = (n: number, l = 2) => String(n).padStart(l, "0");
+ return `${p(h)}:${p(m)}:${p(sec)},${p(milli, 3)}`;
+ }
+
+ function parseTime(v: string, fallback: number): number {
+ const m = v.trim().match(/^(\d+):(\d{1,2}):(\d{1,2})[,.](\d{1,3})$/);
+ if (!m) return fallback;
+ return (
+ (parseInt(m[1]) * 3600 + parseInt(m[2]) * 60 + parseInt(m[3])) * 1000 +
+ parseInt(m[4].padEnd(3, "0"))
+ );
+ }
+
+ async function loadFile() {
+ const sel = await openDialog({
+ multiple: false,
+ filters: [{ name: "Subtitles", extensions: ["srt", "vtt"] }],
+ });
+ if (!sel || typeof sel !== "string") return;
+ busy = true;
+ try {
+ cues = await invoke<Cue[]>("subtitle_load", { path: sel });
+ loadedPath = sel;
+ peaks = [];
+ shots = [];
+ } catch (e) {
+ err(e);
+ } finally {
+ busy = false;
+ }
+ }
+
+ async function loadMedia() {
+ const sel = await openDialog({ multiple: false });
+ if (!sel || typeof sel !== "string") return;
+ busy = true;
+ try {
+ peaks = await invoke<number[]>("waveform_peaks", { input: sel, buckets: 600 });
+ shots = await invoke<number[]>("detect_shot_changes", { input: sel, threshold: 0.4 });
+ } catch (e) {
+ err(e);
+ } finally {
+ busy = false;
+ }
+ }
+
+ function applyShift() {
+ if (!shiftMs) return;
+ cues = cues.map((c) => ({
+ ...c,
+ start_ms: Math.max(0, c.start_ms + shiftMs),
+ end_ms: Math.max(0, c.end_ms + shiftMs),
+ }));
+ }
+
+ function applyReplace() {
+ if (!findText) return;
+ let n = 0;
+ cues = cues.map((c) => {
+ if (c.text.includes(findText)) n++;
+ return { ...c, text: c.text.split(findText).join(replaceText) };
+ });
+ showToast("info", $t("downloads.sw.replaced", { count: n }) as string);
+ }
+
+ function mergeWithNext(i: number) {
+ if (i >= cues.length - 1) return;
+ const a = cues[i];
+ const b = cues[i + 1];
+ const merged: Cue = {
+ start_ms: a.start_ms,
+ end_ms: b.end_ms,
+ text: `${a.text} ${b.text}`.trim(),
+ };
+ cues = [...cues.slice(0, i), merged, ...cues.slice(i + 2)];
+ }
+
+ function splitCue(i: number) {
+ const c = cues[i];
+ const mid = Math.floor((c.start_ms + c.end_ms) / 2);
+ if (mid <= c.start_ms || mid >= c.end_ms) return;
+ const words = c.text.split(/\s+/);
+ const half = Math.ceil(words.length / 2);
+ const first: Cue = {
+ start_ms: c.start_ms,
+ end_ms: mid,
+ text: words.slice(0, half).join(" "),
+ };
+ const second: Cue = {
+ start_ms: mid,
+ end_ms: c.end_ms,
+ text: words.slice(half).join(" "),
+ };
+ cues = [...cues.slice(0, i), first, second, ...cues.slice(i + 1)];
+ }
+
+ function qc(i: number): string | null {
+ const c = cues[i];
+ if (c.end_ms <= c.start_ms) return $t("downloads.sw.qc_negative") as string;
+ if (i < cues.length - 1 && cues[i + 1].start_ms < c.end_ms)
+ return $t("downloads.sw.qc_overlap") as string;
+ const secs = (c.end_ms - c.start_ms) / 1000;
+ const cps = secs > 0 ? c.text.replace(/\s/g, "").length / secs : 99;
+ if (cps > 21) return $t("downloads.sw.qc_fast") as string;
+ return null;
+ }
+
+ async function translateAll() {
+ if (!targetLang.trim() || !cues.length || busy) return;
+ busy = true;
+ try {
+ cues = await invoke<Cue[]>("subtitle_translate", {
+ cues,
+ targetLang: targetLang.trim(),
+ });
+ showToast("success", $t("downloads.sw.translated") as string);
+ } catch (e) {
+ err(e);
+ } finally {
+ busy = false;
+ }
+ }
+
+ async function saveAs(format: "srt" | "vtt") {
+ if (!cues.length) return;
+ const path = await saveDialog({
+ filters: [{ name: format.toUpperCase(), extensions: [format] }],
+ });
+ if (!path) return;
+ try {
+ await invoke("subtitle_save", { path, cues, format });
+ showToast("success", $t("downloads.sw.saved") as string);
+ } catch (e) {
+ err(e);
+ }
+ }
+</script>
+
+<div
+ class="overlay"
+ role="button"
+ tabindex="0"
+ onclick={(e) => { if (e.target === e.currentTarget) onClose(); }}
+ onkeydown={(e) => { if (e.key === "Escape") onClose(); }}
+>
+ <div class="panel" role="dialog" aria-modal="true" aria-label={$t('downloads.sw.title') as string}>
+ <div class="head">
+ <h2>{$t('downloads.sw.title')}</h2>
+ <button class="x" onclick={onClose} aria-label={$t('common.close') as string}>✕</button>
+ </div>
+
+ <div class="toolbar">
+ <button onclick={loadFile}>{$t('downloads.sw.open')}</button>
+ <button onclick={loadMedia} disabled={!cues.length}>{$t('downloads.sw.load_media')}</button>
+ <button class="primary" onclick={() => saveAs('srt')} disabled={!cues.length}>{$t('downloads.sw.save_srt')}</button>
+ <button class="primary" onclick={() => saveAs('vtt')} disabled={!cues.length}>{$t('downloads.sw.save_vtt')}</button>
+ </div>
+
+ {#if cues.length}
+ {#if peaks.length}
+ <div class="wave" aria-hidden="true">
+ {#each peaks as p, idx (idx)}
+ <span class="bar" style="height:{Math.max(2, p * 100)}%"></span>
+ {/each}
+ {#each shots as sec (sec)}
+ <span class="shot" style="left:{durationMs ? (sec * 1000 / durationMs) * 100 : 0}%"></span>
+ {/each}
+ </div>
+ {/if}
+
+ <div class="ops">
+ <div class="op">
+ <input type="number" bind:value={shiftMs} step="100" />
+ <button onclick={applyShift}>{$t('downloads.sw.shift')}</button>
+ </div>
+ <div class="op">
+ <input type="text" placeholder={$t('downloads.sw.find') as string} bind:value={findText} />
+ <input type="text" placeholder={$t('downloads.sw.replace') as string} bind:value={replaceText} />
+ <button onclick={applyReplace}>{$t('downloads.sw.replace_btn')}</button>
+ </div>
+ <div class="op">
+ <input type="text" placeholder={$t('downloads.sw.target_lang') as string} bind:value={targetLang} />
+ <button onclick={translateAll} disabled={busy}>{$t('downloads.sw.translate')}</button>
+ </div>
+ </div>
+
+ <div class="cues">
+ {#each cues as c, i (i)}
+ {@const flag = qc(i)}
+ <div class="cue" class:flagged={flag}>
+ <div class="times">
+ <input
+ type="text"
+ value={fmt(c.start_ms)}
+ onchange={(e) => (c.start_ms = parseTime((e.target as HTMLInputElement).value, c.start_ms))}
+ />
+ <input
+ type="text"
+ value={fmt(c.end_ms)}
+ onchange={(e) => (c.end_ms = parseTime((e.target as HTMLInputElement).value, c.end_ms))}
+ />
+ </div>
+ <textarea bind:value={c.text} rows="2"></textarea>
+ <div class="cue-actions">
+ <button onclick={() => splitCue(i)}>{$t('downloads.sw.split')}</button>
+ <button onclick={() => mergeWithNext(i)} disabled={i >= cues.length - 1}>{$t('downloads.sw.merge')}</button>
+ </div>
+ {#if flag}<span class="flag">{flag}</span>{/if}
+ </div>
+ {/each}
+ </div>
+ {:else}
+ <p class="empty">{$t('downloads.sw.empty')}</p>
+ {/if}
+ </div>
+</div>
+
+<style>
+ .overlay {
+ position: fixed;
+ inset: 0;
+ background: color-mix(in srgb, var(--bg) 70%, transparent);
+ backdrop-filter: blur(3px);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ z-index: 1000;
+ padding: 24px;
+ }
+
+ .panel {
+ background: var(--surface);
+ border: 1px solid var(--border);
+ border-radius: var(--border-radius);
+ width: min(900px, 100%);
+ max-height: 92vh;
+ overflow-y: auto;
+ padding: 20px;
+ display: flex;
+ flex-direction: column;
+ gap: 14px;
+ }
+
+ .head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ }
+
+ .head h2 {
+ margin: 0;
+ font-size: 18px;
+ }
+
+ .x {
+ background: none;
+ border: none;
+ color: var(--text);
+ cursor: pointer;
+ font-size: 16px;
+ }
+
+ .toolbar,
+ .ops,
+ .op {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+ align-items: center;
+ }
+
+ .ops {
+ flex-direction: column;
+ align-items: stretch;
+ }
+
+ button {
+ padding: 7px 12px;
+ border: 1px solid var(--border);
+ border-radius: var(--border-radius);
+ background: var(--button-elevated);
+ color: var(--text);
+ cursor: pointer;
+ }
+
+ button.primary {
+ background: var(--accent);
+ color: var(--on-accent);
+ border-color: transparent;
+ font-weight: 600;
+ }
+
+ button:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+
+ input,
+ textarea {
+ padding: 6px 8px;
+ border: 1px solid var(--border);
+ border-radius: var(--border-radius);
+ background: var(--bg);
+ color: var(--text);
+ font: inherit;
+ }
+
+ .op input[type="text"] {
+ flex: 1;
+ min-width: 100px;
+ }
+
+ .wave {
+ position: relative;
+ display: flex;
+ align-items: flex-end;
+ gap: 1px;
+ height: 56px;
+ background: var(--bg);
+ border: 1px solid var(--border);
+ border-radius: var(--border-radius);
+ padding: 2px;
+ overflow: hidden;
+ }
+
+ .bar {
+ flex: 1;
+ background: var(--accent);
+ opacity: 0.55;
+ min-width: 1px;
+ }
+
+ .shot {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ width: 1px;
+ background: var(--error);
+ }
+
+ .cues {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ }
+
+ .cue {
+ display: grid;
+ grid-template-columns: 130px 1fr auto;
+ gap: 8px;
+ align-items: start;
+ padding: 8px;
+ border: 1px solid var(--border);
+ border-radius: var(--border-radius);
+ }
+
+ .cue.flagged {
+ border-color: var(--warning);
+ }
+
+ .times {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ }
+
+ .times input {
+ width: 120px;
+ font-variant-numeric: tabular-nums;
+ }
+
+ .cue textarea {
+ resize: vertical;
+ width: 100%;
+ }
+
+ .cue-actions {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ }
+
+ .flag {
+ grid-column: 1 / -1;
+ font-size: 12px;
+ color: var(--warning);
+ }
+
+ .empty {
+ color: var(--gray);
+ text-align: center;
+ padding: 32px;
+ }
+</style>
diff --git a/src/components/downloads/ToolsPanel.svelte b/src/components/downloads/ToolsPanel.svelte
new file mode 100644
index 00000000..63b5216d
--- /dev/null
+++ b/src/components/downloads/ToolsPanel.svelte
@@ -0,0 +1,912 @@
+<script lang="ts">
+ import { invoke } from "@tauri-apps/api/core";
+ import { open as openDialog } from "@tauri-apps/plugin-dialog";
+ import { t } from "$lib/i18n";
+ import { showToast } from "$lib/stores/toast-store.svelte";
+ import { getSettings } from "$lib/stores/settings-store.svelte";
+ import SubtitleWorkshop from "$components/downloads/SubtitleWorkshop.svelte";
+
+ let wsOpen = $state(false);
+
+ let metaUrl = $state("");
+ let metaBusy = $state(false);
+
+ async function resolveOutputDir(): Promise<string | null> {
+ const settings = getSettings();
+ let dir = settings?.download.default_output_dir ?? "";
+ if (!dir) {
+ const sel = await openDialog({
+ directory: true,
+ title: $t("settings.download.default_output_dir") as string,
+ });
+ if (!sel || typeof sel !== "string") return null;
+ dir = sel;
+ }
+ return dir;
+ }
+
+ type Thumb = { url: string; width: number; height: number };
+ let thumbUrl = $state("");
+ let thumbBusy = $state(false);
+ let thumbTitle = $state("");
+ let thumbs = $state<Thumb[]>([]);
+ let thumbSavingUrl = $state<string | null>(null);
+
+ async function listThumbs() {
+ const url = thumbUrl.trim();
+ if (!url || thumbBusy) return;
+ thumbBusy = true;
+ thumbs = [];
+ thumbTitle = "";
+ try {
+ const res = await invoke<{ title: string; thumbnails: Thumb[] }>("thumbnails_list", {
+ url,
+ });
+ thumbTitle = res.title;
+ thumbs = res.thumbnails;
+ if (thumbs.length === 0) showToast("info", $t("tools.thumbnails_none") as string);
+ } catch (e: any) {
+ showToast("error", typeof e === "string" ? e : (e?.message ?? String(e)));
+ } finally {
+ thumbBusy = false;
+ }
+ }
+
+ async function saveThumb(thumb: Thumb) {
+ if (thumbSavingUrl) return;
+ thumbSavingUrl = thumb.url;
+ try {
+ const dir = await resolveOutputDir();
+ if (!dir) return;
+ const name =
+ thumb.width && thumb.height
+ ? `${thumbTitle}-${thumb.width}x${thumb.height}`
+ : thumbTitle;
+ const saved = await invoke<string>("thumbnail_save", {
+ thumbUrl: thumb.url,
+ outputDir: dir,
+ fileName: name,
+ });
+ showToast("success", $t("tools.thumbnails_saved", { name: saved }) as string);
+ } catch (e: any) {
+ showToast("error", typeof e === "string" ? e : (e?.message ?? String(e)));
+ } finally {
+ thumbSavingUrl = null;
+ }
+ }
+
+ type SubFormat = { ext: string; url: string };
+ type SubTrack = { lang: string; name: string; auto: boolean; formats: SubFormat[] };
+ let subUrl = $state("");
+ let subBusy = $state(false);
+ let subTitle = $state("");
+ let subTracks = $state<SubTrack[]>([]);
+ let subPrimaryIdx = $state(0);
+ let subPrimaryExt = $state("");
+ let subSecondaryIdx = $state(-1);
+ let subSaving = $state(false);
+
+ let subPrimary = $derived(subTracks[subPrimaryIdx]);
+ let subPrimaryFmt = $derived(
+ subPrimary?.formats.find((f) => f.ext === subPrimaryExt) ?? subPrimary?.formats[0],
+ );
+ let subSecondary = $derived(
+ subSecondaryIdx >= 0 ? subTracks[subSecondaryIdx] : undefined,
+ );
+ let subMergeable = $derived(
+ !!subSecondary &&
+ !!subPrimaryFmt &&
+ (subPrimaryFmt.ext === "srt" || subPrimaryFmt.ext === "vtt"),
+ );
+
+ function trackLabel(tk: SubTrack): string {
+ const base = tk.name && tk.name !== tk.lang ? `${tk.name} (${tk.lang})` : tk.lang;
+ return tk.auto ? `${base} · auto` : base;
+ }
+
+ async function listSubs() {
+ const url = subUrl.trim();
+ if (!url || subBusy) return;
+ subBusy = true;
+ subTracks = [];
+ subTitle = "";
+ subPrimaryIdx = 0;
+ subSecondaryIdx = -1;
+ try {
+ const res = await invoke<{ title: string; tracks: SubTrack[] }>("subtitles_list", {
+ url,
+ });
+ subTitle = res.title;
+ subTracks = res.tracks;
+ subPrimaryExt = res.tracks[0]?.formats[0]?.ext ?? "";
+ if (subTracks.length === 0) showToast("info", $t("tools.subs_none") as string);
+ } catch (e: any) {
+ showToast("error", typeof e === "string" ? e : (e?.message ?? String(e)));
+ } finally {
+ subBusy = false;
+ }
+ }
+
+ async function saveSub() {
+ if (subSaving || !subPrimary || !subPrimaryFmt) return;
+ subSaving = true;
+ try {
+ const dir = await resolveOutputDir();
+ if (!dir) return;
+ const saved = await invoke<string>("subtitles_save", {
+ subUrl: subPrimaryFmt.url,
+ ext: subPrimaryFmt.ext,
+ outputDir: dir,
+ fileName: `${subTitle}.${subPrimary.lang}`,
+ });
+ showToast("success", $t("tools.subs_saved", { name: saved }) as string);
+ } catch (e: any) {
+ showToast("error", typeof e === "string" ? e : (e?.message ?? String(e)));
+ } finally {
+ subSaving = false;
+ }
+ }
+
+ async function mergeSubs() {
+ if (subSaving || !subPrimary || !subPrimaryFmt || !subSecondary) return;
+ const secFmt =
+ subSecondary.formats.find((f) => f.ext === subPrimaryFmt!.ext) ??
+ subSecondary.formats[0];
+ if (!secFmt) return;
+ subSaving = true;
+ try {
+ const dir = await resolveOutputDir();
+ if (!dir) return;
+ const saved = await invoke<string>("subtitles_merge", {
+ primaryUrl: subPrimaryFmt.url,
+ secondaryUrl: secFmt.url,
+ format: subPrimaryFmt.ext,
+ outputDir: dir,
+ fileName: `${subTitle}.${subPrimary.lang}-${subSecondary.lang}`,
+ });
+ showToast("success", $t("tools.subs_saved", { name: saved }) as string);
+ } catch (e: any) {
+ showToast("error", typeof e === "string" ? e : (e?.message ?? String(e)));
+ } finally {
+ subSaving = false;
+ }
+ }
+
+ type Comment = {
+ id: string;
+ parent: string;
+ author: string;
+ text: string;
+ timestamp: number;
+ like_count: number;
+ is_uploader: boolean;
+ };
+ type Chapter = { start: number; end: number; title: string };
+ let ccUrl = $state("");
+ let ccBusy = $state(false);
+ let ccMax = $state(100);
+ let ccSort = $state<"top" | "new">("top");
+ let ccTitle = $state("");
+ let ccMode = $state<"comments" | "chapters" | null>(null);
+ let ccComments = $state<Comment[]>([]);
+ let ccChapters = $state<Chapter[]>([]);
+ let ccFilter = $state("");
+ let ccSaving = $state(false);
+
+ let ccFilteredComments = $derived(
+ ccFilter.trim()
+ ? ccComments.filter((c) =>
+ (c.author + " " + c.text).toLowerCase().includes(ccFilter.trim().toLowerCase()),
+ )
+ : ccComments,
+ );
+ let ccFilteredChapters = $derived(
+ ccFilter.trim()
+ ? ccChapters.filter((c) =>
+ c.title.toLowerCase().includes(ccFilter.trim().toLowerCase()),
+ )
+ : ccChapters,
+ );
+
+ function fmtTime(s: number): string {
+ const t = Math.max(0, Math.floor(s));
+ const h = Math.floor(t / 3600);
+ const m = Math.floor((t % 3600) / 60);
+ const sec = t % 60;
+ const pad = (n: number) => String(n).padStart(2, "0");
+ return h > 0 ? `${h}:${pad(m)}:${pad(sec)}` : `${m}:${pad(sec)}`;
+ }
+
+ function csvCell(v: string | number): string {
+ const s = String(v);
+ return /[",\n\r]/.test(s) ? `"${s.replace(/"/g, '""')}"` : s;
+ }
+
+ async function fetchComments() {
+ const url = ccUrl.trim();
+ if (!url || ccBusy) return;
+ ccBusy = true;
+ ccMode = null;
+ ccComments = [];
+ ccChapters = [];
+ try {
+ const res = await invoke<{ title: string; count: number; comments: Comment[] }>(
+ "comments_fetch",
+ { url, maxComments: ccMax, sort: ccSort },
+ );
+ ccTitle = res.title;
+ ccComments = res.comments;
+ ccMode = "comments";
+ if (ccComments.length === 0) showToast("info", $t("tools.cc_none") as string);
+ } catch (e: any) {
+ showToast("error", typeof e === "string" ? e : (e?.message ?? String(e)));
+ } finally {
+ ccBusy = false;
+ }
+ }
+
+ async function fetchChapters() {
+ const url = ccUrl.trim();
+ if (!url || ccBusy) return;
+ ccBusy = true;
+ ccMode = null;
+ ccComments = [];
+ ccChapters = [];
+ try {
+ const res = await invoke<{ title: string; chapters: Chapter[] }>("chapters_fetch", {
+ url,
+ });
+ ccTitle = res.title;
+ ccChapters = res.chapters;
+ ccMode = "chapters";
+ if (ccChapters.length === 0) showToast("info", $t("tools.cc_none") as string);
+ } catch (e: any) {
+ showToast("error", typeof e === "string" ? e : (e?.message ?? String(e)));
+ } finally {
+ ccBusy = false;
+ }
+ }
+
+ async function exportCc(kind: "json" | "csv") {
+ if (ccSaving || !ccMode) return;
+ ccSaving = true;
+ try {
+ const dir = await resolveOutputDir();
+ if (!dir) return;
+ let content: string;
+ let ext: string;
+ if (ccMode === "comments") {
+ if (kind === "json") {
+ content = JSON.stringify(ccFilteredComments, null, 2);
+ ext = "comments.json";
+ } else {
+ const rows = ccFilteredComments.map(
+ (c) =>
+ `${csvCell(c.author)},${csvCell(c.like_count)},${csvCell(c.text)}`,
+ );
+ content = ["author,likes,text", ...rows].join("\r\n");
+ ext = "comments.csv";
+ }
+ } else if (kind === "json") {
+ content = JSON.stringify(ccFilteredChapters, null, 2);
+ ext = "chapters.json";
+ } else {
+ const rows = ccFilteredChapters.map(
+ (c) => `${csvCell(fmtTime(c.start))},${csvCell(fmtTime(c.end))},${csvCell(c.title)}`,
+ );
+ content = ["start,end,title", ...rows].join("\r\n");
+ ext = "chapters.csv";
+ }
+ const saved = await invoke<string>("tools_save_text", {
+ outputDir: dir,
+ fileName: `${ccTitle}.${ext}`,
+ content,
+ });
+ showToast("success", $t("tools.cc_exported", { name: saved }) as string);
+ } catch (e: any) {
+ showToast("error", typeof e === "string" ? e : (e?.message ?? String(e)));
+ } finally {
+ ccSaving = false;
+ }
+ }
+
+ type LiveMsg = {
+ idx: number;
+ time: string;
+ timestamp_usec: number;
+ author: string;
+ channel_id: string;
+ message: string;
+ msg_type: string;
+ amount: string;
+ };
+ let lcUrl = $state("");
+ let lcBusy = $state(false);
+ let lcMsgs = $state<LiveMsg[]>([]);
+ let lcFilter = $state("");
+ let lcSaving = $state(false);
+ let lcFetched = $state(false);
+
+ let lcFiltered = $derived(
+ lcFilter.trim()
+ ? lcMsgs.filter((m) =>
+ (m.author + " " + m.message).toLowerCase().includes(lcFilter.trim().toLowerCase()),
+ )
+ : lcMsgs,
+ );
+
+ async function fetchLiveChat() {
+ const url = lcUrl.trim();
+ if (!url || lcBusy) return;
+ lcBusy = true;
+ lcMsgs = [];
+ lcFetched = false;
+ try {
+ const res = await invoke<{ count: number; messages: LiveMsg[] }>("livechat_fetch", {
+ url,
+ });
+ lcMsgs = res.messages;
+ lcFetched = true;
+ if (lcMsgs.length === 0) showToast("info", $t("tools.lc_none") as string);
+ } catch (e: any) {
+ showToast("error", typeof e === "string" ? e : (e?.message ?? String(e)));
+ } finally {
+ lcBusy = false;
+ }
+ }
+
+ async function exportLiveChat(kind: "json" | "csv") {
+ if (lcSaving || lcFiltered.length === 0) return;
+ lcSaving = true;
+ try {
+ const dir = await resolveOutputDir();
+ if (!dir) return;
+ let content: string;
+ let ext: string;
+ if (kind === "json") {
+ content = JSON.stringify(lcFiltered, null, 2);
+ ext = "livechat.json";
+ } else {
+ const rows = lcFiltered.map(
+ (m) =>
+ `${csvCell(m.time)},${csvCell(m.author)},${csvCell(m.msg_type)},${csvCell(m.amount)},${csvCell(m.message)}`,
+ );
+ content = ["time,author,type,amount,message", ...rows].join("\r\n");
+ ext = "livechat.csv";
+ }
+ const saved = await invoke<string>("tools_save_text", {
+ outputDir: dir,
+ fileName: `livechat.${ext}`,
+ content,
+ });
+ showToast("success", $t("tools.lc_exported", { name: saved }) as string);
+ } catch (e: any) {
+ showToast("error", typeof e === "string" ? e : (e?.message ?? String(e)));
+ } finally {
+ lcSaving = false;
+ }
+ }
+
+ async function fetchMetadata() {
+ const url = metaUrl.trim();
+ if (!url || metaBusy) return;
+ metaBusy = true;
+ try {
+ const dir = await resolveOutputDir();
+ if (!dir) return;
+ const res = await invoke<{ title: string; saved: string[] }>("metadata_fetch", {
+ url,
+ outputDir: dir,
+ });
+ showToast(
+ "success",
+ $t("tools.metadata_done", {
+ title: res.title,
+ count: String(res.saved.length),
+ }) as string,
+ );
+ metaUrl = "";
+ } catch (e: any) {
+ showToast("error", typeof e === "string" ? e : (e?.message ?? String(e)));
+ } finally {
+ metaBusy = false;
+ }
+ }
+</script>
+
+<div class="tools">
+ <section class="tool-card">
+ <div class="tool-head">
+ <h3 class="tool-title">{$t("tools.metadata_title")}</h3>
+ <p class="tool-desc">{$t("tools.metadata_desc")}</p>
+ </div>
+ <div class="tool-row">
+ <input
+ class="tool-input"
+ type="text"
+ placeholder={$t("tools.url_placeholder") as string}
+ bind:value={metaUrl}
+ spellcheck="false"
+ onkeydown={(e) => {
+ if (e.key === "Enter") fetchMetadata();
+ }}
+ />
+ <button
+ class="tool-btn"
+ type="button"
+ disabled={metaBusy || !metaUrl.trim()}
+ onclick={fetchMetadata}
+ >
+ {metaBusy ? $t("tools.working") : $t("tools.metadata_action")}
+ </button>
+ </div>
+ </section>
+
+ <section class="tool-card">
+ <div class="tool-head">
+ <h3 class="tool-title">{$t("tools.thumbnails_title")}</h3>
+ <p class="tool-desc">{$t("tools.thumbnails_desc")}</p>
+ </div>
+ <div class="tool-row">
+ <input
+ class="tool-input"
+ type="text"
+ placeholder={$t("tools.url_placeholder") as string}
+ bind:value={thumbUrl}
+ spellcheck="false"
+ onkeydown={(e) => {
+ if (e.key === "Enter") listThumbs();
+ }}
+ />
+ <button
+ class="tool-btn"
+ type="button"
+ disabled={thumbBusy || !thumbUrl.trim()}
+ onclick={listThumbs}
+ >
+ {thumbBusy ? $t("tools.working") : $t("tools.thumbnails_action")}
+ </button>
+ </div>
+ {#if thumbs.length > 0}
+ <div class="thumb-grid">
+ {#each thumbs as thumb (thumb.url)}
+ <button
+ class="thumb-chip"
+ type="button"
+ disabled={thumbSavingUrl !== null}
+ onclick={() => saveThumb(thumb)}
+ title={$t("tools.thumbnails_save") as string}
+ >
+ {thumb.width && thumb.height
+ ? `${thumb.width}×${thumb.height}`
+ : $t("tools.thumbnails_default")}
+ </button>
+ {/each}
+ </div>
+ {/if}
+ </section>
+
+ <section class="tool-card">
+ <div class="tool-head">
+ <h3 class="tool-title">{$t("tools.subs_title")}</h3>
+ <p class="tool-desc">{$t("tools.subs_desc")}</p>
+ </div>
+ <div class="tool-row">
+ <input
+ class="tool-input"
+ type="text"
+ placeholder={$t("tools.url_placeholder") as string}
+ bind:value={subUrl}
+ spellcheck="false"
+ onkeydown={(e) => {
+ if (e.key === "Enter") listSubs();
+ }}
+ />
+ <button
+ class="tool-btn"
+ type="button"
+ disabled={subBusy || !subUrl.trim()}
+ onclick={listSubs}
+ >
+ {subBusy ? $t("tools.working") : $t("tools.subs_action")}
+ </button>
+ </div>
+ {#if subTracks.length > 0}
+ <div class="sub-form">
+ <label class="sub-field">
+ <span>{$t("tools.subs_primary")}</span>
+ <select class="tool-select" bind:value={subPrimaryIdx}>
+ {#each subTracks as tk, i (i)}
+ <option value={i}>{trackLabel(tk)}</option>
+ {/each}
+ </select>
+ </label>
+ {#if subPrimary && subPrimary.formats.length > 0}
+ <label class="sub-field">
+ <span>{$t("tools.subs_format")}</span>
+ <select class="tool-select" bind:value={subPrimaryExt}>
+ {#each subPrimary.formats as f (f.ext + f.url)}
+ <option value={f.ext}>{f.ext || "?"}</option>
+ {/each}
+ </select>
+ </label>
+ {/if}
+ <label class="sub-field">
+ <span>{$t("tools.subs_secondary")}</span>
+ <select class="tool-select" bind:value={subSecondaryIdx}>
+ <option value={-1}>{$t("tools.subs_none")}</option>
+ {#each subTracks as tk, i (i)}
+ {#if i !== subPrimaryIdx}
+ <option value={i}>{trackLabel(tk)}</option>
+ {/if}
+ {/each}
+ </select>
+ </label>
+ <div class="sub-actions">
+ <button
+ class="tool-btn"
+ type="button"
+ disabled={subSaving || !subPrimaryFmt}
+ onclick={saveSub}
+ >
+ {subSaving ? $t("tools.working") : $t("tools.subs_save")}
+ </button>
+ <button
+ class="tool-btn ghost"
+ type="button"
+ disabled={subSaving || !subMergeable}
+ title={subMergeable ? "" : ($t("tools.subs_merge_hint") as string)}
+ onclick={mergeSubs}
+ >
+ {$t("tools.subs_merge")}
+ </button>
+ </div>
+ </div>
+ {/if}
+ </section>
+
+ <section class="tool-card">
+ <div class="tool-head">
+ <h3 class="tool-title">{$t("tools.cc_title")}</h3>
+ <p class="tool-desc">{$t("tools.cc_desc")}</p>
+ </div>
+ <div class="tool-row">
+ <input
+ class="tool-input"
+ type="text"
+ placeholder={$t("tools.url_placeholder") as string}
+ bind:value={ccUrl}
+ spellcheck="false"
+ />
+ <input
+ class="tool-num"
+ type="number"
+ min="1"
+ max="2000"
+ bind:value={ccMax}
+ aria-label={$t("tools.cc_max") as string}
+ title={$t("tools.cc_max") as string}
+ />
+ <select class="tool-select" bind:value={ccSort} aria-label={$t("tools.cc_sort") as string}>
+ <option value="top">{$t("tools.cc_sort_top")}</option>
+ <option value="new">{$t("tools.cc_sort_new")}</option>
+ </select>
+ </div>
+ <div class="sub-actions">
+ <button
+ class="tool-btn"
+ type="button"
+ disabled={ccBusy || !ccUrl.trim()}
+ onclick={fetchComments}
+ >
+ {ccBusy ? $t("tools.working") : $t("tools.cc_comments")}
+ </button>
+ <button
+ class="tool-btn ghost"
+ type="button"
+ disabled={ccBusy || !ccUrl.trim()}
+ onclick={fetchChapters}
+ >
+ {$t("tools.cc_chapters")}
+ </button>
+ </div>
+ {#if ccMode}
+ <div class="cc-results">
+ <div class="cc-toolbar">
+ <input
+ class="tool-input"
+ type="text"
+ placeholder={$t("tools.cc_filter") as string}
+ bind:value={ccFilter}
+ spellcheck="false"
+ />
+ <button class="tool-btn ghost" type="button" disabled={ccSaving} onclick={() => exportCc("json")}>JSON</button>
+ <button class="tool-btn ghost" type="button" disabled={ccSaving} onclick={() => exportCc("csv")}>CSV</button>
+ </div>
+ {#if ccMode === "comments"}
+ <ul class="cc-list">
+ {#each ccFilteredComments.slice(0, 200) as c (c.id)}
+ <li class="cc-row">
+ <span class="cc-author">{c.author}{#if c.is_uploader} ★{/if}</span>
+ <span class="cc-likes">▲ {c.like_count}</span>
+ <span class="cc-text">{c.text}</span>
+ </li>
+ {/each}
+ </ul>
+ <p class="cc-count">{$t("tools.cc_showing", { shown: String(Math.min(ccFilteredComments.length, 200)), total: String(ccFilteredComments.length) })}</p>
+ {:else}
+ <ul class="cc-list">
+ {#each ccFilteredChapters as c (c.start)}
+ <li class="cc-row">
+ <span class="cc-time">{fmtTime(c.start)}</span>
+ <span></span>
+ <span class="cc-text">{c.title}</span>
+ </li>
+ {/each}
+ </ul>
+ {/if}
+ </div>
+ {/if}
+ </section>
+
+ <section class="tool-card">
+ <div class="tool-head">
+ <h3 class="tool-title">{$t("tools.lc_title")}</h3>
+ <p class="tool-desc">{$t("tools.lc_desc")}</p>
+ </div>
+ <div class="tool-row">
+ <input
+ class="tool-input"
+ type="text"
+ placeholder={$t("tools.url_placeholder") as string}
+ bind:value={lcUrl}
+ spellcheck="false"
+ onkeydown={(e) => {
+ if (e.key === "Enter") fetchLiveChat();
+ }}
+ />
+ <button
+ class="tool-btn"
+ type="button"
+ disabled={lcBusy || !lcUrl.trim()}
+ onclick={fetchLiveChat}
+ >
+ {lcBusy ? $t("tools.working") : $t("tools.lc_action")}
+ </button>
+ </div>
+ {#if lcFetched && lcMsgs.length > 0}
+ <div class="cc-results">
+ <div class="cc-toolbar">
+ <input
+ class="tool-input"
+ type="text"
+ placeholder={$t("tools.cc_filter") as string}
+ bind:value={lcFilter}
+ spellcheck="false"
+ />
+ <button class="tool-btn ghost" type="button" disabled={lcSaving} onclick={() => exportLiveChat("json")}>JSON</button>
+ <button class="tool-btn ghost" type="button" disabled={lcSaving} onclick={() => exportLiveChat("csv")}>CSV</button>
+ </div>
+ <ul class="cc-list">
+ {#each lcFiltered.slice(0, 300) as m (m.idx)}
+ <li class="cc-row">
+ <span class="cc-time">{m.time}</span>
+ <span class="cc-author">{m.author}{#if m.amount} · {m.amount}{/if}</span>
+ <span class="cc-text">{m.message}</span>
+ </li>
+ {/each}
+ </ul>
+ <p class="cc-count">{$t("tools.cc_showing", { shown: String(Math.min(lcFiltered.length, 300)), total: String(lcFiltered.length) })}</p>
+ </div>
+ {/if}
+ </section>
+
+ <section class="tool-card">
+ <div class="tool-head">
+ <h3 class="tool-title">{$t("downloads.sw.title")}</h3>
+ <p class="tool-desc">{$t("downloads.sw.tool_desc")}</p>
+ </div>
+ <div class="tool-row">
+ <button class="tool-btn" type="button" onclick={() => (wsOpen = true)}>
+ {$t("downloads.sw.open")}
+ </button>
+ </div>
+ </section>
+</div>
+
+{#if wsOpen}
+ <SubtitleWorkshop onClose={() => (wsOpen = false)} />
+{/if}
+
+<style>
+ .tools {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+ padding: 4px 0;
+ }
+ .tool-card {
+ display: flex;
+ flex-direction: column;
+ gap: 12px;
+ padding: 16px 18px;
+ background: var(--surface);
+ border: 1px solid var(--border);
+ border-radius: var(--radius-md, 12px);
+ }
+ .tool-head {
+ display: flex;
+ flex-direction: column;
+ gap: 3px;
+ }
+ .tool-title {
+ margin: 0;
+ font-size: 15px;
+ font-weight: 600;
+ color: var(--text);
+ }
+ .tool-desc {
+ margin: 0;
+ font-size: 12.5px;
+ color: var(--text-muted);
+ line-height: 1.45;
+ }
+ .tool-row {
+ display: flex;
+ gap: 8px;
+ flex-wrap: wrap;
+ }
+ .tool-input {
+ flex: 1;
+ min-width: 220px;
+ padding: 8px 12px;
+ background: var(--button);
+ border: 1px solid var(--input-border);
+ border-radius: var(--border-radius, 8px);
+ color: var(--secondary);
+ font: inherit;
+ font-size: 13px;
+ outline: none;
+ }
+ .tool-input:focus-visible {
+ border-color: var(--accent);
+ }
+ .tool-btn {
+ padding: 8px 16px;
+ background: var(--accent);
+ color: var(--on-accent);
+ border: 0;
+ border-radius: var(--border-radius, 8px);
+ font: inherit;
+ font-size: 13px;
+ font-weight: 600;
+ cursor: pointer;
+ }
+ .tool-btn:hover:not(:disabled) {
+ background: var(--accent-lo, var(--accent));
+ }
+ .tool-btn:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+ .thumb-grid {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 6px;
+ }
+ .thumb-chip {
+ padding: 6px 12px;
+ background: var(--button);
+ border: 1px solid var(--input-border);
+ border-radius: 999px;
+ color: var(--secondary);
+ font: inherit;
+ font-size: 12px;
+ cursor: pointer;
+ transition: border-color 0.12s ease, color 0.12s ease;
+ }
+ .thumb-chip:hover:not(:disabled) {
+ border-color: var(--accent);
+ color: var(--accent);
+ }
+ .thumb-chip:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+ .sub-form {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 10px;
+ align-items: flex-end;
+ }
+ .sub-field {
+ display: flex;
+ flex-direction: column;
+ gap: 3px;
+ font-size: 11.5px;
+ color: var(--text-muted);
+ }
+ .tool-select {
+ padding: 7px 10px;
+ background: var(--button);
+ border: 1px solid var(--input-border);
+ border-radius: var(--border-radius, 8px);
+ color: var(--secondary);
+ font: inherit;
+ font-size: 13px;
+ min-width: 140px;
+ }
+ .sub-actions {
+ display: flex;
+ gap: 8px;
+ }
+ .tool-btn.ghost {
+ background: transparent;
+ color: var(--secondary);
+ border: 1px solid var(--input-border);
+ }
+ .tool-btn.ghost:hover:not(:disabled) {
+ border-color: var(--accent);
+ color: var(--accent);
+ }
+ .tool-num {
+ width: 88px;
+ padding: 7px 10px;
+ background: var(--button);
+ border: 1px solid var(--input-border);
+ border-radius: var(--border-radius, 8px);
+ color: var(--secondary);
+ font: inherit;
+ font-size: 13px;
+ }
+ .cc-results {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ }
+ .cc-toolbar {
+ display: flex;
+ gap: 8px;
+ flex-wrap: wrap;
+ }
+ .cc-list {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+ max-height: 320px;
+ overflow-y: auto;
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ }
+ .cc-row {
+ display: grid;
+ grid-template-columns: auto auto 1fr;
+ gap: 10px;
+ align-items: baseline;
+ padding: 5px 0;
+ border-bottom: 1px solid color-mix(in oklab, var(--border) 40%, transparent);
+ font-size: 12.5px;
+ }
+ .cc-author {
+ font-weight: 600;
+ color: var(--text);
+ white-space: nowrap;
+ }
+ .cc-likes,
+ .cc-time {
+ color: var(--text-muted);
+ font-variant-numeric: tabular-nums;
+ white-space: nowrap;
+ }
+ .cc-text {
+ color: var(--secondary);
+ white-space: pre-wrap;
+ word-break: break-word;
+ }
+ .cc-count {
+ margin: 0;
+ font-size: 11.5px;
+ color: var(--text-muted);
+ }
+</style>
diff --git a/src/components/downloads/VideoOpsOverlay.svelte b/src/components/downloads/VideoOpsOverlay.svelte
new file mode 100644
index 00000000..06ca1ef1
--- /dev/null
+++ b/src/components/downloads/VideoOpsOverlay.svelte
@@ -0,0 +1,279 @@
+<script lang="ts">
+ import { invoke } from "@tauri-apps/api/core";
+ import { t } from "$lib/i18n";
+ import { showToast } from "$lib/stores/toast-store.svelte";
+
+ let { filePath, onClose }: { filePath: string; onClose: () => void } = $props();
+
+ type Stage = "idle" | "review" | "busy" | "done";
+ let stage = $state<Stage>("idle");
+ let instruction = $state("");
+ let trimStart = $state("");
+ let trimEnd = $state("");
+ let proposedArgs = $state<string[]>([]);
+ let outExt = $state("mp4");
+ let resultPath = $state("");
+
+ function fail(e: unknown) {
+ const raw = typeof e === "string" ? e : ($t("common.error") as string);
+ const msg =
+ raw === "ai_not_configured"
+ ? ($t("downloads.vop.not_configured") as string)
+ : raw;
+ showToast("error", msg);
+ stage = stage === "busy" ? "idle" : stage;
+ }
+
+ async function runPreset(action: string) {
+ if (stage === "busy") return;
+ stage = "busy";
+ try {
+ const r = await invoke<{ output_path: string }>("video_op_preset", {
+ input: filePath,
+ action,
+ start: action === "trim" ? trimStart.trim() || null : null,
+ end: action === "trim" ? trimEnd.trim() || null : null,
+ });
+ resultPath = r.output_path;
+ stage = "done";
+ } catch (e) {
+ fail(e);
+ }
+ }
+
+ async function propose() {
+ if (!instruction.trim() || stage === "busy") return;
+ stage = "busy";
+ try {
+ const r = await invoke<{ args: string[]; out_ext: string }>(
+ "video_op_propose",
+ { instruction: instruction.trim() },
+ );
+ proposedArgs = r.args;
+ outExt = r.out_ext;
+ stage = "review";
+ } catch (e) {
+ fail(e);
+ }
+ }
+
+ async function runProposed() {
+ stage = "busy";
+ try {
+ const r = await invoke<{ output_path: string }>("video_op_run", {
+ input: filePath,
+ args: proposedArgs,
+ outExt,
+ });
+ resultPath = r.output_path;
+ stage = "done";
+ } catch (e) {
+ fail(e);
+ }
+ }
+</script>
+
+<div
+ class="overlay"
+ role="button"
+ tabindex="0"
+ onclick={(e) => { if (e.target === e.currentTarget) onClose(); }}
+ onkeydown={(e) => { if (e.key === "Escape") onClose(); }}
+>
+ <div class="panel" role="dialog" aria-modal="true" aria-label={$t('downloads.vop.title') as string}>
+ <div class="head">
+ <h2>{$t('downloads.vop.title')}</h2>
+ <button class="x" onclick={onClose} aria-label={$t('common.close') as string}>✕</button>
+ </div>
+
+ <p class="file" title={filePath}>{filePath}</p>
+
+ {#if stage === "done"}
+ <div class="done">
+ <p>{$t('downloads.vop.done')}</p>
+ <p class="result" title={resultPath}>{resultPath}</p>
+ <button class="primary" onclick={onClose}>{$t('common.close')}</button>
+ </div>
+ {:else}
+ <h3>{$t('downloads.vop.quick_actions')}</h3>
+ <div class="quick">
+ <button disabled={stage === "busy"} onclick={() => runPreset("extract_audio")}>{$t('downloads.vop.extract_audio')}</button>
+ <button disabled={stage === "busy"} onclick={() => runPreset("mute")}>{$t('downloads.vop.mute')}</button>
+ <button disabled={stage === "busy"} onclick={() => runPreset("to_mp4")}>{$t('downloads.vop.to_mp4')}</button>
+ <button disabled={stage === "busy"} onclick={() => runPreset("to_gif")}>{$t('downloads.vop.to_gif')}</button>
+ </div>
+
+ <div class="trim">
+ <input type="text" placeholder={$t('downloads.vop.trim_start')} bind:value={trimStart} />
+ <input type="text" placeholder={$t('downloads.vop.trim_end')} bind:value={trimEnd} />
+ <button disabled={stage === "busy"} onclick={() => runPreset("trim")}>{$t('downloads.vop.trim')}</button>
+ </div>
+
+ <h3>{$t('downloads.vop.nl_label')}</h3>
+ <div class="nl">
+ <input
+ type="text"
+ placeholder={$t('downloads.vop.nl_placeholder')}
+ bind:value={instruction}
+ onkeydown={(e) => { if (e.key === "Enter") propose(); }}
+ />
+ <button disabled={!instruction.trim() || stage === 'busy'} onclick={propose}>
+ {$t('downloads.vop.propose')}
+ </button>
+ </div>
+
+ {#if stage === "review"}
+ <div class="review">
+ <span class="review-title">{$t('downloads.vop.review_title')}</span>
+ <code>ffmpeg -i … {proposedArgs.join(" ")} …{outExt}</code>
+ <span class="review-hint">{$t('downloads.vop.review_hint')}</span>
+ <button class="primary" onclick={runProposed}>{$t('downloads.vop.run')}</button>
+ </div>
+ {/if}
+
+ {#if stage === "busy"}
+ <p class="busy">{$t('downloads.vop.processing')}</p>
+ {/if}
+ {/if}
+ </div>
+</div>
+
+<style>
+ .overlay {
+ position: fixed;
+ inset: 0;
+ background: color-mix(in srgb, var(--bg) 70%, transparent);
+ backdrop-filter: blur(3px);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ z-index: 1000;
+ padding: 24px;
+ }
+
+ .panel {
+ background: var(--surface);
+ border: 1px solid var(--border);
+ border-radius: var(--border-radius);
+ width: min(640px, 100%);
+ max-height: 90vh;
+ overflow-y: auto;
+ padding: 20px;
+ display: flex;
+ flex-direction: column;
+ gap: 14px;
+ }
+
+ .head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ }
+
+ .head h2 {
+ margin: 0;
+ font-size: 18px;
+ }
+
+ .x {
+ background: none;
+ border: none;
+ color: var(--text);
+ cursor: pointer;
+ font-size: 16px;
+ }
+
+ .file,
+ .result {
+ font-size: 12px;
+ color: var(--gray);
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ margin: 0;
+ }
+
+ h3 {
+ margin: 4px 0 0;
+ font-size: 13px;
+ color: var(--gray);
+ }
+
+ .quick,
+ .trim,
+ .nl {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 8px;
+ }
+
+ .nl input,
+ .trim input {
+ flex: 1;
+ min-width: 120px;
+ padding: 8px 10px;
+ border: 1px solid var(--border);
+ border-radius: var(--border-radius);
+ background: var(--bg);
+ color: var(--text);
+ }
+
+ button {
+ padding: 8px 14px;
+ border: 1px solid var(--border);
+ border-radius: var(--border-radius);
+ background: var(--button-elevated);
+ color: var(--text);
+ cursor: pointer;
+ }
+
+ button:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+
+ button.primary {
+ background: var(--accent);
+ color: var(--on-accent);
+ border-color: transparent;
+ font-weight: 600;
+ }
+
+ .review {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ padding: 12px;
+ border: 1px solid var(--border);
+ border-radius: var(--border-radius);
+ background: var(--bg);
+ }
+
+ .review code {
+ font-size: 12px;
+ word-break: break-all;
+ color: var(--text);
+ }
+
+ .review-title {
+ font-weight: 600;
+ font-size: 13px;
+ }
+
+ .review-hint {
+ font-size: 12px;
+ color: var(--gray);
+ }
+
+ .busy {
+ color: var(--gray);
+ font-size: 13px;
+ }
+
+ .done {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ align-items: flex-start;
+ }
+</style>
diff --git a/src/components/hotmart/ModuleList.svelte b/src/components/hotmart/ModuleList.svelte
deleted file mode 100644
index 9dcdf03b..00000000
--- a/src/components/hotmart/ModuleList.svelte
+++ /dev/null
@@ -1,73 +0,0 @@
-<script lang="ts">
- type Module = {
- id: string;
- name: string;
- pages: { hash: string; name: string; page_type: string }[];
- };
-
- let { modules }: { modules: Module[] } = $props();
-</script>
-
-<ul class="module-list">
- {#each modules as mod, i}
- <li class="module-item">
- <div class="module-header">
- <span class="module-number">{i + 1}.</span>
- <span class="module-name">{mod.name}</span>
- <span class="module-count">{mod.pages.length} {mod.pages.length === 1 ? 'aula' : 'aulas'}</span>
- </div>
- </li>
- {/each}
-</ul>
-
-<style>
- .module-list {
- list-style: none;
- padding: 0;
- margin: 0;
- display: flex;
- flex-direction: column;
- gap: 2px;
- }
-
- .module-item {
- padding: calc(var(--padding) / 1.5) var(--padding);
- border-radius: calc(var(--border-radius) - 4px);
- }
-
- @media (hover: hover) {
- .module-item:hover {
- background: var(--button-stroke);
- }
- }
-
- .module-header {
- display: flex;
- align-items: center;
- gap: calc(var(--padding) / 1.5);
- }
-
- .module-number {
- color: var(--gray);
- font-size: 12.5px;
- font-weight: 500;
- min-width: 22px;
- font-variant-numeric: tabular-nums;
- }
-
- .module-name {
- flex: 1;
- font-size: 14.5px;
- color: var(--secondary);
- }
-
- .module-count {
- font-size: 11px;
- font-weight: 500;
- color: var(--gray);
- background: var(--button-stroke);
- padding: 2px calc(var(--padding) / 2);
- border-radius: calc(var(--border-radius) / 2);
- white-space: nowrap;
- }
-</style>
diff --git a/src/components/settings/SettingsAI.svelte b/src/components/settings/SettingsAI.svelte
new file mode 100644
index 00000000..53f2bc7d
--- /dev/null
+++ b/src/components/settings/SettingsAI.svelte
@@ -0,0 +1,358 @@
+<script lang="ts">
+ import { invoke } from "@tauri-apps/api/core";
+ import { onMount } from "svelte";
+ import { t } from "$lib/i18n";
+ import { showToast } from "$lib/stores/toast-store.svelte";
+
+ type Provider = "none" | "openai" | "anthropic" | "local";
+ type ConfigView = {
+ provider: Provider;
+ model: string;
+ local_base_url: string;
+ has_openai_key: boolean;
+ has_anthropic_key: boolean;
+ };
+ type HistoryEntry = {
+ id: number;
+ kind: string;
+ url: string;
+ title: string;
+ content: string;
+ created_at_ms: number;
+ };
+
+ let provider = $state<Provider>("none");
+ let model = $state("");
+ let localBaseUrl = $state("");
+ let openaiKey = $state("");
+ let anthropicKey = $state("");
+ let hasOpenaiKey = $state(false);
+ let hasAnthropicKey = $state(false);
+
+ let testing = $state(false);
+ let summarizeUrl = $state("");
+ let summarizing = $state(false);
+ let summaryStyle = $state<"short" | "balanced" | "detailed">("balanced");
+ let summaryLang = $state("");
+ let history = $state<HistoryEntry[]>([]);
+
+ async function loadConfig() {
+ try {
+ const c = await invoke<ConfigView>("ai_get_config");
+ provider = c.provider;
+ model = c.model;
+ localBaseUrl = c.local_base_url;
+ hasOpenaiKey = c.has_openai_key;
+ hasAnthropicKey = c.has_anthropic_key;
+ openaiKey = "";
+ anthropicKey = "";
+ } catch (e: any) {
+ showToast("error", typeof e === "string" ? e : $t("common.error"));
+ }
+ }
+
+ async function loadHistory() {
+ try {
+ history = (await invoke<HistoryEntry[]>("ai_history_list")).slice().reverse();
+ } catch {
+ history = [];
+ }
+ }
+
+ onMount(() => {
+ loadConfig();
+ loadHistory();
+ });
+
+ async function save() {
+ try {
+ await invoke("ai_set_config", {
+ provider,
+ model: model.trim(),
+ localBaseUrl: localBaseUrl.trim(),
+ openaiKey: openaiKey.trim() !== "" ? openaiKey.trim() : null,
+ anthropicKey: anthropicKey.trim() !== "" ? anthropicKey.trim() : null,
+ });
+ await loadConfig();
+ showToast("success", $t("settings.ai.saved") as string);
+ } catch (e: any) {
+ showToast("error", typeof e === "string" ? e : $t("common.error"));
+ }
+ }
+
+ async function runTest() {
+ if (testing) return;
+ testing = true;
+ try {
+ await invoke<string>("ai_test");
+ showToast("success", $t("settings.ai.test_ok") as string);
+ } catch (e: any) {
+ const msg = typeof e === "string" ? e : $t("common.error");
+ showToast("error", $t("settings.ai.test_fail", { error: msg }) as string);
+ } finally {
+ testing = false;
+ }
+ }
+
+ async function summarize() {
+ const url = summarizeUrl.trim();
+ if (!url || summarizing) return;
+ summarizing = true;
+ try {
+ await invoke("ai_summarize_url", {
+ url,
+ style: summaryStyle === "balanced" ? null : summaryStyle,
+ lang: summaryLang.trim() || null,
+ });
+ summarizeUrl = "";
+ await loadHistory();
+ showToast("success", $t("settings.ai.summary_ready") as string);
+ } catch (e: any) {
+ const raw = typeof e === "string" ? e : $t("common.error");
+ const msg =
+ raw === "no_transcript"
+ ? ($t("settings.ai.no_transcript") as string)
+ : raw === "ai_not_configured"
+ ? ($t("settings.ai.not_configured") as string)
+ : raw;
+ showToast("error", msg);
+ } finally {
+ summarizing = false;
+ }
+ }
+
+ async function clearHistory() {
+ if (!confirm($t("settings.ai.history_clear_confirm"))) return;
+ try {
+ await invoke("ai_history_clear");
+ history = [];
+ } catch {
+ // best-effort
+ }
+ }
+</script>
+
+<section class="section">
+ <h5 class="section-title">{$t('settings.ai.title')}</h5>
+
+ <div class="card">
+ <div class="setting-row">
+ <div class="setting-col">
+ <span class="setting-label">{$t('settings.ai.provider')}</span>
+ <span class="setting-path">{$t('settings.ai.provider_desc')}</span>
+ </div>
+ <select class="input-text select" bind:value={provider}>
+ <option value="none">{$t('settings.ai.provider_none')}</option>
+ <option value="openai">OpenAI</option>
+ <option value="anthropic">Anthropic</option>
+ <option value="local">{$t('settings.ai.provider_local')}</option>
+ </select>
+ </div>
+
+ {#if provider !== "none"}
+ <div class="divider"></div>
+ <div class="setting-row">
+ <div class="setting-col">
+ <span class="setting-label">{$t('settings.ai.model')}</span>
+ <span class="setting-path">{$t('settings.ai.model_desc')}</span>
+ </div>
+ <input type="text" class="input-text" placeholder={$t('settings.ai.model_placeholder')} bind:value={model} />
+ </div>
+ {/if}
+
+ {#if provider === "openai"}
+ <div class="divider"></div>
+ <div class="setting-row">
+ <div class="setting-col">
+ <span class="setting-label">{$t('settings.ai.openai_key')}</span>
+ <span class="setting-path">{hasOpenaiKey ? $t('settings.ai.key_set') : $t('settings.ai.key_unset')}</span>
+ </div>
+ <input type="password" class="input-text" placeholder={hasOpenaiKey ? "••••••••" : "sk-…"} bind:value={openaiKey} />
+ </div>
+ {/if}
+
+ {#if provider === "anthropic"}
+ <div class="divider"></div>
+ <div class="setting-row">
+ <div class="setting-col">
+ <span class="setting-label">{$t('settings.ai.anthropic_key')}</span>
+ <span class="setting-path">{hasAnthropicKey ? $t('settings.ai.key_set') : $t('settings.ai.key_unset')}</span>
+ </div>
+ <input type="password" class="input-text" placeholder={hasAnthropicKey ? "••••••••" : "sk-ant-…"} bind:value={anthropicKey} />
+ </div>
+ {/if}
+
+ {#if provider === "local"}
+ <div class="divider"></div>
+ <div class="setting-row">
+ <div class="setting-col">
+ <span class="setting-label">{$t('settings.ai.local_url')}</span>
+ <span class="setting-path">{$t('settings.ai.local_url_desc')}</span>
+ </div>
+ <input type="text" class="input-text" placeholder="http://localhost:11434/v1" bind:value={localBaseUrl} />
+ </div>
+ {/if}
+
+ <div class="divider"></div>
+ <div class="actions-row">
+ <button class="primary-btn" onclick={save}>{$t('settings.ai.save')}</button>
+ {#if provider !== "none"}
+ <button class="ghost-btn" disabled={testing} onclick={runTest}>{$t('settings.ai.test')}</button>
+ {/if}
+ </div>
+ </div>
+
+ {#if provider !== "none"}
+ <h5 class="section-title">{$t('settings.ai.summarize_title')}</h5>
+ <div class="card">
+ <div class="add-row">
+ <input
+ type="text"
+ class="input-text"
+ placeholder={$t('settings.ai.summarize_placeholder')}
+ bind:value={summarizeUrl}
+ onkeydown={(e) => { if (e.key === "Enter") summarize(); }}
+ />
+ <button class="primary-btn" disabled={!summarizeUrl.trim() || summarizing} onclick={summarize}>
+ {summarizing ? $t('settings.ai.summarizing') : $t('settings.ai.summarize')}
+ </button>
+ </div>
+ <div class="add-row sum-opts">
+ <select class="input-text select" bind:value={summaryStyle} aria-label={$t('settings.ai.style') as string}>
+ <option value="short">{$t('settings.ai.style_short')}</option>
+ <option value="balanced">{$t('settings.ai.style_balanced')}</option>
+ <option value="detailed">{$t('settings.ai.style_detailed')}</option>
+ </select>
+ <input
+ type="text"
+ class="input-text"
+ placeholder={$t('settings.ai.lang_placeholder')}
+ bind:value={summaryLang}
+ />
+ </div>
+ <span class="setting-path add-hint">{$t('settings.ai.summarize_hint')}</span>
+ </div>
+ {/if}
+
+ <div class="hist-head">
+ <h5 class="section-title">{$t('settings.ai.history')}</h5>
+ {#if history.length > 0}
+ <button class="link-btn danger" onclick={clearHistory}>{$t('settings.ai.history_clear')}</button>
+ {/if}
+ </div>
+ {#if history.length === 0}
+ <div class="card empty">
+ <span class="setting-path">{$t('settings.ai.history_empty')}</span>
+ </div>
+ {:else}
+ <div class="card">
+ {#each history as h, i (h.id)}
+ {#if i > 0}<div class="divider"></div>{/if}
+ <details class="hist">
+ <summary>{h.title || h.url}</summary>
+ <p class="hist-body">{h.content}</p>
+ </details>
+ {/each}
+ </div>
+ {/if}
+</section>
+
+<style>
+ .select {
+ min-width: 160px;
+ }
+
+ .actions-row,
+ .add-row {
+ display: flex;
+ gap: 8px;
+ width: 100%;
+ }
+
+ .add-row .input-text {
+ flex: 1;
+ min-width: 0;
+ }
+
+ .primary-btn {
+ padding: 0 16px;
+ border: none;
+ border-radius: var(--border-radius);
+ background: var(--accent);
+ color: var(--on-accent);
+ font-weight: 600;
+ cursor: pointer;
+ }
+
+ .primary-btn:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+
+ .ghost-btn {
+ padding: 0 16px;
+ border: 1px solid var(--border);
+ border-radius: var(--border-radius);
+ background: transparent;
+ color: var(--text);
+ cursor: pointer;
+ }
+
+ .ghost-btn:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+
+ .add-hint {
+ display: block;
+ margin-top: 8px;
+ }
+
+ .sum-opts {
+ margin-top: 8px;
+ }
+
+ .sum-opts .input-text {
+ flex: 1;
+ min-width: 0;
+ }
+
+ .hist-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+ }
+
+ .link-btn {
+ background: none;
+ border: none;
+ color: var(--accent);
+ cursor: pointer;
+ font-size: 13px;
+ padding: 0;
+ }
+
+ .link-btn.danger {
+ color: var(--error);
+ }
+
+ .empty {
+ text-align: center;
+ padding: 20px 16px;
+ }
+
+ .hist summary {
+ cursor: pointer;
+ font-weight: 600;
+ padding: 6px 0;
+ }
+
+ .hist-body {
+ white-space: pre-wrap;
+ margin: 4px 0 8px;
+ color: var(--text);
+ font-size: 13px;
+ line-height: 1.5;
+ }
+</style>
diff --git a/src/components/settings/SettingsAdvanced.svelte b/src/components/settings/SettingsAdvanced.svelte
index 4c3f7762..a1f5fa67 100644
--- a/src/components/settings/SettingsAdvanced.svelte
+++ b/src/components/settings/SettingsAdvanced.svelte
@@ -57,6 +57,30 @@
<input type="number" class="input-number" min="1024" max="65525" value={settings.advanced.torrent_listen_port} onchange={(e) => changeNumber("advanced", "torrent_listen_port", e)} />
</div>
<div class="divider"></div>
+ <div class="setting-row">
+ <div class="setting-col">
+ <span class="setting-label">{$t('settings.advanced.torrent_auto_trackers')}</span>
+ <span class="setting-path">{$t('settings.advanced.torrent_auto_trackers_desc')}</span>
+ </div>
+ <button class="toggle" class:on={settings.advanced.torrent_auto_trackers} onclick={() => toggleBool("advanced", "torrent_auto_trackers", settings.advanced.torrent_auto_trackers)} role="switch" aria-checked={settings.advanced.torrent_auto_trackers} aria-label={$t('settings.advanced.torrent_auto_trackers') as string}><span class="toggle-knob"></span></button>
+ </div>
+ <div class="divider"></div>
+ <div class="setting-row">
+ <div class="setting-col">
+ <span class="setting-label">{$t('settings.advanced.torrent_upnp')}</span>
+ <span class="setting-path">{$t('settings.advanced.torrent_upnp_desc')}</span>
+ </div>
+ <button class="toggle" class:on={settings.advanced.torrent_upnp} onclick={() => toggleBool("advanced", "torrent_upnp", settings.advanced.torrent_upnp)} role="switch" aria-checked={settings.advanced.torrent_upnp} aria-label={$t('settings.advanced.torrent_upnp') as string}><span class="toggle-knob"></span></button>
+ </div>
+ <div class="divider"></div>
+ <div class="setting-row">
+ <div class="setting-col">
+ <span class="setting-label">{$t('settings.advanced.prevent_sleep')}</span>
+ <span class="setting-path">{$t('settings.advanced.prevent_sleep_desc')}</span>
+ </div>
+ <button class="toggle" class:on={settings.advanced.prevent_sleep} onclick={() => toggleBool("advanced", "prevent_sleep", settings.advanced.prevent_sleep)} role="switch" aria-checked={settings.advanced.prevent_sleep} aria-label={$t('settings.advanced.prevent_sleep') as string}><span class="toggle-knob"></span></button>
+ </div>
+ <div class="divider"></div>
<div class="setting-row">
<div class="setting-col">
<span class="setting-label">{$t('settings.advanced.cookies_from_browser')}</span>
@@ -71,6 +95,20 @@
/>
</div>
<div class="divider"></div>
+ <div class="setting-row">
+ <div class="setting-col">
+ <span class="setting-label">{$t('settings.advanced.user_agent')}</span>
+ <span class="setting-path">{$t('settings.advanced.user_agent_desc')}</span>
+ </div>
+ <input
+ type="text"
+ class="input-text"
+ placeholder={$t('settings.advanced.user_agent_placeholder')}
+ value={settings.advanced?.user_agent ?? ""}
+ onchange={(e) => updateSettings({ advanced: { user_agent: (e.target as HTMLInputElement).value.trim() } })}
+ />
+ </div>
+ <div class="divider"></div>
<div class="setting-row">
<div class="setting-col">
<span class="setting-label">{$t('debug.enable')}</span>
diff --git a/src/components/settings/SettingsBrowserExtension.svelte b/src/components/settings/SettingsBrowserExtension.svelte
index 7d497781..584661b7 100644
--- a/src/components/settings/SettingsBrowserExtension.svelte
+++ b/src/components/settings/SettingsBrowserExtension.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import { onMount } from "svelte";
+ import { onMount, onDestroy } from "svelte";
import { invoke } from "@tauri-apps/api/core";
import { t } from "$lib/i18n";
import { showToast } from "$lib/stores/toast-store.svelte";
@@ -54,6 +54,39 @@
}
}
+ let pairing = $state(false);
+ let pairSecondsLeft = $state(0);
+ let pairTimer: ReturnType<typeof setInterval> | null = null;
+
+ async function startPairing() {
+ try {
+ const res = await invoke<{ ok: boolean; window_secs: number; enabled: boolean }>(
+ "bridge_open_pairing"
+ );
+ if (!res.ok || !res.enabled) {
+ showToast("error", $t("settings.bridge.pair_unavailable") as string);
+ return;
+ }
+ pairing = true;
+ pairSecondsLeft = res.window_secs;
+ if (pairTimer) clearInterval(pairTimer);
+ pairTimer = setInterval(() => {
+ pairSecondsLeft -= 1;
+ if (pairSecondsLeft <= 0) {
+ pairing = false;
+ if (pairTimer) clearInterval(pairTimer);
+ pairTimer = null;
+ }
+ }, 1000);
+ } catch (e: any) {
+ showToast("error", typeof e === "string" ? e : (e.message ?? String(e)));
+ }
+ }
+
+ onDestroy(() => {
+ if (pairTimer) clearInterval(pairTimer);
+ });
+
function maskedToken(value: string): string {
if (!value) return "";
if (value.length <= 8) return "•".repeat(value.length);
@@ -77,6 +110,25 @@
<span class="setting-label">{$t("settings.bridge.unavailable")}</span>
</div>
{:else}
+ <div class="setting-row">
+ <div class="setting-col">
+ <span class="setting-label">{$t("settings.bridge.pair_label")}</span>
+ <span class="setting-hint">
+ {pairing
+ ? $t("settings.bridge.pair_active", { secs: pairSecondsLeft })
+ : $t("settings.bridge.pair_hint")}
+ </span>
+ </div>
+ <button
+ class="bridge-action primary"
+ type="button"
+ disabled={pairing}
+ onclick={startPairing}
+ >
+ {pairing ? $t("settings.bridge.pair_waiting") : $t("settings.bridge.pair")}
+ </button>
+ </div>
+ <div class="divider"></div>
<div class="setting-row">
<div class="setting-col">
<span class="setting-label">{$t("settings.bridge.endpoint_label")}</span>
@@ -157,6 +209,12 @@
}
.bridge-action:hover { background: rgba(255, 255, 255, 0.08); }
.bridge-action:disabled { opacity: 0.5; cursor: not-allowed; }
+ .bridge-action.primary {
+ background: var(--accent);
+ color: var(--on-accent);
+ border-color: transparent;
+ }
+ .bridge-action.primary:hover { background: var(--accent-lo, var(--accent)); }
.bridge-action.danger { color: #ff8b6f; border-color: rgba(255, 139, 111, 0.3); }
.bridge-action.danger:hover { background: rgba(255, 139, 111, 0.1); }
</style>
diff --git a/src/components/settings/SettingsChannels.svelte b/src/components/settings/SettingsChannels.svelte
new file mode 100644
index 00000000..6e311d18
--- /dev/null
+++ b/src/components/settings/SettingsChannels.svelte
@@ -0,0 +1,297 @@
+<script lang="ts">
+ import { invoke } from "@tauri-apps/api/core";
+ import { onMount } from "svelte";
+ import { t, locale as i18nLocale } from "$lib/i18n";
+ import { get } from "svelte/store";
+ import { showToast } from "$lib/stores/toast-store.svelte";
+ import timeAgo from "$lib/time-ago";
+
+ type Channel = {
+ id: string;
+ url: string;
+ title: string;
+ added_at_ms: number;
+ last_checked_ms: number | null;
+ enabled: boolean;
+ auto_download: boolean;
+ interval_minutes: number;
+ };
+
+ let channels = $state<Channel[]>([]);
+ let newUrl = $state("");
+ let adding = $state(false);
+
+ async function syncTray() {
+ try {
+ await invoke("sync_channels_tray", {
+ header: $t("settings.channels.tray_header"),
+ channels: channels.map((c) => [c.id, c.title]),
+ });
+ } catch {
+ // tray sync is best-effort
+ }
+ }
+
+ async function load() {
+ try {
+ channels = await invoke<Channel[]>("channels_list");
+ await syncTray();
+ } catch (e: any) {
+ showToast("error", typeof e === "string" ? e : $t("common.error"));
+ }
+ }
+
+ onMount(load);
+
+ async function addChannel() {
+ const url = newUrl.trim();
+ if (!url || adding) return;
+ adding = true;
+ try {
+ await invoke("channel_add", { url });
+ newUrl = "";
+ await load();
+ } catch (e: any) {
+ showToast("error", typeof e === "string" ? e : $t("common.error"));
+ } finally {
+ adding = false;
+ }
+ }
+
+ async function removeChannel(id: string) {
+ if (!confirm($t("settings.channels.remove_confirm"))) return;
+ try {
+ await invoke("channel_remove", { id });
+ await load();
+ } catch (e: any) {
+ showToast("error", typeof e === "string" ? e : $t("common.error"));
+ }
+ }
+
+ async function patch(
+ id: string,
+ fields: { enabled?: boolean; autoDownload?: boolean; intervalMinutes?: number },
+ ) {
+ try {
+ await invoke("channel_update", { id, ...fields });
+ await load();
+ } catch (e: any) {
+ showToast("error", typeof e === "string" ? e : $t("common.error"));
+ }
+ }
+
+ async function checkNow(id: string) {
+ try {
+ const n = await invoke<number>("channel_check_now", { id });
+ showToast(
+ "success",
+ $t("settings.channels.checked", { count: n }) as string,
+ );
+ await load();
+ } catch (e: any) {
+ showToast("error", typeof e === "string" ? e : $t("common.error"));
+ }
+ }
+
+ function lastChecked(ms: number | null): string {
+ if (!ms) return $t("settings.channels.never") as string;
+ const loc = get(i18nLocale) || "en";
+ return timeAgo(ms, loc.startsWith("pt") ? "pt" : "en");
+ }
+
+ function onIntervalChange(id: string, e: Event) {
+ const v = parseInt((e.target as HTMLInputElement).value, 10);
+ if (!Number.isNaN(v)) patch(id, { intervalMinutes: v });
+ }
+</script>
+
+<section class="section">
+ <h5 class="section-title">{$t('settings.channels.title')}</h5>
+
+ <div class="card">
+ <div class="add-row">
+ <input
+ type="text"
+ class="input-text"
+ placeholder={$t('settings.channels.add_placeholder')}
+ bind:value={newUrl}
+ onkeydown={(e) => { if (e.key === "Enter") addChannel(); }}
+ />
+ <button class="add-btn" disabled={!newUrl.trim() || adding} onclick={addChannel}>
+ {$t('settings.channels.add')}
+ </button>
+ </div>
+ <span class="setting-path add-hint">{$t('settings.channels.add_hint')}</span>
+ </div>
+
+ {#if channels.length === 0}
+ <div class="card empty">
+ <span class="empty-title">{$t('settings.channels.empty_title')}</span>
+ <span class="setting-path">{$t('settings.channels.empty_hint')}</span>
+ </div>
+ {:else}
+ <div class="card">
+ {#each channels as ch, i (ch.id)}
+ {#if i > 0}<div class="divider"></div>{/if}
+ <div class="channel">
+ <div class="channel-head">
+ <div class="channel-id">
+ <span class="channel-title" title={ch.url}>{ch.title}</span>
+ <span class="setting-path">{$t('settings.channels.last_checked', { when: lastChecked(ch.last_checked_ms) })}</span>
+ </div>
+ <div class="channel-actions">
+ <button class="link-btn" onclick={() => checkNow(ch.id)}>{$t('settings.channels.check_now')}</button>
+ <button class="link-btn danger" onclick={() => removeChannel(ch.id)}>{$t('settings.channels.remove')}</button>
+ </div>
+ </div>
+ <div class="channel-controls">
+ <label class="ctrl">
+ <button
+ class="toggle"
+ class:on={ch.enabled}
+ onclick={() => patch(ch.id, { enabled: !ch.enabled })}
+ role="switch"
+ aria-checked={ch.enabled}
+ aria-label={$t('settings.channels.enabled') as string}
+ ><span class="toggle-knob"></span></button>
+ <span>{$t('settings.channels.enabled')}</span>
+ </label>
+ <label class="ctrl">
+ <button
+ class="toggle"
+ class:on={ch.auto_download}
+ onclick={() => patch(ch.id, { autoDownload: !ch.auto_download })}
+ role="switch"
+ aria-checked={ch.auto_download}
+ aria-label={$t('settings.channels.auto_download') as string}
+ ><span class="toggle-knob"></span></button>
+ <span>{$t('settings.channels.auto_download')}</span>
+ </label>
+ <label class="ctrl interval">
+ <span>{$t('settings.channels.interval')}</span>
+ <input
+ type="number"
+ class="input-number"
+ min="5"
+ max="1440"
+ value={ch.interval_minutes}
+ onchange={(e) => onIntervalChange(ch.id, e)}
+ />
+ </label>
+ </div>
+ </div>
+ {/each}
+ </div>
+ {/if}
+</section>
+
+<style>
+ .add-row {
+ display: flex;
+ gap: 8px;
+ width: 100%;
+ }
+
+ .add-row .input-text {
+ flex: 1;
+ min-width: 0;
+ }
+
+ .add-btn {
+ flex-shrink: 0;
+ padding: 0 16px;
+ border: none;
+ border-radius: var(--border-radius);
+ background: var(--accent);
+ color: var(--on-accent);
+ font-weight: 600;
+ cursor: pointer;
+ }
+
+ .add-btn:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+
+ .add-hint {
+ display: block;
+ margin-top: 8px;
+ }
+
+ .empty {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ text-align: center;
+ padding: 24px 16px;
+ }
+
+ .empty-title {
+ font-weight: 600;
+ }
+
+ .channel {
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+ padding: 4px 0;
+ }
+
+ .channel-head {
+ display: flex;
+ align-items: flex-start;
+ justify-content: space-between;
+ gap: 12px;
+ }
+
+ .channel-id {
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+ min-width: 0;
+ }
+
+ .channel-title {
+ font-weight: 600;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+
+ .channel-actions {
+ display: flex;
+ gap: 12px;
+ flex-shrink: 0;
+ }
+
+ .link-btn {
+ background: none;
+ border: none;
+ color: var(--accent);
+ cursor: pointer;
+ font-size: 13px;
+ padding: 0;
+ }
+
+ .link-btn.danger {
+ color: var(--error);
+ }
+
+ .channel-controls {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ gap: 16px;
+ }
+
+ .ctrl {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ font-size: 13px;
+ }
+
+ .ctrl.interval .input-number {
+ width: 72px;
+ }
+</style>
diff --git a/src/components/settings/SettingsCookies.svelte b/src/components/settings/SettingsCookies.svelte
index 939bde4a..6f132e40 100644
--- a/src/components/settings/SettingsCookies.svelte
+++ b/src/components/settings/SettingsCookies.svelte
@@ -27,7 +27,57 @@
buckets_written: Array<{ domain: string; cookie_count: number; platform_kind: string }>;
};
+ type HealthItem = {
+ domain: string;
+ slug: string;
+ status: string;
+ age_days: number;
+ expires_in_days: number;
+ cookie_count: number;
+ };
+ type HealthResponse = { items: HealthItem[]; fresh_days: number; expire_days: number };
+
let registry = $state<Registry>({ buckets: {} });
+ let healthByKey = $state<Record<string, HealthItem>>({});
+
+ function healthKey(domain: string, slug: string): string {
+ return `${domain}__${slug}`;
+ }
+
+ function bucketHealth(domain: string): Record<string, HealthItem> {
+ const out: Record<string, HealthItem> = {};
+ for (const [k, v] of Object.entries(healthByKey)) {
+ if (v.domain === domain) out[v.slug] = v;
+ }
+ return out;
+ }
+
+ let testing = $state<Record<string, boolean>>({});
+
+ async function handleTest(domain: string, slug: string) {
+ const bucket = registry.buckets[domain];
+ const acc = bucket?.accounts.find((a) => a.slug === slug);
+ const url = acc?.source_url || `https://${domain}`;
+ const key = healthKey(domain, slug);
+ testing = { ...testing, [key]: true };
+ try {
+ const res = await invoke<{ ok: boolean; message: string }>("cookies_test", {
+ request: { url, slug },
+ });
+ if (res.ok) {
+ showToast("success", $t("settings.cookies.test_ok") as string);
+ } else {
+ showToast(
+ "error",
+ ($t("settings.cookies.test_fail", { msg: res.message }) as string) || res.message,
+ );
+ }
+ } catch (e) {
+ showToast("error", String(e));
+ } finally {
+ testing = { ...testing, [key]: false };
+ }
+ }
let settings = $derived(getSettings());
let managedOnly = $derived(settings?.download.always_use_managed_cookies ?? true);
@@ -72,6 +122,14 @@
const res = await invoke<ListResponse>("cookies_list");
registry = res.registry;
cookiesDir = res.cookies_dir;
+ try {
+ const h = await invoke<HealthResponse>("cookies_health");
+ const map: Record<string, HealthItem> = {};
+ for (const item of h.items) map[healthKey(item.domain, item.slug)] = item;
+ healthByKey = map;
+ } catch {
+ healthByKey = {};
+ }
} catch (e) {
showToast("error", String(e));
} finally {
@@ -301,11 +359,14 @@
{#each bucketList as bucket (bucket.domain)}
<CookieBucketCard
{bucket}
+ health={bucketHealth(bucket.domain)}
+ testing={testing}
onView={handleView}
onExport={handleExport}
onRename={handleRename}
onClear={askClear}
onAddAccount={openAddAccount}
+ onTest={handleTest}
/>
{/each}
</div>
diff --git a/src/components/settings/SettingsDownloads.svelte b/src/components/settings/SettingsDownloads.svelte
index acf277d6..5750225c 100644
--- a/src/components/settings/SettingsDownloads.svelte
+++ b/src/components/settings/SettingsDownloads.svelte
@@ -1,4 +1,5 @@
<script lang="ts">
+ import { invoke } from "@tauri-apps/api/core";
import { t } from "$lib/i18n";
import ContextHint from "$components/hints/ContextHint.svelte";
import {
@@ -14,6 +15,28 @@
let settings = $derived(getSettings());
let activePreset = $derived<YtdlpPresetId | null>(matchActivePreset(settings));
+ type PathLimitInfo = { limit: number; current: number; reserve: number; ok: boolean };
+ let pathInfo = $state<PathLimitInfo | null>(null);
+
+ $effect(() => {
+ const dir = settings?.download.default_output_dir;
+ if (!dir) {
+ pathInfo = null;
+ return;
+ }
+ let cancelled = false;
+ invoke<PathLimitInfo>("validate_output_path", { outputDir: dir })
+ .then((info) => {
+ if (!cancelled) pathInfo = info;
+ })
+ .catch(() => {
+ if (!cancelled) pathInfo = null;
+ });
+ return () => {
+ cancelled = true;
+ };
+ });
+
async function applyPreset(id: YtdlpPresetId) {
const preset = YTDLP_PRESETS.find((p) => p.id === id);
if (!preset) return;
@@ -39,6 +62,53 @@
}
});
+ let speedNum = $state<number | null>(null);
+ let speedUnit = $state<"K" | "M">("M");
+
+ $effect(() => {
+ const raw = settings?.download.speed_limit?.trim() ?? "";
+ const m = raw.match(/^(\d+(?:\.\d+)?)([KM])?$/i);
+ if (m) {
+ speedNum = Number(m[1]);
+ speedUnit = (m[2]?.toUpperCase() as "K" | "M") ?? "M";
+ } else {
+ speedNum = null;
+ }
+ });
+
+ function applySpeedLimit() {
+ const value = speedNum && speedNum > 0 ? `${speedNum}${speedUnit}` : "";
+ updateSettings({ download: { speed_limit: value } });
+ }
+
+ const SB_CATEGORIES = [
+ "sponsor",
+ "selfpromo",
+ "interaction",
+ "intro",
+ "outro",
+ "preview",
+ "filler",
+ "music_offtopic",
+ ] as const;
+
+ function sbHas(cat: string): boolean {
+ return settings?.download.sponsorblock_categories?.includes(cat) ?? false;
+ }
+
+ function toggleSbCategory(cat: string) {
+ const current = settings?.download.sponsorblock_categories ?? [];
+ const next = current.includes(cat)
+ ? current.filter((c) => c !== cat)
+ : [...current, cat];
+ updateSettings({ download: { sponsorblock_categories: next } });
+ }
+
+ function setSbMode(e: Event) {
+ const value = (e.target as HTMLSelectElement).value;
+ updateSettings({ download: { sponsorblock_mode: value } });
+ }
+
function previewTemplate(template: string): string {
return template
.replace("%(title).200s", "My Video Title")
@@ -235,6 +305,16 @@
<div class="setting-col">
<span class="setting-label">{$t('settings.download.default_output_dir')}</span>
<span class="setting-path">{settings.download.default_output_dir}</span>
+ {#if pathInfo && !pathInfo.ok}
+ <span class="path-warning" role="status">
+ <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
+ <path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z" />
+ <line x1="12" y1="9" x2="12" y2="13" />
+ <line x1="12" y1="17" x2="12.01" y2="17" />
+ </svg>
+ {$t('settings.download.path_too_long', { current: pathInfo.current, limit: pathInfo.limit })}
+ </span>
+ {/if}
</div>
<button class="button" onclick={chooseFolder}>{$t('settings.download.choose_folder')}</button>
</div>
@@ -258,6 +338,30 @@
</select>
</div>
<div class="divider"></div>
+ <div class="setting-row">
+ <div class="setting-col">
+ <span class="setting-label">{$t('settings.download.speed_limit')}</span>
+ <span class="setting-path">{$t('settings.download.speed_limit_desc')}</span>
+ </div>
+ <div class="speed-limit">
+ <input
+ type="number"
+ class="input-number"
+ min="0"
+ step="1"
+ inputmode="numeric"
+ placeholder={$t('settings.download.speed_limit_unlimited') as string}
+ bind:value={speedNum}
+ onchange={applySpeedLimit}
+ aria-label={$t('settings.download.speed_limit') as string}
+ />
+ <select class="select" bind:value={speedUnit} onchange={applySpeedLimit} aria-label="unit">
+ <option value="K">KB/s</option>
+ <option value="M">MB/s</option>
+ </select>
+ </div>
+ </div>
+ <div class="divider"></div>
<div class="setting-row">
<span class="setting-label">{$t('settings.download.always_ask_path')}</span>
<button class="toggle" class:on={settings.download.always_ask_path} onclick={() => toggleBool("download", "always_ask_path", settings.download.always_ask_path)} role="switch" aria-checked={settings.download.always_ask_path} aria-label={$t('settings.download.always_ask_path') as string}><span class="toggle-knob"></span></button>
@@ -394,6 +498,39 @@
</div>
<button class="toggle" class:on={settings.download.youtube_sponsorblock} onclick={() => toggleBool("download", "youtube_sponsorblock", settings.download.youtube_sponsorblock)} role="switch" aria-checked={settings.download.youtube_sponsorblock} aria-label={$t('settings.download.youtube_sponsorblock') as string}><span class="toggle-knob"></span></button>
</div>
+ {#if settings.download.youtube_sponsorblock}
+ <div class="divider"></div>
+ <div class="setting-row">
+ <div class="setting-col">
+ <span class="setting-label">{$t('settings.download.sb_mode')}</span>
+ <span class="setting-path">{$t('settings.download.sb_mode_desc')}</span>
+ </div>
+ <select class="select" value={settings.download.sponsorblock_mode} onchange={setSbMode}>
+ <option value="remove">{$t('settings.download.sb_mode_remove')}</option>
+ <option value="mark">{$t('settings.download.sb_mode_mark')}</option>
+ </select>
+ </div>
+ <div class="divider"></div>
+ <div class="setting-row">
+ <div class="setting-col">
+ <span class="setting-label">{$t('settings.download.sb_categories')}</span>
+ <span class="setting-path">{$t('settings.download.sb_categories_desc')}</span>
+ </div>
+ </div>
+ <div class="sb-chips">
+ {#each SB_CATEGORIES as cat (cat)}
+ <button
+ type="button"
+ class="sb-chip"
+ class:on={sbHas(cat)}
+ onclick={() => toggleSbCategory(cat)}
+ aria-pressed={sbHas(cat)}
+ >
+ {$t(`settings.download.sb_cat_${cat}`)}
+ </button>
+ {/each}
+ </div>
+ {/if}
<div class="divider"></div>
<div class="setting-row">
<div class="setting-col">
@@ -402,6 +539,14 @@
</div>
<button class="toggle" class:on={settings.download.split_by_chapters} onclick={() => toggleBool("download", "split_by_chapters", settings.download.split_by_chapters)} role="switch" aria-checked={settings.download.split_by_chapters} aria-label={$t('settings.download.split_by_chapters') as string}><span class="toggle-knob"></span></button>
</div>
+ <div class="divider"></div>
+ <div class="setting-row">
+ <div class="setting-col">
+ <span class="setting-label">{$t('settings.download.live_from_start')}</span>
+ <span class="setting-path">{$t('settings.download.live_from_start_desc')}</span>
+ </div>
+ <button class="toggle" class:on={settings.download.live_from_start} onclick={() => toggleBool("download", "live_from_start", settings.download.live_from_start)} role="switch" aria-checked={settings.download.live_from_start} aria-label={$t('settings.download.live_from_start') as string}><span class="toggle-knob"></span></button>
+ </div>
</div>
</details>
@@ -459,6 +604,70 @@
{/if}
<style>
+ .path-warning {
+ display: flex;
+ align-items: flex-start;
+ gap: 6px;
+ margin-top: 6px;
+ color: var(--warning);
+ font-size: 12px;
+ line-height: 1.4;
+ }
+ .path-warning svg {
+ flex-shrink: 0;
+ margin-top: 1px;
+ }
+
+ .speed-limit {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ }
+ .input-number {
+ width: 88px;
+ padding: 6px 8px;
+ background: var(--surface);
+ color: var(--text);
+ border: 1px solid var(--border);
+ border-radius: var(--border-radius, 6px);
+ font: inherit;
+ text-align: right;
+ }
+ .input-number:focus-visible {
+ outline: var(--focus-ring);
+ outline-offset: var(--focus-ring-offset);
+ }
+
+ .sb-chips {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 6px;
+ padding: 4px 0 8px;
+ }
+ .sb-chip {
+ padding: 5px 12px;
+ border: 1px solid var(--border);
+ border-radius: 999px;
+ background: var(--surface);
+ color: var(--text-muted, var(--text));
+ font: inherit;
+ font-size: 12px;
+ cursor: pointer;
+ transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease;
+ }
+ .sb-chip:hover {
+ border-color: var(--accent);
+ }
+ .sb-chip.on {
+ border-color: var(--accent);
+ background: color-mix(in srgb, var(--accent) 16%, var(--surface));
+ color: var(--text);
+ }
+ .sb-chip:focus-visible {
+ outline: var(--focus-ring);
+ outline-offset: var(--focus-ring-offset);
+ }
+
.preset-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
diff --git a/src/components/settings/SettingsDropdown.svelte b/src/components/settings/SettingsDropdown.svelte
deleted file mode 100644
index 4b5c7e52..00000000
--- a/src/components/settings/SettingsDropdown.svelte
+++ /dev/null
@@ -1,117 +0,0 @@
-<script lang="ts">
- type Option = {
- value: string;
- label: string;
- };
-
- let {
- label = "",
- description = "",
- value = $bindable(""),
- options = [] as Option[],
- onChange,
- } = $props();
-
- const selectId = `dropdown-${Math.random().toString(36).slice(2, 9)}`;
- const labelId = `${selectId}-label`;
-
- function handleChange(e: Event) {
- const target = e.target as HTMLSelectElement;
- value = target.value;
- onChange?.(value);
- }
-</script>
-
-<div class="settings-dropdown">
- <div class="dropdown-labels">
- <label class="dropdown-label" id={labelId} for={selectId}>
- {label}
- </label>
- {#if description}
- <p class="dropdown-description">{description}</p>
- {/if}
- </div>
-
- <div class="dropdown-wrapper">
- <select
- id={selectId}
- class="dropdown-select"
- bind:value
- onchange={handleChange}
- aria-labelledby={labelId}
- >
- {#each options as option (option.value)}
- <option value={option.value}>{option.label}</option>
- {/each}
- </select>
- </div>
-</div>
-
-<style>
- .settings-dropdown {
- display: flex;
- flex-direction: column;
- gap: var(--padding);
- padding: var(--padding);
- background: var(--button);
- border-radius: var(--border-radius);
- }
-
- .dropdown-labels {
- display: flex;
- flex-direction: column;
- gap: calc(var(--padding) / 4);
- }
-
- .dropdown-label {
- font-size: 14.5px;
- font-weight: 500;
- color: var(--secondary);
- cursor: pointer;
- }
-
- .dropdown-description {
- margin: 0;
- font-size: 12.5px;
- font-weight: 400;
- color: var(--gray);
- line-height: 1.4;
- }
-
- .dropdown-wrapper {
- position: relative;
- }
-
- .dropdown-select {
- width: 100%;
- padding: 8px var(--padding);
- font-size: 14.5px;
- background: var(--input-bg);
- border: 1px solid var(--input-border);
- border-radius: calc(var(--border-radius) - 2px);
- color: var(--secondary);
- cursor: pointer;
- appearance: none;
- padding-right: 32px;
- background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>');
- background-repeat: no-repeat;
- background-position: right 8px center;
- background-size: 16px;
- }
-
- .dropdown-select::placeholder {
- color: var(--gray);
- }
-
- .dropdown-select:focus-visible {
- border-color: var(--secondary);
- outline: var(--focus-ring);
- outline-offset: var(--focus-ring-offset);
- }
-
- @media (prefers-reduced-motion: reduce) {
- .dropdown-select {
- transition: none;
- }
- }
-</style>
diff --git a/src/components/settings/SettingsNetwork.svelte b/src/components/settings/SettingsNetwork.svelte
index 0fc8c996..b418a7e8 100644
--- a/src/components/settings/SettingsNetwork.svelte
+++ b/src/components/settings/SettingsNetwork.svelte
@@ -50,17 +50,17 @@
}
const YTDLP_FLAG_CATALOG = [
- { flag: "--embed-subs", label: "Embed subtitles" },
- { flag: "--write-thumbnail", label: "Save thumbnail" },
- { flag: "--write-description", label: "Save description" },
- { flag: "--write-comments", label: "Save comments" },
- { flag: "--restrict-filenames", label: "ASCII filenames" },
- { flag: "--no-overwrites", label: "No overwrites" },
- { flag: "--prefer-free-formats", label: "Free formats" },
- { flag: "--force-ipv4", label: "Force IPv4" },
- { flag: "--geo-bypass", label: "Geo bypass" },
- { flag: "--limit-rate", label: "Limit rate", hasValue: true, placeholder: "e.g. 1M" },
- { flag: "--sleep-interval", label: "Sleep interval", hasValue: true, placeholder: "e.g. 5" },
+ { flag: "--embed-subs", key: "embed_subs" },
+ { flag: "--write-thumbnail", key: "write_thumbnail" },
+ { flag: "--write-description", key: "write_description" },
+ { flag: "--write-comments", key: "write_comments" },
+ { flag: "--restrict-filenames", key: "restrict_filenames" },
+ { flag: "--no-overwrites", key: "no_overwrites" },
+ { flag: "--prefer-free-formats", key: "prefer_free_formats" },
+ { flag: "--force-ipv4", key: "force_ipv4" },
+ { flag: "--geo-bypass", key: "geo_bypass" },
+ { flag: "--limit-rate", key: "limit_rate", hasValue: true, phKey: "limit_rate_ph" },
+ { flag: "--sleep-interval", key: "sleep_interval", hasValue: true, phKey: "sleep_interval_ph" },
];
async function toggleFlag(flag: string) {
@@ -156,13 +156,13 @@
onclick={() => toggleFlag(item.flag)}
title={item.flag}
>
- {item.label}
+ {$t(`settings.ytdlp_flags.${item.key}`)}
</button>
{#if item.hasValue && isFlagActive(item.flag)}
<input
class="flag-value-input"
type="text"
- placeholder={item.placeholder}
+ placeholder={item.phKey ? ($t(`settings.ytdlp_flags.${item.phKey}`) as string) : ""}
value={getFlagValue(item.flag)}
oninput={(e) => {
const val = (e.target as HTMLInputElement).value;
diff --git a/src/components/toast/Toast.svelte b/src/components/toast/Toast.svelte
index 61a727fd..57a69dc9 100644
--- a/src/components/toast/Toast.svelte
+++ b/src/components/toast/Toast.svelte
@@ -1,5 +1,6 @@
<script lang="ts">
import { getToasts, dismissToast, type ToastType } from "$lib/stores/toast-store.svelte";
+ import { t } from "$lib/i18n";
let toasts = $derived(getToasts());
@@ -29,7 +30,7 @@
<path d={iconPath(toast.type)} />
</svg>
<span class="toast-message">{toast.message}</span>
- <button class="toast-close" onclick={() => dismissToast(toast.id)} aria-label="Close">
+ <button class="toast-close" onclick={() => dismissToast(toast.id)} aria-label={$t("common.close") as string}>
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M18 6L6 18M6 6l12 12" />
</svg>
diff --git a/src/lib/anki-bridge.ts b/src/lib/anki-bridge.ts
index 3da9adec..de375298 100644
--- a/src/lib/anki-bridge.ts
+++ b/src/lib/anki-bridge.ts
@@ -1,14 +1,5 @@
import { pluginInvoke } from "$lib/plugin-invoke";
-export type AnkiPet = {
- slug: string;
- display_name: string;
- description: string;
- spritesheet_url: string;
- vibes: string[];
- tags: string[];
-};
-
export type AnkiStreak = {
current: number;
longest: number;
@@ -59,7 +50,6 @@ export type AnkiDashboardState = {
reviewed_today: number;
recent_reviews: number;
streak: AnkiStreak;
- pet: AnkiPet;
pending: AnkiPendingCounts;
motd: string;
};
@@ -101,18 +91,6 @@ export function ankiDashboard(): Promise<AnkiDashboardState> {
return pluginInvoke<AnkiDashboardState>("study", "study:anki:dashboard:state");
}
-export function ankiPetsList(): Promise<AnkiPet[]> {
- return pluginInvoke<AnkiPet[]>("study", "study:anki:pets:list");
-}
-
-export function ankiPetActive(): Promise<AnkiPet> {
- return pluginInvoke<AnkiPet>("study", "study:anki:pets:active");
-}
-
-export function ankiPetSetActive(slug: string): Promise<AnkiPet> {
- return pluginInvoke<AnkiPet>("study", "study:anki:pets:set_active", { slug });
-}
-
export function ankiStreak(): Promise<AnkiStreak> {
return pluginInvoke<AnkiStreak>("study", "study:anki:streak:current");
}
diff --git a/src/lib/components/Mascot.svelte b/src/lib/components/Mascot.svelte
deleted file mode 100644
index f038b0bc..00000000
--- a/src/lib/components/Mascot.svelte
+++ /dev/null
@@ -1,120 +0,0 @@
-<script lang="ts">
- import { onMount } from "svelte";
- import { PET_STATES } from "$lib/pets/states";
- import type { PetStateId } from "$lib/pets/types";
- import { petsResolveAssetUrl } from "$lib/pets/sync";
-
- let {
- slug,
- state: stateProp = "idle" as PetStateId,
- scale = 1,
- paused = false,
- }: {
- slug: string;
- state?: PetStateId;
- scale?: number;
- paused?: boolean;
- } = $props();
-
- const anim = $derived(PET_STATES[stateProp]);
- let resolved = $state<string | null>(null);
-
- onMount(() => {
- let active = true;
- (async () => {
- if (!slug) return;
- try {
- const url = await petsResolveAssetUrl(slug);
- if (active) resolved = url;
- } catch {
- if (active) resolved = null;
- }
- })();
- return () => {
- active = false;
- };
- });
-
- $effect(() => {
- if (!slug) {
- resolved = null;
- return;
- }
- let active = true;
- petsResolveAssetUrl(slug)
- .then((url) => {
- if (active) resolved = url;
- })
- .catch(() => {
- if (active) resolved = null;
- });
- return () => {
- active = false;
- };
- });
-</script>
-
-{#if resolved}
- <div class="pet-sprite-frame" style:--pet-scale={scale}>
- <div
- class="pet-sprite"
- class:paused
- style:--sprite-url="url({resolved})"
- style:--sprite-row={anim.row}
- style:--sprite-frames={anim.frames}
- style:--sprite-duration="{anim.durationMs}ms"
- ></div>
- </div>
-{:else}
- <div class="pet-sprite-frame placeholder" style:--pet-scale={scale}></div>
-{/if}
-
-<style>
- .pet-sprite-frame {
- --pet-scale: 1;
- width: calc(192px * var(--pet-scale));
- height: calc(208px * var(--pet-scale));
- overflow: hidden;
- flex-shrink: 0;
- }
-
- .placeholder {
- background: var(--surface-hi);
- border-radius: var(--radius-sm);
- }
-
- .pet-sprite {
- --sprite-row: 0;
- --sprite-frames: 6;
- --sprite-duration: 1100ms;
- --sprite-y: calc(var(--sprite-row) * -208px);
- --sprite-end-x: calc(var(--sprite-frames) * -192px);
- width: 192px;
- height: 208px;
- background-image: var(--sprite-url);
- background-repeat: no-repeat;
- background-size: 1536px 1872px;
- image-rendering: pixelated;
- transform: scale(var(--pet-scale));
- transform-origin: top left;
- animation: pet-state var(--sprite-duration) steps(var(--sprite-frames)) infinite;
- }
-
- .pet-sprite.paused {
- animation-play-state: paused;
- }
-
- @keyframes pet-state {
- from { background-position: 0 var(--sprite-y); }
- to { background-position: var(--sprite-end-x) var(--sprite-y); }
- }
-
- @media (prefers-reduced-motion: reduce) {
- .pet-sprite { animation: none; }
- }
-
- :global([data-theme^="eink-"]) .pet-sprite {
- animation: none;
- filter: grayscale(1) contrast(1.05);
- }
-</style>
diff --git a/src/lib/components/MascotSlot.svelte b/src/lib/components/MascotSlot.svelte
deleted file mode 100644
index 3829094d..00000000
--- a/src/lib/components/MascotSlot.svelte
+++ /dev/null
@@ -1,163 +0,0 @@
-<script lang="ts">
- import { onMount } from "svelte";
- import Mascot from "./Mascot.svelte";
- import {
- getDisplayPrefs,
- loadDisplayPrefs,
- motionEnabled as motionEnabledFn,
- petsLoaded,
- } from "$lib/pets/display-prefs.svelte";
- import { getStateForEvent, type AnkiMoodEvent } from "$lib/pets/mood";
- import type { PetStateId } from "$lib/pets/types";
-
- type Fallback =
- | "none"
- | "check"
- | "spinner"
- | "warn"
- | "error"
- | "celebrate"
- | "rest"
- | "wave";
-
- let {
- slug,
- state: stateProp,
- event,
- scale = 1,
- fallback = "none" as Fallback,
- fallbackLabel = "",
- overrideEnabled,
- }: {
- slug?: string | null;
- state?: PetStateId;
- event?: AnkiMoodEvent;
- scale?: number;
- fallback?: Fallback;
- fallbackLabel?: string;
- overrideEnabled?: boolean;
- } = $props();
-
- let prefsLoaded = $state(petsLoaded());
-
- onMount(() => {
- if (!prefsLoaded) {
- void loadDisplayPrefs().then(() => {
- prefsLoaded = true;
- });
- }
- });
-
- const resolvedState = $derived<PetStateId>(
- stateProp ?? (event ? getStateForEvent(event) : "idle"),
- );
-
- const enabledByPrefs = $derived(
- overrideEnabled !== undefined ? overrideEnabled : getDisplayPrefs().enabled,
- );
-
- const showMascot = $derived(prefsLoaded && enabledByPrefs && !!slug);
- const showFallback = $derived(prefsLoaded && (!enabledByPrefs || !slug) && fallback !== "none");
-</script>
-
-{#if showMascot}
- {#if motionEnabledFn()}
- <Mascot slug={slug!} state={resolvedState} {scale} />
- {:else}
- <Mascot slug={slug!} state={resolvedState} {scale} paused />
- {/if}
-{:else if showFallback}
- <span class="slot-fallback fb-{fallback}" aria-label={fallbackLabel || undefined} role={fallbackLabel ? "img" : undefined}>
- {#if fallback === "check"}
- <svg viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
- <circle cx="12" cy="12" r="9" />
- <path d="M8 12.5l2.5 2.5L16 9.5" />
- </svg>
- {:else if fallback === "spinner"}
- <span class="spin" aria-hidden="true"></span>
- {:else if fallback === "warn"}
- <svg viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
- <path d="M12 9v4" />
- <path d="M12 17h.01" />
- <path d="M10.3 3.7l-8 14a2 2 0 0 0 1.7 3h16a2 2 0 0 0 1.7-3l-8-14a2 2 0 0 0-3.4 0z" />
- </svg>
- {:else if fallback === "error"}
- <svg viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
- <circle cx="12" cy="12" r="9" />
- <path d="M15 9l-6 6M9 9l6 6" />
- </svg>
- {:else if fallback === "celebrate"}
- <svg viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
- <path d="M12 3v3" />
- <path d="M5 5l2 2" />
- <path d="M19 5l-2 2" />
- <path d="M3 12h3" />
- <path d="M21 12h-3" />
- <path d="M12 9a4 4 0 0 1 4 4v6H8v-6a4 4 0 0 1 4-4z" />
- </svg>
- {:else if fallback === "rest"}
- <svg viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
- <path d="M21 12.79A9 9 0 1 1 11.21 3a7 7 0 0 0 9.79 9.79z" />
- </svg>
- {:else if fallback === "wave"}
- <svg viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
- <path d="M3 12c2 2 4 2 6 0s4-2 6 0 4 2 6 0" />
- </svg>
- {/if}
- {#if fallbackLabel}<span class="sr-only">{fallbackLabel}</span>{/if}
- </span>
-{/if}
-
-<style>
- .slot-fallback {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- color: var(--text-muted);
- }
-
- .slot-fallback.fb-check,
- .slot-fallback.fb-celebrate,
- .slot-fallback.fb-wave {
- color: var(--success);
- }
-
- .slot-fallback.fb-warn {
- color: var(--warning);
- }
-
- .slot-fallback.fb-error {
- color: var(--error);
- }
-
- .spin {
- width: 18px;
- height: 18px;
- border-radius: 50%;
- border: 2px solid var(--surface-hi);
- border-top-color: var(--accent);
- animation: slot-spin 0.8s linear infinite;
- }
-
- @keyframes slot-spin {
- to { transform: rotate(360deg); }
- }
-
- .sr-only {
- position: absolute;
- width: 1px;
- height: 1px;
- padding: 0;
- margin: -1px;
- overflow: hidden;
- clip: rect(0, 0, 0, 0);
- white-space: nowrap;
- border: 0;
- }
-
- @media (prefers-reduced-motion: reduce) {
- .spin {
- animation: none;
- }
- }
-</style>
diff --git a/src/lib/components/PetCard.svelte b/src/lib/components/PetCard.svelte
deleted file mode 100644
index 7c3da5fc..00000000
--- a/src/lib/components/PetCard.svelte
+++ /dev/null
@@ -1,201 +0,0 @@
-<script lang="ts">
- import Mascot from "./Mascot.svelte";
- import type { LocalPetEntry } from "$lib/pets/sync";
-
- let {
- pet,
- active = false,
- busy = false,
- onActivate,
- onRemove,
- onRefresh,
- }: {
- pet: LocalPetEntry;
- active?: boolean;
- busy?: boolean;
- onActivate: (slug: string) => void;
- onRemove: (slug: string) => void;
- onRefresh: (slug: string) => void;
- } = $props();
-</script>
-
-<article class="pet-card" class:active class:busy>
- <div class="pet-stage">
- <Mascot slug={pet.slug} state="idle" scale={0.45} />
- {#if pet.source === "manual"}
- <span class="badge manual">manual</span>
- {/if}
- {#if active}
- <span class="badge active">ativo</span>
- {/if}
- </div>
-
- <div class="pet-meta">
- <strong class="pet-name">{pet.display_name}</strong>
- <div class="pet-tags">
- {#if pet.kind}
- <span class="tag">{pet.kind}</span>
- {/if}
- {#if pet.vibes.length > 0}
- <span class="tag vibe">{pet.vibes[0]}</span>
- {/if}
- </div>
- </div>
-
- <div class="pet-actions">
- {#if !active}
- <button type="button" class="action primary" disabled={busy} onclick={() => onActivate(pet.slug)}>
- Definir como ativo
- </button>
- {/if}
- <button type="button" class="action" disabled={busy} onclick={() => onRefresh(pet.slug)}>
- Atualizar
- </button>
- <button type="button" class="action ghost" disabled={busy} onclick={() => onRemove(pet.slug)}>
- Remover
- </button>
- </div>
-</article>
-
-<style>
- .pet-card {
- display: flex;
- flex-direction: column;
- gap: var(--space-3);
- padding: var(--space-3);
- background: var(--surface);
- border: 1px solid var(--border);
- border-radius: var(--radius-md);
- transition: border-color var(--duration-fast) var(--ease-out),
- box-shadow var(--duration-fast) var(--ease-out);
- }
-
- .pet-card:hover:not(.busy) {
- border-color: var(--accent);
- box-shadow: var(--elev-1);
- }
-
- .pet-card.active {
- border-color: var(--accent);
- box-shadow: 0 0 0 1px var(--accent) inset;
- }
-
- .pet-card.busy {
- opacity: 0.6;
- }
-
- .pet-stage {
- position: relative;
- display: flex;
- align-items: center;
- justify-content: center;
- background: var(--surface-hi);
- border-radius: var(--radius-sm);
- padding: var(--space-3);
- min-height: 110px;
- }
-
- .badge {
- position: absolute;
- top: 6px;
- font-size: var(--text-xs);
- font-weight: 600;
- text-transform: uppercase;
- letter-spacing: 0.06em;
- padding: 1px 8px;
- border-radius: var(--radius-full);
- background: var(--surface);
- color: var(--text-muted);
- border: 1px solid var(--border);
- }
-
- .badge.active {
- right: 6px;
- background: var(--accent);
- color: var(--on-accent);
- border-color: transparent;
- }
-
- .badge.manual {
- left: 6px;
- }
-
- .pet-meta {
- display: flex;
- flex-direction: column;
- gap: 2px;
- }
-
- .pet-name {
- font-size: var(--text-sm);
- font-weight: 600;
- color: var(--text);
- }
-
- .pet-tags {
- display: flex;
- gap: 4px;
- flex-wrap: wrap;
- }
-
- .tag {
- font-size: 10.5px;
- font-weight: 500;
- padding: 1px 8px;
- border-radius: var(--radius-full);
- background: var(--surface-hi);
- color: var(--text-muted);
- }
-
- .tag.vibe {
- color: var(--text);
- }
-
- .pet-actions {
- display: flex;
- gap: 4px;
- flex-wrap: wrap;
- }
-
- .action {
- padding: 4px 10px;
- font-size: var(--text-xs);
- background: var(--surface-hi);
- border: 1px solid transparent;
- border-radius: var(--radius-xs);
- color: var(--text);
- font-family: inherit;
- cursor: pointer;
- transition: background var(--duration-fast) var(--ease-out),
- border-color var(--duration-fast) var(--ease-out);
- }
-
- .action:hover:not(:disabled) {
- background: var(--surface-mut);
- }
-
- .action.primary {
- background: var(--accent);
- color: var(--on-accent);
- }
-
- .action.primary:hover:not(:disabled) {
- background: var(--accent-lo);
- }
-
- .action.ghost {
- background: transparent;
- border-color: var(--border);
- color: var(--text-muted);
- }
-
- .action.ghost:hover:not(:disabled) {
- color: var(--error);
- border-color: var(--error);
- }
-
- .action:disabled {
- opacity: 0.4;
- cursor: not-allowed;
- }
-</style>
diff --git a/src/lib/components/PetsManager.svelte b/src/lib/components/PetsManager.svelte
deleted file mode 100644
index 11fc0f7b..00000000
--- a/src/lib/components/PetsManager.svelte
+++ /dev/null
@@ -1,551 +0,0 @@
-<script lang="ts">
- import { onMount } from "svelte";
- import {
- petsGetLocalIndex,
- petsGetActive,
- petsSetActive,
- petsUninstall,
- petsForceRefresh,
- petsInstallBundle,
- petsOpenFolder,
- type LocalIndex,
- type LocalPetEntry,
- } from "$lib/pets/sync";
- import type { PetVibe } from "$lib/pets/types";
- import { VIBE_MOOD } from "$lib/pets/mood";
- import PetCard from "./PetCard.svelte";
- import SyncButton from "./SyncButton.svelte";
- import { showToast } from "$lib/stores/toast-store.svelte";
-
- type Kind = "creature" | "object" | "character";
-
- let index = $state<LocalIndex | null>(null);
- let activeSlug = $state<string | null>(null);
- let loading = $state(true);
- let busySlug = $state<string | null>(null);
- let bundleBusy = $state(false);
- let query = $state("");
- let kindFilter = $state<Kind | "">("");
- let vibeFilter = $state<PetVibe | "">("");
- let lastSyncRelative = $state("");
-
- let page = $state(0);
- const PAGE_SIZE = 24;
-
- const ALL_VIBES: PetVibe[] = [
- "cozy", "calm", "playful", "cheerful", "focused", "mischievous",
- "heroic", "edgy", "mystical", "wholesome", "chaotic", "melancholic",
- ];
-
- onMount(() => {
- void load();
- });
-
- async function load() {
- loading = true;
- try {
- const [idx, active] = await Promise.all([petsGetLocalIndex(), petsGetActive()]);
- index = idx;
- activeSlug = active;
- lastSyncRelative = formatRelative(idx.last_synced_at);
- } catch (e: any) {
- showToast("error", typeof e === "string" ? e : (e?.message ?? "Erro"));
- } finally {
- loading = false;
- }
- }
-
- function formatRelative(iso: string | null): string {
- if (!iso) return "nunca";
- const then = new Date(iso).getTime();
- const diff = Math.max(0, Date.now() - then) / 1000;
- if (diff < 60) return "agora";
- if (diff < 3600) return `há ${Math.floor(diff / 60)} min`;
- if (diff < 86400) return `há ${Math.floor(diff / 3600)} h`;
- return `há ${Math.floor(diff / 86400)} d`;
- }
-
- function vibeMood(vibe: PetVibe): "positive" | "ambiguous" | "negative" {
- if (VIBE_MOOD.positive.includes(vibe)) return "positive";
- if (VIBE_MOOD.negative.includes(vibe)) return "negative";
- return "ambiguous";
- }
-
- const filtered = $derived.by<LocalPetEntry[]>(() => {
- if (!index) return [];
- const q = query.trim().toLowerCase();
- return index.pets.filter((p) => {
- if (q) {
- const hay = `${p.display_name} ${p.slug} ${p.tags.join(" ")} ${p.vibes.join(" ")}`.toLowerCase();
- if (!hay.includes(q)) return false;
- }
- if (kindFilter && p.kind !== kindFilter) return false;
- if (vibeFilter && !p.vibes.includes(vibeFilter)) return false;
- return true;
- });
- });
-
- const totalPages = $derived(Math.max(1, Math.ceil(filtered.length / PAGE_SIZE)));
- const visible = $derived.by<LocalPetEntry[]>(() => {
- const start = page * PAGE_SIZE;
- return filtered.slice(start, start + PAGE_SIZE);
- });
-
- $effect(() => {
- void query;
- void kindFilter;
- void vibeFilter;
- page = 0;
- });
-
- $effect(() => {
- if (page >= totalPages) page = Math.max(0, totalPages - 1);
- });
-
- function nextPage() {
- if (page + 1 < totalPages) {
- page += 1;
- scrollToTop();
- }
- }
- function prevPage() {
- if (page > 0) {
- page -= 1;
- scrollToTop();
- }
- }
- function goToPage(p: number) {
- page = Math.max(0, Math.min(totalPages - 1, p));
- scrollToTop();
- }
- function scrollToTop() {
- const el = document.querySelector(".pets-manager");
- if (el) el.scrollIntoView({ behavior: "smooth", block: "start" });
- }
-
- async function activate(slug: string) {
- if (busySlug) return;
- busySlug = slug;
- try {
- await petsSetActive(slug);
- activeSlug = slug;
- showToast("info", "Pet ativado");
- } catch (e: any) {
- showToast("error", typeof e === "string" ? e : (e?.message ?? "Erro"));
- } finally {
- busySlug = null;
- }
- }
-
- async function remove(slug: string) {
- if (busySlug) return;
- if (!confirm(`Remover '${slug}'? Os arquivos locais serão apagados.`)) return;
- busySlug = slug;
- try {
- await petsUninstall(slug);
- await load();
- showToast("info", "Pet removido");
- } catch (e: any) {
- showToast("error", typeof e === "string" ? e : (e?.message ?? "Erro"));
- } finally {
- busySlug = null;
- }
- }
-
- async function refresh(slug: string) {
- if (busySlug) return;
- if (!confirm(`Substituir os arquivos de '${slug}' pela versão mais recente do petdex?`)) return;
- busySlug = slug;
- try {
- await petsForceRefresh(slug);
- await load();
- showToast("info", "Pet atualizado");
- } catch (e: any) {
- showToast("error", typeof e === "string" ? e : (e?.message ?? "Erro"));
- } finally {
- busySlug = null;
- }
- }
-
- async function downloadAll() {
- if (bundleBusy) return;
- bundleBusy = true;
- try {
- const report = await petsInstallBundle();
- await load();
- showToast(
- "info",
- `${report.added.length} pets adicionados, ${report.skipped.length} pulados`,
- );
- } catch (e: any) {
- showToast("error", typeof e === "string" ? e : (e?.message ?? "Erro"));
- } finally {
- bundleBusy = false;
- }
- }
-
- async function openFolder() {
- try {
- await petsOpenFolder();
- } catch (e: any) {
- showToast("error", typeof e === "string" ? e : (e?.message ?? "Erro"));
- }
- }
-</script>
-
-<section class="pets-manager">
- <header class="head">
- <div class="head-text">
- <h2 class="title">Pets</h2>
- {#if index}
- <p class="subtitle">
- {index.total} pets instalados · última sincronização {lastSyncRelative}
- </p>
- {/if}
- </div>
- <div class="head-actions">
- <SyncButton onChange={load} />
- <button type="button" class="btn-secondary" disabled={bundleBusy} onclick={downloadAll}>
- {bundleBusy ? "Baixando…" : "Baixar todos"}
- </button>
- <button type="button" class="link" onclick={openFolder}>Abrir pasta de pets</button>
- </div>
- </header>
-
- <div class="filters">
- <input
- type="search"
- class="input"
- placeholder="Buscar por nome, tag ou vibe"
- bind:value={query}
- />
- <select class="input" bind:value={kindFilter}>
- <option value="">Todos os tipos</option>
- <option value="creature">Creatures</option>
- <option value="object">Objects</option>
- <option value="character">Characters</option>
- </select>
- <select class="input" bind:value={vibeFilter}>
- <option value="">Todas as vibes</option>
- {#each ALL_VIBES as vibe (vibe)}
- <option value={vibe}>{vibe}</option>
- {/each}
- </select>
- </div>
-
- {#if loading}
- <div class="state">Carregando…</div>
- {:else if !index || index.total === 0}
- <div class="empty">
- <h3 class="empty-title">Você ainda não tem pets instalados.</h3>
- <p class="empty-desc">
- Baixe a coleção completa de uma vez ou puxe sob demanda do petdex.
- </p>
- <div class="empty-actions">
- <button type="button" class="btn-primary" disabled={bundleBusy} onclick={downloadAll}>
- {bundleBusy ? "Baixando…" : "Baixar todos os pets"}
- </button>
- </div>
- </div>
- {:else if filtered.length === 0}
- <div class="state">Nenhum pet bate com os filtros.</div>
- {:else}
- <div class="result-info">
- <span>
- {filtered.length === 1
- ? "1 pet"
- : `${filtered.length} pets`}
- {#if totalPages > 1}
- · página {page + 1} de {totalPages}
- {/if}
- </span>
- </div>
-
- <div class="grid">
- {#each visible as pet (pet.slug)}
- <PetCard
- {pet}
- active={pet.slug === activeSlug}
- busy={busySlug === pet.slug}
- onActivate={activate}
- onRemove={remove}
- onRefresh={refresh}
- />
- {/each}
- </div>
-
- {#if totalPages > 1}
- <nav class="pagination" aria-label="Paginação de pets">
- <button
- type="button"
- class="page-btn"
- onclick={prevPage}
- disabled={page === 0}
- aria-label="Página anterior"
- >
- ← Anterior
- </button>
-
- <div class="page-nums">
- {#each Array(totalPages) as _, i (i)}
- {#if i === 0 || i === totalPages - 1 || Math.abs(i - page) <= 1}
- <button
- type="button"
- class="page-num"
- class:active={i === page}
- onclick={() => goToPage(i)}
- >
- {i + 1}
- </button>
- {:else if Math.abs(i - page) === 2}
- <span class="page-ellipsis" aria-hidden="true">…</span>
- {/if}
- {/each}
- </div>
-
- <button
- type="button"
- class="page-btn"
- onclick={nextPage}
- disabled={page + 1 >= totalPages}
- aria-label="Próxima página"
- >
- Próxima →
- </button>
- </nav>
- {/if}
- {/if}
-</section>
-
-<style>
- .pets-manager {
- display: flex;
- flex-direction: column;
- gap: var(--space-4);
- width: 100%;
- }
-
-
- .head {
- display: flex;
- flex-wrap: wrap;
- gap: var(--space-3);
- justify-content: space-between;
- align-items: flex-start;
- }
-
- .head-text .title {
- margin: 0;
- font-family: var(--font-display);
- font-size: var(--text-xl);
- font-weight: 600;
- }
-
- .subtitle {
- margin: 4px 0 0;
- color: var(--text-muted);
- font-size: var(--text-sm);
- }
-
- .head-actions {
- display: flex;
- gap: var(--space-2);
- align-items: flex-start;
- flex-wrap: wrap;
- }
-
- .btn-secondary {
- padding: 8px 14px;
- background: var(--surface-hi);
- border: 1px solid var(--border);
- border-radius: var(--radius-sm);
- color: var(--text);
- font-family: inherit;
- font-size: var(--text-sm);
- cursor: pointer;
- }
-
- .btn-secondary:hover:not(:disabled) {
- background: var(--surface-mut);
- }
-
- .btn-secondary:disabled {
- opacity: 0.5;
- cursor: progress;
- }
-
- .link {
- background: transparent;
- border: none;
- color: var(--accent);
- font-family: inherit;
- font-size: var(--text-sm);
- cursor: pointer;
- padding: 8px 0;
- text-decoration: underline;
- text-decoration-color: transparent;
- transition: text-decoration-color var(--duration-fast) var(--ease-out);
- }
-
- .link:hover {
- text-decoration-color: currentColor;
- }
-
- .filters {
- display: flex;
- gap: var(--space-2);
- flex-wrap: wrap;
- }
-
- .input {
- flex: 1 1 200px;
- min-width: 160px;
- padding: 8px 12px;
- background: var(--surface);
- border: 1px solid var(--border);
- border-radius: var(--radius-sm);
- color: var(--text);
- font-family: inherit;
- font-size: var(--text-sm);
- }
-
- .input:focus-visible {
- outline: none;
- border-color: var(--accent);
- box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
- }
-
- .grid {
- display: grid;
- grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
- gap: var(--space-3);
- }
-
- .state {
- text-align: center;
- padding: var(--space-6);
- color: var(--text-muted);
- font-size: var(--text-sm);
- }
-
- .empty {
- display: flex;
- flex-direction: column;
- align-items: center;
- text-align: center;
- gap: var(--space-3);
- padding: var(--space-7) var(--space-5);
- background: var(--surface);
- border: 1px dashed var(--border);
- border-radius: var(--radius-md);
- }
-
- .empty-title {
- margin: 0;
- font-family: var(--font-display);
- font-size: var(--text-lg);
- }
-
- .empty-desc {
- margin: 0;
- color: var(--text-muted);
- max-width: 420px;
- }
-
- .empty-actions {
- display: flex;
- gap: var(--space-2);
- margin-top: var(--space-2);
- }
-
- .btn-primary {
- padding: 10px 20px;
- background: var(--accent);
- color: var(--on-accent);
- border: 1px solid transparent;
- border-radius: var(--radius-sm);
- font-family: inherit;
- font-size: var(--text-md);
- font-weight: 600;
- cursor: pointer;
- }
-
- .btn-primary:hover:not(:disabled) {
- background: var(--accent-lo);
- }
-
- .btn-primary:disabled {
- opacity: 0.6;
- cursor: progress;
- }
-
- .result-info {
- display: flex;
- justify-content: space-between;
- align-items: center;
- color: var(--text-muted);
- font-size: var(--text-sm);
- }
-
- .pagination {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: var(--space-2);
- margin-top: var(--space-3);
- padding-top: var(--space-3);
- border-top: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
- }
-
- .page-btn {
- padding: 7px 14px;
- background: var(--surface-hi);
- border: 1px solid var(--border);
- border-radius: var(--radius-sm);
- color: var(--text);
- font-family: inherit;
- font-size: var(--text-sm);
- cursor: pointer;
- transition: background var(--duration-fast) var(--ease-out);
- }
- .page-btn:hover:not(:disabled) {
- background: var(--surface-mut);
- border-color: var(--accent);
- }
- .page-btn:disabled {
- opacity: 0.4;
- cursor: not-allowed;
- }
-
- .page-nums {
- display: flex;
- gap: 2px;
- align-items: center;
- }
- .page-num {
- min-width: 32px;
- padding: 6px 10px;
- background: transparent;
- border: 1px solid transparent;
- border-radius: var(--radius-sm);
- color: var(--text-muted);
- font-family: var(--font-mono, ui-monospace, monospace);
- font-size: var(--text-sm);
- cursor: pointer;
- transition: background var(--duration-fast) var(--ease-out);
- }
- .page-num:hover {
- background: color-mix(in srgb, var(--accent) 8%, transparent);
- color: var(--text);
- }
- .page-num.active {
- background: var(--accent);
- color: var(--on-accent);
- font-weight: 600;
- }
- .page-ellipsis {
- color: var(--text-muted);
- font-size: var(--text-sm);
- padding: 0 4px;
- }
-</style>
diff --git a/src/lib/components/SyncButton.svelte b/src/lib/components/SyncButton.svelte
deleted file mode 100644
index e69aaa35..00000000
--- a/src/lib/components/SyncButton.svelte
+++ /dev/null
@@ -1,311 +0,0 @@
-<script lang="ts">
- import { onDestroy, onMount } from "svelte";
- import {
- petsDiff,
- petsInstallMissing,
- attachSyncListeners,
- type DiffReport,
- type SyncProgressEvent,
- type InstallReport,
- } from "$lib/pets/sync";
-
- type State = "idle" | "checking" | "uptodate" | "confirming" | "downloading" | "done" | "error";
-
- let {
- onChange,
- }: {
- onChange?: () => void;
- } = $props();
-
- let phase = $state<State>("idle");
- let diff = $state<DiffReport | null>(null);
- let progress = $state<SyncProgressEvent | null>(null);
- let lastReport = $state<InstallReport | null>(null);
- let errorMsg = $state("");
- let detach: (() => void) | null = null;
- let revertTimer: ReturnType<typeof setTimeout> | null = null;
-
- onMount(async () => {
- detach = await attachSyncListeners({
- onProgress: (e) => {
- progress = e;
- },
- onFinished: (e) => {
- lastReport = e;
- progress = null;
- if (e.failed.length === 0 && e.added.length === 0) {
- phase = "uptodate";
- } else {
- phase = "done";
- }
- if (onChange) onChange();
- if (revertTimer) clearTimeout(revertTimer);
- revertTimer = setTimeout(() => {
- phase = "idle";
- lastReport = null;
- }, 5000);
- },
- onError: (e) => {
- errorMsg = e.message;
- },
- });
- });
-
- onDestroy(() => {
- if (detach) detach();
- if (revertTimer) clearTimeout(revertTimer);
- });
-
- async function check() {
- if (phase !== "idle" && phase !== "uptodate" && phase !== "error" && phase !== "done") return;
- phase = "checking";
- errorMsg = "";
- try {
- const d = await petsDiff();
- diff = d;
- if (d.new_remote.length === 0) {
- phase = "uptodate";
- if (revertTimer) clearTimeout(revertTimer);
- revertTimer = setTimeout(() => (phase = "idle"), 3000);
- } else {
- phase = "confirming";
- }
- } catch (e: any) {
- phase = "error";
- errorMsg = typeof e === "string" ? e : (e?.message ?? "Falha ao verificar");
- }
- }
-
- async function confirmInstall() {
- if (!diff) return;
- phase = "downloading";
- progress = null;
- try {
- await petsInstallMissing(diff.new_remote);
- } catch (e: any) {
- phase = "error";
- errorMsg = typeof e === "string" ? e : (e?.message ?? "Falha ao baixar");
- }
- }
-
- function cancelConfirm() {
- phase = "idle";
- diff = null;
- }
-
- const label = $derived.by(() => {
- if (phase === "checking") return "Verificando…";
- if (phase === "confirming") return "Confirmar atualização";
- if (phase === "downloading") {
- if (progress) return `Baixando ${progress.current} de ${progress.total}…`;
- return "Baixando…";
- }
- if (phase === "uptodate") return "Tudo em dia";
- if (phase === "done" && lastReport) {
- return `${lastReport.added.length} novos adicionados`;
- }
- if (phase === "error") return "Tentar novamente";
- return "Atualizar pets";
- });
-
- const progressPct = $derived(
- progress && progress.total > 0
- ? Math.min(100, (progress.current / progress.total) * 100)
- : 0,
- );
-</script>
-
-<div class="sync">
- <button
- type="button"
- class="sync-btn"
- class:phase-idle={phase === "idle"}
- class:phase-checking={phase === "checking"}
- class:phase-uptodate={phase === "uptodate"}
- class:phase-error={phase === "error"}
- class:phase-done={phase === "done"}
- aria-busy={phase === "downloading" || phase === "checking"}
- disabled={phase === "checking" || phase === "downloading"}
- onclick={check}
- >
- {#if phase === "checking" || phase === "downloading"}
- <span class="spinner" aria-hidden="true"></span>
- {:else if phase === "uptodate" || phase === "done"}
- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
- <path d="M20 6L9 17l-5-5" />
- </svg>
- {:else}
- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
- <path d="M21 12a9 9 0 0 1-15 6.7L3 16" />
- <path d="M3 12a9 9 0 0 1 15-6.7L21 8" />
- <path d="M21 4v4h-4" />
- <path d="M3 20v-4h4" />
- </svg>
- {/if}
- <span>{label}</span>
- </button>
-
- {#if phase === "downloading"}
- <div
- class="progress"
- role="progressbar"
- aria-valuenow={Math.round(progressPct)}
- aria-valuemin="0"
- aria-valuemax="100"
- >
- <div class="progress-fill" style:width="{progressPct}%"></div>
- </div>
- {/if}
-
- {#if phase === "confirming" && diff}
- <div class="confirm">
- <p>
- {diff.new_remote.length} novos pets disponíveis: {diff.new_remote.slice(0, 3).join(", ")}{#if diff.new_remote.length > 3} e mais {diff.new_remote.length - 3}{/if}.
- </p>
- <div class="confirm-actions">
- <button type="button" class="confirm-btn primary" onclick={confirmInstall}>Baixar agora</button>
- <button type="button" class="confirm-btn ghost" onclick={cancelConfirm}>Cancelar</button>
- </div>
- </div>
- {/if}
-
- {#if phase === "error" && errorMsg}
- <p class="err" aria-live="polite">{errorMsg}</p>
- {/if}
-
- {#if phase === "done" && lastReport && lastReport.failed.length > 0}
- <p class="warn" aria-live="polite">
- {lastReport.added.length} adicionados, {lastReport.failed.length} falharam.
- </p>
- {/if}
-</div>
-
-<style>
- .sync {
- display: flex;
- flex-direction: column;
- gap: var(--space-2);
- }
-
- .sync-btn {
- display: inline-flex;
- align-items: center;
- gap: var(--space-2);
- padding: 8px 14px;
- background: var(--accent);
- color: var(--on-accent);
- border: 1px solid transparent;
- border-radius: var(--radius-sm);
- font-family: inherit;
- font-size: var(--text-sm);
- font-weight: 600;
- cursor: pointer;
- align-self: flex-start;
- transition: background var(--duration-fast) var(--ease-out);
- }
-
- .sync-btn:hover:not(:disabled) {
- background: var(--accent-lo);
- }
-
- .sync-btn:disabled {
- cursor: progress;
- }
-
- .sync-btn.phase-uptodate,
- .sync-btn.phase-done {
- background: var(--success);
- }
-
- .sync-btn.phase-error {
- background: var(--error);
- }
-
- .spinner {
- width: 12px;
- height: 12px;
- border-radius: 50%;
- border: 2px solid currentColor;
- border-right-color: transparent;
- animation: spin 0.7s linear infinite;
- }
-
- @keyframes spin {
- to {
- transform: rotate(360deg);
- }
- }
-
- .progress {
- width: 280px;
- height: 4px;
- background: var(--surface-hi);
- border-radius: var(--radius-full);
- overflow: hidden;
- }
-
- .progress-fill {
- height: 100%;
- background: var(--accent);
- transition: width var(--duration-fast) var(--ease-out);
- }
-
- .confirm {
- display: flex;
- flex-direction: column;
- gap: var(--space-2);
- padding: var(--space-3);
- background: var(--surface);
- border: 1px solid var(--border);
- border-radius: var(--radius-sm);
- max-width: 480px;
- }
-
- .confirm p {
- margin: 0;
- font-size: var(--text-sm);
- color: var(--text-muted);
- }
-
- .confirm-actions {
- display: flex;
- gap: var(--space-2);
- }
-
- .confirm-btn {
- padding: 6px 12px;
- background: var(--surface-hi);
- border: 1px solid var(--border);
- border-radius: var(--radius-xs);
- color: var(--text);
- font-family: inherit;
- font-size: var(--text-sm);
- cursor: pointer;
- }
-
- .confirm-btn.primary {
- background: var(--accent);
- color: var(--on-accent);
- border-color: transparent;
- }
-
- .confirm-btn.primary:hover {
- background: var(--accent-lo);
- }
-
- .confirm-btn.ghost {
- background: transparent;
- }
-
- .err {
- margin: 0;
- color: var(--error);
- font-size: var(--text-sm);
- }
-
- .warn {
- margin: 0;
- color: var(--warning);
- font-size: var(--text-sm);
- }
-</style>
diff --git a/src/lib/components/cookies/CookieBucketCard.svelte b/src/lib/components/cookies/CookieBucketCard.svelte
index 37b258ff..7ad256c2 100644
--- a/src/lib/components/cookies/CookieBucketCard.svelte
+++ b/src/lib/components/cookies/CookieBucketCard.svelte
@@ -19,16 +19,31 @@
accounts: Account[];
};
+ type HealthItem = { status: string; age_days: number; expires_in_days: number };
+
type Props = {
bucket: Bucket;
+ health?: Record<string, HealthItem>;
+ testing?: Record<string, boolean>;
onView: (domain: string, slug: string) => void;
onExport: (domain: string, slug: string) => void;
onRename: (domain: string, slug: string, currentAlias: string) => void;
onClear: (domain: string, slug: string) => void;
onAddAccount?: (domain: string) => void;
+ onTest?: (domain: string, slug: string) => void;
};
- let { bucket, onView, onExport, onRename, onClear, onAddAccount }: Props = $props();
+ let {
+ bucket,
+ health = {},
+ testing = {},
+ onView,
+ onExport,
+ onRename,
+ onClear,
+ onAddAccount,
+ onTest,
+ }: Props = $props();
let primaryAccount = $derived(bucket.accounts.find((a) => a.slug === "_default") ?? bucket.accounts[0]);
let extraAccounts = $derived(bucket.accounts.filter((a) => a !== primaryAccount));
@@ -36,12 +51,19 @@
let editValue = $state("");
let inputRef = $state<HTMLInputElement | null>(null);
+ let primaryHealth = $derived(primaryAccount ? health[primaryAccount.slug] : undefined);
+
let status = $derived.by(() => {
if (!primaryAccount) return "empty";
+ if (primaryHealth) {
+ if (primaryHealth.status === "fresh") return "fresh";
+ if (primaryHealth.status === "stale") return "aging";
+ return "stale";
+ }
const ageMs = Date.now() - primaryAccount.captured_at_ms;
const dayMs = 24 * 60 * 60 * 1000;
if (ageMs < dayMs) return "fresh";
- if (ageMs < 30 * dayMs) return "aging";
+ if (ageMs < 28 * dayMs) return "aging";
return "stale";
});
@@ -183,6 +205,14 @@
<span class="sep">·</span>
<span class="via">{$t("settings.cookies.via_label", { label: primaryAccount.source_label })}</span>
{/if}
+ {#if primaryHealth && primaryHealth.status !== "fresh"}
+ <span class="sep">·</span>
+ {#if primaryHealth.status === "expired"}
+ <span class="expiry expired">{$t("settings.cookies.expired")}</span>
+ {:else}
+ <span class="expiry stale">{$t("settings.cookies.expires_in", { days: String(primaryHealth.expires_in_days) })}</span>
+ {/if}
+ {/if}
</p>
{/if}
@@ -197,6 +227,18 @@
<button type="button" class="ghost-btn" onclick={() => startEdit()}>
{$t("settings.cookies.action_rename")}
</button>
+ {#if onTest}
+ <button
+ type="button"
+ class="ghost-btn"
+ disabled={testing[`${bucket.domain}__${primaryAccount.slug}`]}
+ onclick={() => onTest?.(bucket.domain, primaryAccount.slug)}
+ >
+ {testing[`${bucket.domain}__${primaryAccount.slug}`]
+ ? $t("settings.cookies.test_running")
+ : $t("settings.cookies.action_test")}
+ </button>
+ {/if}
<button type="button" class="ghost-btn danger" onclick={() => onClear(bucket.domain, primaryAccount.slug)}>
{$t("settings.cookies.action_clear")}
</button>
@@ -353,6 +395,15 @@
color: var(--tertiary);
font-size: 11px;
}
+ .expiry {
+ font-weight: 600;
+ }
+ .expiry.stale {
+ color: #f4a72b;
+ }
+ .expiry.expired {
+ color: #d33;
+ }
.actions {
display: flex;
gap: 6px;
diff --git a/src/lib/host-queue-bridge.ts b/src/lib/host-queue-bridge.ts
deleted file mode 100644
index c5bdd6b7..00000000
--- a/src/lib/host-queue-bridge.ts
+++ /dev/null
@@ -1,87 +0,0 @@
-import { invoke } from "@tauri-apps/api/core";
-
-export type QueueKind =
- | "video"
- | "audio"
- | "image"
- | "pdf"
- | "book"
- | "webpage"
- | "telegram_media"
- | "course_lesson"
- | "generic";
-
-export type EnqueueExternalArgs = {
- platform: string;
- title: string;
- output_path: string;
- total_bytes?: number;
- thumbnail_url?: string;
- kind?: QueueKind;
- url?: string;
- file_name?: string;
-};
-
-export type EnqueueExternalResult = {
- queue_id: number;
-};
-
-export type ReportProgressArgs = {
- queue_id: number;
- percent: number;
- downloaded_bytes: number;
- speed_bytes_per_sec: number;
-};
-
-export type ReportCompleteArgs = {
- queue_id: number;
- success: boolean;
- file_path?: string;
- error?: string;
- file_size_bytes?: number;
-};
-
-export async function hostQueueEnqueueExternal(
- args: EnqueueExternalArgs,
-): Promise<EnqueueExternalResult> {
- return invoke<EnqueueExternalResult>("host_queue_enqueue_external", { args });
-}
-
-export async function hostQueueReportProgress(args: ReportProgressArgs): Promise<void> {
- await invoke<void>("host_queue_report_progress", { args });
-}
-
-export async function hostQueueReportComplete(args: ReportCompleteArgs): Promise<void> {
- await invoke<void>("host_queue_report_complete", { args });
-}
-
-export function kindFromPlatform(platform: string): QueueKind {
- const p = platform.toLowerCase();
- if (
- [
- "youtube",
- "vimeo",
- "twitch",
- "bilibili",
- "tiktok",
- "twitter",
- "x",
- "instagram",
- "reddit",
- "bluesky",
- "facebook",
- "generic_ytdlp",
- ].includes(p)
- ) {
- return "video";
- }
- if (["soundcloud", "spotify"].includes(p)) return "audio";
- if (p === "pinterest") return "image";
- if (["magnet", "p2p", "torrent"].includes(p)) return "generic";
- if (["telegram", "telegram_media"].includes(p)) return "telegram_media";
- if (["courses", "course_lesson"].includes(p)) return "course_lesson";
- if (["annas_archive", "book", "libgen", "gutendex"].includes(p)) return "book";
- if (p === "pdf") return "pdf";
- if (["webpage", "embed"].includes(p)) return "webpage";
- return "generic";
-}
diff --git a/src/lib/i18n/el.json b/src/lib/i18n/el.json
index dc9c4c48..a9b22179 100644
--- a/src/lib/i18n/el.json
+++ b/src/lib/i18n/el.json
@@ -43,6 +43,50 @@
"settings": "Ρυθμίσεις",
"about": "Σχετικά"
},
+ "tools": {
+ "tab": "Εργαλεία",
+ "working": "Εκτέλεση…",
+ "url_placeholder": "Επικόλλησε ένα URL βίντεο",
+ "metadata_title": "Λήψη μεταδεδομένων",
+ "metadata_desc": "Αποθηκεύει πληροφορίες, περιγραφή και μικρογραφία του βίντεο χωρίς να κατεβάσει το ίδιο το βίντεο.",
+ "metadata_action": "Λήψη μεταδεδομένων",
+ "metadata_done": "Αποθηκεύτηκαν {{count}} αρχείο(α) για «{{title}}»",
+ "thumbnails_title": "Λήψη μικρογραφίας",
+ "thumbnails_desc": "Δες όλες τις διαθέσιμες εικόνες εξωφύλλου και αποθήκευσέ τη σε οποιαδήποτε ανάλυση.",
+ "thumbnails_action": "Λίστα μεγεθών",
+ "thumbnails_none": "Δεν βρέθηκαν μικρογραφίες για αυτό το URL.",
+ "thumbnails_saved": "Αποθηκεύτηκε {{name}}",
+ "thumbnails_save": "Αποθήκευση αυτού του μεγέθους",
+ "thumbnails_default": "Προεπιλογή",
+ "subs_title": "Εξαγωγή υποτίτλων",
+ "subs_desc": "Κατέβασε υπότιτλους ή συνένωσε δύο γλώσσες σε ένα δίγλωσσο αρχείο.",
+ "subs_action": "Λίστα υποτίτλων",
+ "subs_none": "— κανένα —",
+ "subs_primary": "Κύρια",
+ "subs_format": "Μορφή",
+ "subs_secondary": "Δεύτερη γλώσσα",
+ "subs_save": "Αποθήκευση υποτίτλου",
+ "subs_merge": "Συνένωση δίγλωσσου",
+ "subs_merge_hint": "Διάλεξε δεύτερη γλώσσα· η συνένωση χρειάζεται SRT ή VTT.",
+ "subs_saved": "Αποθηκεύτηκε {{name}}",
+ "cc_title": "Σχόλια & κεφάλαια",
+ "cc_desc": "Πάρε τα σχόλια ή τους δείκτες κεφαλαίων ενός βίντεο, φιλτράρισέ τα και κάνε εξαγωγή σε JSON ή CSV.",
+ "cc_comments": "Λήψη σχολίων",
+ "cc_chapters": "Λήψη κεφαλαίων",
+ "cc_max": "Μέγ. σχόλια",
+ "cc_sort": "Ταξινόμηση",
+ "cc_sort_top": "Κορυφαία",
+ "cc_sort_new": "Νεότερα",
+ "cc_filter": "Φίλτρο…",
+ "cc_none": "Δεν βρέθηκε τίποτα για αυτό το URL.",
+ "cc_exported": "Εξήχθη {{name}}",
+ "cc_showing": "Εμφάνιση {{shown}} από {{total}}",
+ "lc_title": "Αρχειοθέτηση live chat",
+ "lc_desc": "Πάρε το replay του chat μιας ολοκληρωμένης ζωντανής μετάδοσης, φιλτράρισέ το και κάνε εξαγωγή σε JSON ή CSV.",
+ "lc_action": "Λήψη live chat",
+ "lc_none": "Δεν υπάρχει replay chat για αυτό το βίντεο.",
+ "lc_exported": "Εξήχθη {{name}}"
+ },
"downloads": {
"title": "Λήψεις",
"empty": "Δεν υπάρχουν μεταφορτώσεις σε εξέλιξη",
@@ -85,6 +129,54 @@
"open_in_study": "Watch in Study",
"stop": "Διακοπή",
"confirm_remove": "Αφαίρεση αυτής της λήψης;",
+ "delete_file": "Διαγραφή αρχείου από τον δίσκο",
+ "delete_file_confirm": "Οριστική διαγραφή του ληφθέντος αρχείου από τον δίσκο; Δεν είναι δυνατή η αναίρεση.",
+ "sw": {
+ "title": "Εργαστήριο υποτίτλων",
+ "tool_desc": "Άνοιγμα, επεξεργασία χρόνου/κειμένου, μετάφραση και αποθήκευση υποτίτλων SRT/VTT.",
+ "open": "Άνοιγμα αρχείου υποτίτλων",
+ "load_media": "Φόρτωση μέσου (κυματομορφή)",
+ "save_srt": "Αποθήκευση .srt",
+ "save_vtt": "Αποθήκευση .vtt",
+ "shift": "Μετατόπιση όλων (ms)",
+ "find": "Εύρεση",
+ "replace": "Αντικατάσταση με",
+ "replace_btn": "Αντικατάσταση όλων",
+ "replaced": "{{count}} υπότιτλος/οι άλλαξαν",
+ "target_lang": "Γλώσσα-στόχος",
+ "translate": "Μετάφραση με AI",
+ "translated": "Οι υπότιτλοι μεταφράστηκαν",
+ "translate_mismatch": "Η μετάφραση δεν ταίριαξε — δοκίμασε ξανά",
+ "not_configured": "Ρύθμισε πρώτα έναν πάροχο AI στις Ρυθμίσεις",
+ "saved": "Οι υπότιτλοι αποθηκεύτηκαν",
+ "split": "Διαχωρισμός",
+ "merge": "Συγχώνευση ↓",
+ "empty": "Άνοιξε ένα αρχείο SRT ή VTT για να ξεκινήσεις.",
+ "qc_negative": "Το τέλος προηγείται της αρχής",
+ "qc_overlap": "Επικαλύπτει τον επόμενο υπότιτλο",
+ "qc_fast": "Πολύ υψηλή ταχύτητα ανάγνωσης"
+ },
+ "vop": {
+ "action_label": "Εργαλεία βίντεο AI",
+ "title": "Εργαλεία βίντεο AI",
+ "not_configured": "Ρύθμισε πρώτα έναν πάροχο AI στις Ρυθμίσεις",
+ "done": "Έτοιμο — αποθηκεύτηκε στο:",
+ "quick_actions": "Γρήγορες ενέργειες",
+ "extract_audio": "Εξαγωγή ήχου",
+ "mute": "Αφαίρεση ήχου",
+ "to_mp4": "Μετατροπή σε MP4",
+ "to_gif": "Μετατροπή σε GIF",
+ "trim_start": "Έναρξη (ωω:λλ:δδ)",
+ "trim_end": "Λήξη (ωω:λλ:δδ)",
+ "trim": "Περικοπή",
+ "nl_label": "Περίγραψε τι θέλεις",
+ "nl_placeholder": "π.χ. κάν' το 720p και χωρίς ήχο",
+ "propose": "Πρόταση",
+ "review_title": "Έλεγξε την εντολή πριν την εκτέλεση",
+ "review_hint": "Η εφαρμογή συμπληρώνει είσοδο/έξοδο. Εκτελείται μόνο μετά την επιβεβαίωση.",
+ "run": "Εκτέλεση",
+ "processing": "Επεξεργασία…"
+ },
"quality_hint": "Ποιότητα που μεταφορτώνεται για αυτό το στοιχείο",
"stats_line": "{{count}} λήψεις · {{size}} αποθηκευμένα",
"filter_label": "Φιλτράρισμα λήψεων ανά κατάσταση",
@@ -113,6 +205,8 @@
"auto_download_started": "Αυτόματη λήψη ξεκίνησε",
"external_url_ready": "Το URL λήφθηκε και είναι έτοιμο για λήψη",
"external_url_queued": "Η λήψη προστέθηκε από την επέκταση Chrome",
+ "channel_new": "{{channel}}: {{count}} νέο/α βίντεο",
+ "channel_new_auto": "{{channel}}: λήψη {{count}} νέου/ων βίντεο",
"file_copied_to_clipboard": "Το αρχείο αντιγράφηκε στο πρόχειρο",
"drm_skipped": "{{count}} βίντεο παραλείφθηκαν — προστατευμένα DRM (FairPlay/SAMPLE-AES)",
"generic_download_complete": "{{name}} — η λήψη ολοκληρώθηκε!"
@@ -232,9 +326,13 @@
},
"download": {
"default_output_dir": "Εξ'ορισμού φάκελος",
+ "path_too_long": "Η διαδρομή αυτού του φακέλου είναι μεγάλη ({{current}}/{{limit}} χαρακτήρες). Οι λήψεις με μεγάλα ονόματα μπορεί να αποτύχουν — διάλεξε έναν πιο σύντομο φάκελο.",
"choose_folder": "Διάλεξε",
"always_ask_path": "Πάντα ερώτηση πριν αποθήκευση",
"video_quality": "Ποιότητα βίντεο",
+ "speed_limit": "Όριο ταχύτητας λήψης",
+ "speed_limit_desc": "Περιορίζει τον ρυθμό λήψης. Άφησέ το κενό για χωρίς όριο.",
+ "speed_limit_unlimited": "Χωρίς όριο",
"skip_existing": "Παράλειψη υπαρχόντων αρχείων",
"download_attachments": "Λήψη συνημμένων",
"download_descriptions": "Αποθήκευση περιγραφών",
@@ -267,8 +365,24 @@
"translate_metadata_desc": "Ζητήστε από το YouTube να τοπικοποιήσει τίτλους και κεφάλαια στη γλώσσα της εφαρμογής (μόνο YouTube)",
"youtube_sponsorblock": "Αφαίρεση τμημάτων SponsorBlock",
"youtube_sponsorblock_desc": "Κόψτε χορηγούμενα τμήματα, intro και outro από τα βίντεο YouTube (δεδομένα κοινότητας· μπορεί να χάσει ή να κόψει υπερβολικά)",
+ "sb_mode": "Ενέργεια SponsorBlock",
+ "sb_mode_desc": "Η αφαίρεση κόβει τα τμήματα από το αρχείο. Η μόνο σήμανση προσθέτει δείκτες κεφαλαίων για να τα προσπερνάς στον player.",
+ "sb_mode_remove": "Αφαίρεση τμημάτων",
+ "sb_mode_mark": "Μόνο σήμανση",
+ "sb_categories": "Τύποι τμήματος",
+ "sb_categories_desc": "Σε ποιους τύπους τμήματος να εφαρμοστεί.",
+ "sb_cat_sponsor": "Χορηγία",
+ "sb_cat_selfpromo": "Αυτοπροβολή",
+ "sb_cat_interaction": "Υπενθύμιση αλληλεπίδρασης",
+ "sb_cat_intro": "Εισαγωγή",
+ "sb_cat_outro": "Λήξη / τελικές κάρτες",
+ "sb_cat_preview": "Προεπισκόπηση / ανακεφαλαίωση",
+ "sb_cat_filler": "Γέμισμα / παρέκβαση",
+ "sb_cat_music_offtopic": "Τμήμα χωρίς μουσική",
"split_by_chapters": "Διαίρεση βίντεο ανά κεφάλαια",
"split_by_chapters_desc": "Όταν το βίντεο έχει δείκτες κεφαλαίων, αποθηκεύεται κάθε κεφάλαιο σε ξεχωριστό αρχείο",
+ "live_from_start": "Εγγραφή ζωντανών από την αρχή",
+ "live_from_start_desc": "Κατά τη λήψη μιας ζωντανής μετάδοσης σε εξέλιξη, κατέγραψέ τη από την αρχή αντί από την τρέχουσα στιγμή",
"presets": "Γρήγορες προεπιλογές",
"presets_desc": "Ρύθμιση με ένα κλικ. Πατήστε μια κάρτα για εφαρμογή.",
"preset_fast": "Γρήγορα",
@@ -360,7 +474,20 @@
"password": "Κωδικός"
},
"ytdlp_flags": {
- "title": "Παράμετροι yt-dlp"
+ "title": "Παράμετροι yt-dlp",
+ "embed_subs": "Ενσωμάτωση υποτίτλων",
+ "write_thumbnail": "Αποθήκευση μικρογραφίας",
+ "write_description": "Αποθήκευση περιγραφής",
+ "write_comments": "Αποθήκευση σχολίων",
+ "restrict_filenames": "Ονόματα ASCII",
+ "no_overwrites": "Χωρίς αντικατάσταση",
+ "prefer_free_formats": "Ελεύθερες μορφές",
+ "force_ipv4": "Επιβολή IPv4",
+ "geo_bypass": "Παράκαμψη γεωγραφικού αποκλεισμού",
+ "limit_rate": "Όριο ρυθμού",
+ "sleep_interval": "Διάστημα αναμονής",
+ "limit_rate_ph": "π.χ. 1M",
+ "sleep_interval_ph": "π.χ. 5"
},
"advanced": {
"title": "Για προχωρημένους",
@@ -376,9 +503,18 @@
"reset_confirm": "Είσαι σίγουροι; Θα γίνει επαναφορά όλων των ρυθμίσεων.",
"torrent_listen_port": "Θύρα ακρόασης torrent",
"torrent_listen_port_desc": "Θύρα TCP για εισερχόμενες συνδέσεις BitTorrent",
+ "torrent_auto_trackers": "Προσθήκη επιπλέον δημόσιων trackers",
+ "torrent_auto_trackers_desc": "Βελτιώνει την ανακάλυψη peers για magnet με λίγα ή ανενεργά trackers",
+ "torrent_upnp": "Άνοιγμα θύρας router (UPnP)",
+ "torrent_upnp_desc": "Επιτρέπει στους routers να δέχονται εισερχόμενες συνδέσεις peer για ταχύτερα torrents",
+ "prevent_sleep": "Διατήρηση του συστήματος ξύπνιου κατά τη λήψη",
+ "prevent_sleep_desc": "Εμποδίζει τον υπολογιστή να αδρανοποιηθεί όσο υπάρχουν ενεργές λήψεις",
"cookies_from_browser": "Cookies προγράμματος περιήγησης (προχωρημένο)",
"cookies_from_browser_desc": "Ορίστε μόνο αν η επέκταση του προγράμματος περιήγησης δεν λειτουργεί. Οι περισσότεροι χρήστες πρέπει να το αφήσουν κενό.",
"cookies_from_browser_placeholder": "ex.: firefox, chrome, edge",
+ "user_agent": "Προσαρμοσμένο User-Agent (για προχωρημένους)",
+ "user_agent_desc": "Στέλνει προσαρμοσμένο User-Agent στις λήψεις. Άφησέ το κενό για χρήση του προεπιλεγμένου.",
+ "user_agent_placeholder": "Προεπιλεγμένο User-Agent του προγράμματος περιήγησης",
"twitter_manual_cookie": "Χειροκίνητο cookie",
"twitter_manual_cookie_desc": "Αν μια λήψη αποτύχει, μπορείτε να επικολλήσετε εδώ μια χειροκίνητη κεφαλίδα Cookie και να δοκιμάσετε ξανά. Δεν περιορίζεται στο Twitter/X. Παράδειγμα: sessionid=...; csrftoken=...; auth_token=..."
},
@@ -410,6 +546,12 @@
"bridge": {
"title": "Browser extension",
"intro": "Pair the OmniGet browser extension with this app over a private localhost connection. Open the extension's options page, paste the endpoint URL and token below, and click Save.",
+ "pair_label": "Σύνδεση της επέκτασης",
+ "pair_hint": "Ένα κλικ εδώ και η εγκατεστημένη επέκταση συνδέεται μόνη της — χωρίς αντιγραφή-επικόλληση.",
+ "pair": "Σύνδεση επέκτασης",
+ "pair_waiting": "Αναμονή…",
+ "pair_active": "Παράθυρο ανοιχτό — η επέκταση θα συνδεθεί αυτόματα (απομένουν {{secs}}s).",
+ "pair_unavailable": "Ενεργοποίησε πρώτα τη γέφυρα του προγράμματος περιήγησης.",
"endpoint_label": "Endpoint URL",
"token_label": "Pairing token",
"rotate_label": "Rotate token",
@@ -425,6 +567,64 @@
"unavailable": "Bridge unavailable. Try restarting the app."
},
"cat_cookies": "Cookies",
+ "cat_channels": "Κανάλια",
+ "cat_ai": "AI",
+ "ai": {
+ "title": "Πάροχος AI",
+ "provider": "Πάροχος",
+ "provider_desc": "Επίλεξε πού πηγαίνουν τα αιτήματα AI. Το κλειδί αποθηκεύεται τοπικά και δεν καταγράφεται ποτέ.",
+ "provider_none": "Ανενεργό",
+ "provider_local": "Τοπικό (συμβατό με OpenAI)",
+ "model": "Μοντέλο",
+ "model_desc": "Το αναγνωριστικό μοντέλου για τον επιλεγμένο πάροχο.",
+ "model_placeholder": "π.χ. gpt-4o-mini, claude-3-5-sonnet-latest, llama3",
+ "openai_key": "Κλειδί API OpenAI",
+ "anthropic_key": "Κλειδί API Anthropic",
+ "key_set": "Υπάρχει αποθηκευμένο κλειδί. Άφησέ το κενό για να διατηρηθεί.",
+ "key_unset": "Δεν έχει αποθηκευτεί κλειδί ακόμη.",
+ "local_url": "URL τοπικού endpoint",
+ "local_url_desc": "Βασικό URL συμβατό με OpenAI (Ollama, LM Studio, …).",
+ "save": "Αποθήκευση",
+ "test": "Δοκιμή σύνδεσης",
+ "test_ok": "Η σύνδεση AI λειτουργεί",
+ "test_fail": "Η δοκιμή AI απέτυχε: {{error}}",
+ "saved": "Οι ρυθμίσεις AI αποθηκεύτηκαν",
+ "summarize_title": "Σύνοψη βίντεο",
+ "summarize": "Σύνοψη",
+ "summarizing": "Γίνεται σύνοψη…",
+ "summarize_placeholder": "URL βίντεο",
+ "summarize_hint": "Λαμβάνει τους υπότιτλους του βίντεο και τους συνοψίζει. Το αποτέλεσμα αποθηκεύεται παρακάτω.",
+ "style": "Στυλ σύνοψης",
+ "style_short": "Σύντομη",
+ "style_balanced": "Ισορροπημένη",
+ "style_detailed": "Λεπτομερής",
+ "lang_placeholder": "Γλώσσα εξόδου (προαιρετικό)",
+ "summary_ready": "Η σύνοψη είναι έτοιμη",
+ "no_transcript": "Δεν υπάρχει διαθέσιμη μεταγραφή για αυτό το βίντεο",
+ "not_configured": "Ρύθμισε πρώτα έναν πάροχο AI",
+ "history": "Ιστορικό AI",
+ "history_clear": "Εκκαθάριση",
+ "history_clear_confirm": "Εκκαθάριση όλου του ιστορικού AI;",
+ "history_empty": "Δεν υπάρχουν αποτελέσματα AI ακόμη."
+ },
+ "channels": {
+ "title": "Κανάλια που ακολουθείς",
+ "tray_header": "Κανάλια",
+ "add": "Ακολούθησε",
+ "add_placeholder": "URL καναλιού ή λίστας αναπαραγωγής",
+ "add_hint": "Τα νέα βίντεο ελέγχονται στο παρασκήνιο. Η αυτόματη λήψη είναι ανενεργή μέχρι να την ενεργοποιήσεις.",
+ "empty_title": "Δεν ακολουθείς κανάλια ακόμη",
+ "empty_hint": "Ακολούθησε ένα κανάλι ή λίστα για αυτόματη λήψη νέων βίντεο.",
+ "last_checked": "Τελευταίος έλεγχος {{when}}",
+ "never": "ποτέ",
+ "check_now": "Έλεγχος τώρα",
+ "checked": "{{count}} νέο/α βίντεο",
+ "remove": "Αφαίρεση",
+ "remove_confirm": "Διακοπή παρακολούθησης αυτού του καναλιού;",
+ "enabled": "Ενεργό",
+ "auto_download": "Αυτόματη λήψη",
+ "interval": "Κάθε (λεπτά)"
+ },
"cookies": {
"title": "Cookies",
"intro": "Manage your account cookies. Everything stays on your computer — nothing is sent to our servers.",
@@ -454,6 +654,12 @@
"action_view": "View",
"action_export": "Export",
"action_rename": "Rename",
+ "action_test": "Δοκιμή",
+ "test_running": "Δοκιμή…",
+ "test_ok": "Τα cookies λειτουργούν.",
+ "test_fail": "Απέτυχε: {{msg}}",
+ "expires_in": "λήγει σε ~{{days}} ημ.",
+ "expired": "έληξε",
"action_clear": "Clear",
"import_trigger": "Import",
"import_file_title": "File",
@@ -540,6 +746,30 @@
"formats_playlist_note": "Η επιλογή μορφής ανά βίντεο δεν ισχύει για λίστες αναπαραγωγής. Η επιλογή Ποιότητα παραπάνω εφαρμόζεται σε κάθε βίντεο.",
"referer_label": "Παραπομπή (προαιρετικό)",
"referer_placeholder": "https://example.com",
+ "timerange_label": "Λήψη μόνο ενός τμήματος (προαιρετικό)",
+ "timerange_start": "Έναρξη",
+ "timerange_end": "Λήξη",
+ "timerange_hint": "Χρησιμοποίησε mm:ss ή hh:mm:ss. Άφησέ το κενό για λήψη ολόκληρου του βίντεο.",
+ "schedule_label": "Προγραμματισμός",
+ "schedule_1h": "Σε 1 ώρα",
+ "schedule_tonight": "Απόψε",
+ "schedule_1d": "Αύριο",
+ "schedule_clear": "Καθαρισμός",
+ "schedule_start": "Ώρα έναρξης",
+ "schedule_stop": "Ώρα διακοπής",
+ "schedule_hint": "Άφησέ το κενό για άμεση έναρξη. Η προαιρετική ώρα διακοπής ακυρώνει τη λήψη αν εκτελείται ακόμη.",
+ "playlist_selected": "{{selected}} από {{total}} επιλεγμένα",
+ "playlist_all": "Επιλογή όλων",
+ "playlist_none": "Κανένα",
+ "playlist_loading": "Φόρτωση playlist…",
+ "playlist_empty": "Δεν ήταν δυνατή η φόρτωση των στοιχείων της playlist",
+ "playlist_none_selected": "Επίλεξε τουλάχιστον ένα στοιχείο για λήψη",
+ "torrent_selected": "{{selected}} από {{total}} αρχεία επιλεγμένα",
+ "torrent_loading": "Ανάγνωση περιεχομένου torrent…",
+ "torrent_none_selected": "Επίλεξε τουλάχιστον ένα αρχείο για λήψη",
+ "cookie_hint_stale": "Το αποθηκευμένο cookie αυτού του ιστότοπου παλιώνει.",
+ "cookie_hint_expired": "Το αποθηκευμένο cookie αυτού του ιστότοπου έληξε — οι λήψεις μπορεί να αποτύχουν.",
+ "cookie_hint_action": "Ενημέρωση",
"external_url_ready": "Το URL λήφθηκε από την επέκταση Chrome",
"content_type": {
"video": "Βίντεο",
@@ -1469,12 +1699,25 @@
"music_theme_reduce_motion_on": "Always reduce",
"music_theme_reduce_motion_hint": "Disables transitions and animations in the music section, independent of the global system setting.",
"now_playing_title": "Now playing",
+ "youtube_live": "ΖΩΝΤΑΝΑ",
+ "youtube_error_generic": "Κάτι πήγε στραβά με το YouTube",
+ "youtube_error_retry": "Δοκιμή ξανά",
+ "youtube_error_audio_only": "Μόνο ήχος",
+ "youtube_error_details": "Τεχνικές λεπτομέρειες",
+ "youtube_error_hide_details": "Απόκρυψη λεπτομερειών",
"now_playing_close": "Back",
"now_playing_tab_lyrics": "Lyrics",
"now_playing_tab_queue": "Up next",
"now_playing_tab_previous": "Previous",
"now_playing_lyrics_empty": "No lyrics available.",
- "now_playing_lyrics_error": "Couldn't load lyrics. Try again.",
+ "now_playing_lyrics_error": "Δεν ήταν δυνατή η φόρτωση των στίχων. Δοκιμάστε ξανά.",
+ "now_playing_lyrics_retry": "Δοκιμή ξανά",
+ "now_playing_lyrics_show_translation": "Εμφάνιση μετάφρασης",
+ "now_playing_lyrics_hide_translation": "Απόκρυψη μετάφρασης",
+ "now_playing_lyrics_plain_note": "Μη συγχρονισμένοι στίχοι",
+ "now_playing_lyrics_sync_earlier": "Στίχοι νωρίτερα",
+ "now_playing_lyrics_sync_later": "Στίχοι αργότερα",
+ "now_playing_lyrics_sync_reset": "Επαναφορά συγχρονισμού",
"now_playing_queue_empty": "Queue is empty — click any track to start.",
"now_playing_previous_empty": "Nothing played in this session yet.",
"now_playing_no_track": "No track playing right now.",
diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json
index 96d1e141..26cf8340 100644
--- a/src/lib/i18n/en.json
+++ b/src/lib/i18n/en.json
@@ -43,6 +43,50 @@
"settings": "Settings",
"about": "About"
},
+ "tools": {
+ "tab": "Tools",
+ "working": "Working…",
+ "url_placeholder": "Paste a video URL",
+ "metadata_title": "Metadata fetcher",
+ "metadata_desc": "Save the video's info, description and thumbnail without downloading the video itself.",
+ "metadata_action": "Fetch metadata",
+ "metadata_done": "Saved {{count}} file(s) for \"{{title}}\"",
+ "thumbnails_title": "Thumbnail downloader",
+ "thumbnails_desc": "Browse every available cover image and save it at any resolution.",
+ "thumbnails_action": "List sizes",
+ "thumbnails_none": "No thumbnails found for this URL.",
+ "thumbnails_saved": "Saved {{name}}",
+ "thumbnails_save": "Save this size",
+ "thumbnails_default": "Default",
+ "subs_title": "Subtitle extractor",
+ "subs_desc": "Download subtitles, or merge two languages into one bilingual file.",
+ "subs_action": "List subtitles",
+ "subs_none": "— none —",
+ "subs_primary": "Primary",
+ "subs_format": "Format",
+ "subs_secondary": "Second language",
+ "subs_save": "Save subtitle",
+ "subs_merge": "Merge bilingual",
+ "subs_merge_hint": "Pick a second language; merge needs SRT or VTT.",
+ "subs_saved": "Saved {{name}}",
+ "cc_title": "Comments & chapters",
+ "cc_desc": "Fetch a video's comments or chapter markers, filter them, and export as JSON or CSV.",
+ "cc_comments": "Fetch comments",
+ "cc_chapters": "Fetch chapters",
+ "cc_max": "Max comments",
+ "cc_sort": "Sort",
+ "cc_sort_top": "Top",
+ "cc_sort_new": "Newest",
+ "cc_filter": "Filter…",
+ "cc_none": "Nothing found for this URL.",
+ "cc_exported": "Exported {{name}}",
+ "cc_showing": "Showing {{shown}} of {{total}}",
+ "lc_title": "Live chat archiver",
+ "lc_desc": "Pull a finished livestream's chat replay, filter it, and export as JSON or CSV.",
+ "lc_action": "Fetch live chat",
+ "lc_none": "No live chat replay for this video.",
+ "lc_exported": "Exported {{name}}"
+ },
"downloads": {
"title": "Downloads",
"empty": "No downloads in progress",
@@ -85,6 +129,54 @@
"open_in_study": "Watch in Study",
"stop": "Stop",
"confirm_remove": "Remove this download?",
+ "delete_file": "Delete file from disk",
+ "delete_file_confirm": "Permanently delete the downloaded file from disk? This cannot be undone.",
+ "sw": {
+ "title": "Subtitle workshop",
+ "tool_desc": "Open, edit timing/text, translate and save SRT/VTT subtitles.",
+ "open": "Open subtitle file",
+ "load_media": "Load media (waveform)",
+ "save_srt": "Save .srt",
+ "save_vtt": "Save .vtt",
+ "shift": "Shift all (ms)",
+ "find": "Find",
+ "replace": "Replace with",
+ "replace_btn": "Replace all",
+ "replaced": "{{count}} cue(s) changed",
+ "target_lang": "Target language",
+ "translate": "AI translate",
+ "translated": "Subtitles translated",
+ "translate_mismatch": "Translation didn't line up — try again",
+ "not_configured": "Configure an AI provider in Settings first",
+ "saved": "Subtitles saved",
+ "split": "Split",
+ "merge": "Merge ↓",
+ "empty": "Open an SRT or VTT file to start.",
+ "qc_negative": "End is before start",
+ "qc_overlap": "Overlaps the next cue",
+ "qc_fast": "Reading speed too high"
+ },
+ "vop": {
+ "action_label": "AI video tools",
+ "title": "AI video tools",
+ "not_configured": "Configure an AI provider in Settings first",
+ "done": "Done — saved to:",
+ "quick_actions": "Quick actions",
+ "extract_audio": "Extract audio",
+ "mute": "Remove audio",
+ "to_mp4": "Convert to MP4",
+ "to_gif": "Convert to GIF",
+ "trim_start": "Start (hh:mm:ss)",
+ "trim_end": "End (hh:mm:ss)",
+ "trim": "Trim",
+ "nl_label": "Describe what you want",
+ "nl_placeholder": "e.g. make it 720p and mute it",
+ "propose": "Propose",
+ "review_title": "Review the command before running",
+ "review_hint": "The app fills the input/output. This runs only after you confirm.",
+ "run": "Run",
+ "processing": "Processing…"
+ },
"quality_hint": "Quality being downloaded for this item",
"stats_line": "{{count}} downloads · {{size}} saved",
"filter_label": "Filter downloads by status",
@@ -113,6 +205,8 @@
"auto_download_started": "Auto-download started",
"external_url_ready": "URL received and ready to download",
"external_url_queued": "Download added from the Chrome extension",
+ "channel_new": "{{channel}}: {{count}} new video(s)",
+ "channel_new_auto": "{{channel}}: downloading {{count}} new video(s)",
"file_copied_to_clipboard": "File copied to clipboard",
"drm_skipped": "{{count}} video(s) skipped — protected by DRM (FairPlay/SAMPLE-AES)",
"generic_download_complete": "{{name}} — download complete!"
@@ -232,9 +326,13 @@
},
"download": {
"default_output_dir": "Default folder",
+ "path_too_long": "This folder path is long ({{current}}/{{limit}} characters). Downloads with long filenames may fail — pick a shorter folder.",
"choose_folder": "Choose",
"always_ask_path": "Always ask where to save",
"video_quality": "Video quality",
+ "speed_limit": "Download speed limit",
+ "speed_limit_desc": "Cap the download rate. Leave empty for no limit.",
+ "speed_limit_unlimited": "No limit",
"skip_existing": "Skip existing files",
"download_attachments": "Download attachments",
"download_descriptions": "Save descriptions",
@@ -267,8 +365,24 @@
"translate_metadata_desc": "Ask YouTube to localize titles and chapter names to the app language (YouTube only)",
"youtube_sponsorblock": "Remove SponsorBlock segments",
"youtube_sponsorblock_desc": "Cut sponsored, intro and outro segments from YouTube videos (community-sourced data; may miss or over-cut)",
+ "sb_mode": "SponsorBlock action",
+ "sb_mode_desc": "Remove cuts the segments out of the file. Mark only adds chapter markers so you can skip them in the player.",
+ "sb_mode_remove": "Remove segments",
+ "sb_mode_mark": "Mark only",
+ "sb_categories": "Segment types",
+ "sb_categories_desc": "Which kinds of segment to act on.",
+ "sb_cat_sponsor": "Sponsor",
+ "sb_cat_selfpromo": "Self-promotion",
+ "sb_cat_interaction": "Interaction reminder",
+ "sb_cat_intro": "Intro",
+ "sb_cat_outro": "Outro / endcards",
+ "sb_cat_preview": "Preview / recap",
+ "sb_cat_filler": "Filler / tangent",
+ "sb_cat_music_offtopic": "Non-music section",
"split_by_chapters": "Split video by chapters",
"split_by_chapters_desc": "When the source has chapter markers, save each chapter as a separate file",
+ "live_from_start": "Record live streams from the start",
+ "live_from_start_desc": "When downloading an ongoing livestream, capture it from the beginning instead of the current moment",
"presets": "Quick presets",
"presets_desc": "One-click setup for common workflows. Tap a card to apply.",
"preset_fast": "Fast",
@@ -360,7 +474,20 @@
"password": "Password"
},
"ytdlp_flags": {
- "title": "yt-dlp Flags"
+ "title": "yt-dlp Flags",
+ "embed_subs": "Embed subtitles",
+ "write_thumbnail": "Save thumbnail",
+ "write_description": "Save description",
+ "write_comments": "Save comments",
+ "restrict_filenames": "ASCII filenames",
+ "no_overwrites": "No overwrites",
+ "prefer_free_formats": "Free formats",
+ "force_ipv4": "Force IPv4",
+ "geo_bypass": "Geo bypass",
+ "limit_rate": "Limit rate",
+ "sleep_interval": "Sleep interval",
+ "limit_rate_ph": "e.g. 1M",
+ "sleep_interval_ph": "e.g. 5"
},
"advanced": {
"title": "Advanced",
@@ -376,9 +503,18 @@
"reset_confirm": "Are you sure? All settings will be reset.",
"torrent_listen_port": "Torrent listen port",
"torrent_listen_port_desc": "TCP port for incoming BitTorrent connections",
+ "torrent_auto_trackers": "Add extra public trackers",
+ "torrent_auto_trackers_desc": "Improves peer discovery for magnets with few or dead trackers",
+ "torrent_upnp": "Open router port (UPnP)",
+ "torrent_upnp_desc": "Lets routers accept incoming peer connections for faster torrents",
+ "prevent_sleep": "Keep system awake while downloading",
+ "prevent_sleep_desc": "Stops the computer from sleeping while downloads are active",
"cookies_from_browser": "Read cookies directly from a browser profile (advanced)",
"cookies_from_browser_desc": "Only set this if the browser extension isn't working. Most users should leave this empty.",
"cookies_from_browser_placeholder": "ex.: firefox, chrome, edge",
+ "user_agent": "Custom User-Agent (advanced)",
+ "user_agent_desc": "Send a custom User-Agent to downloads. Leave empty to use the default.",
+ "user_agent_placeholder": "Default browser User-Agent",
"twitter_manual_cookie": "Manual cookie",
"twitter_manual_cookie_desc": "If a download fails, you can paste a manual Cookie header here and try again. This is not limited to Twitter/X. Example: sessionid=...; csrftoken=...; auth_token=..."
},
@@ -410,6 +546,12 @@
"bridge": {
"title": "Browser extension",
"intro": "Pair the OmniGet browser extension with this app over a private localhost connection. Open the extension's options page, paste the endpoint URL and token below, and click Save.",
+ "pair_label": "Pair the extension",
+ "pair_hint": "One click here, then the installed extension connects on its own — no copy-paste.",
+ "pair": "Pair extension",
+ "pair_waiting": "Waiting…",
+ "pair_active": "Window open — the extension will connect automatically ({{secs}}s left).",
+ "pair_unavailable": "Enable the browser bridge first.",
"endpoint_label": "Endpoint URL",
"token_label": "Pairing token",
"rotate_label": "Rotate token",
@@ -425,6 +567,64 @@
"unavailable": "Bridge unavailable. Try restarting the app."
},
"cat_cookies": "Cookies",
+ "cat_channels": "Channels",
+ "cat_ai": "AI",
+ "ai": {
+ "title": "AI provider",
+ "provider": "Provider",
+ "provider_desc": "Choose where AI requests go. Your key is stored locally and never logged.",
+ "provider_none": "Off",
+ "provider_local": "Local (OpenAI-compatible)",
+ "model": "Model",
+ "model_desc": "The model identifier for the chosen provider.",
+ "model_placeholder": "e.g. gpt-4o-mini, claude-3-5-sonnet-latest, llama3",
+ "openai_key": "OpenAI API key",
+ "anthropic_key": "Anthropic API key",
+ "key_set": "A key is saved. Leave blank to keep it.",
+ "key_unset": "No key saved yet.",
+ "local_url": "Local endpoint URL",
+ "local_url_desc": "OpenAI-compatible base URL (Ollama, LM Studio, …).",
+ "save": "Save",
+ "test": "Test connection",
+ "test_ok": "AI connection works",
+ "test_fail": "AI test failed: {{error}}",
+ "saved": "AI settings saved",
+ "summarize_title": "Summarize a video",
+ "summarize": "Summarize",
+ "summarizing": "Summarizing…",
+ "summarize_placeholder": "Video URL",
+ "summarize_hint": "Fetches the video's subtitles and summarizes them. Result is saved below.",
+ "style": "Summary style",
+ "style_short": "Short",
+ "style_balanced": "Balanced",
+ "style_detailed": "Detailed",
+ "lang_placeholder": "Output language (optional)",
+ "summary_ready": "Summary ready",
+ "no_transcript": "No transcript available for this video",
+ "not_configured": "Configure an AI provider first",
+ "history": "AI history",
+ "history_clear": "Clear",
+ "history_clear_confirm": "Clear all AI history?",
+ "history_empty": "No AI results yet."
+ },
+ "channels": {
+ "title": "Followed channels",
+ "tray_header": "Channels",
+ "add": "Follow",
+ "add_placeholder": "Channel or playlist URL",
+ "add_hint": "New uploads are checked in the background. Auto-download is off until you turn it on.",
+ "empty_title": "No channels followed yet",
+ "empty_hint": "Follow a channel or playlist to get new uploads automatically.",
+ "last_checked": "Last checked {{when}}",
+ "never": "never",
+ "check_now": "Check now",
+ "checked": "{{count}} new video(s)",
+ "remove": "Remove",
+ "remove_confirm": "Stop following this channel?",
+ "enabled": "Enabled",
+ "auto_download": "Auto-download",
+ "interval": "Every (min)"
+ },
"cookies": {
"title": "Cookies",
"intro": "Manage your account cookies. Everything stays on your computer — nothing is sent to our servers.",
@@ -454,6 +654,12 @@
"action_view": "View",
"action_export": "Export",
"action_rename": "Rename",
+ "action_test": "Test",
+ "test_running": "Testing…",
+ "test_ok": "Cookies work.",
+ "test_fail": "Test failed: {{msg}}",
+ "expires_in": "expires in ~{{days}}d",
+ "expired": "expired",
"action_clear": "Clear",
"import_trigger": "Import",
"import_file_title": "File",
@@ -540,6 +746,30 @@
"formats_playlist_note": "Per-video format picker doesn't apply to playlists. The Quality option above applies to every video.",
"referer_label": "Referer (optional)",
"referer_placeholder": "https://example.com",
+ "timerange_label": "Download only a section (optional)",
+ "timerange_start": "Start",
+ "timerange_end": "End",
+ "timerange_hint": "Use mm:ss or hh:mm:ss. Leave empty to download the whole video.",
+ "schedule_label": "Schedule",
+ "schedule_1h": "In 1 hour",
+ "schedule_tonight": "Tonight",
+ "schedule_1d": "Tomorrow",
+ "schedule_clear": "Clear",
+ "schedule_start": "Start time",
+ "schedule_stop": "Stop time",
+ "schedule_hint": "Leave empty to start now. Optional stop time cancels the download if it's still running.",
+ "playlist_selected": "{{selected}} of {{total}} selected",
+ "playlist_all": "Select all",
+ "playlist_none": "None",
+ "playlist_loading": "Loading playlist…",
+ "playlist_empty": "Could not load playlist items",
+ "playlist_none_selected": "Select at least one item to download",
+ "torrent_selected": "{{selected}} of {{total}} files selected",
+ "torrent_loading": "Reading torrent contents…",
+ "torrent_none_selected": "Select at least one file to download",
+ "cookie_hint_stale": "This site's saved cookie is getting old.",
+ "cookie_hint_expired": "This site's saved cookie has expired — downloads may fail.",
+ "cookie_hint_action": "Update it",
"external_url_ready": "URL received from the Chrome extension",
"content_type": {
"video": "Video",
@@ -1469,12 +1699,25 @@
"music_theme_reduce_motion_on": "Always reduce",
"music_theme_reduce_motion_hint": "Disables transitions and animations in the music section, independent of the global system setting.",
"now_playing_title": "Now playing",
+ "youtube_live": "LIVE",
+ "youtube_error_generic": "Something went wrong talking to YouTube",
+ "youtube_error_retry": "Try again",
+ "youtube_error_audio_only": "Audio only",
+ "youtube_error_details": "Technical details",
+ "youtube_error_hide_details": "Hide details",
"now_playing_close": "Back",
"now_playing_tab_lyrics": "Lyrics",
"now_playing_tab_queue": "Up next",
"now_playing_tab_previous": "Previous",
"now_playing_lyrics_empty": "No lyrics available.",
"now_playing_lyrics_error": "Couldn't load lyrics. Try again.",
+ "now_playing_lyrics_retry": "Try again",
+ "now_playing_lyrics_show_translation": "Show translation",
+ "now_playing_lyrics_hide_translation": "Hide translation",
+ "now_playing_lyrics_plain_note": "Unsynced lyrics",
+ "now_playing_lyrics_sync_earlier": "Lyrics earlier",
+ "now_playing_lyrics_sync_later": "Lyrics later",
+ "now_playing_lyrics_sync_reset": "Reset sync",
"now_playing_queue_empty": "Queue is empty — click any track to start.",
"now_playing_previous_empty": "Nothing played in this session yet.",
"now_playing_no_track": "No track playing right now.",
diff --git a/src/lib/i18n/es.json b/src/lib/i18n/es.json
index 8ca663ed..e7e8210b 100644
--- a/src/lib/i18n/es.json
+++ b/src/lib/i18n/es.json
@@ -43,6 +43,50 @@
"settings": "Configuración",
"about": "Acerca de"
},
+ "tools": {
+ "tab": "Herramientas",
+ "working": "Procesando…",
+ "url_placeholder": "Pega la URL de un vídeo",
+ "metadata_title": "Obtener metadatos",
+ "metadata_desc": "Guarda la info, descripción y miniatura del vídeo sin descargar el vídeo.",
+ "metadata_action": "Obtener metadatos",
+ "metadata_done": "Guardados {{count}} archivo(s) de \"{{title}}\"",
+ "thumbnails_title": "Descargar miniatura",
+ "thumbnails_desc": "Explora todas las imágenes de portada y guárdala en cualquier resolución.",
+ "thumbnails_action": "Listar tamaños",
+ "thumbnails_none": "No se encontraron miniaturas para esta URL.",
+ "thumbnails_saved": "Guardado {{name}}",
+ "thumbnails_save": "Guardar este tamaño",
+ "thumbnails_default": "Predeterminado",
+ "subs_title": "Extraer subtítulos",
+ "subs_desc": "Descarga subtítulos o combina dos idiomas en un archivo bilingüe.",
+ "subs_action": "Listar subtítulos",
+ "subs_none": "— ninguno —",
+ "subs_primary": "Principal",
+ "subs_format": "Formato",
+ "subs_secondary": "Segundo idioma",
+ "subs_save": "Guardar subtítulo",
+ "subs_merge": "Combinar bilingüe",
+ "subs_merge_hint": "Elige un segundo idioma; la combinación necesita SRT o VTT.",
+ "subs_saved": "Guardado {{name}}",
+ "cc_title": "Comentarios y capítulos",
+ "cc_desc": "Obtén los comentarios o los marcadores de capítulo de un vídeo, fíltralos y expórtalos como JSON o CSV.",
+ "cc_comments": "Obtener comentarios",
+ "cc_chapters": "Obtener capítulos",
+ "cc_max": "Máx. comentarios",
+ "cc_sort": "Ordenar",
+ "cc_sort_top": "Top",
+ "cc_sort_new": "Más recientes",
+ "cc_filter": "Filtrar…",
+ "cc_none": "No se encontró nada para esta URL.",
+ "cc_exported": "Exportado {{name}}",
+ "cc_showing": "Mostrando {{shown}} de {{total}}",
+ "lc_title": "Archivar chat en vivo",
+ "lc_desc": "Obtén el replay del chat de un directo finalizado, fíltralo y expórtalo como JSON o CSV.",
+ "lc_action": "Obtener chat en vivo",
+ "lc_none": "No hay replay de chat para este vídeo.",
+ "lc_exported": "Exportado {{name}}"
+ },
"downloads": {
"title": "Descargas",
"empty": "Sin descargas en curso",
@@ -85,6 +129,54 @@
"open_in_study": "Ver en Estudio",
"stop": "Detener",
"confirm_remove": "¿Quitar esta descarga?",
+ "delete_file": "Eliminar archivo del disco",
+ "delete_file_confirm": "¿Eliminar permanentemente el archivo descargado del disco? Esto no se puede deshacer.",
+ "sw": {
+ "title": "Taller de subtítulos",
+ "tool_desc": "Abre, edita tiempo/texto, traduce y guarda subtítulos SRT/VTT.",
+ "open": "Abrir archivo de subtítulos",
+ "load_media": "Cargar medio (forma de onda)",
+ "save_srt": "Guardar .srt",
+ "save_vtt": "Guardar .vtt",
+ "shift": "Desplazar todo (ms)",
+ "find": "Buscar",
+ "replace": "Reemplazar con",
+ "replace_btn": "Reemplazar todo",
+ "replaced": "{{count}} subtítulo(s) cambiado(s)",
+ "target_lang": "Idioma destino",
+ "translate": "Traducir con IA",
+ "translated": "Subtítulos traducidos",
+ "translate_mismatch": "La traducción no coincidió — inténtalo de nuevo",
+ "not_configured": "Configura primero un proveedor de IA en Ajustes",
+ "saved": "Subtítulos guardados",
+ "split": "Dividir",
+ "merge": "Combinar ↓",
+ "empty": "Abre un archivo SRT o VTT para empezar.",
+ "qc_negative": "El fin es anterior al inicio",
+ "qc_overlap": "Se solapa con el siguiente subtítulo",
+ "qc_fast": "Velocidad de lectura demasiado alta"
+ },
+ "vop": {
+ "action_label": "Herramientas de vídeo IA",
+ "title": "Herramientas de vídeo IA",
+ "not_configured": "Configura primero un proveedor de IA en Ajustes",
+ "done": "Listo — guardado en:",
+ "quick_actions": "Acciones rápidas",
+ "extract_audio": "Extraer audio",
+ "mute": "Quitar audio",
+ "to_mp4": "Convertir a MP4",
+ "to_gif": "Convertir a GIF",
+ "trim_start": "Inicio (hh:mm:ss)",
+ "trim_end": "Fin (hh:mm:ss)",
+ "trim": "Recortar",
+ "nl_label": "Describe lo que quieres",
+ "nl_placeholder": "p. ej. ponlo en 720p y sin audio",
+ "propose": "Proponer",
+ "review_title": "Revisa el comando antes de ejecutar",
+ "review_hint": "La app rellena entrada/salida. Solo se ejecuta tras tu confirmación.",
+ "run": "Ejecutar",
+ "processing": "Procesando…"
+ },
"quality_hint": "Calidad que se está descargando para este elemento",
"stats_line": "{{count}} descargas · {{size}} guardados",
"filter_label": "Filtrar descargas por estado",
@@ -113,6 +205,8 @@
"auto_download_started": "Auto-download started",
"external_url_ready": "URL recibida y lista para descargar",
"external_url_queued": "Descarga añadida desde la extensión de Chrome",
+ "channel_new": "{{channel}}: {{count}} vídeo(s) nuevo(s)",
+ "channel_new_auto": "{{channel}}: descargando {{count}} vídeo(s) nuevo(s)",
"file_copied_to_clipboard": "Archivo copiado al portapapeles",
"drm_skipped": "{{count}} vídeo(s) omitidos — protegidos por DRM (FairPlay/SAMPLE-AES)",
"generic_download_complete": "{{name}} — ¡descarga completa!"
@@ -232,9 +326,13 @@
},
"download": {
"default_output_dir": "Carpeta por defecto",
+ "path_too_long": "La ruta de esta carpeta es larga ({{current}}/{{limit}} caracteres). Las descargas con nombres largos pueden fallar — elige una carpeta más corta.",
"choose_folder": "Elegir",
"always_ask_path": "Preguntar siempre dónde guardar",
"video_quality": "Calidad de vídeo",
+ "speed_limit": "Límite de velocidad de descarga",
+ "speed_limit_desc": "Limita la tasa de descarga. Déjalo vacío para sin límite.",
+ "speed_limit_unlimited": "Sin límite",
"skip_existing": "Saltar archivos existentes",
"download_attachments": "Descargar adjuntos",
"download_descriptions": "Guardar descripciones",
@@ -267,8 +365,24 @@
"translate_metadata_desc": "Pide a YouTube que localice los títulos y capítulos al idioma de la app (solo YouTube)",
"youtube_sponsorblock": "Eliminar segmentos de SponsorBlock",
"youtube_sponsorblock_desc": "Corta segmentos patrocinados, intros y outros de vídeos de YouTube (datos comunitarios; puede fallar o cortar de más)",
+ "sb_mode": "Acción de SponsorBlock",
+ "sb_mode_desc": "Quitar elimina los segmentos del archivo. Solo marcar añade marcadores de capítulo para saltarlos en el reproductor.",
+ "sb_mode_remove": "Quitar segmentos",
+ "sb_mode_mark": "Solo marcar",
+ "sb_categories": "Tipos de segmento",
+ "sb_categories_desc": "Sobre qué tipos de segmento actuar.",
+ "sb_cat_sponsor": "Patrocinio",
+ "sb_cat_selfpromo": "Autopromoción",
+ "sb_cat_interaction": "Recordatorio de interacción",
+ "sb_cat_intro": "Introducción",
+ "sb_cat_outro": "Cierre / tarjetas finales",
+ "sb_cat_preview": "Avance / resumen",
+ "sb_cat_filler": "Relleno / digresión",
+ "sb_cat_music_offtopic": "Sección sin música",
"split_by_chapters": "Dividir vídeo por capítulos",
"split_by_chapters_desc": "Cuando el origen tiene marcadores de capítulo, guarda cada capítulo como un archivo aparte",
+ "live_from_start": "Grabar directos desde el inicio",
+ "live_from_start_desc": "Al descargar un directo en curso, captúralo desde el principio en lugar del momento actual",
"presets": "Presets rápidos",
"presets_desc": "Configuración en un clic para flujos comunes. Toca una tarjeta para aplicar.",
"preset_fast": "Rápido",
@@ -360,7 +474,20 @@
"password": "Contraseña"
},
"ytdlp_flags": {
- "title": "Flags de yt-dlp"
+ "title": "Flags de yt-dlp",
+ "embed_subs": "Incrustar subtítulos",
+ "write_thumbnail": "Guardar miniatura",
+ "write_description": "Guardar descripción",
+ "write_comments": "Guardar comentarios",
+ "restrict_filenames": "Nombres ASCII",
+ "no_overwrites": "No sobrescribir",
+ "prefer_free_formats": "Formatos libres",
+ "force_ipv4": "Forzar IPv4",
+ "geo_bypass": "Evitar geobloqueo",
+ "limit_rate": "Limitar velocidad",
+ "sleep_interval": "Intervalo de espera",
+ "limit_rate_ph": "p. ej. 1M",
+ "sleep_interval_ph": "p. ej. 5"
},
"advanced": {
"title": "Avanzado",
@@ -376,9 +503,18 @@
"reset_confirm": "¿Estás seguro? Toda la configuración se restablecerá.",
"torrent_listen_port": "Puerto de escucha de torrent",
"torrent_listen_port_desc": "Puerto TCP para conexiones BitTorrent entrantes",
+ "torrent_auto_trackers": "Añadir trackers públicos adicionales",
+ "torrent_auto_trackers_desc": "Mejora el descubrimiento de pares en imanes con pocos o ningún tracker",
+ "torrent_upnp": "Abrir puerto del router (UPnP)",
+ "torrent_upnp_desc": "Permite que los routers acepten conexiones entrantes de pares para torrents más rápidos",
+ "prevent_sleep": "Mantener el sistema activo durante las descargas",
+ "prevent_sleep_desc": "Evita que el equipo entre en suspensión mientras hay descargas activas",
"cookies_from_browser": "Leer cookies directamente desde un perfil del navegador (avanzado)",
"cookies_from_browser_desc": "Solo actívalo si la extensión del navegador no funciona. La mayoría no necesita tocar esto.",
"cookies_from_browser_placeholder": "ex.: firefox, chrome, edge",
+ "user_agent": "User-Agent personalizado (avanzado)",
+ "user_agent_desc": "Envía un User-Agent personalizado en las descargas. Déjalo vacío para usar el predeterminado.",
+ "user_agent_placeholder": "User-Agent predeterminado del navegador",
"twitter_manual_cookie": "Manual cookie",
"twitter_manual_cookie_desc": "If a download fails, you can paste a manual Cookie header here and try again. This is not limited to Twitter/X. Example: sessionid=...; csrftoken=...; auth_token=..."
},
@@ -410,6 +546,12 @@
"bridge": {
"title": "Browser extension",
"intro": "Pair the OmniGet browser extension with this app over a private localhost connection. Open the extension's options page, paste the endpoint URL and token below, and click Save.",
+ "pair_label": "Vincular la extensión",
+ "pair_hint": "Un clic aquí y la extensión instalada se conecta sola — sin copiar y pegar.",
+ "pair": "Vincular extensión",
+ "pair_waiting": "Esperando…",
+ "pair_active": "Ventana abierta — la extensión se conectará sola (quedan {{secs}}s).",
+ "pair_unavailable": "Activa primero el puente del navegador.",
"endpoint_label": "Endpoint URL",
"token_label": "Pairing token",
"rotate_label": "Rotate token",
@@ -425,6 +567,64 @@
"unavailable": "Bridge unavailable. Try restarting the app."
},
"cat_cookies": "Cookies",
+ "cat_channels": "Canales",
+ "cat_ai": "IA",
+ "ai": {
+ "title": "Proveedor de IA",
+ "provider": "Proveedor",
+ "provider_desc": "Elige adónde van las solicitudes de IA. Tu clave se guarda localmente y nunca se registra.",
+ "provider_none": "Desactivado",
+ "provider_local": "Local (compatible con OpenAI)",
+ "model": "Modelo",
+ "model_desc": "El identificador del modelo para el proveedor elegido.",
+ "model_placeholder": "p. ej. gpt-4o-mini, claude-3-5-sonnet-latest, llama3",
+ "openai_key": "Clave API de OpenAI",
+ "anthropic_key": "Clave API de Anthropic",
+ "key_set": "Hay una clave guardada. Déjalo en blanco para conservarla.",
+ "key_unset": "Aún no hay clave guardada.",
+ "local_url": "URL del endpoint local",
+ "local_url_desc": "URL base compatible con OpenAI (Ollama, LM Studio, …).",
+ "save": "Guardar",
+ "test": "Probar conexión",
+ "test_ok": "La conexión de IA funciona",
+ "test_fail": "Prueba de IA fallida: {{error}}",
+ "saved": "Configuración de IA guardada",
+ "summarize_title": "Resumir un vídeo",
+ "summarize": "Resumir",
+ "summarizing": "Resumiendo…",
+ "summarize_placeholder": "URL del vídeo",
+ "summarize_hint": "Obtiene los subtítulos del vídeo y los resume. El resultado se guarda abajo.",
+ "style": "Estilo del resumen",
+ "style_short": "Corto",
+ "style_balanced": "Equilibrado",
+ "style_detailed": "Detallado",
+ "lang_placeholder": "Idioma de salida (opcional)",
+ "summary_ready": "Resumen listo",
+ "no_transcript": "No hay transcripción disponible para este vídeo",
+ "not_configured": "Configura primero un proveedor de IA",
+ "history": "Historial de IA",
+ "history_clear": "Borrar",
+ "history_clear_confirm": "¿Borrar todo el historial de IA?",
+ "history_empty": "Aún no hay resultados de IA."
+ },
+ "channels": {
+ "title": "Canales seguidos",
+ "tray_header": "Canales",
+ "add": "Seguir",
+ "add_placeholder": "URL del canal o lista de reproducción",
+ "add_hint": "Los nuevos vídeos se comprueban en segundo plano. La descarga automática está desactivada hasta que la actives.",
+ "empty_title": "Aún no sigues ningún canal",
+ "empty_hint": "Sigue un canal o lista de reproducción para recibir nuevos vídeos automáticamente.",
+ "last_checked": "Última comprobación {{when}}",
+ "never": "nunca",
+ "check_now": "Comprobar ahora",
+ "checked": "{{count}} vídeo(s) nuevo(s)",
+ "remove": "Quitar",
+ "remove_confirm": "¿Dejar de seguir este canal?",
+ "enabled": "Activado",
+ "auto_download": "Descarga automática",
+ "interval": "Cada (min)"
+ },
"cookies": {
"title": "Cookies",
"intro": "Manage your account cookies. Everything stays on your computer — nothing is sent to our servers.",
@@ -454,6 +654,12 @@
"action_view": "View",
"action_export": "Export",
"action_rename": "Rename",
+ "action_test": "Probar",
+ "test_running": "Probando…",
+ "test_ok": "Las cookies funcionan.",
+ "test_fail": "Falló: {{msg}}",
+ "expires_in": "caduca en ~{{days}}d",
+ "expired": "caducada",
"action_clear": "Clear",
"import_trigger": "Import",
"import_file_title": "File",
@@ -540,6 +746,30 @@
"formats_playlist_note": "El selector de formato por vídeo no se aplica a listas de reproducción. La opción Calidad de arriba se aplica a cada vídeo.",
"referer_label": "Referer (opcional)",
"referer_placeholder": "https://example.com",
+ "timerange_label": "Descargar solo un fragmento (opcional)",
+ "timerange_start": "Inicio",
+ "timerange_end": "Fin",
+ "timerange_hint": "Usa mm:ss o hh:mm:ss. Déjalo vacío para descargar el vídeo completo.",
+ "schedule_label": "Programar",
+ "schedule_1h": "En 1 hora",
+ "schedule_tonight": "Esta noche",
+ "schedule_1d": "Mañana",
+ "schedule_clear": "Borrar",
+ "schedule_start": "Hora de inicio",
+ "schedule_stop": "Hora de parada",
+ "schedule_hint": "Déjalo vacío para empezar ahora. La hora de parada opcional cancela la descarga si sigue en curso.",
+ "playlist_selected": "{{selected}} de {{total}} seleccionados",
+ "playlist_all": "Seleccionar todo",
+ "playlist_none": "Ninguno",
+ "playlist_loading": "Cargando playlist…",
+ "playlist_empty": "No se pudieron cargar los elementos de la playlist",
+ "playlist_none_selected": "Selecciona al menos un elemento para descargar",
+ "torrent_selected": "{{selected}} de {{total}} archivos seleccionados",
+ "torrent_loading": "Leyendo contenido del torrent…",
+ "torrent_none_selected": "Selecciona al menos un archivo para descargar",
+ "cookie_hint_stale": "La cookie guardada de este sitio se está quedando vieja.",
+ "cookie_hint_expired": "La cookie guardada de este sitio caducó — las descargas pueden fallar.",
+ "cookie_hint_action": "Actualizar",
"external_url_ready": "URL recibida desde la extensión de Chrome",
"content_type": {
"video": "Vídeo",
@@ -1469,12 +1699,25 @@
"music_theme_reduce_motion_on": "Always reduce",
"music_theme_reduce_motion_hint": "Disables transitions and animations in the music section, independent of the global system setting.",
"now_playing_title": "Now playing",
+ "youtube_live": "EN VIVO",
+ "youtube_error_generic": "Algo salió mal al hablar con YouTube",
+ "youtube_error_retry": "Reintentar",
+ "youtube_error_audio_only": "Solo audio",
+ "youtube_error_details": "Detalles técnicos",
+ "youtube_error_hide_details": "Ocultar detalles",
"now_playing_close": "Back",
"now_playing_tab_lyrics": "Lyrics",
"now_playing_tab_queue": "Up next",
"now_playing_tab_previous": "Previous",
"now_playing_lyrics_empty": "No lyrics available.",
- "now_playing_lyrics_error": "Couldn't load lyrics. Try again.",
+ "now_playing_lyrics_error": "No se pudo cargar la letra. Inténtalo de nuevo.",
+ "now_playing_lyrics_retry": "Reintentar",
+ "now_playing_lyrics_show_translation": "Mostrar traducción",
+ "now_playing_lyrics_hide_translation": "Ocultar traducción",
+ "now_playing_lyrics_plain_note": "Letra no sincronizada",
+ "now_playing_lyrics_sync_earlier": "Letra antes",
+ "now_playing_lyrics_sync_later": "Letra después",
+ "now_playing_lyrics_sync_reset": "Restablecer sincronización",
"now_playing_queue_empty": "Queue is empty — click any track to start.",
"now_playing_previous_empty": "Nothing played in this session yet.",
"now_playing_no_track": "No track playing right now.",
diff --git a/src/lib/i18n/fr.json b/src/lib/i18n/fr.json
index b282df75..03bcd2e1 100644
--- a/src/lib/i18n/fr.json
+++ b/src/lib/i18n/fr.json
@@ -43,6 +43,50 @@
"settings": "Paramètres",
"about": "À propos"
},
+ "tools": {
+ "tab": "Outils",
+ "working": "En cours…",
+ "url_placeholder": "Collez l'URL d'une vidéo",
+ "metadata_title": "Récupérer les métadonnées",
+ "metadata_desc": "Enregistre les infos, la description et la miniature de la vidéo sans télécharger la vidéo.",
+ "metadata_action": "Récupérer les métadonnées",
+ "metadata_done": "{{count}} fichier(s) enregistré(s) pour « {{title}} »",
+ "thumbnails_title": "Télécharger la miniature",
+ "thumbnails_desc": "Parcourez toutes les images de couverture et enregistrez-la dans n'importe quelle résolution.",
+ "thumbnails_action": "Lister les tailles",
+ "thumbnails_none": "Aucune miniature trouvée pour cette URL.",
+ "thumbnails_saved": "Enregistré {{name}}",
+ "thumbnails_save": "Enregistrer cette taille",
+ "thumbnails_default": "Par défaut",
+ "subs_title": "Extraire les sous-titres",
+ "subs_desc": "Téléchargez les sous-titres ou fusionnez deux langues en un fichier bilingue.",
+ "subs_action": "Lister les sous-titres",
+ "subs_none": "— aucun —",
+ "subs_primary": "Principal",
+ "subs_format": "Format",
+ "subs_secondary": "Deuxième langue",
+ "subs_save": "Enregistrer le sous-titre",
+ "subs_merge": "Fusionner bilingue",
+ "subs_merge_hint": "Choisissez une deuxième langue ; la fusion nécessite SRT ou VTT.",
+ "subs_saved": "Enregistré {{name}}",
+ "cc_title": "Commentaires et chapitres",
+ "cc_desc": "Récupérez les commentaires ou les chapitres d'une vidéo, filtrez-les et exportez en JSON ou CSV.",
+ "cc_comments": "Récupérer les commentaires",
+ "cc_chapters": "Récupérer les chapitres",
+ "cc_max": "Max commentaires",
+ "cc_sort": "Trier",
+ "cc_sort_top": "Top",
+ "cc_sort_new": "Plus récents",
+ "cc_filter": "Filtrer…",
+ "cc_none": "Rien trouvé pour cette URL.",
+ "cc_exported": "Exporté {{name}}",
+ "cc_showing": "Affichage de {{shown}} sur {{total}}",
+ "lc_title": "Archiver le tchat live",
+ "lc_desc": "Récupérez le replay du tchat d'un direct terminé, filtrez-le et exportez en JSON ou CSV.",
+ "lc_action": "Récupérer le tchat live",
+ "lc_none": "Pas de replay de tchat pour cette vidéo.",
+ "lc_exported": "Exporté {{name}}"
+ },
"downloads": {
"title": "Téléchargements",
"empty": "Aucun téléchargement en cours",
@@ -85,6 +129,54 @@
"open_in_study": "Watch in Study",
"stop": "Arrêter",
"confirm_remove": "Supprimer ce téléchargement ?",
+ "delete_file": "Supprimer le fichier du disque",
+ "delete_file_confirm": "Supprimer définitivement le fichier téléchargé du disque ? Cette action est irréversible.",
+ "sw": {
+ "title": "Atelier de sous-titres",
+ "tool_desc": "Ouvrez, modifiez le temps/texte, traduisez et enregistrez des sous-titres SRT/VTT.",
+ "open": "Ouvrir un fichier de sous-titres",
+ "load_media": "Charger un média (forme d'onde)",
+ "save_srt": "Enregistrer .srt",
+ "save_vtt": "Enregistrer .vtt",
+ "shift": "Décaler tout (ms)",
+ "find": "Rechercher",
+ "replace": "Remplacer par",
+ "replace_btn": "Tout remplacer",
+ "replaced": "{{count}} sous-titre(s) modifié(s)",
+ "target_lang": "Langue cible",
+ "translate": "Traduire avec l'IA",
+ "translated": "Sous-titres traduits",
+ "translate_mismatch": "La traduction ne correspond pas — réessayez",
+ "not_configured": "Configurez d'abord un fournisseur IA dans les Paramètres",
+ "saved": "Sous-titres enregistrés",
+ "split": "Diviser",
+ "merge": "Fusionner ↓",
+ "empty": "Ouvrez un fichier SRT ou VTT pour commencer.",
+ "qc_negative": "La fin précède le début",
+ "qc_overlap": "Chevauche le sous-titre suivant",
+ "qc_fast": "Vitesse de lecture trop élevée"
+ },
+ "vop": {
+ "action_label": "Outils vidéo IA",
+ "title": "Outils vidéo IA",
+ "not_configured": "Configurez d'abord un fournisseur IA dans les Paramètres",
+ "done": "Terminé — enregistré dans :",
+ "quick_actions": "Actions rapides",
+ "extract_audio": "Extraire l'audio",
+ "mute": "Supprimer l'audio",
+ "to_mp4": "Convertir en MP4",
+ "to_gif": "Convertir en GIF",
+ "trim_start": "Début (hh:mm:ss)",
+ "trim_end": "Fin (hh:mm:ss)",
+ "trim": "Découper",
+ "nl_label": "Décrivez ce que vous voulez",
+ "nl_placeholder": "ex. passez-le en 720p et coupez le son",
+ "propose": "Proposer",
+ "review_title": "Vérifiez la commande avant d'exécuter",
+ "review_hint": "L'app remplit l'entrée/sortie. Exécuté seulement après confirmation.",
+ "run": "Exécuter",
+ "processing": "Traitement…"
+ },
"quality_hint": "Qualité en téléchargement pour cet élément",
"stats_line": "{{count}} téléchargements · {{size}} enregistrés",
"filter_label": "Filtrer les téléchargements par statut",
@@ -113,6 +205,8 @@
"auto_download_started": "Téléchargement automatique lancé",
"external_url_ready": "URL reçue et prête à être téléchargée",
"external_url_queued": "Téléchargement ajouté depuis l'extension Chrome",
+ "channel_new": "{{channel}} : {{count}} nouvelle(s) vidéo(s)",
+ "channel_new_auto": "{{channel}} : téléchargement de {{count}} nouvelle(s) vidéo(s)",
"file_copied_to_clipboard": "Fichier copié dans le presse-papiers",
"drm_skipped": "{{count}} vidéo(s) ignorée(s) — protégée(s) par DRM (FairPlay/SAMPLE-AES)",
"generic_download_complete": "{{name}} — téléchargement terminé !"
@@ -232,9 +326,13 @@
},
"download": {
"default_output_dir": "Dossier par défaut",
+ "path_too_long": "Le chemin de ce dossier est long ({{current}}/{{limit}} caractères). Les téléchargements avec des noms longs peuvent échouer — choisissez un dossier plus court.",
"choose_folder": "Choisir",
"always_ask_path": "Toujours demander où enregistrer",
"video_quality": "Qualité vidéo",
+ "speed_limit": "Limite de vitesse",
+ "speed_limit_desc": "Limite le débit de téléchargement. Laissez vide pour aucune limite.",
+ "speed_limit_unlimited": "Aucune limite",
"skip_existing": "Ignorer les fichiers existants",
"download_attachments": "Télécharger les pièces jointes",
"download_descriptions": "Enregistrer les descriptions",
@@ -267,8 +365,24 @@
"translate_metadata_desc": "Demander à YouTube de localiser titres et noms de chapitres dans la langue de l'app (YouTube uniquement)",
"youtube_sponsorblock": "Retirer les segments SponsorBlock",
"youtube_sponsorblock_desc": "Couper les segments sponsorisés, intros et outros des vidéos YouTube (données communautaires ; peut manquer ou trop couper)",
+ "sb_mode": "Action SponsorBlock",
+ "sb_mode_desc": "Supprimer retire les segments du fichier. Marquer seulement ajoute des marqueurs de chapitre pour les passer dans le lecteur.",
+ "sb_mode_remove": "Supprimer les segments",
+ "sb_mode_mark": "Marquer seulement",
+ "sb_categories": "Types de segment",
+ "sb_categories_desc": "Sur quels types de segment agir.",
+ "sb_cat_sponsor": "Sponsor",
+ "sb_cat_selfpromo": "Autopromotion",
+ "sb_cat_interaction": "Rappel d'interaction",
+ "sb_cat_intro": "Intro",
+ "sb_cat_outro": "Fin / cartes de fin",
+ "sb_cat_preview": "Aperçu / récapitulatif",
+ "sb_cat_filler": "Remplissage / digression",
+ "sb_cat_music_offtopic": "Section sans musique",
"split_by_chapters": "Diviser la vidéo par chapitres",
"split_by_chapters_desc": "Lorsque la vidéo contient des marqueurs de chapitre, enregistrer chaque chapitre dans un fichier séparé",
+ "live_from_start": "Enregistrer les directs depuis le début",
+ "live_from_start_desc": "Lors du téléchargement d'un direct en cours, capturez-le depuis le début plutôt qu'à partir du moment actuel",
"presets": "Préréglages rapides",
"presets_desc": "Configuration en un clic. Appuyez sur une carte pour appliquer.",
"preset_fast": "Rapide",
@@ -360,7 +474,20 @@
"password": "Mot de passe"
},
"ytdlp_flags": {
- "title": "Paramètres yt-dlp"
+ "title": "Paramètres yt-dlp",
+ "embed_subs": "Intégrer les sous-titres",
+ "write_thumbnail": "Enregistrer la miniature",
+ "write_description": "Enregistrer la description",
+ "write_comments": "Enregistrer les commentaires",
+ "restrict_filenames": "Noms ASCII",
+ "no_overwrites": "Pas d'écrasement",
+ "prefer_free_formats": "Formats libres",
+ "force_ipv4": "Forcer IPv4",
+ "geo_bypass": "Contourner le géoblocage",
+ "limit_rate": "Limiter le débit",
+ "sleep_interval": "Intervalle d'attente",
+ "limit_rate_ph": "ex. 1M",
+ "sleep_interval_ph": "ex. 5"
},
"advanced": {
"title": "Avancé",
@@ -376,9 +503,18 @@
"reset_confirm": "Êtes-vous sûr ? Tous les paramètres seront réinitialisés.",
"torrent_listen_port": "Port d’écoute torrent",
"torrent_listen_port_desc": "Port TCP pour les connexions BitTorrent entrantes",
+ "torrent_auto_trackers": "Ajouter des trackers publics supplémentaires",
+ "torrent_auto_trackers_desc": "Améliore la découverte de pairs pour les magnets avec peu ou pas de trackers",
+ "torrent_upnp": "Ouvrir le port du routeur (UPnP)",
+ "torrent_upnp_desc": "Permet aux routeurs d'accepter les connexions entrantes pour des torrents plus rapides",
+ "prevent_sleep": "Garder le système éveillé pendant les téléchargements",
+ "prevent_sleep_desc": "Empêche l'ordinateur de se mettre en veille tant que des téléchargements sont actifs",
"cookies_from_browser": "Cookies du navigateur (avancé)",
"cookies_from_browser_desc": "À configurer uniquement si l'extension du navigateur ne fonctionne pas. La plupart des utilisateurs doivent laisser vide.",
"cookies_from_browser_placeholder": "ex.: firefox, chrome, edge",
+ "user_agent": "User-Agent personnalisé (avancé)",
+ "user_agent_desc": "Envoie un User-Agent personnalisé aux téléchargements. Laissez vide pour utiliser celui par défaut.",
+ "user_agent_placeholder": "User-Agent par défaut du navigateur",
"twitter_manual_cookie": "Cookie manuel",
"twitter_manual_cookie_desc": "Si un téléchargement échoue, vous pouvez coller ici un en-tête Cookie manuel et réessayer. Ce n'est pas limité à Twitter/X. Exemple : sessionid=...; csrftoken=...; auth_token=..."
},
@@ -410,6 +546,12 @@
"bridge": {
"title": "Extension de navigateur",
"intro": "Associez l'extension OmniGet à l'application via une connexion locale privée. Ouvrez la page d'options de l'extension, collez l'URL et le jeton ci-dessous, puis enregistrez.",
+ "pair_label": "Associer l'extension",
+ "pair_hint": "Un clic ici et l'extension installée se connecte toute seule — sans copier-coller.",
+ "pair": "Associer l'extension",
+ "pair_waiting": "En attente…",
+ "pair_active": "Fenêtre ouverte — l'extension se connectera automatiquement ({{secs}}s restantes).",
+ "pair_unavailable": "Activez d'abord le pont du navigateur.",
"endpoint_label": "URL du point d'accès",
"token_label": "Jeton d'appairage",
"rotate_label": "Régénérer le jeton",
@@ -425,6 +567,64 @@
"unavailable": "Pont indisponible. Redémarrez l'application."
},
"cat_cookies": "Cookies",
+ "cat_channels": "Chaînes",
+ "cat_ai": "IA",
+ "ai": {
+ "title": "Fournisseur IA",
+ "provider": "Fournisseur",
+ "provider_desc": "Choisissez la destination des requêtes IA. Votre clé est stockée localement et jamais journalisée.",
+ "provider_none": "Désactivé",
+ "provider_local": "Local (compatible OpenAI)",
+ "model": "Modèle",
+ "model_desc": "L'identifiant du modèle pour le fournisseur choisi.",
+ "model_placeholder": "ex. gpt-4o-mini, claude-3-5-sonnet-latest, llama3",
+ "openai_key": "Clé API OpenAI",
+ "anthropic_key": "Clé API Anthropic",
+ "key_set": "Une clé est enregistrée. Laissez vide pour la conserver.",
+ "key_unset": "Aucune clé enregistrée.",
+ "local_url": "URL du point d'accès local",
+ "local_url_desc": "URL de base compatible OpenAI (Ollama, LM Studio, …).",
+ "save": "Enregistrer",
+ "test": "Tester la connexion",
+ "test_ok": "La connexion IA fonctionne",
+ "test_fail": "Échec du test IA : {{error}}",
+ "saved": "Paramètres IA enregistrés",
+ "summarize_title": "Résumer une vidéo",
+ "summarize": "Résumer",
+ "summarizing": "Résumé en cours…",
+ "summarize_placeholder": "URL de la vidéo",
+ "summarize_hint": "Récupère les sous-titres de la vidéo et les résume. Le résultat est enregistré ci-dessous.",
+ "style": "Style du résumé",
+ "style_short": "Court",
+ "style_balanced": "Équilibré",
+ "style_detailed": "Détaillé",
+ "lang_placeholder": "Langue de sortie (facultatif)",
+ "summary_ready": "Résumé prêt",
+ "no_transcript": "Aucune transcription disponible pour cette vidéo",
+ "not_configured": "Configurez d'abord un fournisseur IA",
+ "history": "Historique IA",
+ "history_clear": "Effacer",
+ "history_clear_confirm": "Effacer tout l'historique IA ?",
+ "history_empty": "Aucun résultat IA pour l'instant."
+ },
+ "channels": {
+ "title": "Chaînes suivies",
+ "tray_header": "Chaînes",
+ "add": "Suivre",
+ "add_placeholder": "URL de la chaîne ou de la playlist",
+ "add_hint": "Les nouvelles vidéos sont vérifiées en arrière-plan. Le téléchargement automatique est désactivé tant que vous ne l'activez pas.",
+ "empty_title": "Aucune chaîne suivie",
+ "empty_hint": "Suivez une chaîne ou une playlist pour recevoir automatiquement les nouvelles vidéos.",
+ "last_checked": "Dernière vérification {{when}}",
+ "never": "jamais",
+ "check_now": "Vérifier maintenant",
+ "checked": "{{count}} nouvelle(s) vidéo(s)",
+ "remove": "Retirer",
+ "remove_confirm": "Arrêter de suivre cette chaîne ?",
+ "enabled": "Activé",
+ "auto_download": "Téléchargement auto",
+ "interval": "Toutes les (min)"
+ },
"cookies": {
"title": "Cookies",
"intro": "Manage your account cookies. Everything stays on your computer — nothing is sent to our servers.",
@@ -454,6 +654,12 @@
"action_view": "View",
"action_export": "Export",
"action_rename": "Rename",
+ "action_test": "Tester",
+ "test_running": "Test…",
+ "test_ok": "Les cookies fonctionnent.",
+ "test_fail": "Échec : {{msg}}",
+ "expires_in": "expire dans ~{{days}}j",
+ "expired": "expiré",
"action_clear": "Clear",
"import_trigger": "Import",
"import_file_title": "File",
@@ -540,6 +746,30 @@
"formats_playlist_note": "Le sélecteur de format par vidéo ne s'applique pas aux playlists. L'option Qualité ci-dessus s'applique à chaque vidéo.",
"referer_label": "Referer (optionnel)",
"referer_placeholder": "https://example.com",
+ "timerange_label": "Télécharger seulement une section (facultatif)",
+ "timerange_start": "Début",
+ "timerange_end": "Fin",
+ "timerange_hint": "Utilisez mm:ss ou hh:mm:ss. Laissez vide pour télécharger toute la vidéo.",
+ "schedule_label": "Planifier",
+ "schedule_1h": "Dans 1 heure",
+ "schedule_tonight": "Ce soir",
+ "schedule_1d": "Demain",
+ "schedule_clear": "Effacer",
+ "schedule_start": "Heure de début",
+ "schedule_stop": "Heure d'arrêt",
+ "schedule_hint": "Laissez vide pour démarrer maintenant. L'heure d'arrêt facultative annule le téléchargement s'il est encore en cours.",
+ "playlist_selected": "{{selected}} sur {{total}} sélectionnés",
+ "playlist_all": "Tout sélectionner",
+ "playlist_none": "Aucun",
+ "playlist_loading": "Chargement de la playlist…",
+ "playlist_empty": "Impossible de charger les éléments de la playlist",
+ "playlist_none_selected": "Sélectionnez au moins un élément à télécharger",
+ "torrent_selected": "{{selected}} sur {{total}} fichiers sélectionnés",
+ "torrent_loading": "Lecture du contenu du torrent…",
+ "torrent_none_selected": "Sélectionnez au moins un fichier à télécharger",
+ "cookie_hint_stale": "Le cookie enregistré de ce site commence à dater.",
+ "cookie_hint_expired": "Le cookie enregistré de ce site a expiré — les téléchargements peuvent échouer.",
+ "cookie_hint_action": "Mettre à jour",
"external_url_ready": "URL reçue depuis l'extension Chrome",
"content_type": {
"video": "Vidéo",
@@ -1469,12 +1699,25 @@
"music_theme_reduce_motion_on": "Always reduce",
"music_theme_reduce_motion_hint": "Disables transitions and animations in the music section, independent of the global system setting.",
"now_playing_title": "Now playing",
+ "youtube_live": "EN DIRECT",
+ "youtube_error_generic": "Un problème est survenu avec YouTube",
+ "youtube_error_retry": "Réessayer",
+ "youtube_error_audio_only": "Audio seulement",
+ "youtube_error_details": "Détails techniques",
+ "youtube_error_hide_details": "Masquer les détails",
"now_playing_close": "Back",
"now_playing_tab_lyrics": "Lyrics",
"now_playing_tab_queue": "Up next",
"now_playing_tab_previous": "Previous",
"now_playing_lyrics_empty": "No lyrics available.",
- "now_playing_lyrics_error": "Couldn't load lyrics. Try again.",
+ "now_playing_lyrics_error": "Impossible de charger les paroles. Réessayez.",
+ "now_playing_lyrics_retry": "Réessayer",
+ "now_playing_lyrics_show_translation": "Afficher la traduction",
+ "now_playing_lyrics_hide_translation": "Masquer la traduction",
+ "now_playing_lyrics_plain_note": "Paroles non synchronisées",
+ "now_playing_lyrics_sync_earlier": "Paroles plus tôt",
+ "now_playing_lyrics_sync_later": "Paroles plus tard",
+ "now_playing_lyrics_sync_reset": "Réinitialiser la synchro",
"now_playing_queue_empty": "Queue is empty — click any track to start.",
"now_playing_previous_empty": "Nothing played in this session yet.",
"now_playing_no_track": "No track playing right now.",
diff --git a/src/lib/i18n/it.json b/src/lib/i18n/it.json
index 1895e312..adf438f7 100644
--- a/src/lib/i18n/it.json
+++ b/src/lib/i18n/it.json
@@ -43,6 +43,50 @@
"settings": "Impostazioni",
"about": "Info"
},
+ "tools": {
+ "tab": "Strumenti",
+ "working": "In corso…",
+ "url_placeholder": "Incolla l'URL di un video",
+ "metadata_title": "Recupera metadati",
+ "metadata_desc": "Salva info, descrizione e miniatura del video senza scaricare il video.",
+ "metadata_action": "Recupera metadati",
+ "metadata_done": "Salvati {{count}} file per \"{{title}}\"",
+ "thumbnails_title": "Scarica copertina",
+ "thumbnails_desc": "Sfoglia tutte le immagini di copertina e salvala in qualsiasi risoluzione.",
+ "thumbnails_action": "Elenca dimensioni",
+ "thumbnails_none": "Nessuna copertina trovata per questo URL.",
+ "thumbnails_saved": "Salvato {{name}}",
+ "thumbnails_save": "Salva questa dimensione",
+ "thumbnails_default": "Predefinito",
+ "subs_title": "Estrai sottotitoli",
+ "subs_desc": "Scarica i sottotitoli o unisci due lingue in un file bilingue.",
+ "subs_action": "Elenca sottotitoli",
+ "subs_none": "— nessuno —",
+ "subs_primary": "Principale",
+ "subs_format": "Formato",
+ "subs_secondary": "Seconda lingua",
+ "subs_save": "Salva sottotitolo",
+ "subs_merge": "Unisci bilingue",
+ "subs_merge_hint": "Scegli una seconda lingua; l'unione richiede SRT o VTT.",
+ "subs_saved": "Salvato {{name}}",
+ "cc_title": "Commenti e capitoli",
+ "cc_desc": "Recupera i commenti o i capitoli di un video, filtrali ed esportali in JSON o CSV.",
+ "cc_comments": "Recupera commenti",
+ "cc_chapters": "Recupera capitoli",
+ "cc_max": "Max commenti",
+ "cc_sort": "Ordina",
+ "cc_sort_top": "Top",
+ "cc_sort_new": "Più recenti",
+ "cc_filter": "Filtra…",
+ "cc_none": "Nessun risultato per questo URL.",
+ "cc_exported": "Esportato {{name}}",
+ "cc_showing": "Mostrati {{shown}} di {{total}}",
+ "lc_title": "Archivia chat live",
+ "lc_desc": "Recupera il replay della chat di una diretta conclusa, filtralo ed esportalo in JSON o CSV.",
+ "lc_action": "Recupera chat live",
+ "lc_none": "Nessun replay della chat per questo video.",
+ "lc_exported": "Esportato {{name}}"
+ },
"downloads": {
"title": "Download",
"empty": "Nessun download in corso",
@@ -85,6 +129,54 @@
"open_in_study": "Watch in Study",
"stop": "Ferma",
"confirm_remove": "Rimuovere questo download?",
+ "delete_file": "Elimina file dal disco",
+ "delete_file_confirm": "Eliminare definitivamente il file scaricato dal disco? L'operazione non può essere annullata.",
+ "sw": {
+ "title": "Officina sottotitoli",
+ "tool_desc": "Apri, modifica tempo/testo, traduci e salva sottotitoli SRT/VTT.",
+ "open": "Apri file sottotitoli",
+ "load_media": "Carica media (forma d'onda)",
+ "save_srt": "Salva .srt",
+ "save_vtt": "Salva .vtt",
+ "shift": "Sposta tutto (ms)",
+ "find": "Trova",
+ "replace": "Sostituisci con",
+ "replace_btn": "Sostituisci tutto",
+ "replaced": "{{count}} sottotitolo/i modificato/i",
+ "target_lang": "Lingua di destinazione",
+ "translate": "Traduci con IA",
+ "translated": "Sottotitoli tradotti",
+ "translate_mismatch": "La traduzione non corrisponde — riprova",
+ "not_configured": "Configura prima un provider IA nelle Impostazioni",
+ "saved": "Sottotitoli salvati",
+ "split": "Dividi",
+ "merge": "Unisci ↓",
+ "empty": "Apri un file SRT o VTT per iniziare.",
+ "qc_negative": "La fine precede l'inizio",
+ "qc_overlap": "Si sovrappone al sottotitolo successivo",
+ "qc_fast": "Velocità di lettura troppo alta"
+ },
+ "vop": {
+ "action_label": "Strumenti video IA",
+ "title": "Strumenti video IA",
+ "not_configured": "Configura prima un provider IA nelle Impostazioni",
+ "done": "Fatto — salvato in:",
+ "quick_actions": "Azioni rapide",
+ "extract_audio": "Estrai audio",
+ "mute": "Rimuovi audio",
+ "to_mp4": "Converti in MP4",
+ "to_gif": "Converti in GIF",
+ "trim_start": "Inizio (hh:mm:ss)",
+ "trim_end": "Fine (hh:mm:ss)",
+ "trim": "Taglia",
+ "nl_label": "Descrivi cosa vuoi",
+ "nl_placeholder": "es. mettilo a 720p e togli l'audio",
+ "propose": "Proponi",
+ "review_title": "Controlla il comando prima di eseguire",
+ "review_hint": "L'app inserisce ingresso/uscita. Viene eseguito solo dopo la conferma.",
+ "run": "Esegui",
+ "processing": "Elaborazione…"
+ },
"quality_hint": "Qualità in download per questo elemento",
"stats_line": "{{count}} download · {{size}} salvati",
"filter_label": "Filtra download per stato",
@@ -113,6 +205,8 @@
"auto_download_started": "Download automatico avviato",
"external_url_ready": "URL ricevuto e pronto per il download",
"external_url_queued": "Download aggiunto dall'estensione Chrome",
+ "channel_new": "{{channel}}: {{count}} nuovo/i video",
+ "channel_new_auto": "{{channel}}: download di {{count}} nuovo/i video",
"file_copied_to_clipboard": "File copiato negli appunti",
"drm_skipped": "{{count}} video ignorati — protetti da DRM (FairPlay/SAMPLE-AES)",
"generic_download_complete": "{{name}} — download completato!"
@@ -232,9 +326,13 @@
},
"download": {
"default_output_dir": "Cartella predefinita",
+ "path_too_long": "Il percorso di questa cartella è lungo ({{current}}/{{limit}} caratteri). I download con nomi lunghi possono fallire — scegli una cartella più breve.",
"choose_folder": "Scegli",
"always_ask_path": "Chiedi sempre dove salvare",
"video_quality": "Qualità video",
+ "speed_limit": "Limite di velocità",
+ "speed_limit_desc": "Limita la velocità di download. Lascia vuoto per nessun limite.",
+ "speed_limit_unlimited": "Nessun limite",
"skip_existing": "Salta file esistenti",
"download_attachments": "Scarica allegati",
"download_descriptions": "Salva descrizioni",
@@ -267,8 +365,24 @@
"translate_metadata_desc": "Chiedi a YouTube di localizzare titoli e nomi dei capitoli nella lingua dell'app (solo YouTube)",
"youtube_sponsorblock": "Rimuovi segmenti SponsorBlock",
"youtube_sponsorblock_desc": "Taglia sponsor, intro e outro dai video YouTube (dati della community; può mancare o tagliare troppo)",
+ "sb_mode": "Azione SponsorBlock",
+ "sb_mode_desc": "Rimuovi taglia i segmenti dal file. Solo segna aggiunge marcatori di capitolo per saltarli nel player.",
+ "sb_mode_remove": "Rimuovi segmenti",
+ "sb_mode_mark": "Solo segna",
+ "sb_categories": "Tipi di segmento",
+ "sb_categories_desc": "Su quali tipi di segmento agire.",
+ "sb_cat_sponsor": "Sponsor",
+ "sb_cat_selfpromo": "Autopromozione",
+ "sb_cat_interaction": "Promemoria di interazione",
+ "sb_cat_intro": "Introduzione",
+ "sb_cat_outro": "Finale / schede finali",
+ "sb_cat_preview": "Anteprima / riepilogo",
+ "sb_cat_filler": "Riempitivo / divagazione",
+ "sb_cat_music_offtopic": "Sezione senza musica",
"split_by_chapters": "Dividi video per capitoli",
"split_by_chapters_desc": "Quando il video ha marcatori di capitolo, salva ciascun capitolo come file separato",
+ "live_from_start": "Registra le dirette dall'inizio",
+ "live_from_start_desc": "Quando scarichi una diretta in corso, catturala dall'inizio invece che dal momento attuale",
"presets": "Preset rapidi",
"presets_desc": "Configurazione con un clic. Tocca una scheda per applicare.",
"preset_fast": "Veloce",
@@ -360,7 +474,20 @@
"password": "Password"
},
"ytdlp_flags": {
- "title": "Flag di yt-dlp"
+ "title": "Flag di yt-dlp",
+ "embed_subs": "Incorpora sottotitoli",
+ "write_thumbnail": "Salva miniatura",
+ "write_description": "Salva descrizione",
+ "write_comments": "Salva commenti",
+ "restrict_filenames": "Nomi ASCII",
+ "no_overwrites": "Non sovrascrivere",
+ "prefer_free_formats": "Formati liberi",
+ "force_ipv4": "Forza IPv4",
+ "geo_bypass": "Aggira geoblocco",
+ "limit_rate": "Limita velocità",
+ "sleep_interval": "Intervallo di attesa",
+ "limit_rate_ph": "es. 1M",
+ "sleep_interval_ph": "es. 5"
},
"advanced": {
"title": "Avanzate",
@@ -376,9 +503,18 @@
"reset_confirm": "Sei sicuro? Tutte le impostazioni verranno ripristinate.",
"torrent_listen_port": "Porta di ascolto torrent",
"torrent_listen_port_desc": "Porta TCP per le connessioni BitTorrent in entrata",
+ "torrent_auto_trackers": "Aggiungi tracker pubblici extra",
+ "torrent_auto_trackers_desc": "Migliora la scoperta dei peer per magnet con pochi o nessun tracker",
+ "torrent_upnp": "Apri la porta del router (UPnP)",
+ "torrent_upnp_desc": "Consente ai router di accettare connessioni peer in entrata per torrent più veloci",
+ "prevent_sleep": "Mantieni il sistema attivo durante i download",
+ "prevent_sleep_desc": "Impedisce al computer di andare in sospensione mentre ci sono download attivi",
"cookies_from_browser": "Cookie del browser (avanzato)",
"cookies_from_browser_desc": "Configura solo se l'estensione del browser non funziona. La maggior parte degli utenti dovrebbe lasciare vuoto.",
"cookies_from_browser_placeholder": "ex.: firefox, chrome, edge",
+ "user_agent": "User-Agent personalizzato (avanzato)",
+ "user_agent_desc": "Invia un User-Agent personalizzato ai download. Lascia vuoto per usare quello predefinito.",
+ "user_agent_placeholder": "User-Agent predefinito del browser",
"twitter_manual_cookie": "Cookie manuale",
"twitter_manual_cookie_desc": "Se un download fallisce, puoi incollare qui un header Cookie manuale e riprovare. Non è limitato a Twitter/X. Esempio: sessionid=...; csrftoken=...; auth_token=..."
},
@@ -410,6 +546,12 @@
"bridge": {
"title": "Estensione del browser",
"intro": "Associa l'estensione OmniGet a questa app tramite una connessione locale privata. Apri la pagina delle opzioni dell'estensione, incolla URL e token qui sotto, poi clicca Salva.",
+ "pair_label": "Abbina l'estensione",
+ "pair_hint": "Un clic qui e l'estensione installata si collega da sola — niente copia-incolla.",
+ "pair": "Abbina estensione",
+ "pair_waiting": "In attesa…",
+ "pair_active": "Finestra aperta — l'estensione si collegherà da sola ({{secs}}s rimanenti).",
+ "pair_unavailable": "Abilita prima il bridge del browser.",
"endpoint_label": "URL dell'endpoint",
"token_label": "Token di abbinamento",
"rotate_label": "Rigenera token",
@@ -425,6 +567,64 @@
"unavailable": "Bridge non disponibile. Riavvia l'app."
},
"cat_cookies": "Cookies",
+ "cat_channels": "Canali",
+ "cat_ai": "IA",
+ "ai": {
+ "title": "Provider IA",
+ "provider": "Provider",
+ "provider_desc": "Scegli dove inviare le richieste IA. La chiave è salvata localmente e mai registrata.",
+ "provider_none": "Disattivato",
+ "provider_local": "Locale (compatibile OpenAI)",
+ "model": "Modello",
+ "model_desc": "L'identificatore del modello per il provider scelto.",
+ "model_placeholder": "es. gpt-4o-mini, claude-3-5-sonnet-latest, llama3",
+ "openai_key": "Chiave API OpenAI",
+ "anthropic_key": "Chiave API Anthropic",
+ "key_set": "Una chiave è salvata. Lascia vuoto per mantenerla.",
+ "key_unset": "Nessuna chiave salvata.",
+ "local_url": "URL endpoint locale",
+ "local_url_desc": "URL base compatibile OpenAI (Ollama, LM Studio, …).",
+ "save": "Salva",
+ "test": "Prova connessione",
+ "test_ok": "La connessione IA funziona",
+ "test_fail": "Test IA fallito: {{error}}",
+ "saved": "Impostazioni IA salvate",
+ "summarize_title": "Riassumi un video",
+ "summarize": "Riassumi",
+ "summarizing": "Riassunto in corso…",
+ "summarize_placeholder": "URL del video",
+ "summarize_hint": "Recupera i sottotitoli del video e li riassume. Il risultato è salvato sotto.",
+ "style": "Stile del riassunto",
+ "style_short": "Breve",
+ "style_balanced": "Bilanciato",
+ "style_detailed": "Dettagliato",
+ "lang_placeholder": "Lingua di output (opzionale)",
+ "summary_ready": "Riassunto pronto",
+ "no_transcript": "Nessuna trascrizione disponibile per questo video",
+ "not_configured": "Configura prima un provider IA",
+ "history": "Cronologia IA",
+ "history_clear": "Cancella",
+ "history_clear_confirm": "Cancellare tutta la cronologia IA?",
+ "history_empty": "Ancora nessun risultato IA."
+ },
+ "channels": {
+ "title": "Canali seguiti",
+ "tray_header": "Canali",
+ "add": "Segui",
+ "add_placeholder": "URL del canale o della playlist",
+ "add_hint": "I nuovi video vengono controllati in background. Il download automatico è disattivato finché non lo attivi.",
+ "empty_title": "Nessun canale seguito",
+ "empty_hint": "Segui un canale o una playlist per ricevere automaticamente i nuovi video.",
+ "last_checked": "Ultimo controllo {{when}}",
+ "never": "mai",
+ "check_now": "Controlla ora",
+ "checked": "{{count}} nuovo/i video",
+ "remove": "Rimuovi",
+ "remove_confirm": "Smettere di seguire questo canale?",
+ "enabled": "Attivo",
+ "auto_download": "Download automatico",
+ "interval": "Ogni (min)"
+ },
"cookies": {
"title": "Cookies",
"intro": "Manage your account cookies. Everything stays on your computer — nothing is sent to our servers.",
@@ -454,6 +654,12 @@
"action_view": "View",
"action_export": "Export",
"action_rename": "Rename",
+ "action_test": "Prova",
+ "test_running": "Verifica…",
+ "test_ok": "I cookie funzionano.",
+ "test_fail": "Fallito: {{msg}}",
+ "expires_in": "scade tra ~{{days}}g",
+ "expired": "scaduto",
"action_clear": "Clear",
"import_trigger": "Import",
"import_file_title": "File",
@@ -540,6 +746,30 @@
"formats_playlist_note": "La selezione del formato per video non si applica alle playlist. L'opzione Qualità sopra vale per ogni video.",
"referer_label": "Referer (opzionale)",
"referer_placeholder": "https://example.com",
+ "timerange_label": "Scarica solo una parte (opzionale)",
+ "timerange_start": "Inizio",
+ "timerange_end": "Fine",
+ "timerange_hint": "Usa mm:ss o hh:mm:ss. Lascia vuoto per scaricare l'intero video.",
+ "schedule_label": "Pianifica",
+ "schedule_1h": "Tra 1 ora",
+ "schedule_tonight": "Stasera",
+ "schedule_1d": "Domani",
+ "schedule_clear": "Cancella",
+ "schedule_start": "Ora di inizio",
+ "schedule_stop": "Ora di stop",
+ "schedule_hint": "Lascia vuoto per iniziare ora. L'ora di stop opzionale annulla il download se è ancora in corso.",
+ "playlist_selected": "{{selected}} di {{total}} selezionati",
+ "playlist_all": "Seleziona tutto",
+ "playlist_none": "Nessuno",
+ "playlist_loading": "Caricamento playlist…",
+ "playlist_empty": "Impossibile caricare gli elementi della playlist",
+ "playlist_none_selected": "Seleziona almeno un elemento da scaricare",
+ "torrent_selected": "{{selected}} di {{total}} file selezionati",
+ "torrent_loading": "Lettura del contenuto del torrent…",
+ "torrent_none_selected": "Seleziona almeno un file da scaricare",
+ "cookie_hint_stale": "Il cookie salvato di questo sito sta invecchiando.",
+ "cookie_hint_expired": "Il cookie salvato di questo sito è scaduto — i download potrebbero fallire.",
+ "cookie_hint_action": "Aggiorna",
"external_url_ready": "URL ricevuto dall'estensione Chrome",
"content_type": {
"video": "Video",
@@ -1469,12 +1699,25 @@
"music_theme_reduce_motion_on": "Always reduce",
"music_theme_reduce_motion_hint": "Disables transitions and animations in the music section, independent of the global system setting.",
"now_playing_title": "Now playing",
+ "youtube_live": "IN DIRETTA",
+ "youtube_error_generic": "Qualcosa è andato storto con YouTube",
+ "youtube_error_retry": "Riprova",
+ "youtube_error_audio_only": "Solo audio",
+ "youtube_error_details": "Dettagli tecnici",
+ "youtube_error_hide_details": "Nascondi dettagli",
"now_playing_close": "Back",
"now_playing_tab_lyrics": "Lyrics",
"now_playing_tab_queue": "Up next",
"now_playing_tab_previous": "Previous",
"now_playing_lyrics_empty": "No lyrics available.",
- "now_playing_lyrics_error": "Couldn't load lyrics. Try again.",
+ "now_playing_lyrics_error": "Impossibile caricare il testo. Riprova.",
+ "now_playing_lyrics_retry": "Riprova",
+ "now_playing_lyrics_show_translation": "Mostra traduzione",
+ "now_playing_lyrics_hide_translation": "Nascondi traduzione",
+ "now_playing_lyrics_plain_note": "Testo non sincronizzato",
+ "now_playing_lyrics_sync_earlier": "Testo prima",
+ "now_playing_lyrics_sync_later": "Testo dopo",
+ "now_playing_lyrics_sync_reset": "Reimposta sincronizzazione",
"now_playing_queue_empty": "Queue is empty — click any track to start.",
"now_playing_previous_empty": "Nothing played in this session yet.",
"now_playing_no_track": "No track playing right now.",
diff --git a/src/lib/i18n/ja.json b/src/lib/i18n/ja.json
index a00973f4..b12b4308 100644
--- a/src/lib/i18n/ja.json
+++ b/src/lib/i18n/ja.json
@@ -43,6 +43,50 @@
"settings": "設定",
"about": "このアプリについて"
},
+ "tools": {
+ "tab": "ツール",
+ "working": "処理中…",
+ "url_placeholder": "動画のURLを貼り付け",
+ "metadata_title": "メタデータを取得",
+ "metadata_desc": "動画本体をダウンロードせずに、情報・説明・サムネイルを保存します。",
+ "metadata_action": "メタデータを取得",
+ "metadata_done": "「{{title}}」のファイルを{{count}}件保存しました",
+ "thumbnails_title": "サムネイルをダウンロード",
+ "thumbnails_desc": "利用可能なすべてのカバー画像を確認し、任意の解像度で保存します。",
+ "thumbnails_action": "サイズ一覧",
+ "thumbnails_none": "このURLのサムネイルが見つかりません。",
+ "thumbnails_saved": "{{name}} を保存しました",
+ "thumbnails_save": "このサイズを保存",
+ "thumbnails_default": "既定",
+ "subs_title": "字幕を抽出",
+ "subs_desc": "字幕をダウンロード、または2言語を1つの二か国語ファイルに結合します。",
+ "subs_action": "字幕一覧",
+ "subs_none": "— なし —",
+ "subs_primary": "メイン",
+ "subs_format": "形式",
+ "subs_secondary": "2つ目の言語",
+ "subs_save": "字幕を保存",
+ "subs_merge": "二か国語を結合",
+ "subs_merge_hint": "2つ目の言語を選択してください。結合にはSRTまたはVTTが必要です。",
+ "subs_saved": "{{name}} を保存しました",
+ "cc_title": "コメントとチャプター",
+ "cc_desc": "動画のコメントやチャプターマーカーを取得し、絞り込んでJSONまたはCSVでエクスポートします。",
+ "cc_comments": "コメントを取得",
+ "cc_chapters": "チャプターを取得",
+ "cc_max": "最大コメント数",
+ "cc_sort": "並び替え",
+ "cc_sort_top": "人気順",
+ "cc_sort_new": "新着順",
+ "cc_filter": "絞り込み…",
+ "cc_none": "このURLでは何も見つかりませんでした。",
+ "cc_exported": "{{name}} をエクスポートしました",
+ "cc_showing": "{{total}} 件中 {{shown}} 件表示",
+ "lc_title": "ライブチャット保存",
+ "lc_desc": "終了した配信のチャットリプレイを取得し、絞り込んでJSONまたはCSVでエクスポートします。",
+ "lc_action": "ライブチャットを取得",
+ "lc_none": "この動画にはチャットリプレイがありません。",
+ "lc_exported": "{{name}} をエクスポートしました"
+ },
"downloads": {
"title": "ダウンロード",
"empty": "ダウンロード中のファイルはありません",
@@ -85,6 +129,54 @@
"open_in_study": "Watch in Study",
"stop": "停止",
"confirm_remove": "このダウンロードを削除しますか?",
+ "delete_file": "ディスクからファイルを削除",
+ "delete_file_confirm": "ダウンロードしたファイルをディスクから完全に削除しますか?元に戻せません。",
+ "sw": {
+ "title": "字幕ワークショップ",
+ "tool_desc": "SRT/VTT 字幕を開いて時間/テキストを編集、翻訳、保存します。",
+ "open": "字幕ファイルを開く",
+ "load_media": "メディアを読み込む(波形)",
+ "save_srt": ".srt を保存",
+ "save_vtt": ".vtt を保存",
+ "shift": "全体をシフト(ms)",
+ "find": "検索",
+ "replace": "置換後",
+ "replace_btn": "すべて置換",
+ "replaced": "{{count}} 件の字幕を変更",
+ "target_lang": "対象言語",
+ "translate": "AI 翻訳",
+ "translated": "字幕を翻訳しました",
+ "translate_mismatch": "翻訳が一致しませんでした — もう一度お試しください",
+ "not_configured": "先に設定で AI プロバイダーを設定してください",
+ "saved": "字幕を保存しました",
+ "split": "分割",
+ "merge": "結合 ↓",
+ "empty": "SRT または VTT ファイルを開いて開始します。",
+ "qc_negative": "終了が開始より前です",
+ "qc_overlap": "次の字幕と重なっています",
+ "qc_fast": "読み速度が速すぎます"
+ },
+ "vop": {
+ "action_label": "AI 動画ツール",
+ "title": "AI 動画ツール",
+ "not_configured": "先に設定で AI プロバイダーを設定してください",
+ "done": "完了 — 保存先:",
+ "quick_actions": "クイック操作",
+ "extract_audio": "音声を抽出",
+ "mute": "音声を削除",
+ "to_mp4": "MP4 に変換",
+ "to_gif": "GIF に変換",
+ "trim_start": "開始 (hh:mm:ss)",
+ "trim_end": "終了 (hh:mm:ss)",
+ "trim": "トリム",
+ "nl_label": "やりたいことを記述",
+ "nl_placeholder": "例: 720p にして音声を消す",
+ "propose": "生成",
+ "review_title": "実行前にコマンドを確認",
+ "review_hint": "入力/出力はアプリが補います。確認後にのみ実行されます。",
+ "run": "実行",
+ "processing": "処理中…"
+ },
"quality_hint": "この項目でダウンロード中の画質",
"stats_line": "{{count}} 件のダウンロード · {{size}} 保存済み",
"filter_label": "ステータスでダウンロードを絞り込む",
@@ -113,6 +205,8 @@
"auto_download_started": "自動ダウンロードを開始しました",
"external_url_ready": "URLを受信し、ダウンロードの準備ができました",
"external_url_queued": "Chrome拡張機能からダウンロードを追加しました",
+ "channel_new": "{{channel}}:新着動画 {{count}} 件",
+ "channel_new_auto": "{{channel}}:新着動画 {{count}} 件をダウンロード中",
"file_copied_to_clipboard": "ファイルをクリップボードにコピーしました",
"drm_skipped": "{{count}} 本の動画をスキップしました — DRM保護(FairPlay/SAMPLE-AES)",
"generic_download_complete": "{{name}} — ダウンロード完了!"
@@ -232,9 +326,13 @@
},
"download": {
"default_output_dir": "既定のフォルダ",
+ "path_too_long": "このフォルダのパスが長すぎます({{current}}/{{limit}} 文字)。ファイル名が長いとダウンロードが失敗することがあります — もっと短いフォルダを選んでください。",
"choose_folder": "選択",
"always_ask_path": "保存先を毎回確認する",
"video_quality": "動画の画質",
+ "speed_limit": "ダウンロード速度制限",
+ "speed_limit_desc": "ダウンロード速度の上限。空欄で無制限。",
+ "speed_limit_unlimited": "無制限",
"skip_existing": "既存のファイルをスキップ",
"download_attachments": "添付ファイルをダウンロード",
"download_descriptions": "説明を保存",
@@ -267,8 +365,24 @@
"translate_metadata_desc": "YouTubeにタイトルとチャプター名をアプリ言語にローカライズするよう依頼(YouTubeのみ)",
"youtube_sponsorblock": "SponsorBlockセグメントを削除",
"youtube_sponsorblock_desc": "YouTube動画からスポンサー、イントロ、アウトロのセグメントをカット(コミュニティデータ。漏れや過剰カットの可能性あり)",
+ "sb_mode": "SponsorBlock の動作",
+ "sb_mode_desc": "削除はセグメントをファイルから切り取ります。マークのみはチャプターマーカーを追加し、プレーヤーでスキップできます。",
+ "sb_mode_remove": "セグメントを削除",
+ "sb_mode_mark": "マークのみ",
+ "sb_categories": "セグメントの種類",
+ "sb_categories_desc": "対象とするセグメントの種類。",
+ "sb_cat_sponsor": "スポンサー",
+ "sb_cat_selfpromo": "自己宣伝",
+ "sb_cat_interaction": "操作のお願い",
+ "sb_cat_intro": "イントロ",
+ "sb_cat_outro": "アウトロ / エンドカード",
+ "sb_cat_preview": "プレビュー / 要約",
+ "sb_cat_filler": "間延び / 脱線",
+ "sb_cat_music_offtopic": "音楽以外の区間",
"split_by_chapters": "チャプターごとに動画を分割",
"split_by_chapters_desc": "動画にチャプターマーカーがある場合、各チャプターを別ファイルとして保存します",
+ "live_from_start": "ライブを最初から録画",
+ "live_from_start_desc": "進行中のライブ配信をダウンロードする際、現在の時点ではなく最初から取得します",
"presets": "クイックプリセット",
"presets_desc": "よく使う設定をワンクリックで適用。カードをタップしてください。",
"preset_fast": "高速",
@@ -360,7 +474,20 @@
"password": "パスワード"
},
"ytdlp_flags": {
- "title": "yt-dlp フラグ"
+ "title": "yt-dlp フラグ",
+ "embed_subs": "字幕を埋め込む",
+ "write_thumbnail": "サムネイルを保存",
+ "write_description": "説明を保存",
+ "write_comments": "コメントを保存",
+ "restrict_filenames": "ASCII ファイル名",
+ "no_overwrites": "上書きしない",
+ "prefer_free_formats": "フリー形式を優先",
+ "force_ipv4": "IPv4 を強制",
+ "geo_bypass": "地域制限を回避",
+ "limit_rate": "レート制限",
+ "sleep_interval": "待機間隔",
+ "limit_rate_ph": "例: 1M",
+ "sleep_interval_ph": "例: 5"
},
"advanced": {
"title": "詳細設定",
@@ -376,9 +503,18 @@
"reset_confirm": "本当によろしいですか?すべての設定がリセットされます。",
"torrent_listen_port": "Torrent待ち受けポート",
"torrent_listen_port_desc": "BitTorrent接続を受け付けるTCPポート",
+ "torrent_auto_trackers": "公開トラッカーを追加",
+ "torrent_auto_trackers_desc": "トラッカーが少ない・無効なマグネットのピア探索を改善します",
+ "torrent_upnp": "ルーターのポートを開放 (UPnP)",
+ "torrent_upnp_desc": "ルーターが受信ピア接続を許可し、トレントを高速化します",
+ "prevent_sleep": "ダウンロード中はスリープを防ぐ",
+ "prevent_sleep_desc": "アクティブなダウンロード中はコンピューターをスリープさせません",
"cookies_from_browser": "ブラウザのCookie(詳細)",
"cookies_from_browser_desc": "ブラウザ拡張機能が動作しない場合のみ設定してください。通常は空のままにしてください。",
"cookies_from_browser_placeholder": "ex.: firefox, chrome, edge",
+ "user_agent": "カスタム User-Agent(上級者向け)",
+ "user_agent_desc": "ダウンロードにカスタム User-Agent を送信します。空欄で既定値を使用。",
+ "user_agent_placeholder": "ブラウザの既定 User-Agent",
"twitter_manual_cookie": "手動Cookie",
"twitter_manual_cookie_desc": "ダウンロードに失敗した場合、ここに手動のCookieヘッダーを貼り付けて再試行できます。Twitter/Xに限定されません。例: sessionid=...; csrftoken=...; auth_token=..."
},
@@ -410,6 +546,12 @@
"bridge": {
"title": "ブラウザー拡張機能",
"intro": "プライベートなローカル接続でOmniGetブラウザー拡張機能をこのアプリと連携します。拡張機能のオプションページを開き、下のエンドポイントURLとトークンを貼り付けて保存をクリックしてください。",
+ "pair_label": "拡張機能をペアリング",
+ "pair_hint": "ここを1回クリックするだけで、インストール済みの拡張機能が自動接続します(コピペ不要)。",
+ "pair": "拡張機能をペアリング",
+ "pair_waiting": "待機中…",
+ "pair_active": "ウィンドウ開放中 — 拡張機能が自動接続します(残り {{secs}}秒)。",
+ "pair_unavailable": "先にブラウザブリッジを有効にしてください。",
"endpoint_label": "エンドポイントURL",
"token_label": "ペアリングトークン",
"rotate_label": "トークンを再発行",
@@ -425,6 +567,64 @@
"unavailable": "ブリッジが利用できません。アプリを再起動してください。"
},
"cat_cookies": "クッキー",
+ "cat_channels": "チャンネル",
+ "cat_ai": "AI",
+ "ai": {
+ "title": "AI プロバイダー",
+ "provider": "プロバイダー",
+ "provider_desc": "AI リクエストの送信先を選びます。キーはローカルに保存され、ログには記録されません。",
+ "provider_none": "オフ",
+ "provider_local": "ローカル(OpenAI 互換)",
+ "model": "モデル",
+ "model_desc": "選択したプロバイダーのモデル識別子。",
+ "model_placeholder": "例: gpt-4o-mini, claude-3-5-sonnet-latest, llama3",
+ "openai_key": "OpenAI API キー",
+ "anthropic_key": "Anthropic API キー",
+ "key_set": "キーは保存済みです。空欄のままにすると保持されます。",
+ "key_unset": "キーは未保存です。",
+ "local_url": "ローカルエンドポイント URL",
+ "local_url_desc": "OpenAI 互換のベース URL(Ollama、LM Studio など)。",
+ "save": "保存",
+ "test": "接続テスト",
+ "test_ok": "AI 接続は正常です",
+ "test_fail": "AI テスト失敗: {{error}}",
+ "saved": "AI 設定を保存しました",
+ "summarize_title": "動画を要約",
+ "summarize": "要約",
+ "summarizing": "要約中…",
+ "summarize_placeholder": "動画 URL",
+ "summarize_hint": "動画の字幕を取得して要約します。結果は下に保存されます。",
+ "style": "要約スタイル",
+ "style_short": "短め",
+ "style_balanced": "バランス",
+ "style_detailed": "詳細",
+ "lang_placeholder": "出力言語(任意)",
+ "summary_ready": "要約が完了しました",
+ "no_transcript": "この動画には字幕がありません",
+ "not_configured": "先に AI プロバイダーを設定してください",
+ "history": "AI 履歴",
+ "history_clear": "クリア",
+ "history_clear_confirm": "すべての AI 履歴を消去しますか?",
+ "history_empty": "AI の結果はまだありません。"
+ },
+ "channels": {
+ "title": "フォロー中のチャンネル",
+ "tray_header": "チャンネル",
+ "add": "フォロー",
+ "add_placeholder": "チャンネルまたはプレイリストのURL",
+ "add_hint": "新着はバックグラウンドで確認します。自動ダウンロードはオンにするまで無効です。",
+ "empty_title": "まだチャンネルをフォローしていません",
+ "empty_hint": "チャンネルやプレイリストをフォローすると新着動画を自動取得します。",
+ "last_checked": "最終確認 {{when}}",
+ "never": "未確認",
+ "check_now": "今すぐ確認",
+ "checked": "新着動画 {{count}} 件",
+ "remove": "削除",
+ "remove_confirm": "このチャンネルのフォローを解除しますか?",
+ "enabled": "有効",
+ "auto_download": "自動ダウンロード",
+ "interval": "間隔(分)"
+ },
"cookies": {
"title": "Cookies",
"intro": "Manage your account cookies. Everything stays on your computer — nothing is sent to our servers.",
@@ -454,6 +654,12 @@
"action_view": "View",
"action_export": "Export",
"action_rename": "Rename",
+ "action_test": "テスト",
+ "test_running": "テスト中…",
+ "test_ok": "クッキーは有効です。",
+ "test_fail": "失敗: {{msg}}",
+ "expires_in": "あと約{{days}}日で期限切れ",
+ "expired": "期限切れ",
"action_clear": "Clear",
"import_trigger": "Import",
"import_file_title": "File",
@@ -540,6 +746,30 @@
"formats_playlist_note": "動画ごとのフォーマット選択はプレイリストには適用されません。上の「品質」設定がすべての動画に適用されます。",
"referer_label": "リファラー(任意)",
"referer_placeholder": "https://example.com",
+ "timerange_label": "一部だけダウンロード(任意)",
+ "timerange_start": "開始",
+ "timerange_end": "終了",
+ "timerange_hint": "mm:ss または hh:mm:ss 形式。空欄で動画全体をダウンロード。",
+ "schedule_label": "スケジュール",
+ "schedule_1h": "1 時間後",
+ "schedule_tonight": "今夜",
+ "schedule_1d": "明日",
+ "schedule_clear": "クリア",
+ "schedule_start": "開始時刻",
+ "schedule_stop": "停止時刻",
+ "schedule_hint": "空欄で今すぐ開始。任意の停止時刻は、ダウンロードがまだ実行中なら中止します。",
+ "playlist_selected": "{{total}} 件中 {{selected}} 件選択",
+ "playlist_all": "すべて選択",
+ "playlist_none": "なし",
+ "playlist_loading": "プレイリストを読み込み中…",
+ "playlist_empty": "プレイリストの項目を読み込めませんでした",
+ "playlist_none_selected": "ダウンロードする項目を1つ以上選択してください",
+ "torrent_selected": "{{total}} 件中 {{selected}} 件のファイルを選択",
+ "torrent_loading": "トレントの内容を読み込み中…",
+ "torrent_none_selected": "ダウンロードするファイルを1つ以上選択してください",
+ "cookie_hint_stale": "このサイトの保存済みクッキーが古くなっています。",
+ "cookie_hint_expired": "このサイトの保存済みクッキーは期限切れです — ダウンロードが失敗する可能性があります。",
+ "cookie_hint_action": "更新する",
"external_url_ready": "Chrome拡張機能からURLを受信しました",
"content_type": {
"video": "動画",
@@ -1469,12 +1699,25 @@
"music_theme_reduce_motion_on": "Always reduce",
"music_theme_reduce_motion_hint": "Disables transitions and animations in the music section, independent of the global system setting.",
"now_playing_title": "Now playing",
+ "youtube_live": "ライブ",
+ "youtube_error_generic": "YouTube との通信でエラーが発生しました",
+ "youtube_error_retry": "再試行",
+ "youtube_error_audio_only": "音声のみ",
+ "youtube_error_details": "技術的な詳細",
+ "youtube_error_hide_details": "詳細を隠す",
"now_playing_close": "Back",
"now_playing_tab_lyrics": "Lyrics",
"now_playing_tab_queue": "Up next",
"now_playing_tab_previous": "Previous",
"now_playing_lyrics_empty": "No lyrics available.",
- "now_playing_lyrics_error": "Couldn't load lyrics. Try again.",
+ "now_playing_lyrics_error": "歌詞を読み込めませんでした。もう一度お試しください。",
+ "now_playing_lyrics_retry": "再試行",
+ "now_playing_lyrics_show_translation": "翻訳を表示",
+ "now_playing_lyrics_hide_translation": "翻訳を非表示",
+ "now_playing_lyrics_plain_note": "未同期の歌詞",
+ "now_playing_lyrics_sync_earlier": "歌詞を早める",
+ "now_playing_lyrics_sync_later": "歌詞を遅らせる",
+ "now_playing_lyrics_sync_reset": "同期をリセット",
"now_playing_queue_empty": "Queue is empty — click any track to start.",
"now_playing_previous_empty": "Nothing played in this session yet.",
"now_playing_no_track": "No track playing right now.",
diff --git a/src/lib/i18n/keys.ts b/src/lib/i18n/keys.ts
index 7f203834..f498812d 100644
--- a/src/lib/i18n/keys.ts
+++ b/src/lib/i18n/keys.ts
@@ -161,6 +161,8 @@ export type TranslationKeys =
| 'downloads.clear_confirm'
| 'downloads.clear_finished'
| 'downloads.confirm_remove'
+ | 'downloads.delete_file'
+ | 'downloads.delete_file_confirm'
| 'downloads.empty'
| 'downloads.filter.active'
| 'downloads.filter.all'
@@ -209,7 +211,49 @@ export type TranslationKeys =
| 'downloads.status.queued'
| 'downloads.status.seeding'
| 'downloads.stop'
+ | 'downloads.sw.empty'
+ | 'downloads.sw.find'
+ | 'downloads.sw.load_media'
+ | 'downloads.sw.merge'
+ | 'downloads.sw.not_configured'
+ | 'downloads.sw.open'
+ | 'downloads.sw.qc_fast'
+ | 'downloads.sw.qc_negative'
+ | 'downloads.sw.qc_overlap'
+ | 'downloads.sw.replace'
+ | 'downloads.sw.replace_btn'
+ | 'downloads.sw.replaced'
+ | 'downloads.sw.save_srt'
+ | 'downloads.sw.save_vtt'
+ | 'downloads.sw.saved'
+ | 'downloads.sw.shift'
+ | 'downloads.sw.split'
+ | 'downloads.sw.target_lang'
+ | 'downloads.sw.title'
+ | 'downloads.sw.tool_desc'
+ | 'downloads.sw.translate'
+ | 'downloads.sw.translate_mismatch'
+ | 'downloads.sw.translated'
| 'downloads.title'
+ | 'downloads.vop.action_label'
+ | 'downloads.vop.done'
+ | 'downloads.vop.extract_audio'
+ | 'downloads.vop.mute'
+ | 'downloads.vop.nl_label'
+ | 'downloads.vop.nl_placeholder'
+ | 'downloads.vop.not_configured'
+ | 'downloads.vop.processing'
+ | 'downloads.vop.propose'
+ | 'downloads.vop.quick_actions'
+ | 'downloads.vop.review_hint'
+ | 'downloads.vop.review_title'
+ | 'downloads.vop.run'
+ | 'downloads.vop.title'
+ | 'downloads.vop.to_gif'
+ | 'downloads.vop.to_mp4'
+ | 'downloads.vop.trim'
+ | 'downloads.vop.trim_end'
+ | 'downloads.vop.trim_start'
| 'errors.access_denied'
| 'errors.connection_timeout'
@@ -401,6 +445,9 @@ export type TranslationKeys =
| 'omnibox.content_type.video'
| 'omnibox.cookie_account'
| 'omnibox.cookie_account_cookies'
+ | 'omnibox.cookie_hint_action'
+ | 'omnibox.cookie_hint_expired'
+ | 'omnibox.cookie_hint_stale'
| 'omnibox.download'
| 'omnibox.error'
| 'omnibox.external_url_ready'
@@ -425,6 +472,12 @@ export type TranslationKeys =
| 'omnibox.no_formats'
| 'omnibox.options'
| 'omnibox.placeholder'
+ | 'omnibox.playlist_all'
+ | 'omnibox.playlist_empty'
+ | 'omnibox.playlist_loading'
+ | 'omnibox.playlist_none'
+ | 'omnibox.playlist_none_selected'
+ | 'omnibox.playlist_selected'
| 'omnibox.preparing'
| 'omnibox.preset_best'
| 'omnibox.preset_custom'
@@ -440,8 +493,23 @@ export type TranslationKeys =
| 'omnibox.referer_label'
| 'omnibox.referer_placeholder'
| 'omnibox.retry'
+ | 'omnibox.schedule_1d'
+ | 'omnibox.schedule_1h'
+ | 'omnibox.schedule_clear'
+ | 'omnibox.schedule_hint'
+ | 'omnibox.schedule_label'
+ | 'omnibox.schedule_start'
+ | 'omnibox.schedule_stop'
+ | 'omnibox.schedule_tonight'
| 'omnibox.search_empty'
| 'omnibox.searching'
+ | 'omnibox.timerange_end'
+ | 'omnibox.timerange_hint'
+ | 'omnibox.timerange_label'
+ | 'omnibox.timerange_start'
+ | 'omnibox.torrent_loading'
+ | 'omnibox.torrent_none_selected'
+ | 'omnibox.torrent_selected'
| 'omnibox.unsupported'
| 'omnibox.view_formats'
@@ -539,15 +607,60 @@ export type TranslationKeys =
| 'settings.advanced.max_concurrent_downloads_desc'
| 'settings.advanced.max_concurrent_segments'
| 'settings.advanced.max_retries'
+ | 'settings.advanced.prevent_sleep'
+ | 'settings.advanced.prevent_sleep_desc'
| 'settings.advanced.reset'
| 'settings.advanced.reset_confirm'
| 'settings.advanced.stagger_delay'
| 'settings.advanced.stagger_delay_desc'
| 'settings.advanced.title'
+ | 'settings.advanced.torrent_auto_trackers'
+ | 'settings.advanced.torrent_auto_trackers_desc'
| 'settings.advanced.torrent_listen_port'
| 'settings.advanced.torrent_listen_port_desc'
+ | 'settings.advanced.torrent_upnp'
+ | 'settings.advanced.torrent_upnp_desc'
| 'settings.advanced.twitter_manual_cookie'
| 'settings.advanced.twitter_manual_cookie_desc'
+ | 'settings.advanced.user_agent'
+ | 'settings.advanced.user_agent_desc'
+ | 'settings.advanced.user_agent_placeholder'
+ | 'settings.ai.anthropic_key'
+ | 'settings.ai.history'
+ | 'settings.ai.history_clear'
+ | 'settings.ai.history_clear_confirm'
+ | 'settings.ai.history_empty'
+ | 'settings.ai.key_set'
+ | 'settings.ai.key_unset'
+ | 'settings.ai.lang_placeholder'
+ | 'settings.ai.local_url'
+ | 'settings.ai.local_url_desc'
+ | 'settings.ai.model'
+ | 'settings.ai.model_desc'
+ | 'settings.ai.model_placeholder'
+ | 'settings.ai.no_transcript'
+ | 'settings.ai.not_configured'
+ | 'settings.ai.openai_key'
+ | 'settings.ai.provider'
+ | 'settings.ai.provider_desc'
+ | 'settings.ai.provider_local'
+ | 'settings.ai.provider_none'
+ | 'settings.ai.save'
+ | 'settings.ai.saved'
+ | 'settings.ai.style'
+ | 'settings.ai.style_balanced'
+ | 'settings.ai.style_detailed'
+ | 'settings.ai.style_short'
+ | 'settings.ai.summarize'
+ | 'settings.ai.summarize_hint'
+ | 'settings.ai.summarize_placeholder'
+ | 'settings.ai.summarize_title'
+ | 'settings.ai.summarizing'
+ | 'settings.ai.summary_ready'
+ | 'settings.ai.test'
+ | 'settings.ai.test_fail'
+ | 'settings.ai.test_ok'
+ | 'settings.ai.title'
| 'settings.appearance.lang_el'
| 'settings.appearance.lang_en'
| 'settings.appearance.lang_es'
@@ -567,6 +680,12 @@ export type TranslationKeys =
| 'settings.bridge.endpoint_label'
| 'settings.bridge.hide'
| 'settings.bridge.intro'
+ | 'settings.bridge.pair'
+ | 'settings.bridge.pair_active'
+ | 'settings.bridge.pair_hint'
+ | 'settings.bridge.pair_label'
+ | 'settings.bridge.pair_unavailable'
+ | 'settings.bridge.pair_waiting'
| 'settings.bridge.reveal'
| 'settings.bridge.rotate'
| 'settings.bridge.rotate_hint'
@@ -577,16 +696,35 @@ export type TranslationKeys =
| 'settings.bridge.token_label'
| 'settings.bridge.unavailable'
| 'settings.cat_advanced'
+ | 'settings.cat_ai'
| 'settings.cat_appearance'
+ | 'settings.cat_channels'
| 'settings.cat_cookies'
| 'settings.cat_downloads'
| 'settings.cat_network'
| 'settings.cat_plugins'
| 'settings.cat_typography'
+ | 'settings.channels.add'
+ | 'settings.channels.add_hint'
+ | 'settings.channels.add_placeholder'
+ | 'settings.channels.auto_download'
+ | 'settings.channels.check_now'
+ | 'settings.channels.checked'
+ | 'settings.channels.empty_hint'
+ | 'settings.channels.empty_title'
+ | 'settings.channels.enabled'
+ | 'settings.channels.interval'
+ | 'settings.channels.last_checked'
+ | 'settings.channels.never'
+ | 'settings.channels.remove'
+ | 'settings.channels.remove_confirm'
+ | 'settings.channels.title'
+ | 'settings.channels.tray_header'
| 'settings.cookies.account_primary_tag'
| 'settings.cookies.action_clear'
| 'settings.cookies.action_export'
| 'settings.cookies.action_rename'
+ | 'settings.cookies.action_test'
| 'settings.cookies.action_view'
| 'settings.cookies.add_account_label'
| 'settings.cookies.add_account_success'
@@ -608,6 +746,8 @@ export type TranslationKeys =
| 'settings.cookies.dir_label'
| 'settings.cookies.empty_body'
| 'settings.cookies.empty_title'
+ | 'settings.cookies.expired'
+ | 'settings.cookies.expires_in'
| 'settings.cookies.export_dialog_title'
| 'settings.cookies.export_done'
| 'settings.cookies.hint_use_extension'
@@ -646,6 +786,9 @@ export type TranslationKeys =
| 'settings.cookies.status_empty'
| 'settings.cookies.status_fresh'
| 'settings.cookies.status_stale'
+ | 'settings.cookies.test_fail'
+ | 'settings.cookies.test_ok'
+ | 'settings.cookies.test_running'
| 'settings.cookies.time_days'
| 'settings.cookies.time_hours'
| 'settings.cookies.time_just_now'
@@ -704,6 +847,8 @@ export type TranslationKeys =
| 'settings.download.include_auto_subtitles_desc'
| 'settings.download.keep_vtt'
| 'settings.download.keep_vtt_desc'
+ | 'settings.download.live_from_start'
+ | 'settings.download.live_from_start_desc'
| 'settings.download.music_audio_format'
| 'settings.download.music_audio_format_desc'
| 'settings.download.music_hotkey_binding'
@@ -711,6 +856,7 @@ export type TranslationKeys =
| 'settings.download.music_hotkey_enabled_desc'
| 'settings.download.organize_by_platform'
| 'settings.download.organize_by_platform_desc'
+ | 'settings.download.path_too_long'
| 'settings.download.preset_compact'
| 'settings.download.preset_compact_desc'
| 'settings.download.preset_fast'
@@ -721,7 +867,24 @@ export type TranslationKeys =
| 'settings.download.preset_quality_desc'
| 'settings.download.presets'
| 'settings.download.presets_desc'
+ | 'settings.download.sb_cat_filler'
+ | 'settings.download.sb_cat_interaction'
+ | 'settings.download.sb_cat_intro'
+ | 'settings.download.sb_cat_music_offtopic'
+ | 'settings.download.sb_cat_outro'
+ | 'settings.download.sb_cat_preview'
+ | 'settings.download.sb_cat_selfpromo'
+ | 'settings.download.sb_cat_sponsor'
+ | 'settings.download.sb_categories'
+ | 'settings.download.sb_categories_desc'
+ | 'settings.download.sb_mode'
+ | 'settings.download.sb_mode_desc'
+ | 'settings.download.sb_mode_mark'
+ | 'settings.download.sb_mode_remove'
| 'settings.download.skip_existing'
+ | 'settings.download.speed_limit'
+ | 'settings.download.speed_limit_desc'
+ | 'settings.download.speed_limit_unlimited'
| 'settings.download.split_by_chapters'
| 'settings.download.split_by_chapters_desc'
| 'settings.download.telegram_plugin_section'
@@ -800,7 +963,20 @@ export type TranslationKeys =
| 'settings.update_available'
| 'settings.update_button'
| 'settings.update_downloading'
+ | 'settings.ytdlp_flags.embed_subs'
+ | 'settings.ytdlp_flags.force_ipv4'
+ | 'settings.ytdlp_flags.geo_bypass'
+ | 'settings.ytdlp_flags.limit_rate'
+ | 'settings.ytdlp_flags.limit_rate_ph'
+ | 'settings.ytdlp_flags.no_overwrites'
+ | 'settings.ytdlp_flags.prefer_free_formats'
+ | 'settings.ytdlp_flags.restrict_filenames'
+ | 'settings.ytdlp_flags.sleep_interval'
+ | 'settings.ytdlp_flags.sleep_interval_ph'
| 'settings.ytdlp_flags.title'
+ | 'settings.ytdlp_flags.write_comments'
+ | 'settings.ytdlp_flags.write_description'
+ | 'settings.ytdlp_flags.write_thumbnail'
| 'shortcuts.cancel_dialog'
| 'shortcuts.nav_downloads'
@@ -1803,6 +1979,13 @@ export type TranslationKeys =
| 'study.music.now_playing_close'
| 'study.music.now_playing_lyrics_empty'
| 'study.music.now_playing_lyrics_error'
+ | 'study.music.now_playing_lyrics_hide_translation'
+ | 'study.music.now_playing_lyrics_plain_note'
+ | 'study.music.now_playing_lyrics_retry'
+ | 'study.music.now_playing_lyrics_show_translation'
+ | 'study.music.now_playing_lyrics_sync_earlier'
+ | 'study.music.now_playing_lyrics_sync_later'
+ | 'study.music.now_playing_lyrics_sync_reset'
| 'study.music.now_playing_no_track'
| 'study.music.now_playing_open'
| 'study.music.now_playing_previous_empty'
@@ -2182,6 +2365,12 @@ export type TranslationKeys =
| 'study.music.youtube.shelf_trending'
| 'study.music.youtube.shelf_trending_error'
| 'study.music.youtube.subscribers_count_label'
+ | 'study.music.youtube_error_audio_only'
+ | 'study.music.youtube_error_details'
+ | 'study.music.youtube_error_generic'
+ | 'study.music.youtube_error_hide_details'
+ | 'study.music.youtube_error_retry'
+ | 'study.music.youtube_live'
| 'study.music.yt_add_playlist'
| 'study.music.yt_auth_desc'
| 'study.music.yt_auth_how'
@@ -2824,6 +3013,8 @@ export type TranslationKeys =
| 'terms_note.link'
| 'toast.auto_download_started'
+ | 'toast.channel_new'
+ | 'toast.channel_new_auto'
| 'toast.clipboard_url_detected'
| 'toast.download_complete'
| 'toast.download_error'
@@ -2835,6 +3026,49 @@ export type TranslationKeys =
| 'toast.file_copied_to_clipboard'
| 'toast.generic_download_complete'
+ | 'tools.cc_chapters'
+ | 'tools.cc_comments'
+ | 'tools.cc_desc'
+ | 'tools.cc_exported'
+ | 'tools.cc_filter'
+ | 'tools.cc_max'
+ | 'tools.cc_none'
+ | 'tools.cc_showing'
+ | 'tools.cc_sort'
+ | 'tools.cc_sort_new'
+ | 'tools.cc_sort_top'
+ | 'tools.cc_title'
+ | 'tools.lc_action'
+ | 'tools.lc_desc'
+ | 'tools.lc_exported'
+ | 'tools.lc_none'
+ | 'tools.lc_title'
+ | 'tools.metadata_action'
+ | 'tools.metadata_desc'
+ | 'tools.metadata_done'
+ | 'tools.metadata_title'
+ | 'tools.subs_action'
+ | 'tools.subs_desc'
+ | 'tools.subs_format'
+ | 'tools.subs_merge'
+ | 'tools.subs_merge_hint'
+ | 'tools.subs_none'
+ | 'tools.subs_primary'
+ | 'tools.subs_save'
+ | 'tools.subs_saved'
+ | 'tools.subs_secondary'
+ | 'tools.subs_title'
+ | 'tools.tab'
+ | 'tools.thumbnails_action'
+ | 'tools.thumbnails_default'
+ | 'tools.thumbnails_desc'
+ | 'tools.thumbnails_none'
+ | 'tools.thumbnails_save'
+ | 'tools.thumbnails_saved'
+ | 'tools.thumbnails_title'
+ | 'tools.url_placeholder'
+ | 'tools.working'
+
| 'torrent.open_file'
| 'tracking.add_button'
diff --git a/src/lib/i18n/pt.json b/src/lib/i18n/pt.json
index c2e1c3c5..221fd524 100644
--- a/src/lib/i18n/pt.json
+++ b/src/lib/i18n/pt.json
@@ -43,6 +43,50 @@
"settings": "Configurações",
"about": "Sobre"
},
+ "tools": {
+ "tab": "Ferramentas",
+ "working": "Processando…",
+ "url_placeholder": "Cole a URL de um vídeo",
+ "metadata_title": "Buscar metadados",
+ "metadata_desc": "Salva info, descrição e capa do vídeo sem baixar o vídeo.",
+ "metadata_action": "Buscar metadados",
+ "metadata_done": "Salvos {{count}} arquivo(s) de \"{{title}}\"",
+ "thumbnails_title": "Baixar capa",
+ "thumbnails_desc": "Veja todas as imagens de capa e salve em qualquer resolução.",
+ "thumbnails_action": "Listar tamanhos",
+ "thumbnails_none": "Nenhuma capa encontrada para esta URL.",
+ "thumbnails_saved": "Salvo {{name}}",
+ "thumbnails_save": "Salvar este tamanho",
+ "thumbnails_default": "Padrão",
+ "subs_title": "Extrair legendas",
+ "subs_desc": "Baixe legendas, ou junte dois idiomas num arquivo bilíngue.",
+ "subs_action": "Listar legendas",
+ "subs_none": "— nenhum —",
+ "subs_primary": "Principal",
+ "subs_format": "Formato",
+ "subs_secondary": "Segundo idioma",
+ "subs_save": "Salvar legenda",
+ "subs_merge": "Juntar bilíngue",
+ "subs_merge_hint": "Escolha um segundo idioma; o merge precisa de SRT ou VTT.",
+ "subs_saved": "Salvo {{name}}",
+ "cc_title": "Comentários e capítulos",
+ "cc_desc": "Busque comentários ou marcadores de capítulo de um vídeo, filtre e exporte em JSON ou CSV.",
+ "cc_comments": "Buscar comentários",
+ "cc_chapters": "Buscar capítulos",
+ "cc_max": "Máx. comentários",
+ "cc_sort": "Ordenar",
+ "cc_sort_top": "Mais relevantes",
+ "cc_sort_new": "Mais recentes",
+ "cc_filter": "Filtrar…",
+ "cc_none": "Nada encontrado para esta URL.",
+ "cc_exported": "Exportado {{name}}",
+ "cc_showing": "Mostrando {{shown}} de {{total}}",
+ "lc_title": "Arquivar chat ao vivo",
+ "lc_desc": "Baixe o replay do chat de uma live encerrada, filtre e exporte em JSON ou CSV.",
+ "lc_action": "Buscar chat ao vivo",
+ "lc_none": "Sem replay de chat para este vídeo.",
+ "lc_exported": "Exportado {{name}}"
+ },
"downloads": {
"title": "Downloads",
"empty": "Nenhum download em andamento",
@@ -85,6 +129,54 @@
"open_in_study": "Assistir no Study",
"stop": "Parar",
"confirm_remove": "Remover este download?",
+ "delete_file": "Excluir arquivo do disco",
+ "delete_file_confirm": "Excluir permanentemente o arquivo baixado do disco? Isso não pode ser desfeito.",
+ "sw": {
+ "title": "Estúdio de legendas",
+ "tool_desc": "Abra, edite tempo/texto, traduza e salve legendas SRT/VTT.",
+ "open": "Abrir arquivo de legenda",
+ "load_media": "Carregar mídia (waveform)",
+ "save_srt": "Salvar .srt",
+ "save_vtt": "Salvar .vtt",
+ "shift": "Deslocar tudo (ms)",
+ "find": "Localizar",
+ "replace": "Substituir por",
+ "replace_btn": "Substituir tudo",
+ "replaced": "{{count}} legenda(s) alterada(s)",
+ "target_lang": "Idioma alvo",
+ "translate": "Traduzir com IA",
+ "translated": "Legendas traduzidas",
+ "translate_mismatch": "A tradução não alinhou — tente de novo",
+ "not_configured": "Configure um provedor de IA nas Configurações primeiro",
+ "saved": "Legendas salvas",
+ "split": "Dividir",
+ "merge": "Mesclar ↓",
+ "empty": "Abra um arquivo SRT ou VTT para começar.",
+ "qc_negative": "Fim antes do início",
+ "qc_overlap": "Sobrepõe a próxima legenda",
+ "qc_fast": "Velocidade de leitura muito alta"
+ },
+ "vop": {
+ "action_label": "Ferramentas de vídeo IA",
+ "title": "Ferramentas de vídeo IA",
+ "not_configured": "Configure um provedor de IA nas Configurações primeiro",
+ "done": "Concluído — salvo em:",
+ "quick_actions": "Ações rápidas",
+ "extract_audio": "Extrair áudio",
+ "mute": "Remover áudio",
+ "to_mp4": "Converter para MP4",
+ "to_gif": "Converter para GIF",
+ "trim_start": "Início (hh:mm:ss)",
+ "trim_end": "Fim (hh:mm:ss)",
+ "trim": "Cortar",
+ "nl_label": "Descreva o que você quer",
+ "nl_placeholder": "ex.: deixe em 720p e sem áudio",
+ "propose": "Propor",
+ "review_title": "Revise o comando antes de executar",
+ "review_hint": "O app preenche entrada/saída. Só executa após você confirmar.",
+ "run": "Executar",
+ "processing": "Processando…"
+ },
"quality_hint": "Qualidade que está sendo baixada para este item",
"stats_line": "{{count}} downloads · {{size}} salvos",
"filter_label": "Filtrar downloads por status",
@@ -113,6 +205,8 @@
"auto_download_started": "Download automático iniciado",
"external_url_ready": "URL recebida e pronta para download",
"external_url_queued": "Download adicionado pela extensão do Chrome",
+ "channel_new": "{{channel}}: {{count}} vídeo(s) novo(s)",
+ "channel_new_auto": "{{channel}}: baixando {{count}} vídeo(s) novo(s)",
"file_copied_to_clipboard": "Arquivo copiado para o clipboard",
"drm_skipped": "{{count}} vídeo(s) ignorados — protegidos por DRM (FairPlay/SAMPLE-AES)",
"generic_download_complete": "{{name}} — download concluído!"
@@ -232,9 +326,13 @@
},
"download": {
"default_output_dir": "Pasta padrão",
+ "path_too_long": "O caminho desta pasta está longo ({{current}}/{{limit}} caracteres). Downloads com nomes longos podem falhar — escolha uma pasta mais curta.",
"choose_folder": "Escolher",
"always_ask_path": "Sempre perguntar onde salvar",
"video_quality": "Qualidade de vídeo",
+ "speed_limit": "Limite de velocidade",
+ "speed_limit_desc": "Limita a taxa de download. Deixe vazio para sem limite.",
+ "speed_limit_unlimited": "Sem limite",
"skip_existing": "Pular arquivos existentes",
"download_attachments": "Baixar anexos",
"download_descriptions": "Salvar descrições",
@@ -267,8 +365,24 @@
"translate_metadata_desc": "Pedir que o YouTube localize títulos e capítulos para o idioma do app (apenas YouTube)",
"youtube_sponsorblock": "Remover segmentos SponsorBlock",
"youtube_sponsorblock_desc": "Cortar trechos patrocinados, intros e outros de vídeos do YouTube (dados da comunidade; pode falhar ou cortar demais)",
+ "sb_mode": "Ação do SponsorBlock",
+ "sb_mode_desc": "Remover corta os trechos do arquivo. Apenas marcar adiciona marcadores de capítulo para você pular no player.",
+ "sb_mode_remove": "Remover trechos",
+ "sb_mode_mark": "Apenas marcar",
+ "sb_categories": "Tipos de trecho",
+ "sb_categories_desc": "Em quais tipos de trecho agir.",
+ "sb_cat_sponsor": "Patrocínio",
+ "sb_cat_selfpromo": "Autopromoção",
+ "sb_cat_interaction": "Lembrete de interação",
+ "sb_cat_intro": "Introdução",
+ "sb_cat_outro": "Encerramento / cards finais",
+ "sb_cat_preview": "Prévia / recapitulação",
+ "sb_cat_filler": "Enrolação / tangente",
+ "sb_cat_music_offtopic": "Trecho sem música",
"split_by_chapters": "Dividir vídeo por capítulos",
"split_by_chapters_desc": "Quando o vídeo tem marcadores de capítulo, salvar cada capítulo como arquivo separado",
+ "live_from_start": "Gravar lives desde o início",
+ "live_from_start_desc": "Ao baixar uma transmissão ao vivo em andamento, captura desde o começo em vez do momento atual",
"presets": "Predefinições rápidas",
"presets_desc": "Configuração com um clique. Toque num cartão para aplicar.",
"preset_fast": "Rápido",
@@ -360,7 +474,20 @@
"password": "Senha"
},
"ytdlp_flags": {
- "title": "Flags do yt-dlp"
+ "title": "Flags do yt-dlp",
+ "embed_subs": "Embutir legendas",
+ "write_thumbnail": "Salvar miniatura",
+ "write_description": "Salvar descrição",
+ "write_comments": "Salvar comentários",
+ "restrict_filenames": "Nomes ASCII",
+ "no_overwrites": "Não sobrescrever",
+ "prefer_free_formats": "Formatos livres",
+ "force_ipv4": "Forçar IPv4",
+ "geo_bypass": "Burlar geobloqueio",
+ "limit_rate": "Limitar taxa",
+ "sleep_interval": "Intervalo de espera",
+ "limit_rate_ph": "ex.: 1M",
+ "sleep_interval_ph": "ex.: 5"
},
"advanced": {
"title": "Avançado",
@@ -376,9 +503,18 @@
"reset_confirm": "Tem certeza? Todas as configurações serão restauradas.",
"torrent_listen_port": "Porta de escuta torrent",
"torrent_listen_port_desc": "Porta TCP para conexões BitTorrent de entrada",
+ "torrent_auto_trackers": "Adicionar trackers públicos extras",
+ "torrent_auto_trackers_desc": "Melhora a descoberta de peers em magnets com poucos ou nenhum tracker",
+ "torrent_upnp": "Abrir porta no roteador (UPnP)",
+ "torrent_upnp_desc": "Permite que roteadores aceitem conexões de peers de entrada para torrents mais rápidos",
+ "prevent_sleep": "Manter o sistema acordado durante downloads",
+ "prevent_sleep_desc": "Impede o computador de dormir enquanto há downloads ativos",
"cookies_from_browser": "Ler cookies direto de um perfil do navegador (avançado)",
"cookies_from_browser_desc": "Só configure se a extensão do navegador não funcionar. A maioria dos usuários deve deixar vazio.",
"cookies_from_browser_placeholder": "ex.: firefox, chrome, edge",
+ "user_agent": "User-Agent personalizado (avançado)",
+ "user_agent_desc": "Envia um User-Agent personalizado nos downloads. Deixe vazio para usar o padrão.",
+ "user_agent_placeholder": "User-Agent padrão do navegador",
"twitter_manual_cookie": "Cookie manual",
"twitter_manual_cookie_desc": "Se um download falhar, você pode colar aqui um cabeçalho Cookie manual e tentar novamente. Não está limitado ao Twitter/X. Exemplo: sessionid=...; csrftoken=...; auth_token=..."
},
@@ -410,6 +546,12 @@
"bridge": {
"title": "Extensão do navegador",
"intro": "Pareie a extensão OmniGet com este app por meio de uma conexão local privada. Abra a página de opções da extensão, cole a URL e o token abaixo e clique em Salvar.",
+ "pair_label": "Parear a extensão",
+ "pair_hint": "Um clique aqui e a extensão instalada conecta sozinha — sem copiar e colar.",
+ "pair": "Parear extensão",
+ "pair_waiting": "Aguardando…",
+ "pair_active": "Janela aberta — a extensão vai conectar sozinha (faltam {{secs}}s).",
+ "pair_unavailable": "Ative o bridge do navegador primeiro.",
"endpoint_label": "URL do endpoint",
"token_label": "Token de pareamento",
"rotate_label": "Gerar novo token",
@@ -425,6 +567,64 @@
"unavailable": "Bridge indisponível. Reinicie o app."
},
"cat_cookies": "Cookies",
+ "cat_channels": "Canais",
+ "cat_ai": "IA",
+ "ai": {
+ "title": "Provedor de IA",
+ "provider": "Provedor",
+ "provider_desc": "Escolha para onde vão os pedidos de IA. Sua chave fica salva localmente e nunca é registrada.",
+ "provider_none": "Desligado",
+ "provider_local": "Local (compatível com OpenAI)",
+ "model": "Modelo",
+ "model_desc": "O identificador do modelo para o provedor escolhido.",
+ "model_placeholder": "ex.: gpt-4o-mini, claude-3-5-sonnet-latest, llama3",
+ "openai_key": "Chave da API OpenAI",
+ "anthropic_key": "Chave da API Anthropic",
+ "key_set": "Uma chave está salva. Deixe em branco para mantê-la.",
+ "key_unset": "Nenhuma chave salva ainda.",
+ "local_url": "URL do endpoint local",
+ "local_url_desc": "URL base compatível com OpenAI (Ollama, LM Studio, …).",
+ "save": "Salvar",
+ "test": "Testar conexão",
+ "test_ok": "Conexão de IA funcionando",
+ "test_fail": "Teste de IA falhou: {{error}}",
+ "saved": "Configurações de IA salvas",
+ "summarize_title": "Resumir um vídeo",
+ "summarize": "Resumir",
+ "summarizing": "Resumindo…",
+ "summarize_placeholder": "URL do vídeo",
+ "summarize_hint": "Busca as legendas do vídeo e as resume. O resultado é salvo abaixo.",
+ "style": "Estilo do resumo",
+ "style_short": "Curto",
+ "style_balanced": "Equilibrado",
+ "style_detailed": "Detalhado",
+ "lang_placeholder": "Idioma de saída (opcional)",
+ "summary_ready": "Resumo pronto",
+ "no_transcript": "Nenhuma transcrição disponível para este vídeo",
+ "not_configured": "Configure um provedor de IA primeiro",
+ "history": "Histórico de IA",
+ "history_clear": "Limpar",
+ "history_clear_confirm": "Limpar todo o histórico de IA?",
+ "history_empty": "Nenhum resultado de IA ainda."
+ },
+ "channels": {
+ "title": "Canais seguidos",
+ "tray_header": "Canais",
+ "add": "Seguir",
+ "add_placeholder": "URL do canal ou playlist",
+ "add_hint": "Novos uploads são verificados em segundo plano. O download automático fica desligado até você ativar.",
+ "empty_title": "Nenhum canal seguido ainda",
+ "empty_hint": "Siga um canal ou playlist para receber novos uploads automaticamente.",
+ "last_checked": "Última verificação {{when}}",
+ "never": "nunca",
+ "check_now": "Verificar agora",
+ "checked": "{{count}} vídeo(s) novo(s)",
+ "remove": "Remover",
+ "remove_confirm": "Parar de seguir este canal?",
+ "enabled": "Ativado",
+ "auto_download": "Download automático",
+ "interval": "A cada (min)"
+ },
"cookies": {
"title": "Cookies",
"intro": "Gerencie os cookies das suas contas. Tudo fica no seu computador — nada é enviado pra nossos servidores.",
@@ -454,6 +654,12 @@
"action_view": "Ver",
"action_export": "Exportar",
"action_rename": "Renomear",
+ "action_test": "Testar",
+ "test_running": "Testando…",
+ "test_ok": "Cookies funcionam.",
+ "test_fail": "Falhou: {{msg}}",
+ "expires_in": "expira em ~{{days}}d",
+ "expired": "expirado",
"action_clear": "Limpar",
"import_trigger": "Importar",
"import_file_title": "Arquivo",
@@ -540,6 +746,30 @@
"formats_playlist_note": "A seleção de formato por vídeo não se aplica a playlists. A opção Qualidade acima vale para cada vídeo.",
"referer_label": "Referer (opcional)",
"referer_placeholder": "https://exemplo.com",
+ "timerange_label": "Baixar só um trecho (opcional)",
+ "timerange_start": "Início",
+ "timerange_end": "Fim",
+ "timerange_hint": "Use mm:ss ou hh:mm:ss. Deixe vazio para baixar o vídeo inteiro.",
+ "schedule_label": "Agendar",
+ "schedule_1h": "Em 1 hora",
+ "schedule_tonight": "Hoje à noite",
+ "schedule_1d": "Amanhã",
+ "schedule_clear": "Limpar",
+ "schedule_start": "Horário de início",
+ "schedule_stop": "Horário de parada",
+ "schedule_hint": "Deixe vazio para começar agora. O horário de parada opcional cancela o download se ainda estiver em andamento.",
+ "playlist_selected": "{{selected}} de {{total}} selecionados",
+ "playlist_all": "Selecionar todos",
+ "playlist_none": "Nenhum",
+ "playlist_loading": "Carregando playlist…",
+ "playlist_empty": "Não foi possível carregar os itens da playlist",
+ "playlist_none_selected": "Selecione ao menos um item para baixar",
+ "torrent_selected": "{{selected}} de {{total}} arquivos selecionados",
+ "torrent_loading": "Lendo conteúdo do torrent…",
+ "torrent_none_selected": "Selecione ao menos um arquivo para baixar",
+ "cookie_hint_stale": "O cookie salvo deste site está ficando velho.",
+ "cookie_hint_expired": "O cookie salvo deste site expirou — downloads podem falhar.",
+ "cookie_hint_action": "Atualizar",
"external_url_ready": "URL recebida da extensão do Chrome",
"content_type": {
"video": "Vídeo",
@@ -1469,12 +1699,25 @@
"music_theme_reduce_motion_on": "Sempre reduzir",
"music_theme_reduce_motion_hint": "Desliga transições e animações da seção de música. Independente da configuração global do sistema.",
"now_playing_title": "Tocando agora",
+ "youtube_live": "AO VIVO",
+ "youtube_error_generic": "Algo deu errado ao falar com o YouTube",
+ "youtube_error_retry": "Tentar de novo",
+ "youtube_error_audio_only": "Ouvir só áudio",
+ "youtube_error_details": "Detalhes técnicos",
+ "youtube_error_hide_details": "Esconder detalhes",
"now_playing_close": "Voltar",
"now_playing_tab_lyrics": "Letra",
"now_playing_tab_queue": "Próximas",
"now_playing_tab_previous": "Anterior",
"now_playing_lyrics_empty": "Sem letra disponível.",
"now_playing_lyrics_error": "Não consegui carregar a letra. Tente novamente.",
+ "now_playing_lyrics_retry": "Tentar novamente",
+ "now_playing_lyrics_show_translation": "Mostrar tradução",
+ "now_playing_lyrics_hide_translation": "Ocultar tradução",
+ "now_playing_lyrics_plain_note": "Letra não sincronizada",
+ "now_playing_lyrics_sync_earlier": "Letra mais cedo",
+ "now_playing_lyrics_sync_later": "Letra mais tarde",
+ "now_playing_lyrics_sync_reset": "Redefinir sincronização",
"now_playing_queue_empty": "Fila vazia — clique em qualquer faixa para começar.",
"now_playing_previous_empty": "Nada tocado nesta sessão ainda.",
"now_playing_no_track": "Nenhuma música em reprodução agora.",
diff --git a/src/lib/i18n/zh-TW.json b/src/lib/i18n/zh-TW.json
index 1cb54131..5590cba9 100644
--- a/src/lib/i18n/zh-TW.json
+++ b/src/lib/i18n/zh-TW.json
@@ -43,6 +43,50 @@
"settings": "設定",
"about": "關於"
},
+ "tools": {
+ "tab": "工具",
+ "working": "處理中…",
+ "url_placeholder": "貼上影片連結",
+ "metadata_title": "取得中繼資料",
+ "metadata_desc": "不下載影片本身,僅儲存影片的資訊、簡介與縮圖。",
+ "metadata_action": "取得中繼資料",
+ "metadata_done": "已為「{{title}}」儲存 {{count}} 個檔案",
+ "thumbnails_title": "下載封面",
+ "thumbnails_desc": "瀏覽所有可用封面圖,並以任意解析度儲存。",
+ "thumbnails_action": "列出尺寸",
+ "thumbnails_none": "找不到此連結的封面。",
+ "thumbnails_saved": "已儲存 {{name}}",
+ "thumbnails_save": "儲存此尺寸",
+ "thumbnails_default": "預設",
+ "subs_title": "擷取字幕",
+ "subs_desc": "下載字幕,或將兩種語言合併為一個雙語檔案。",
+ "subs_action": "列出字幕",
+ "subs_none": "— 無 —",
+ "subs_primary": "主要",
+ "subs_format": "格式",
+ "subs_secondary": "第二語言",
+ "subs_save": "儲存字幕",
+ "subs_merge": "合併雙語",
+ "subs_merge_hint": "請選擇第二語言;合併需要 SRT 或 VTT。",
+ "subs_saved": "已儲存 {{name}}",
+ "cc_title": "留言與章節",
+ "cc_desc": "取得影片的留言或章節標記,篩選並匯出為 JSON 或 CSV。",
+ "cc_comments": "取得留言",
+ "cc_chapters": "取得章節",
+ "cc_max": "最大留言數",
+ "cc_sort": "排序",
+ "cc_sort_top": "熱門",
+ "cc_sort_new": "最新",
+ "cc_filter": "篩選…",
+ "cc_none": "此連結找不到任何內容。",
+ "cc_exported": "已匯出 {{name}}",
+ "cc_showing": "顯示 {{shown}}/{{total}}",
+ "lc_title": "直播聊天封存",
+ "lc_desc": "取得已結束直播的聊天重播,篩選並匯出為 JSON 或 CSV。",
+ "lc_action": "取得直播聊天",
+ "lc_none": "此影片沒有聊天重播。",
+ "lc_exported": "已匯出 {{name}}"
+ },
"downloads": {
"title": "下載",
"empty": "目前沒有進行中的下載",
@@ -85,6 +129,54 @@
"open_in_study": "Watch in Study",
"stop": "停止",
"confirm_remove": "移除此下载?",
+ "delete_file": "從磁碟刪除檔案",
+ "delete_file_confirm": "永久從磁碟刪除已下載的檔案?此操作無法復原。",
+ "sw": {
+ "title": "字幕工作室",
+ "tool_desc": "開啟、編輯時間/文字、翻譯並儲存 SRT/VTT 字幕。",
+ "open": "開啟字幕檔案",
+ "load_media": "載入媒體(波形)",
+ "save_srt": "儲存 .srt",
+ "save_vtt": "儲存 .vtt",
+ "shift": "整體位移(毫秒)",
+ "find": "尋找",
+ "replace": "取代為",
+ "replace_btn": "全部取代",
+ "replaced": "已變更 {{count}} 條字幕",
+ "target_lang": "目標語言",
+ "translate": "AI 翻譯",
+ "translated": "字幕已翻譯",
+ "translate_mismatch": "翻譯未對齊 — 請重試",
+ "not_configured": "請先在設定中設定 AI 提供者",
+ "saved": "字幕已儲存",
+ "split": "分割",
+ "merge": "合併 ↓",
+ "empty": "開啟 SRT 或 VTT 檔案以開始。",
+ "qc_negative": "結束早於開始",
+ "qc_overlap": "與下一條字幕重疊",
+ "qc_fast": "閱讀速度過快"
+ },
+ "vop": {
+ "action_label": "AI 影片工具",
+ "title": "AI 影片工具",
+ "not_configured": "請先在設定中設定 AI 提供者",
+ "done": "完成 — 已儲存至:",
+ "quick_actions": "快速操作",
+ "extract_audio": "擷取音訊",
+ "mute": "移除音訊",
+ "to_mp4": "轉換為 MP4",
+ "to_gif": "轉換為 GIF",
+ "trim_start": "開始(hh:mm:ss)",
+ "trim_end": "結束(hh:mm:ss)",
+ "trim": "裁剪",
+ "nl_label": "描述你想要的效果",
+ "nl_placeholder": "例如:轉成 720p 並靜音",
+ "propose": "產生",
+ "review_title": "執行前請檢查指令",
+ "review_hint": "應用程式會填入輸入/輸出。僅在你確認後執行。",
+ "run": "執行",
+ "processing": "處理中…"
+ },
"quality_hint": "目前下載此項目的品質",
"stats_line": "{{count}} 次下载 · 已保存 {{size}}",
"filter_label": "依狀態篩選下載",
@@ -113,6 +205,8 @@
"auto_download_started": "已啟動自動下載",
"external_url_ready": "已收到 URL,可以开始下载",
"external_url_queued": "已从 Chrome 扩展添加下载",
+ "channel_new": "{{channel}}:{{count}} 個新影片",
+ "channel_new_auto": "{{channel}}:正在下載 {{count}} 個新影片",
"file_copied_to_clipboard": "檔案已複製到剪貼簿",
"drm_skipped": "已略過 {{count}} 部影片 — 受 DRM (FairPlay/SAMPLE-AES) 保護",
"generic_download_complete": "{{name}} — 下載完成!"
@@ -232,9 +326,13 @@
},
"download": {
"default_output_dir": "預設資料夾",
+ "path_too_long": "此資料夾路徑過長({{current}}/{{limit}} 個字元)。檔名較長時下載可能失敗 — 請選擇更短的資料夾。",
"choose_folder": "選擇",
"always_ask_path": "每次都詢問儲存位置",
"video_quality": "影片品質",
+ "speed_limit": "下載速度限制",
+ "speed_limit_desc": "限制下載速率。留空表示不限速。",
+ "speed_limit_unlimited": "不限速",
"skip_existing": "略過已存在的檔案",
"download_attachments": "下載附件",
"download_descriptions": "儲存描述",
@@ -267,8 +365,24 @@
"translate_metadata_desc": "請求 YouTube 將標題與章節名稱在地化為應用程式語言(僅 YouTube)",
"youtube_sponsorblock": "移除 SponsorBlock 片段",
"youtube_sponsorblock_desc": "從 YouTube 影片中剪除贊助、片頭、片尾片段(社群資料;可能遺漏或過度剪除)",
+ "sb_mode": "SponsorBlock 動作",
+ "sb_mode_desc": "移除會從檔案中剪掉這些片段。僅標記則加入章節標記,方便在播放器中跳過。",
+ "sb_mode_remove": "移除片段",
+ "sb_mode_mark": "僅標記",
+ "sb_categories": "片段類型",
+ "sb_categories_desc": "對哪些類型的片段生效。",
+ "sb_cat_sponsor": "贊助",
+ "sb_cat_selfpromo": "自我宣傳",
+ "sb_cat_interaction": "互動提醒",
+ "sb_cat_intro": "片頭",
+ "sb_cat_outro": "片尾 / 結束卡片",
+ "sb_cat_preview": "預告 / 回顧",
+ "sb_cat_filler": "填充 / 離題",
+ "sb_cat_music_offtopic": "非音樂片段",
"split_by_chapters": "依章節分割影片",
"split_by_chapters_desc": "當影片含有章節標記時,將每個章節儲存為獨立檔案",
+ "live_from_start": "從頭錄製直播",
+ "live_from_start_desc": "下載進行中的直播時,從開頭開始擷取,而非從目前時刻",
"presets": "快速預設",
"presets_desc": "一鍵套用常用設定。點擊卡片即可套用。",
"preset_fast": "快速",
@@ -360,7 +474,20 @@
"password": "密碼"
},
"ytdlp_flags": {
- "title": "yt-dlp 命令參數"
+ "title": "yt-dlp 命令參數",
+ "embed_subs": "嵌入字幕",
+ "write_thumbnail": "儲存縮圖",
+ "write_description": "儲存描述",
+ "write_comments": "儲存留言",
+ "restrict_filenames": "ASCII 檔名",
+ "no_overwrites": "不覆寫",
+ "prefer_free_formats": "優先自由格式",
+ "force_ipv4": "強制 IPv4",
+ "geo_bypass": "繞過地區限制",
+ "limit_rate": "限制速率",
+ "sleep_interval": "等待間隔",
+ "limit_rate_ph": "例如 1M",
+ "sleep_interval_ph": "例如 5"
},
"advanced": {
"title": "進階",
@@ -376,9 +503,18 @@
"reset_confirm": "確定要重設嗎?所有設定都會恢復為預設值。",
"torrent_listen_port": "Torrent 監聽連接埠",
"torrent_listen_port_desc": "用於接收 BitTorrent 連線的 TCP 連接埠",
+ "torrent_auto_trackers": "新增額外的公共 Tracker",
+ "torrent_auto_trackers_desc": "改善 tracker 較少或失效的磁力連結的節點探索",
+ "torrent_upnp": "開啟路由器連接埠 (UPnP)",
+ "torrent_upnp_desc": "讓路由器接受入站節點連線以加快種子下載",
+ "prevent_sleep": "下載時保持系統喚醒",
+ "prevent_sleep_desc": "有進行中的下載時阻止電腦進入睡眠",
"cookies_from_browser": "浏览器 Cookie(高级)",
"cookies_from_browser_desc": "仅在浏览器扩展无法工作时设置。大多数用户应保持为空。",
"cookies_from_browser_placeholder": "ex.: firefox, chrome, edge",
+ "user_agent": "自訂 User-Agent(進階)",
+ "user_agent_desc": "為下載傳送自訂 User-Agent。留空則使用預設值。",
+ "user_agent_placeholder": "瀏覽器預設 User-Agent",
"twitter_manual_cookie": "手動 Cookie",
"twitter_manual_cookie_desc": "如果下載失敗,您可以在此貼上手動的 Cookie 標頭並重試。不限於 Twitter/X。範例:sessionid=...; csrftoken=...; auth_token=..."
},
@@ -410,6 +546,12 @@
"bridge": {
"title": "瀏覽器擴充功能",
"intro": "透過私有的本機連線將 OmniGet 瀏覽器擴充功能與此應用程式配對。打開擴充功能的選項頁面,貼上下方的端點 URL 與權杖,然後按下儲存。",
+ "pair_label": "配對擴充功能",
+ "pair_hint": "在此點一下,已安裝的擴充功能會自動連線——免複製貼上。",
+ "pair": "配對擴充功能",
+ "pair_waiting": "等待中…",
+ "pair_active": "視窗已開啟——擴充功能將自動連線(剩餘 {{secs}} 秒)。",
+ "pair_unavailable": "請先啟用瀏覽器橋接。",
"endpoint_label": "端點 URL",
"token_label": "配對權杖",
"rotate_label": "重新產生權杖",
@@ -425,6 +567,64 @@
"unavailable": "橋接不可用。請重新啟動應用程式。"
},
"cat_cookies": "Cookies",
+ "cat_channels": "頻道",
+ "cat_ai": "AI",
+ "ai": {
+ "title": "AI 提供者",
+ "provider": "提供者",
+ "provider_desc": "選擇 AI 請求的目的地。金鑰僅在本機儲存,絕不記錄。",
+ "provider_none": "關閉",
+ "provider_local": "本機(相容 OpenAI)",
+ "model": "模型",
+ "model_desc": "所選提供者的模型識別碼。",
+ "model_placeholder": "例如 gpt-4o-mini、claude-3-5-sonnet-latest、llama3",
+ "openai_key": "OpenAI API 金鑰",
+ "anthropic_key": "Anthropic API 金鑰",
+ "key_set": "已儲存金鑰。留空以保留。",
+ "key_unset": "尚未儲存金鑰。",
+ "local_url": "本機端點 URL",
+ "local_url_desc": "相容 OpenAI 的基礎 URL(Ollama、LM Studio 等)。",
+ "save": "儲存",
+ "test": "測試連線",
+ "test_ok": "AI 連線正常",
+ "test_fail": "AI 測試失敗:{{error}}",
+ "saved": "AI 設定已儲存",
+ "summarize_title": "摘要影片",
+ "summarize": "摘要",
+ "summarizing": "正在摘要…",
+ "summarize_placeholder": "影片網址",
+ "summarize_hint": "取得影片字幕並產生摘要。結果儲存在下方。",
+ "style": "摘要風格",
+ "style_short": "簡短",
+ "style_balanced": "均衡",
+ "style_detailed": "詳細",
+ "lang_placeholder": "輸出語言(選填)",
+ "summary_ready": "摘要已完成",
+ "no_transcript": "此影片沒有可用的字幕",
+ "not_configured": "請先設定 AI 提供者",
+ "history": "AI 紀錄",
+ "history_clear": "清除",
+ "history_clear_confirm": "清除所有 AI 紀錄?",
+ "history_empty": "尚無 AI 結果。"
+ },
+ "channels": {
+ "title": "已追蹤的頻道",
+ "tray_header": "頻道",
+ "add": "追蹤",
+ "add_placeholder": "頻道或播放清單網址",
+ "add_hint": "在背景檢查新影片。自動下載預設關閉,需手動開啟。",
+ "empty_title": "尚未追蹤任何頻道",
+ "empty_hint": "追蹤一個頻道或播放清單,自動取得新影片。",
+ "last_checked": "上次檢查 {{when}}",
+ "never": "從未",
+ "check_now": "立即檢查",
+ "checked": "{{count}} 個新影片",
+ "remove": "移除",
+ "remove_confirm": "停止追蹤此頻道?",
+ "enabled": "已啟用",
+ "auto_download": "自動下載",
+ "interval": "間隔(分鐘)"
+ },
"cookies": {
"title": "Cookies",
"intro": "Manage your account cookies. Everything stays on your computer — nothing is sent to our servers.",
@@ -454,6 +654,12 @@
"action_view": "View",
"action_export": "Export",
"action_rename": "Rename",
+ "action_test": "測試",
+ "test_running": "測試中…",
+ "test_ok": "Cookie 有效。",
+ "test_fail": "失敗:{{msg}}",
+ "expires_in": "約 {{days}} 天後過期",
+ "expired": "已過期",
"action_clear": "Clear",
"import_trigger": "Import",
"import_file_title": "File",
@@ -540,6 +746,30 @@
"formats_playlist_note": "單一影片的格式選擇不適用於播放清單。上方的「品質」選項會套用到每一支影片。",
"referer_label": "Referer (選填)",
"referer_placeholder": "https://example.com",
+ "timerange_label": "僅下載片段(選填)",
+ "timerange_start": "開始",
+ "timerange_end": "結束",
+ "timerange_hint": "使用 mm:ss 或 hh:mm:ss。留空則下載整部影片。",
+ "schedule_label": "排程",
+ "schedule_1h": "1 小時後",
+ "schedule_tonight": "今晚",
+ "schedule_1d": "明天",
+ "schedule_clear": "清除",
+ "schedule_start": "開始時間",
+ "schedule_stop": "停止時間",
+ "schedule_hint": "留空則立即開始。可選的停止時間會在下載仍在進行時取消它。",
+ "playlist_selected": "已選 {{selected}}/{{total}}",
+ "playlist_all": "全選",
+ "playlist_none": "全不選",
+ "playlist_loading": "正在載入播放清單…",
+ "playlist_empty": "無法載入播放清單項目",
+ "playlist_none_selected": "請至少選擇一個項目進行下載",
+ "torrent_selected": "已選擇 {{total}} 個檔案中的 {{selected}} 個",
+ "torrent_loading": "正在讀取種子內容…",
+ "torrent_none_selected": "請至少選擇一個檔案進行下載",
+ "cookie_hint_stale": "該網站儲存的 Cookie 正在變舊。",
+ "cookie_hint_expired": "該網站儲存的 Cookie 已過期——下載可能失敗。",
+ "cookie_hint_action": "更新",
"external_url_ready": "已从 Chrome 扩展收到 URL",
"content_type": {
"video": "影片",
@@ -1469,12 +1699,25 @@
"music_theme_reduce_motion_on": "Always reduce",
"music_theme_reduce_motion_hint": "Disables transitions and animations in the music section, independent of the global system setting.",
"now_playing_title": "Now playing",
+ "youtube_live": "直播",
+ "youtube_error_generic": "與 YouTube 通訊時發生錯誤",
+ "youtube_error_retry": "重試",
+ "youtube_error_audio_only": "僅音訊",
+ "youtube_error_details": "技術細節",
+ "youtube_error_hide_details": "隱藏細節",
"now_playing_close": "Back",
"now_playing_tab_lyrics": "Lyrics",
"now_playing_tab_queue": "Up next",
"now_playing_tab_previous": "Previous",
"now_playing_lyrics_empty": "No lyrics available.",
- "now_playing_lyrics_error": "Couldn't load lyrics. Try again.",
+ "now_playing_lyrics_error": "無法載入歌詞。請重試。",
+ "now_playing_lyrics_retry": "重試",
+ "now_playing_lyrics_show_translation": "顯示翻譯",
+ "now_playing_lyrics_hide_translation": "隱藏翻譯",
+ "now_playing_lyrics_plain_note": "未同步歌詞",
+ "now_playing_lyrics_sync_earlier": "歌詞提前",
+ "now_playing_lyrics_sync_later": "歌詞延後",
+ "now_playing_lyrics_sync_reset": "重置同步",
"now_playing_queue_empty": "Queue is empty — click any track to start.",
"now_playing_previous_empty": "Nothing played in this session yet.",
"now_playing_no_track": "No track playing right now.",
diff --git a/src/lib/i18n/zh.json b/src/lib/i18n/zh.json
index 1d05bf3d..a60808bc 100644
--- a/src/lib/i18n/zh.json
+++ b/src/lib/i18n/zh.json
@@ -43,6 +43,50 @@
"settings": "设置",
"about": "关于"
},
+ "tools": {
+ "tab": "工具",
+ "working": "处理中…",
+ "url_placeholder": "粘贴视频链接",
+ "metadata_title": "获取元数据",
+ "metadata_desc": "不下载视频本身,仅保存视频的信息、简介和缩略图。",
+ "metadata_action": "获取元数据",
+ "metadata_done": "已为“{{title}}”保存 {{count}} 个文件",
+ "thumbnails_title": "下载封面",
+ "thumbnails_desc": "浏览所有可用封面图,并以任意分辨率保存。",
+ "thumbnails_action": "列出尺寸",
+ "thumbnails_none": "未找到该链接的封面。",
+ "thumbnails_saved": "已保存 {{name}}",
+ "thumbnails_save": "保存此尺寸",
+ "thumbnails_default": "默认",
+ "subs_title": "提取字幕",
+ "subs_desc": "下载字幕,或将两种语言合并为一个双语文件。",
+ "subs_action": "列出字幕",
+ "subs_none": "— 无 —",
+ "subs_primary": "主语言",
+ "subs_format": "格式",
+ "subs_secondary": "第二语言",
+ "subs_save": "保存字幕",
+ "subs_merge": "合并双语",
+ "subs_merge_hint": "请选择第二语言;合并需要 SRT 或 VTT。",
+ "subs_saved": "已保存 {{name}}",
+ "cc_title": "评论与章节",
+ "cc_desc": "获取视频的评论或章节标记,进行筛选并导出为 JSON 或 CSV。",
+ "cc_comments": "获取评论",
+ "cc_chapters": "获取章节",
+ "cc_max": "最大评论数",
+ "cc_sort": "排序",
+ "cc_sort_top": "热门",
+ "cc_sort_new": "最新",
+ "cc_filter": "筛选…",
+ "cc_none": "该链接未找到任何内容。",
+ "cc_exported": "已导出 {{name}}",
+ "cc_showing": "显示 {{shown}}/{{total}}",
+ "lc_title": "直播聊天存档",
+ "lc_desc": "获取已结束直播的聊天回放,进行筛选并导出为 JSON 或 CSV。",
+ "lc_action": "获取直播聊天",
+ "lc_none": "该视频没有聊天回放。",
+ "lc_exported": "已导出 {{name}}"
+ },
"downloads": {
"title": "下载",
"empty": "暂无正在进行的下载",
@@ -85,6 +129,54 @@
"open_in_study": "Watch in Study",
"stop": "停止",
"confirm_remove": "移除此下载?",
+ "delete_file": "从磁盘删除文件",
+ "delete_file_confirm": "永久从磁盘删除已下载的文件?此操作无法撤销。",
+ "sw": {
+ "title": "字幕工作室",
+ "tool_desc": "打开、编辑时间/文本、翻译并保存 SRT/VTT 字幕。",
+ "open": "打开字幕文件",
+ "load_media": "加载媒体(波形)",
+ "save_srt": "保存 .srt",
+ "save_vtt": "保存 .vtt",
+ "shift": "整体偏移(毫秒)",
+ "find": "查找",
+ "replace": "替换为",
+ "replace_btn": "全部替换",
+ "replaced": "已更改 {{count}} 条字幕",
+ "target_lang": "目标语言",
+ "translate": "AI 翻译",
+ "translated": "字幕已翻译",
+ "translate_mismatch": "翻译未对齐 — 请重试",
+ "not_configured": "请先在设置中配置 AI 提供方",
+ "saved": "字幕已保存",
+ "split": "拆分",
+ "merge": "合并 ↓",
+ "empty": "打开 SRT 或 VTT 文件以开始。",
+ "qc_negative": "结束早于开始",
+ "qc_overlap": "与下一条字幕重叠",
+ "qc_fast": "阅读速度过快"
+ },
+ "vop": {
+ "action_label": "AI 视频工具",
+ "title": "AI 视频工具",
+ "not_configured": "请先在设置中配置 AI 提供方",
+ "done": "完成 — 已保存到:",
+ "quick_actions": "快捷操作",
+ "extract_audio": "提取音频",
+ "mute": "移除音频",
+ "to_mp4": "转换为 MP4",
+ "to_gif": "转换为 GIF",
+ "trim_start": "开始(hh:mm:ss)",
+ "trim_end": "结束(hh:mm:ss)",
+ "trim": "裁剪",
+ "nl_label": "描述你想要的效果",
+ "nl_placeholder": "例如:转成 720p 并静音",
+ "propose": "生成",
+ "review_title": "执行前请检查命令",
+ "review_hint": "应用会填入输入/输出。仅在你确认后执行。",
+ "run": "执行",
+ "processing": "处理中…"
+ },
"quality_hint": "正在为此项下载的质量",
"stats_line": "{{count}} 次下载 · 已保存 {{size}}",
"filter_label": "按状态筛选下载",
@@ -113,6 +205,8 @@
"auto_download_started": "已启动自动下载",
"external_url_ready": "已收到 URL,可以开始下载",
"external_url_queued": "已从 Chrome 扩展添加下载",
+ "channel_new": "{{channel}}:{{count}} 个新视频",
+ "channel_new_auto": "{{channel}}:正在下载 {{count}} 个新视频",
"file_copied_to_clipboard": "文件已复制到剪贴板",
"drm_skipped": "{{count}} 个视频已跳过 — 受DRM保护(FairPlay/SAMPLE-AES)",
"generic_download_complete": "{{name}} — 下载完成!"
@@ -232,9 +326,13 @@
},
"download": {
"default_output_dir": "默认文件夹",
+ "path_too_long": "此文件夹路径过长({{current}}/{{limit}} 个字符)。文件名较长时下载可能失败 — 请选择更短的文件夹。",
"choose_folder": "选择",
"always_ask_path": "每次都询问保存位置",
"video_quality": "视频质量",
+ "speed_limit": "下载速度限制",
+ "speed_limit_desc": "限制下载速率。留空表示不限速。",
+ "speed_limit_unlimited": "不限速",
"skip_existing": "跳过已有文件",
"download_attachments": "下载附件",
"download_descriptions": "保存描述",
@@ -267,8 +365,24 @@
"translate_metadata_desc": "请求 YouTube 将标题和章节名本地化为应用语言(仅 YouTube)",
"youtube_sponsorblock": "移除 SponsorBlock 片段",
"youtube_sponsorblock_desc": "从 YouTube 视频中剪除广告、片头、片尾等赞助片段(社区数据;可能遗漏或误剪)",
+ "sb_mode": "SponsorBlock 操作",
+ "sb_mode_desc": "移除会从文件中剪掉这些片段。仅标记则添加章节标记,便于在播放器中跳过。",
+ "sb_mode_remove": "移除片段",
+ "sb_mode_mark": "仅标记",
+ "sb_categories": "片段类型",
+ "sb_categories_desc": "对哪些类型的片段生效。",
+ "sb_cat_sponsor": "赞助",
+ "sb_cat_selfpromo": "自我宣传",
+ "sb_cat_interaction": "互动提醒",
+ "sb_cat_intro": "片头",
+ "sb_cat_outro": "片尾 / 结束卡片",
+ "sb_cat_preview": "预告 / 回顾",
+ "sb_cat_filler": "填充 / 跑题",
+ "sb_cat_music_offtopic": "非音乐片段",
"split_by_chapters": "按章节分割视频",
"split_by_chapters_desc": "当视频包含章节标记时,将每个章节保存为单独的文件",
+ "live_from_start": "从头录制直播",
+ "live_from_start_desc": "下载正在进行的直播时,从开头开始捕获,而不是从当前时刻",
"presets": "快速预设",
"presets_desc": "一键应用常用配置。点击卡片即可应用。",
"preset_fast": "快速",
@@ -360,7 +474,20 @@
"password": "密码"
},
"ytdlp_flags": {
- "title": "yt-dlp 参数"
+ "title": "yt-dlp 参数",
+ "embed_subs": "嵌入字幕",
+ "write_thumbnail": "保存缩略图",
+ "write_description": "保存描述",
+ "write_comments": "保存评论",
+ "restrict_filenames": "ASCII 文件名",
+ "no_overwrites": "不覆盖",
+ "prefer_free_formats": "优先免费格式",
+ "force_ipv4": "强制 IPv4",
+ "geo_bypass": "绕过地域限制",
+ "limit_rate": "限制速率",
+ "sleep_interval": "等待间隔",
+ "limit_rate_ph": "例如 1M",
+ "sleep_interval_ph": "例如 5"
},
"advanced": {
"title": "高级",
@@ -376,9 +503,18 @@
"reset_confirm": "确定要恢复吗?所有设置将被重置。",
"torrent_listen_port": "Torrent 监听端口",
"torrent_listen_port_desc": "用于接收 BitTorrent 连接的 TCP 端口",
+ "torrent_auto_trackers": "添加额外的公共 Tracker",
+ "torrent_auto_trackers_desc": "改善 tracker 较少或失效的磁力链接的节点发现",
+ "torrent_upnp": "打开路由器端口 (UPnP)",
+ "torrent_upnp_desc": "让路由器接受入站节点连接以加快种子下载",
+ "prevent_sleep": "下载时保持系统唤醒",
+ "prevent_sleep_desc": "有活动下载时阻止计算机进入睡眠",
"cookies_from_browser": "浏览器 Cookie(高级)",
"cookies_from_browser_desc": "仅在浏览器扩展无法工作时设置。大多数用户应保持为空。",
"cookies_from_browser_placeholder": "ex.: firefox, chrome, edge",
+ "user_agent": "自定义 User-Agent(高级)",
+ "user_agent_desc": "为下载发送自定义 User-Agent。留空则使用默认值。",
+ "user_agent_placeholder": "浏览器默认 User-Agent",
"twitter_manual_cookie": "手动 Cookie",
"twitter_manual_cookie_desc": "如果下载失败,您可以在此粘贴手动的 Cookie 标头并重试。不限于 Twitter/X。示例:sessionid=...; csrftoken=...; auth_token=..."
},
@@ -410,6 +546,12 @@
"bridge": {
"title": "浏览器扩展",
"intro": "通过私有的本地连接将 OmniGet 浏览器扩展与此应用配对。打开扩展的选项页面,粘贴下方的端点 URL 与令牌,然后点击保存。",
+ "pair_label": "配对扩展",
+ "pair_hint": "在此点击一次,已安装的扩展会自动连接——无需复制粘贴。",
+ "pair": "配对扩展",
+ "pair_waiting": "等待中…",
+ "pair_active": "窗口已开启——扩展将自动连接(剩余 {{secs}} 秒)。",
+ "pair_unavailable": "请先启用浏览器桥接。",
"endpoint_label": "端点 URL",
"token_label": "配对令牌",
"rotate_label": "重新生成令牌",
@@ -425,6 +567,64 @@
"unavailable": "桥接不可用。请重启应用。"
},
"cat_cookies": "Cookies",
+ "cat_channels": "频道",
+ "cat_ai": "AI",
+ "ai": {
+ "title": "AI 提供方",
+ "provider": "提供方",
+ "provider_desc": "选择 AI 请求的去向。密钥仅本地保存,绝不记录。",
+ "provider_none": "关闭",
+ "provider_local": "本地(兼容 OpenAI)",
+ "model": "模型",
+ "model_desc": "所选提供方的模型标识符。",
+ "model_placeholder": "例如 gpt-4o-mini、claude-3-5-sonnet-latest、llama3",
+ "openai_key": "OpenAI API 密钥",
+ "anthropic_key": "Anthropic API 密钥",
+ "key_set": "已保存密钥。留空以保留。",
+ "key_unset": "尚未保存密钥。",
+ "local_url": "本地端点 URL",
+ "local_url_desc": "兼容 OpenAI 的基础 URL(Ollama、LM Studio 等)。",
+ "save": "保存",
+ "test": "测试连接",
+ "test_ok": "AI 连接正常",
+ "test_fail": "AI 测试失败:{{error}}",
+ "saved": "AI 设置已保存",
+ "summarize_title": "总结视频",
+ "summarize": "总结",
+ "summarizing": "正在总结…",
+ "summarize_placeholder": "视频网址",
+ "summarize_hint": "获取视频字幕并进行总结。结果保存在下方。",
+ "style": "摘要风格",
+ "style_short": "简短",
+ "style_balanced": "均衡",
+ "style_detailed": "详细",
+ "lang_placeholder": "输出语言(可选)",
+ "summary_ready": "总结已完成",
+ "no_transcript": "此视频没有可用的字幕",
+ "not_configured": "请先配置 AI 提供方",
+ "history": "AI 历史",
+ "history_clear": "清除",
+ "history_clear_confirm": "清除所有 AI 历史?",
+ "history_empty": "暂无 AI 结果。"
+ },
+ "channels": {
+ "title": "已关注的频道",
+ "tray_header": "频道",
+ "add": "关注",
+ "add_placeholder": "频道或播放列表网址",
+ "add_hint": "后台检查新视频。自动下载默认关闭,需手动开启。",
+ "empty_title": "尚未关注任何频道",
+ "empty_hint": "关注一个频道或播放列表,自动获取新视频。",
+ "last_checked": "上次检查 {{when}}",
+ "never": "从未",
+ "check_now": "立即检查",
+ "checked": "{{count}} 个新视频",
+ "remove": "移除",
+ "remove_confirm": "停止关注此频道?",
+ "enabled": "已启用",
+ "auto_download": "自动下载",
+ "interval": "间隔(分钟)"
+ },
"cookies": {
"title": "Cookies",
"intro": "Manage your account cookies. Everything stays on your computer — nothing is sent to our servers.",
@@ -454,6 +654,12 @@
"action_view": "View",
"action_export": "Export",
"action_rename": "Rename",
+ "action_test": "测试",
+ "test_running": "测试中…",
+ "test_ok": "Cookie 有效。",
+ "test_fail": "失败:{{msg}}",
+ "expires_in": "约 {{days}} 天后过期",
+ "expired": "已过期",
"action_clear": "Clear",
"import_trigger": "Import",
"import_file_title": "File",
@@ -540,6 +746,30 @@
"formats_playlist_note": "单视频格式选择器不适用于播放列表。上方的「质量」选项将应用于每个视频。",
"referer_label": "Referer(可选)",
"referer_placeholder": "https://example.com",
+ "timerange_label": "仅下载片段(可选)",
+ "timerange_start": "开始",
+ "timerange_end": "结束",
+ "timerange_hint": "使用 mm:ss 或 hh:mm:ss。留空则下载整个视频。",
+ "schedule_label": "定时",
+ "schedule_1h": "1 小时后",
+ "schedule_tonight": "今晚",
+ "schedule_1d": "明天",
+ "schedule_clear": "清除",
+ "schedule_start": "开始时间",
+ "schedule_stop": "停止时间",
+ "schedule_hint": "留空则立即开始。可选的停止时间会在下载仍在进行时取消它。",
+ "playlist_selected": "已选 {{selected}}/{{total}}",
+ "playlist_all": "全选",
+ "playlist_none": "全不选",
+ "playlist_loading": "正在加载播放列表…",
+ "playlist_empty": "无法加载播放列表项目",
+ "playlist_none_selected": "请至少选择一个项目进行下载",
+ "torrent_selected": "已选择 {{total}} 个文件中的 {{selected}} 个",
+ "torrent_loading": "正在读取种子内容…",
+ "torrent_none_selected": "请至少选择一个文件进行下载",
+ "cookie_hint_stale": "该网站保存的 Cookie 正在变旧。",
+ "cookie_hint_expired": "该网站保存的 Cookie 已过期——下载可能失败。",
+ "cookie_hint_action": "更新",
"external_url_ready": "已从 Chrome 扩展收到 URL",
"content_type": {
"video": "视频",
@@ -1469,12 +1699,25 @@
"music_theme_reduce_motion_on": "Always reduce",
"music_theme_reduce_motion_hint": "Disables transitions and animations in the music section, independent of the global system setting.",
"now_playing_title": "Now playing",
+ "youtube_live": "直播",
+ "youtube_error_generic": "与 YouTube 通信时出错",
+ "youtube_error_retry": "重试",
+ "youtube_error_audio_only": "仅音频",
+ "youtube_error_details": "技术细节",
+ "youtube_error_hide_details": "隐藏细节",
"now_playing_close": "Back",
"now_playing_tab_lyrics": "Lyrics",
"now_playing_tab_queue": "Up next",
"now_playing_tab_previous": "Previous",
"now_playing_lyrics_empty": "No lyrics available.",
- "now_playing_lyrics_error": "Couldn't load lyrics. Try again.",
+ "now_playing_lyrics_error": "无法加载歌词。请重试。",
+ "now_playing_lyrics_retry": "重试",
+ "now_playing_lyrics_show_translation": "显示翻译",
+ "now_playing_lyrics_hide_translation": "隐藏翻译",
+ "now_playing_lyrics_plain_note": "未同步歌词",
+ "now_playing_lyrics_sync_earlier": "歌词提前",
+ "now_playing_lyrics_sync_later": "歌词延后",
+ "now_playing_lyrics_sync_reset": "重置同步",
"now_playing_queue_empty": "Queue is empty — click any track to start.",
"now_playing_previous_empty": "Nothing played in this session yet.",
"now_playing_no_track": "No track playing right now.",
diff --git a/src/lib/pets/display-prefs.svelte.ts b/src/lib/pets/display-prefs.svelte.ts
deleted file mode 100644
index 78391901..00000000
--- a/src/lib/pets/display-prefs.svelte.ts
+++ /dev/null
@@ -1,76 +0,0 @@
-import { invoke } from "@tauri-apps/api/core";
-import { listen, type UnlistenFn } from "@tauri-apps/api/event";
-import type { PetStateId } from "./types";
-
-export type DisplayPrefs = {
- enabled: boolean;
- motion_enabled: boolean;
- default_state: PetStateId;
- event_overrides: Partial<Record<string, PetStateId>>;
-};
-
-const DEFAULT_PREFS: DisplayPrefs = {
- enabled: true,
- motion_enabled: true,
- default_state: "idle",
- event_overrides: {},
-};
-
-let prefs = $state<DisplayPrefs>(DEFAULT_PREFS);
-let loaded = $state(false);
-let listenerActive = false;
-let unlisten: UnlistenFn | null = null;
-
-async function ensureListener() {
- if (listenerActive) return;
- listenerActive = true;
- try {
- unlisten = await listen<DisplayPrefs>("pets:prefs:changed", (event) => {
- prefs = { ...DEFAULT_PREFS, ...event.payload };
- });
- } catch {
- listenerActive = false;
- }
-}
-
-export async function loadDisplayPrefs(): Promise<DisplayPrefs> {
- if (!loaded) {
- try {
- const res = await invoke<DisplayPrefs>("pets_get_display_prefs");
- prefs = { ...DEFAULT_PREFS, ...res };
- } catch {
- prefs = DEFAULT_PREFS;
- }
- loaded = true;
- void ensureListener();
- }
- return prefs;
-}
-
-export async function setDisplayPrefs(next: Partial<DisplayPrefs>): Promise<DisplayPrefs> {
- const merged: DisplayPrefs = { ...prefs, ...next };
- try {
- const saved = await invoke<DisplayPrefs>("pets_set_display_prefs", { prefs: merged });
- prefs = { ...DEFAULT_PREFS, ...saved };
- } catch {
- prefs = merged;
- }
- loaded = true;
- return prefs;
-}
-
-export function getDisplayPrefs(): DisplayPrefs {
- return prefs;
-}
-
-export function petsEnabled(): boolean {
- return prefs.enabled;
-}
-
-export function motionEnabled(): boolean {
- return prefs.motion_enabled;
-}
-
-export function petsLoaded(): boolean {
- return loaded;
-}
diff --git a/src/lib/pets/mood.ts b/src/lib/pets/mood.ts
deleted file mode 100644
index c9c00b16..00000000
--- a/src/lib/pets/mood.ts
+++ /dev/null
@@ -1,72 +0,0 @@
-import type {
- PetMeta,
- PetStateId,
- PetStateMood,
- PetVibe,
- PetVibeMood,
-} from "./types";
-
-export const STATE_MOOD: Record<PetStateId, PetStateMood> = {
- idle: "positive",
- waving: "positive",
- jumping: "positive",
- "running-right": "positive",
- "running-left": "positive",
- running: "positive",
- review: "positive",
- waiting: "neutral",
- failed: "negative",
-};
-
-export const MOOD_BY_EVENT = {
- cardCorrect: "jumping",
- cardWrong: "failed",
- streakActive: "idle",
- streakMilestone: "waving",
- studying: "review",
- syncing: "waiting",
- syncSuccess: "waving",
- syncError: "failed",
- emptyState: "idle",
- welcome: "waving",
- goalReached: "jumping",
-} as const satisfies Record<string, PetStateId>;
-
-export type AnkiMoodEvent = keyof typeof MOOD_BY_EVENT;
-
-export const VIBE_MOOD: Record<PetVibeMood, PetVibe[]> = {
- positive: ["cozy", "playful", "cheerful", "focused", "heroic", "wholesome"],
- ambiguous: ["calm", "mischievous", "mystical"],
- negative: ["edgy", "chaotic", "melancholic"],
-};
-
-export function getStateMood(state: PetStateId): PetStateMood {
- return STATE_MOOD[state];
-}
-
-export function getStateForEvent(event: AnkiMoodEvent): PetStateId {
- return MOOD_BY_EVENT[event];
-}
-
-export function getPetMood(vibes: PetVibe[]): PetVibeMood {
- if (vibes.length === 0) return "ambiguous";
- const counts: Record<PetVibeMood, number> = { positive: 0, ambiguous: 0, negative: 0 };
- for (const vibe of vibes) {
- if (VIBE_MOOD.positive.includes(vibe)) counts.positive += 1;
- else if (VIBE_MOOD.negative.includes(vibe)) counts.negative += 1;
- else counts.ambiguous += 1;
- }
- if (counts.negative > counts.positive && counts.negative >= counts.ambiguous) return "negative";
- if (counts.positive >= counts.negative && counts.positive >= counts.ambiguous) return "positive";
- return "ambiguous";
-}
-
-export function pickPetForMood(
- mood: PetVibeMood,
- availablePets: PetMeta[],
-): string | null {
- const matches = availablePets.filter((pet) => getPetMood(pet.vibes) === mood);
- const pool = matches.length > 0 ? matches : availablePets;
- if (pool.length === 0) return null;
- return pool[0].slug;
-}
diff --git a/src/lib/pets/states.ts b/src/lib/pets/states.ts
deleted file mode 100644
index 7477f1c1..00000000
--- a/src/lib/pets/states.ts
+++ /dev/null
@@ -1,78 +0,0 @@
-import type { PetStateConfig, PetStateId } from "./types";
-
-export const PET_STATES: Record<PetStateId, PetStateConfig> = {
- idle: {
- id: "idle",
- label: "Idle",
- row: 0,
- frames: 6,
- durationMs: 1100,
- purpose: "Neutral breathing and blinking loop",
- },
- "running-right": {
- id: "running-right",
- label: "Run Right",
- row: 1,
- frames: 8,
- durationMs: 1060,
- purpose: "Directional locomotion to the right",
- },
- "running-left": {
- id: "running-left",
- label: "Run Left",
- row: 2,
- frames: 8,
- durationMs: 1060,
- purpose: "Directional locomotion to the left",
- },
- waving: {
- id: "waving",
- label: "Waving",
- row: 3,
- frames: 4,
- durationMs: 700,
- purpose: "Greeting or attention gesture",
- },
- jumping: {
- id: "jumping",
- label: "Jumping",
- row: 4,
- frames: 5,
- durationMs: 840,
- purpose: "Anticipation, lift, peak, descent, settle",
- },
- failed: {
- id: "failed",
- label: "Failed",
- row: 5,
- frames: 8,
- durationMs: 1220,
- purpose: "Readable error or sad reaction",
- },
- waiting: {
- id: "waiting",
- label: "Waiting",
- row: 6,
- frames: 6,
- durationMs: 1010,
- purpose: "Patient idle variant",
- },
- running: {
- id: "running",
- label: "Running",
- row: 7,
- frames: 6,
- durationMs: 820,
- purpose: "Generic in-place run loop",
- },
- review: {
- id: "review",
- label: "Review",
- row: 8,
- frames: 6,
- durationMs: 1030,
- purpose: "Focused inspecting or thinking loop",
- },
-};
-
-export const PET_STATE_IDS: PetStateId[] = Object.keys(PET_STATES) as PetStateId[];
diff --git a/src/lib/pets/sync.ts b/src/lib/pets/sync.ts
deleted file mode 100644
index 98bef71f..00000000
--- a/src/lib/pets/sync.ts
+++ /dev/null
@@ -1,161 +0,0 @@
-import { invoke, convertFileSrc } from "@tauri-apps/api/core";
-import { listen, type UnlistenFn } from "@tauri-apps/api/event";
-import type { PetVibe } from "./types";
-
-export type PetSource = "bundle" | "manifest" | "manual";
-
-export type LocalPetEntry = {
- slug: string;
- display_name: string;
- source: PetSource;
- installed_at: string;
- vibes: PetVibe[];
- tags: string[];
- kind?: string | null;
- sprite_ext: string;
- file_sizes: Record<string, number>;
- remote_checked_at?: string | null;
-};
-
-export type LocalIndex = {
- pets: LocalPetEntry[];
- last_synced_at: string | null;
- total: number;
-};
-
-export type RemotePet = {
- slug: string;
- display_name: string;
- description?: string | null;
- kind?: string | null;
- vibes: PetVibe[];
- tags: string[];
- featured: boolean;
- spritesheet_url?: string | null;
- pet_json_url?: string | null;
- zip_url?: string | null;
- submitted_by?: string | null;
-};
-
-export type RemoteManifest = {
- generated_at: string | null;
- total: number;
- featured: number;
- all_pets_pack_path: string | null;
- pets: RemotePet[];
-};
-
-export type DiffReport = {
- new_remote: string[];
- in_both: string[];
- only_local: string[];
- total_remote: number;
- total_local: number;
-};
-
-export type FailedInstall = {
- slug: string;
- reason: string;
-};
-
-export type InstallReport = {
- added: string[];
- skipped: string[];
- failed: FailedInstall[];
- total_bytes: number;
- duration_ms: number;
-};
-
-export type SyncStartedEvent = {
- kind: "bundle" | "incremental";
- expected: number;
-};
-
-export type SyncProgressEvent = {
- slug: string;
- current: number;
- total: number;
- bytes_downloaded: number;
- bytes_total: number;
-};
-
-export type SyncErrorEvent = {
- slug: string;
- message: string;
- retryable: boolean;
-};
-
-export function petsGetLocalIndex(): Promise<LocalIndex> {
- return invoke<LocalIndex>("pets_get_local_index");
-}
-
-export function petsFetchRemoteManifest(): Promise<RemoteManifest> {
- return invoke<RemoteManifest>("pets_fetch_remote_manifest");
-}
-
-export function petsDiff(): Promise<DiffReport> {
- return invoke<DiffReport>("pets_diff");
-}
-
-export function petsInstallBundle(): Promise<InstallReport> {
- return invoke<InstallReport>("pets_install_bundle");
-}
-
-export function petsInstallMissing(slugs?: string[]): Promise<InstallReport> {
- return invoke<InstallReport>("pets_install_missing", { slugs: slugs ?? null });
-}
-
-export function petsForceRefresh(slug: string): Promise<InstallReport> {
- return invoke<InstallReport>("pets_force_refresh", { slug });
-}
-
-export function petsUninstall(slug: string): Promise<void> {
- return invoke<void>("pets_uninstall", { slug });
-}
-
-export function petsOpenFolder(): Promise<void> {
- return invoke<void>("pets_open_folder");
-}
-
-export function petsSetActive(slug: string): Promise<void> {
- return invoke<void>("pets_set_active", { slug });
-}
-
-export function petsGetActive(): Promise<string | null> {
- return invoke<string | null>("pets_get_active");
-}
-
-export function petsResolvePath(slug: string): Promise<string> {
- return invoke<string>("pets_resolve_path", { slug });
-}
-
-export async function petsResolveAssetUrl(slug: string): Promise<string> {
- const path = await petsResolvePath(slug);
- return convertFileSrc(path);
-}
-
-export type SyncListeners = {
- onStarted?: (e: SyncStartedEvent) => void;
- onProgress?: (e: SyncProgressEvent) => void;
- onFinished?: (e: InstallReport) => void;
- onError?: (e: SyncErrorEvent) => void;
-};
-
-export async function attachSyncListeners(handlers: SyncListeners): Promise<() => void> {
- const offs: UnlistenFn[] = [];
- if (handlers.onStarted) {
- offs.push(await listen<SyncStartedEvent>("pets:sync:started", (e) => handlers.onStarted?.(e.payload)));
- }
- if (handlers.onProgress) {
- offs.push(await listen<SyncProgressEvent>("pets:sync:progress", (e) => handlers.onProgress?.(e.payload)));
- }
- if (handlers.onFinished) {
- offs.push(await listen<InstallReport>("pets:sync:finished", (e) => handlers.onFinished?.(e.payload)));
- }
- if (handlers.onError) {
- offs.push(await listen<SyncErrorEvent>("pets:sync:error", (e) => handlers.onError?.(e.payload)));
- }
- return () => {
- for (const off of offs) off();
- };
-}
diff --git a/src/lib/pets/types.ts b/src/lib/pets/types.ts
deleted file mode 100644
index c58db348..00000000
--- a/src/lib/pets/types.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-export type PetStateId =
- | "idle"
- | "running-right"
- | "running-left"
- | "waving"
- | "jumping"
- | "failed"
- | "waiting"
- | "running"
- | "review";
-
-export type PetVibe =
- | "cozy"
- | "calm"
- | "playful"
- | "cheerful"
- | "focused"
- | "mischievous"
- | "heroic"
- | "edgy"
- | "mystical"
- | "wholesome"
- | "chaotic"
- | "melancholic";
-
-export type PetStateMood = "positive" | "neutral" | "negative";
-export type PetVibeMood = "positive" | "ambiguous" | "negative";
-
-export type PetStateConfig = {
- id: PetStateId;
- label: string;
- row: number;
- frames: number;
- durationMs: number;
- purpose: string;
-};
-
-export type PetMeta = {
- slug: string;
- display_name: string;
- description: string;
- spritesheet_url: string;
- vibes: PetVibe[];
- tags: string[];
-};
diff --git a/src/lib/stores/changelog-store.svelte.ts b/src/lib/stores/changelog-store.svelte.ts
index b4b1ee69..0a2ff937 100644
--- a/src/lib/stores/changelog-store.svelte.ts
+++ b/src/lib/stores/changelog-store.svelte.ts
@@ -39,7 +39,7 @@ export async function initChangelog(): Promise<void> {
try {
currentVersion = await getVersion();
} catch {
- currentVersion = "0.6.1";
+ currentVersion = "0.6.2";
}
const lastSeen = localStorage.getItem(STORAGE_KEY);
diff --git a/src/lib/stores/download-listener.ts b/src/lib/stores/download-listener.ts
index ae8ee31e..d7ceb773 100644
--- a/src/lib/stores/download-listener.ts
+++ b/src/lib/stores/download-listener.ts
@@ -19,6 +19,26 @@ import { addLog } from "./debug-store.svelte";
import { recordDownloadComplete } from "./download-stats.svelte";
import { rpcSyncIdleStats } from "$lib/rpc";
+// Best-effort OS notification so completions reach the user when the window is
+// in the background (parity with the in-app toast and the channel feature).
+async function notifyComplete(title: string) {
+ try {
+ const n = await import("@tauri-apps/plugin-notification");
+ let granted = await n.isPermissionGranted();
+ if (!granted) {
+ granted = (await n.requestPermission()) === "granted";
+ }
+ if (granted) {
+ const tr = get(t);
+ n.sendNotification({
+ title: tr("toast.download_complete", { name: title }) as string,
+ });
+ }
+ } catch {
+ // notifications are optional; never block completion handling
+ }
+}
+
type ProgressPayload = {
course_id: number;
course_name: string;
@@ -173,6 +193,7 @@ export async function initDownloadListener(): Promise<() => void> {
const tr = get(t);
if (d.success) {
showToast("success", tr("toast.download_complete", { name: d.course_name }));
+ void notifyComplete(d.course_name);
addLog("info", "download", `Course download complete: ${d.course_name}`);
recordDownloadComplete(0);
void rpcSyncIdleStats();
@@ -219,6 +240,7 @@ export async function initDownloadListener(): Promise<() => void> {
const tr = get(t);
if (d.success) {
showToast("success", tr("toast.download_complete", { name: d.course_name }));
+ void notifyComplete(d.course_name);
addLog("info", "download", `Udemy download complete: ${d.course_name}`);
recordDownloadComplete(0);
void rpcSyncIdleStats();
@@ -251,6 +273,7 @@ export async function initDownloadListener(): Promise<() => void> {
addLog("info", "download", `Download complete: ${item.title}`, item.file_path ?? undefined);
const tr = get(t);
showToast("success", tr("toast.generic_download_complete", { name: item.title }));
+ void notifyComplete(item.title);
recordDownloadComplete(item.file_size_bytes ?? 0);
void rpcSyncIdleStats();
}
diff --git a/src/lib/stores/settings-store.svelte.ts b/src/lib/stores/settings-store.svelte.ts
index 4c4dfacd..05b6e92c 100644
--- a/src/lib/stores/settings-store.svelte.ts
+++ b/src/lib/stores/settings-store.svelte.ts
@@ -26,7 +26,11 @@ export type AppSettings = {
continuous_lecture_numbers: boolean;
translate_metadata: boolean;
youtube_sponsorblock: boolean;
+ sponsorblock_mode: string;
+ sponsorblock_categories: string[];
split_by_chapters: boolean;
+ live_from_start: boolean;
+ speed_limit: string;
hotkey_enabled: boolean;
hotkey_binding: string;
clip_hotkey_enabled?: boolean;
@@ -54,8 +58,12 @@ export type AppSettings = {
concurrent_fragments: number;
stagger_delay_ms: number;
torrent_listen_port: number;
+ torrent_auto_trackers: boolean;
+ torrent_upnp: boolean;
+ prevent_sleep: boolean;
cookies_from_browser: string;
twitter_manual_cookie: string;
+ user_agent: string;
};
telegram: {
concurrent_downloads: number;
diff --git a/src/lib/study-bridge.ts b/src/lib/study-bridge.ts
index 33581fc5..07bf3afe 100644
--- a/src/lib/study-bridge.ts
+++ b/src/lib/study-bridge.ts
@@ -654,6 +654,9 @@ export type YoutubePlayerResult = {
adaptive_formats: YoutubeStreamFormat[];
dash_manifest_url: string | null;
hls_manifest_url: string | null;
+ dash_built: string | null;
+ sabr_only: boolean;
+ server_abr_url: string | null;
expires_at: number;
has_potoken: boolean;
client_used: string;
diff --git a/src/lib/study-components/Tag.svelte b/src/lib/study-components/Tag.svelte
deleted file mode 100644
index 1440f866..00000000
--- a/src/lib/study-components/Tag.svelte
+++ /dev/null
@@ -1,120 +0,0 @@
-<script lang="ts">
- interface Props {
- label: string;
- color?: string;
- active?: boolean;
- removable?: boolean;
- onClick?: (e: Event) => void;
- onRemove?: (e: Event) => void;
- }
-
- let {
- label,
- color = "var(--accent)",
- active = false,
- removable = false,
- onClick,
- onRemove,
- }: Props = $props();
-
- function handleClick(e: Event) {
- if (onClick) onClick(e);
- }
-
- function handleKey(e: KeyboardEvent) {
- if (onClick && (e.key === "Enter" || e.key === " ")) {
- e.preventDefault();
- onClick(e);
- }
- }
-
- function handleRemove(e: Event) {
- e.stopPropagation();
- if (onRemove) onRemove(e);
- }
-</script>
-
-{#if onClick}
- <button
- type="button"
- class="tag clickable"
- class:active
- style="--tag-color: {color};"
- onclick={handleClick}
- onkeydown={handleKey}
- >
- <span class="label">{label}</span>
- {#if removable}
- <span
- class="x"
- role="button"
- tabindex="0"
- aria-label="Remove"
- onclick={handleRemove}
- onkeydown={(e) => (e.key === "Enter" || e.key === " ") && handleRemove(e)}
- >✕</span>
- {/if}
- </button>
-{:else}
- <span class="tag" class:active style="--tag-color: {color};">
- <span class="label">{label}</span>
- {#if removable}
- <button type="button" class="x" aria-label="Remove" onclick={handleRemove}>✕</button>
- {/if}
- </span>
-{/if}
-
-<style>
- .tag {
- display: inline-flex;
- align-items: center;
- gap: 0.35rem;
- padding: 0.25rem 0.6rem;
- border-radius: 999px;
- font-size: 12px;
- font-weight: 500;
- color: var(--secondary);
- background: color-mix(in oklab, var(--tag-color) 8%, transparent);
- border: 1px solid color-mix(in oklab, var(--tag-color) 30%, var(--content-border));
- transition:
- background 150ms ease,
- border-color 150ms ease;
- line-height: 1.3;
- font-family: inherit;
- }
- button.tag {
- cursor: pointer;
- }
- .tag.clickable:hover {
- background: color-mix(in oklab, var(--tag-color) 15%, transparent);
- border-color: var(--tag-color);
- }
- .tag.active {
- background: color-mix(in oklab, var(--tag-color) 25%, transparent);
- border-color: var(--tag-color);
- }
- .tag:focus-visible {
- outline: var(--focus-ring, 2px solid var(--tag-color));
- outline-offset: 2px;
- }
- .x {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- width: 14px;
- height: 14px;
- border: 0;
- background: transparent;
- color: var(--tertiary);
- cursor: pointer;
- font-size: 10px;
- padding: 0;
- border-radius: 50%;
- font-family: inherit;
- line-height: 1;
- }
- .x:hover {
- color: var(--secondary);
- background: color-mix(in oklab, var(--tag-color) 20%, transparent);
- }
-</style>
diff --git a/src/lib/study-components/TelegramDownloadsDrawer.svelte b/src/lib/study-components/TelegramDownloadsDrawer.svelte
deleted file mode 100644
index a76a747f..00000000
--- a/src/lib/study-components/TelegramDownloadsDrawer.svelte
+++ /dev/null
@@ -1,568 +0,0 @@
-<script lang="ts">
- import { onMount, onDestroy } from "svelte";
- import { listen, type UnlistenFn } from "@tauri-apps/api/event";
- import { goto } from "$app/navigation";
- import { t } from "$lib/i18n";
- import {
- studyDownloadsList,
- studyDownloadsUpdate,
- studyDownloadsRemove,
- studyDownloadsClearFinished,
- studyIdForTelegramId,
- studyIdForBatchItem,
- studyIdForUploadId,
- clearLiveDownload,
- clearLiveUpload,
- studyReadRegisterFile,
- type StudyDownloadRow,
- } from "$lib/study-telegram-bridge";
-
- let { open = $bindable(false), activeCount = $bindable(0) } = $props<{
- open?: boolean;
- activeCount?: number;
- }>();
-
- let downloads = $state<StudyDownloadRow[]>([]);
- let loading = $state(false);
- let error = $state("");
- let unlistenProgress: UnlistenFn | null = null;
- let unlistenComplete: UnlistenFn | null = null;
- let unlistenBatch: UnlistenFn | null = null;
- let unlistenUploadProgress: UnlistenFn | null = null;
- let unlistenUploadComplete: UnlistenFn | null = null;
-
- type ProgressEvent = {
- payload: {
- id: number;
- title: string;
- platform: string;
- percent: number;
- };
- };
- type CompleteEvent = {
- payload: {
- id: number;
- title: string;
- platform: string;
- success: boolean;
- error?: string;
- file_path?: string;
- file_size_bytes?: number;
- };
- };
- type BatchEvent = {
- payload: {
- batch_id: number;
- message_id: number;
- status: string;
- percent: number;
- error?: string;
- };
- };
- type UploadCompleteEvent = {
- payload: {
- id: number;
- title: string;
- platform: string;
- success: boolean;
- error?: string;
- message_id?: number;
- };
- };
-
- function recomputeActiveCount() {
- activeCount = downloads.filter(
- (d) => d.status === "queued" || d.status === "downloading",
- ).length;
- }
-
- async function refresh() {
- loading = true;
- error = "";
- try {
- const res = await studyDownloadsList();
- downloads = res.downloads;
- recomputeActiveCount();
- } catch (e) {
- error = e instanceof Error ? e.message : String(e);
- } finally {
- loading = false;
- }
- }
-
- function patchRow(id: number, patch: Partial<StudyDownloadRow>) {
- downloads = downloads.map((d) => (d.id === id ? { ...d, ...patch } : d));
- recomputeActiveCount();
- }
-
- async function onProgress(ev: ProgressEvent) {
- if (ev.payload.platform !== "telegram") return;
- const studyId = studyIdForTelegramId(ev.payload.id);
- if (!studyId) return;
- patchRow(studyId, { progress_pct: ev.payload.percent });
- try {
- await studyDownloadsUpdate({
- id: studyId,
- progressPct: ev.payload.percent,
- status: "downloading",
- });
- } catch {
- /* noop */
- }
- }
-
- async function onComplete(ev: CompleteEvent) {
- if (ev.payload.platform !== "telegram") return;
- const studyId = studyIdForTelegramId(ev.payload.id);
- if (!studyId) return;
- clearLiveDownload(ev.payload.id);
- const status = ev.payload.success ? "done" : "error";
- patchRow(studyId, {
- status,
- progress_pct: ev.payload.success ? 100 : downloads.find((d) => d.id === studyId)?.progress_pct ?? 0,
- error_msg: ev.payload.error ?? null,
- output_path: ev.payload.file_path ?? null,
- });
- try {
- await studyDownloadsUpdate({
- id: studyId,
- status,
- errorMsg: ev.payload.error,
- outputPath: ev.payload.file_path,
- progressPct: ev.payload.success ? 100 : undefined,
- });
- } catch {
- /* noop */
- }
- }
-
- async function onUploadProgress(ev: ProgressEvent) {
- if (ev.payload.platform !== "telegram") return;
- const studyId = studyIdForUploadId(ev.payload.id);
- if (!studyId) return;
- patchRow(studyId, { progress_pct: ev.payload.percent, status: "downloading" });
- try {
- await studyDownloadsUpdate({
- id: studyId,
- progressPct: ev.payload.percent,
- status: "downloading",
- });
- } catch {
- /* noop */
- }
- }
-
- async function onUploadComplete(ev: UploadCompleteEvent) {
- if (ev.payload.platform !== "telegram") return;
- const studyId = studyIdForUploadId(ev.payload.id);
- if (!studyId) return;
- clearLiveUpload(ev.payload.id);
- const status = ev.payload.success ? "done" : "error";
- patchRow(studyId, {
- status,
- progress_pct: ev.payload.success ? 100 : downloads.find((d) => d.id === studyId)?.progress_pct ?? 0,
- error_msg: ev.payload.error ?? null,
- });
- try {
- await studyDownloadsUpdate({
- id: studyId,
- status,
- errorMsg: ev.payload.error,
- progressPct: ev.payload.success ? 100 : undefined,
- });
- } catch {
- /* noop */
- }
- }
-
- async function onBatchStatus(ev: BatchEvent) {
- const studyId = studyIdForBatchItem(ev.payload.batch_id, ev.payload.message_id);
- if (!studyId) return;
- if (ev.payload.status === "downloading") {
- patchRow(studyId, {
- progress_pct: ev.payload.percent,
- status: "downloading",
- });
- try {
- await studyDownloadsUpdate({
- id: studyId,
- status: "downloading",
- progressPct: ev.payload.percent,
- });
- } catch {
- /* noop */
- }
- return;
- }
- if (ev.payload.status === "done") {
- patchRow(studyId, { status: "done", progress_pct: 100 });
- try {
- await studyDownloadsUpdate({
- id: studyId,
- status: "done",
- progressPct: 100,
- });
- } catch {
- /* noop */
- }
- return;
- }
- if (ev.payload.status === "error") {
- patchRow(studyId, {
- status: "error",
- error_msg: ev.payload.error ?? null,
- });
- try {
- await studyDownloadsUpdate({
- id: studyId,
- status: "error",
- errorMsg: ev.payload.error,
- });
- } catch {
- /* noop */
- }
- return;
- }
- if (ev.payload.status === "skipped") {
- patchRow(studyId, { status: "cancelled" });
- try {
- await studyDownloadsUpdate({ id: studyId, status: "cancelled" });
- } catch {
- /* noop */
- }
- }
- }
-
- async function removeRow(id: number) {
- try {
- await studyDownloadsRemove(id);
- downloads = downloads.filter((d) => d.id !== id);
- recomputeActiveCount();
- } catch {
- /* noop */
- }
- }
-
- async function clearFinished() {
- try {
- await studyDownloadsClearFinished();
- downloads = downloads.filter(
- (d) => d.status === "queued" || d.status === "downloading",
- );
- recomputeActiveCount();
- } catch {
- /* noop */
- }
- }
-
- function formatBytes(n: number) {
- if (!n) return "";
- const units = ["B", "KB", "MB", "GB", "TB"];
- let v = n;
- let i = 0;
- while (v >= 1024 && i < units.length - 1) {
- v /= 1024;
- i++;
- }
- return `${v.toFixed(v >= 100 || i === 0 ? 0 : 1)} ${units[i]}`;
- }
-
- function statusLabel(status: string) {
- return $t(`study.library.telegram.downloads.status_${status}`);
- }
-
- const READABLE_EXTS = ["pdf", "epub", "djvu", "mobi", "azw3", "azw", "fb2", "txt", "html", "htm", "rtf"];
-
- function isReadable(d: StudyDownloadRow): boolean {
- if (d.direction !== "download") return false;
- if (d.status !== "done") return false;
- if (!d.output_path) return false;
- const ext = d.file_name.split(".").pop()?.toLowerCase() ?? "";
- return READABLE_EXTS.includes(ext);
- }
-
- async function openInReader(d: StudyDownloadRow) {
- if (!d.output_path) return;
- try {
- const book = await studyReadRegisterFile(d.output_path);
- open = false;
- void goto(`/study/read/${book.id}`);
- } catch (e) {
- error = e instanceof Error ? e.message : String(e);
- }
- }
-
- onMount(async () => {
- unlistenProgress = await listen<ProgressEvent["payload"]>(
- "generic-download-progress",
- (ev) => void onProgress(ev as ProgressEvent),
- );
- unlistenComplete = await listen<CompleteEvent["payload"]>(
- "generic-download-complete",
- (ev) => void onComplete(ev as CompleteEvent),
- );
- unlistenBatch = await listen<BatchEvent["payload"]>(
- "telegram-batch-file-status",
- (ev) => void onBatchStatus(ev as BatchEvent),
- );
- unlistenUploadProgress = await listen<ProgressEvent["payload"]>(
- "generic-upload-progress",
- (ev) => void onUploadProgress(ev as ProgressEvent),
- );
- unlistenUploadComplete = await listen<UploadCompleteEvent["payload"]>(
- "generic-upload-complete",
- (ev) => void onUploadComplete(ev as UploadCompleteEvent),
- );
- await refresh();
- });
-
- onDestroy(() => {
- unlistenProgress?.();
- unlistenComplete?.();
- unlistenBatch?.();
- unlistenUploadProgress?.();
- unlistenUploadComplete?.();
- });
-
- export async function reload() {
- await refresh();
- }
-</script>
-
-{#if open}
- <aside class="drawer" aria-label="downloads">
- <header class="head">
- <strong>{$t("study.library.telegram.downloads.title")}</strong>
- <span class="muted small">
- {downloads.length}
- </span>
- <button
- type="button"
- class="ghost-icon"
- onclick={() => (open = false)}
- aria-label={$t("study.common.close")}
- >
- ✕
- </button>
- </header>
-
- {#if error}
- <p class="error small">{error}</p>
- {/if}
-
- {#if loading && downloads.length === 0}
- <p class="muted small">{$t("study.common.loading")}</p>
- {:else if downloads.length === 0}
- <p class="muted small">{$t("study.library.telegram.downloads.empty")}</p>
- {:else}
- <ul class="list">
- {#each downloads as d (d.id)}
- <li class="row" data-status={d.status}>
- <div class="row-head">
- <span class="dir-icon" aria-hidden="true">
- {d.direction === "upload" ? "↑" : "↓"}
- </span>
- <span class="title" title={d.file_name}>{d.file_name}</span>
- <button
- type="button"
- class="ghost-icon"
- onclick={() => removeRow(d.id)}
- aria-label={$t("study.common.delete")}
- >
- ✕
- </button>
- </div>
- <div class="row-meta muted small">
- <span>{statusLabel(d.status)}</span>
- {#if d.expected_size > 0}
- <span aria-hidden="true">·</span>
- <span>{formatBytes(d.expected_size)}</span>
- {/if}
- {#if d.status === "downloading" || d.status === "queued"}
- <span aria-hidden="true">·</span>
- <span class="mono">{Math.round(d.progress_pct)}%</span>
- {/if}
- </div>
- {#if d.status === "downloading" || d.status === "queued"}
- <div class="bar-track">
- <div
- class="bar-fill"
- style:width={`${Math.max(0, Math.min(100, d.progress_pct))}%`}
- ></div>
- </div>
- {/if}
- {#if d.error_msg}
- <p class="error small">{d.error_msg}</p>
- {/if}
- {#if isReadable(d)}
- <button
- type="button"
- class="ghost-btn small"
- onclick={() => void openInReader(d)}
- >
- 📖 {$t("study.library.telegram.downloads.open_in_reader")}
- </button>
- {/if}
- </li>
- {/each}
- </ul>
-
- <footer class="foot">
- <button type="button" class="ghost-btn small" onclick={clearFinished}>
- {$t("study.library.telegram.downloads.clear_finished")}
- </button>
- </footer>
- {/if}
- </aside>
-{/if}
-
-<style>
- .drawer {
- position: fixed;
- right: 16px;
- bottom: 16px;
- width: 360px;
- max-height: 60vh;
- display: flex;
- flex-direction: column;
- background: var(--button-elevated);
- border: 1px solid var(--content-border);
- border-radius: calc(var(--border-radius) * 1.4);
- box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
- z-index: 50;
- overflow: hidden;
- animation: slide-in 220ms cubic-bezier(0.22, 1, 0.36, 1);
- }
- @keyframes slide-in {
- from { transform: translateY(12px); opacity: 0; }
- to { transform: translateY(0); opacity: 1; }
- }
- .head {
- display: flex;
- align-items: center;
- gap: 8px;
- padding: 10px 12px;
- border-bottom: 1px solid var(--content-border);
- }
- .head strong {
- color: var(--secondary);
- font-size: 13px;
- }
- .head .muted {
- margin-left: auto;
- margin-right: 4px;
- }
- .ghost-icon {
- background: transparent;
- border: none;
- color: var(--tertiary);
- cursor: pointer;
- font-size: 14px;
- padding: 2px 6px;
- border-radius: var(--border-radius);
- }
- .ghost-icon:hover {
- background: var(--sidebar-highlight);
- color: var(--secondary);
- }
- .list {
- list-style: none;
- margin: 0;
- padding: 0;
- overflow-y: auto;
- max-height: 50vh;
- }
- .row {
- display: flex;
- flex-direction: column;
- gap: 4px;
- padding: 10px 12px;
- border-bottom: 1px solid color-mix(in oklab, var(--content-border) 60%, transparent);
- }
- .row:last-child {
- border-bottom: none;
- }
- .row-head {
- display: flex;
- align-items: center;
- gap: 6px;
- }
- .dir-icon {
- color: var(--accent);
- font-weight: 700;
- width: 12px;
- flex-shrink: 0;
- }
- .row .title {
- flex: 1;
- color: var(--secondary);
- font-size: 13px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .row-meta {
- display: flex;
- gap: 4px;
- align-items: baseline;
- }
- .bar-track {
- width: 100%;
- height: 3px;
- background: color-mix(in oklab, var(--content-border) 70%, transparent);
- border-radius: 2px;
- overflow: hidden;
- }
- .bar-fill {
- height: 100%;
- background: var(--accent);
- transition: width 200ms ease;
- }
- .row[data-status="done"] .bar-fill {
- background: var(--success);
- }
- .row[data-status="error"] .bar-fill,
- .row[data-status="cancelled"] .bar-fill {
- background: var(--error);
- }
- .foot {
- padding: 8px 12px;
- border-top: 1px solid var(--content-border);
- display: flex;
- justify-content: flex-end;
- }
- .ghost-btn {
- background: transparent;
- border: 1px solid var(--input-border);
- border-radius: var(--border-radius);
- color: var(--secondary);
- font-family: inherit;
- cursor: pointer;
- padding: 6px 12px;
- font-size: 12px;
- }
- .ghost-btn:hover {
- border-color: var(--accent);
- color: var(--accent);
- }
- .small {
- font-size: 11px;
- }
- .muted {
- color: var(--tertiary);
- }
- .error {
- color: var(--error);
- }
- .mono {
- font-family: var(--font-mono, "IBM Plex Mono", monospace);
- }
- @media (prefers-reduced-motion: reduce) {
- .drawer {
- animation: none;
- }
- .bar-fill {
- transition: none;
- }
- }
-</style>
diff --git a/src/lib/study-components/anki/EmptyState.svelte b/src/lib/study-components/anki/EmptyState.svelte
deleted file mode 100644
index 546c9f0d..00000000
--- a/src/lib/study-components/anki/EmptyState.svelte
+++ /dev/null
@@ -1,69 +0,0 @@
-<script lang="ts">
- import Mascot from "$lib/components/Mascot.svelte";
-
- let {
- title,
- description = "",
- petSlug = "",
- emoji = "",
- children,
- }: {
- title: string;
- description?: string;
- petSlug?: string;
- emoji?: string;
- children?: any;
- } = $props();
-</script>
-
-<section class="empty">
- {#if petSlug}
- <Mascot slug={petSlug} state="jumping" scale={1} />
- {:else if emoji}
- <span class="empty-emoji" aria-hidden="true">{emoji}</span>
- {/if}
- <h3 class="empty-title">{title}</h3>
- {#if description}
- <p class="empty-desc">{description}</p>
- {/if}
- {#if children}
- <div class="empty-actions">{@render children?.()}</div>
- {/if}
-</section>
-
-<style>
- .empty {
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: var(--space-3);
- padding: var(--space-7) var(--space-5);
- text-align: center;
- }
-
- .empty-emoji {
- font-size: 56px;
- line-height: 1;
- }
-
- .empty-title {
- margin: 0;
- font-size: var(--text-md);
- font-weight: 600;
- color: var(--text);
- }
-
- .empty-desc {
- margin: 0;
- font-size: var(--text-sm);
- color: var(--text-muted);
- max-width: 360px;
- line-height: 1.5;
- }
-
- .empty-actions {
- display: flex;
- gap: var(--space-2);
- margin-top: var(--space-3);
- }
-</style>
diff --git a/src/lib/study-components/anki/PetPicker.svelte b/src/lib/study-components/anki/PetPicker.svelte
deleted file mode 100644
index c80d6def..00000000
--- a/src/lib/study-components/anki/PetPicker.svelte
+++ /dev/null
@@ -1,177 +0,0 @@
-<script lang="ts">
- import { onMount } from "svelte";
- import { ankiPetsList, ankiPetActive, ankiPetSetActive, type AnkiPet } from "$lib/anki-bridge";
- import Mascot from "$lib/components/Mascot.svelte";
- import { showToast } from "$lib/stores/toast-store.svelte";
-
- let pets = $state<AnkiPet[]>([]);
- let active = $state<AnkiPet | null>(null);
- let loading = $state(true);
- let busy = $state(false);
-
- onMount(() => {
- void load();
- });
-
- async function load() {
- loading = true;
- try {
- const [list, current] = await Promise.all([ankiPetsList(), ankiPetActive()]);
- pets = list;
- active = current;
- } finally {
- loading = false;
- }
- }
-
- async function pick(pet: AnkiPet) {
- if (busy || pet.slug === active?.slug) return;
- busy = true;
- try {
- const updated = await ankiPetSetActive(pet.slug);
- active = updated;
- showToast("info", `Mascote: ${updated.display_name}`);
- } catch (e: any) {
- showToast("error", typeof e === "string" ? e : (e?.message ?? "Erro"));
- } finally {
- busy = false;
- }
- }
-</script>
-
-<section class="pets-section">
- <header class="pets-head">
- <h2>Mascote</h2>
- <p class="muted">Quem te acompanha enquanto você revisa.</p>
- </header>
-
- {#if loading}
- <div class="loader"><div class="ring"></div></div>
- {:else}
- <div class="pets-grid">
- {#each pets as pet (pet.slug)}
- {@const isActive = pet.slug === active?.slug}
- <button
- type="button"
- class="pet-card"
- class:pet-active={isActive}
- onclick={() => pick(pet)}
- disabled={busy}
- >
- <Mascot slug={pet.slug} state="idle" scale={0.45} />
- <div class="pet-info">
- <strong>{pet.display_name}</strong>
- <span class="pet-desc">{pet.description}</span>
- </div>
- {#if isActive}<span class="active-badge">Ativo</span>{/if}
- </button>
- {/each}
- </div>
- {/if}
-</section>
-
-<style>
- .pets-section {
- display: flex;
- flex-direction: column;
- gap: var(--space-4);
- }
- .pets-head h2 {
- margin: 0;
- font-size: 16px;
- font-weight: 600;
- }
- .muted {
- margin: 4px 0 0;
- font-size: var(--text-xs);
- color: var(--text-muted);
- }
- .loader {
- display: flex;
- justify-content: center;
- padding: var(--space-5);
- }
- .ring {
- width: 28px;
- height: 28px;
- border-radius: 50%;
- border: 3px solid var(--surface-mut);
- border-top-color: var(--accent);
- animation: spin 0.8s linear infinite;
- }
- @keyframes spin { to { transform: rotate(360deg); } }
-
- .pets-grid {
- display: grid;
- grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
- gap: var(--space-3);
- }
-
- .pet-card {
- position: relative;
- display: flex;
- align-items: flex-start;
- gap: var(--space-3);
- padding: var(--space-3);
- background: var(--surface);
- border: 1px solid var(--border);
- border-radius: var(--radius-sm);
- cursor: pointer;
- text-align: left;
- font-family: inherit;
- color: inherit;
- transition: border-color var(--duration-fast) var(--ease-out),
- transform var(--duration-fast) var(--ease-out),
- box-shadow var(--duration-fast) var(--ease-out);
- }
- .pet-card:hover:not(:disabled) {
- border-color: var(--accent);
- transform: translateY(-2px);
- box-shadow: var(--elev-2);
- }
- .pet-card:disabled {
- opacity: 0.6;
- cursor: not-allowed;
- }
- .pet-card.pet-active {
- border-color: var(--success);
- background: linear-gradient(135deg, color-mix(in srgb, var(--success) 14%, transparent), transparent 60%);
- }
-
- .pet-info {
- flex: 1;
- min-width: 0;
- display: flex;
- flex-direction: column;
- gap: 4px;
- }
- .pet-info strong {
- font-size: var(--text-sm);
- font-weight: 600;
- }
- .pet-desc {
- font-size: var(--text-xs);
- color: var(--text-muted);
- line-height: 1.4;
- }
- .pet-vibes {
- display: flex;
- gap: 4px;
- flex-wrap: wrap;
- margin-top: 4px;
- }
-
- .active-badge {
- position: absolute;
- top: 8px;
- right: 8px;
- background: var(--success);
- color: white;
- font-size: 10px;
- font-weight: 700;
- text-transform: uppercase;
- letter-spacing: 0.5px;
- padding: 2px 8px;
- border-radius: 999px;
- }
-</style>
diff --git a/src/lib/study-components/anki/RatingButton.svelte b/src/lib/study-components/anki/RatingButton.svelte
deleted file mode 100644
index 7163f596..00000000
--- a/src/lib/study-components/anki/RatingButton.svelte
+++ /dev/null
@@ -1,115 +0,0 @@
-<script lang="ts">
- type Rating = "again" | "hard" | "good" | "easy";
-
- let {
- rating,
- shortcut,
- interval = "",
- onclick,
- disabled = false,
- }: {
- rating: Rating;
- shortcut: string;
- interval?: string;
- onclick: () => void;
- disabled?: boolean;
- } = $props();
-
- const meta: Record<Rating, { emoji: string; label: string }> = {
- again: { emoji: "🙈", label: "De novo" },
- hard: { emoji: "😬", label: "Difícil" },
- good: { emoji: "😐", label: "Bom" },
- easy: { emoji: "😊", label: "Fácil" },
- };
- const info = $derived(meta[rating as Rating]);
-</script>
-
-<button
- type="button"
- class="rate rate--{rating}"
- {disabled}
- onclick={onclick}
- aria-label="{info.label} ({shortcut})"
->
- <span class="rate-emoji" aria-hidden="true">{info.emoji}</span>
- <span class="rate-label">{info.label}</span>
- {#if interval}
- <span class="rate-interval">{interval}</span>
- {/if}
- <span class="rate-shortcut">{shortcut}</span>
-</button>
-
-<style>
- .rate {
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: var(--space-1);
- padding: var(--space-3) var(--space-2);
- background: var(--surface-hi);
- border: 1px solid var(--border);
- border-radius: var(--radius-sm);
- color: var(--text);
- font-family: inherit;
- cursor: pointer;
- min-width: 110px;
- transition: background var(--duration-fast) var(--ease-out),
- border-color var(--duration-fast) var(--ease-out),
- transform var(--duration-fast) var(--ease-out);
- }
-
- .rate:hover:not(:disabled) {
- transform: translateY(-2px);
- box-shadow: var(--elev-2);
- }
-
- .rate:active:not(:disabled) {
- transform: translateY(0);
- }
-
- .rate:disabled {
- opacity: 0.5;
- cursor: not-allowed;
- }
-
- .rate-emoji {
- font-size: 28px;
- line-height: 1;
- }
-
- .rate-label {
- font-size: var(--text-sm);
- font-weight: 600;
- }
-
- .rate-interval {
- font-size: var(--text-xs);
- color: var(--text-muted);
- }
-
- .rate-shortcut {
- font-size: 10px;
- font-family: monospace;
- background: var(--surface-mut);
- padding: 1px 6px;
- border-radius: 4px;
- color: var(--text-muted);
- }
-
- .rate--again:hover:not(:disabled) {
- border-color: var(--error);
- background: color-mix(in srgb, var(--error) 14%, transparent);
- }
- .rate--hard:hover:not(:disabled) {
- border-color: var(--warning);
- background: color-mix(in srgb, var(--warning) 14%, transparent);
- }
- .rate--good:hover:not(:disabled) {
- border-color: var(--accent);
- background: color-mix(in srgb, var(--accent) 14%, transparent);
- }
- .rate--easy:hover:not(:disabled) {
- border-color: var(--success);
- background: color-mix(in srgb, var(--success) 14%, transparent);
- }
-</style>
diff --git a/src/lib/study-components/anki/StreakRing.svelte b/src/lib/study-components/anki/StreakRing.svelte
deleted file mode 100644
index 02b3733d..00000000
--- a/src/lib/study-components/anki/StreakRing.svelte
+++ /dev/null
@@ -1,116 +0,0 @@
-<script lang="ts">
- let {
- current,
- longest,
- reviewedToday,
- goal = 50,
- } = $props<{
- current: number;
- longest: number;
- reviewedToday: number;
- goal?: number;
- }>();
-
- const radius = 52;
- const circumference = 2 * Math.PI * radius;
-
- const ratio = $derived(Math.min(1, reviewedToday / Math.max(goal, 1)));
- const dashoffset = $derived(circumference * (1 - ratio));
- const flame = $derived(current >= 30 ? "🔥🔥🔥" : current >= 7 ? "🔥🔥" : current >= 3 ? "🔥" : "✨");
-</script>
-
-<div class="streak">
- <svg viewBox="0 0 120 120" width="120" height="120" class="streak-ring" aria-hidden="true">
- <circle cx="60" cy="60" r={radius} fill="none" stroke="var(--surface-mut)" stroke-width="8" />
- <circle
- cx="60"
- cy="60"
- r={radius}
- fill="none"
- stroke="var(--accent)"
- stroke-width="8"
- stroke-linecap="round"
- stroke-dasharray={circumference}
- stroke-dashoffset={dashoffset}
- transform="rotate(-90 60 60)"
- class="streak-progress"
- />
- </svg>
- <div class="streak-center">
- <span class="streak-flame">{flame}</span>
- <span class="streak-current">{current}</span>
- <span class="streak-label">{current === 1 ? "dia" : "dias"}</span>
- </div>
-</div>
-
-<div class="streak-stats">
- <span><strong>{reviewedToday}</strong> hoje</span>
- <span class="dot">·</span>
- <span><strong>{longest}</strong> recorde</span>
-</div>
-
-<style>
- .streak {
- position: relative;
- width: 120px;
- height: 120px;
- margin-inline: auto;
- }
-
- .streak-ring {
- position: absolute;
- inset: 0;
- }
-
- .streak-progress {
- transition: stroke-dashoffset var(--duration-base) var(--ease-out);
- }
-
- .streak-center {
- position: absolute;
- inset: 0;
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- gap: 2px;
- }
-
- .streak-flame {
- font-size: 18px;
- line-height: 1;
- }
-
- .streak-current {
- font-size: 28px;
- font-weight: 700;
- line-height: 1;
- color: var(--accent);
- }
-
- .streak-label {
- font-size: var(--text-xs);
- text-transform: uppercase;
- letter-spacing: 0.5px;
- color: var(--text-muted);
- }
-
- .streak-stats {
- display: flex;
- align-items: center;
- justify-content: center;
- gap: var(--space-2);
- margin-top: var(--space-2);
- font-size: var(--text-xs);
- color: var(--text-muted);
- }
-
- .streak-stats strong {
- color: var(--text);
- font-weight: 600;
- }
-
- .dot {
- opacity: 0.5;
- }
-</style>
diff --git a/src/lib/study-components/notes/RefsPanel.svelte b/src/lib/study-components/notes/RefsPanel.svelte
deleted file mode 100644
index 3e1696e9..00000000
--- a/src/lib/study-components/notes/RefsPanel.svelte
+++ /dev/null
@@ -1,293 +0,0 @@
-<script lang="ts">
- import { t } from "$lib/i18n";
- import {
- notesBlocksPropertyListKeys,
- type LinkedRef,
- type PropertyKeyStat,
- } from "$lib/notes-bridge";
-
- type Props = {
- linkedRefs: LinkedRef[];
- unlinkedRefs: LinkedRef[];
- loading: boolean;
- active: boolean;
- pageId: number | null;
- onPageNavigate: (name: string) => void;
- };
-
- let { linkedRefs, unlinkedRefs, loading, active, pageId, onPageNavigate }: Props = $props();
-
- type Tab = "linked" | "unlinked" | "props";
- let tab = $state<Tab>("linked");
-
- let propsLoading = $state(false);
- let propsList = $state<PropertyKeyStat[]>([]);
-
- const RESERVED_KEYS = ["status", "deadline", "timestamp", "tags"];
-
- async function loadProps() {
- if (!pageId) {
- propsList = [];
- return;
- }
- propsLoading = true;
- try {
- const all = await notesBlocksPropertyListKeys({ pageId });
- propsList = all;
- } catch (e) {
- console.error("loadProps failed", e);
- propsList = [];
- } finally {
- propsLoading = false;
- }
- }
-
- $effect(() => {
- if (active && tab === "props" && pageId !== null) {
- void loadProps();
- }
- });
-
- $effect(() => {
- if (pageId !== null && tab === "props") {
- void loadProps();
- }
- });
-</script>
-
-<aside class="refs-panel">
- {#if active}
- <nav class="tabs" role="tablist" aria-label="Refs e propriedades">
- <button
- type="button"
- class="tab"
- class:active={tab === "linked"}
- role="tab"
- aria-selected={tab === "linked"}
- onclick={() => (tab = "linked")}
- >
- Linked <span class="tab-count">{linkedRefs.length}</span>
- </button>
- <button
- type="button"
- class="tab"
- class:active={tab === "unlinked"}
- role="tab"
- aria-selected={tab === "unlinked"}
- onclick={() => (tab = "unlinked")}
- >
- Unlinked <span class="tab-count">{unlinkedRefs.length}</span>
- </button>
- <button
- type="button"
- class="tab"
- class:active={tab === "props"}
- role="tab"
- aria-selected={tab === "props"}
- onclick={() => (tab = "props")}
- >
- Props
- </button>
- </nav>
-
- {#if tab === "linked"}
- {#if loading}
- <div class="state-sm">Carregando…</div>
- {:else if linkedRefs.length === 0}
- <p class="empty">{$t("study.library.notes_no_references")}</p>
- {:else}
- <ul class="ref-list">
- {#each linkedRefs as r (r.block_id)}
- <li>
- <button
- class="ref-row"
- onclick={() => onPageNavigate(r.page_name)}
- >
- <span class="ref-page">{r.page_name}</span>
- <span class="ref-snippet">{r.snippet}</span>
- </button>
- </li>
- {/each}
- </ul>
- {/if}
- {:else if tab === "unlinked"}
- {#if unlinkedRefs.length === 0}
- <p class="empty">Nada por aqui.</p>
- {:else}
- <ul class="ref-list">
- {#each unlinkedRefs.slice(0, 30) as r (r.block_id)}
- <li>
- <button
- class="ref-row subtle"
- onclick={() => onPageNavigate(r.page_name)}
- >
- <span class="ref-page">{r.page_name}</span>
- <span class="ref-snippet">{r.snippet}</span>
- </button>
- </li>
- {/each}
- </ul>
- {/if}
- {:else if tab === "props"}
- {#if propsLoading}
- <div class="state-sm">Carregando propriedades…</div>
- {:else if propsList.length === 0}
- <p class="empty">Sem propriedades nesta página.</p>
- {:else}
- <ul class="prop-list">
- {#each propsList as p (p.key)}
- <li class="prop-row">
- <span class="prop-key" class:reserved={RESERVED_KEYS.includes(p.key)}>
- {p.key}
- </span>
- <span class="prop-stats">
- {p.block_count} bloco{p.block_count === 1 ? "" : "s"} · {p.distinct_values} valor{p.distinct_values === 1 ? "" : "es"}
- </span>
- </li>
- {/each}
- </ul>
- {/if}
- {/if}
- {/if}
-</aside>
-
-<style>
- .refs-panel {
- border-left: 1px solid color-mix(in oklab, var(--input-border) 60%, transparent);
- padding: 12px;
- overflow-y: auto;
- display: flex;
- flex-direction: column;
- gap: 12px;
- }
- .tabs {
- display: flex;
- gap: 2px;
- border-bottom: 1px solid color-mix(in oklab, var(--input-border) 60%, transparent);
- padding-bottom: 4px;
- }
- .tab {
- flex: 1;
- padding: 6px 8px;
- border: 0;
- background: transparent;
- color: var(--tertiary);
- font: inherit;
- font-size: 11px;
- font-weight: 600;
- text-transform: uppercase;
- letter-spacing: 0.04em;
- cursor: pointer;
- border-bottom: 2px solid transparent;
- transition: color 120ms ease, border-color 120ms ease;
- border-radius: var(--border-radius) var(--border-radius) 0 0;
- }
- .tab:hover {
- color: var(--text);
- }
- .tab.active {
- color: var(--accent);
- border-bottom-color: var(--accent);
- }
- .tab-count {
- display: inline-block;
- margin-left: 4px;
- padding: 1px 6px;
- background: color-mix(in oklab, var(--accent) 14%, transparent);
- color: var(--accent);
- border-radius: 999px;
- font-size: 10px;
- text-transform: none;
- font-weight: 500;
- }
- .ref-list {
- list-style: none;
- margin: 0;
- padding: 0;
- display: flex;
- flex-direction: column;
- gap: 4px;
- }
- .ref-row {
- width: 100%;
- display: flex;
- flex-direction: column;
- gap: 2px;
- padding: 6px 8px;
- border: 0;
- border-radius: var(--border-radius);
- background: color-mix(in oklab, var(--input-border) 18%, transparent);
- color: var(--text);
- text-align: left;
- cursor: pointer;
- font: inherit;
- transition: background 150ms ease;
- }
- .ref-row:hover {
- background: color-mix(in oklab, var(--accent) 12%, transparent);
- }
- .ref-row.subtle {
- background: transparent;
- border: 1px dashed color-mix(in oklab, var(--input-border) 60%, transparent);
- }
- .ref-page {
- font-size: 11px;
- color: var(--accent);
- font-family: var(--font-mono, ui-monospace, monospace);
- }
- .ref-snippet {
- font-size: 12px;
- color: var(--secondary);
- line-height: 1.4;
- overflow: hidden;
- display: -webkit-box;
- -webkit-line-clamp: 3;
- line-clamp: 3;
- -webkit-box-orient: vertical;
- }
- .prop-list {
- list-style: none;
- margin: 0;
- padding: 0;
- display: flex;
- flex-direction: column;
- gap: 4px;
- }
- .prop-row {
- display: flex;
- flex-direction: column;
- gap: 2px;
- padding: 6px 8px;
- border-radius: var(--border-radius);
- background: color-mix(in oklab, var(--input-border) 14%, transparent);
- }
- .prop-key {
- font-size: 12px;
- font-family: var(--font-mono, ui-monospace, monospace);
- color: var(--text);
- font-weight: 500;
- }
- .prop-key.reserved {
- color: var(--accent);
- }
- .prop-stats {
- font-size: 10px;
- color: var(--tertiary);
- }
- .state-sm {
- color: var(--tertiary);
- font-size: 12px;
- }
- .empty {
- color: var(--tertiary);
- font-size: 12px;
- padding: 8px 0;
- margin: 0;
- }
- @media (prefers-reduced-motion: reduce) {
- .ref-row,
- .tab {
- transition: none;
- }
- }
-</style>
diff --git a/src/lib/study-components/notes/SidebarTree.svelte b/src/lib/study-components/notes/SidebarTree.svelte
deleted file mode 100644
index 14022522..00000000
--- a/src/lib/study-components/notes/SidebarTree.svelte
+++ /dev/null
@@ -1,562 +0,0 @@
-<script lang="ts">
- import { onMount } from "svelte";
- import { t } from "$lib/i18n";
- import {
- notesPagesListByTag,
- notesSettingsGet,
- notesSettingsSet,
- type PageSummary,
- type TagSummary,
- } from "$lib/notes-bridge";
-
- type Props = {
- pages: PageSummary[];
- tags: TagSummary[];
- selectedPageId: number | null;
- searchValue: string;
- recentLimit: number;
- onCreate: () => void;
- onSelect: (pageId: number) => void;
- onJournalToday: () => void;
- onSearchInput: (value: string) => void;
- onShowMore: () => void;
- };
-
- let {
- pages,
- tags,
- selectedPageId,
- searchValue,
- recentLimit,
- onCreate,
- onSelect,
- onJournalToday,
- onSearchInput,
- onShowMore,
- }: Props = $props();
-
- let favorites = $state<PageSummary[]>([]);
- let sidebarWidth = $state<number | null>(null);
- let resizing = false;
- let resizeStartX = 0;
- let resizeStartWidth = 0;
-
- const SIDEBAR_WIDTH_KEY = "sidebar:width";
- const SIDEBAR_WIDTH_DEFAULT = 280;
- const SIDEBAR_WIDTH_MIN = 200;
- const SIDEBAR_WIDTH_MAX = 480;
-
- async function loadFavorites() {
- try {
- favorites = await notesPagesListByTag("favorite");
- } catch (e) {
- console.error("loadFavorites failed", e);
- }
- }
-
- async function loadWidth() {
- try {
- const r = await notesSettingsGet(SIDEBAR_WIDTH_KEY);
- const v = r.value;
- if (typeof v === "number" && v >= SIDEBAR_WIDTH_MIN && v <= SIDEBAR_WIDTH_MAX) {
- sidebarWidth = v;
- } else {
- sidebarWidth = SIDEBAR_WIDTH_DEFAULT;
- }
- } catch {
- sidebarWidth = SIDEBAR_WIDTH_DEFAULT;
- }
- }
-
- async function saveWidth(w: number) {
- try {
- await notesSettingsSet({ key: SIDEBAR_WIDTH_KEY, value: w });
- } catch (e) {
- console.error("saveWidth failed", e);
- }
- }
-
- function onResizeStart(e: PointerEvent) {
- resizing = true;
- resizeStartX = e.clientX;
- resizeStartWidth = sidebarWidth ?? SIDEBAR_WIDTH_DEFAULT;
- (e.currentTarget as HTMLElement).setPointerCapture(e.pointerId);
- }
-
- function onResizeMove(e: PointerEvent) {
- if (!resizing) return;
- const next = Math.max(
- SIDEBAR_WIDTH_MIN,
- Math.min(SIDEBAR_WIDTH_MAX, resizeStartWidth + (e.clientX - resizeStartX)),
- );
- sidebarWidth = next;
- }
-
- function onResizeEnd(e: PointerEvent) {
- if (!resizing) return;
- resizing = false;
- (e.currentTarget as HTMLElement).releasePointerCapture(e.pointerId);
- if (sidebarWidth) void saveWidth(sidebarWidth);
- }
-
- onMount(() => {
- void loadFavorites();
- void loadWidth();
- });
-
- function fmtDay(secs: number): string {
- if (!secs) return "—";
- const d = new Date(secs * 1000);
- const today = new Date();
- const same =
- d.getFullYear() === today.getFullYear() &&
- d.getMonth() === today.getMonth() &&
- d.getDate() === today.getDate();
- if (same) return "hoje";
- const yest = new Date(today);
- yest.setDate(today.getDate() - 1);
- if (
- d.getFullYear() === yest.getFullYear() &&
- d.getMonth() === yest.getMonth() &&
- d.getDate() === yest.getDate()
- )
- return "ontem";
- return d.toLocaleDateString();
- }
-
- function matchesSearch(p: PageSummary, q: string): boolean {
- if (!q) return true;
- return (
- p.name.toLowerCase().includes(q) ||
- (p.title ?? "").toLowerCase().includes(q)
- );
- }
-
- function isCoursePage(p: PageSummary): boolean {
- return p.name.startsWith("course/");
- }
-
- const query = $derived(searchValue.trim().toLowerCase());
-
- const sectionFavorites = $derived.by(() =>
- favorites.filter((p) => matchesSearch(p, query)),
- );
-
- const sectionRecent = $derived.by(() =>
- pages
- .filter((p) => matchesSearch(p, query))
- .filter((p) => !isCoursePage(p))
- .slice()
- .sort((a, b) => b.updated_at - a.updated_at)
- .slice(0, 10),
- );
-
- const sectionPages = $derived.by(() =>
- pages
- .filter((p) => matchesSearch(p, query))
- .filter((p) => !isCoursePage(p))
- .slice()
- .sort((a, b) =>
- (a.title ?? a.name).localeCompare(b.title ?? b.name, "pt-BR", {
- sensitivity: "base",
- }),
- ),
- );
-
- const sectionCursos = $derived.by(() =>
- pages
- .filter((p) => matchesSearch(p, query))
- .filter(isCoursePage)
- .slice()
- .sort((a, b) => a.name.localeCompare(b.name, "pt-BR")),
- );
-
- const sectionTags = $derived.by(() =>
- tags.filter((t) => !query || t.name.toLowerCase().includes(query)),
- );
-</script>
-
-<aside
- class="sidebar"
- style:width={sidebarWidth ? `${sidebarWidth}px` : undefined}
->
- <header class="sidebar-head">
- <h2 class="page-title">Notes</h2>
- <button class="btn ghost sm" onclick={onCreate}>
- + Nova
- </button>
- </header>
-
- <div class="quick-actions">
- <button class="quick" onclick={onJournalToday}>
- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
- <rect x="3" y="4" width="18" height="18" rx="2" />
- <path d="M3 10h18 M8 2v4 M16 2v4" />
- </svg>
- <span>Journal hoje</span>
- </button>
- <a class="quick" href="/study/notes/journal">
- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
- <rect x="3" y="4" width="18" height="18" rx="2" />
- <path d="M3 10h18 M8 2v4 M16 2v4 M12 14v3l2 1" />
- </svg>
- <span>Histórico de journal</span>
- </a>
- <a class="quick" href="/study/notes/search">
- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
- <circle cx="11" cy="11" r="7" />
- <path d="M21 21l-4.3-4.3" />
- </svg>
- <span>Buscar</span>
- </a>
- <a class="quick" href="/study/notes/graph">
- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
- <circle cx="6" cy="6" r="2.5" />
- <circle cx="18" cy="6" r="2.5" />
- <circle cx="12" cy="18" r="2.5" />
- <path d="M8 7l3 9 M16 7l-3 9 M9 6h6" />
- </svg>
- <span>Grafo</span>
- </a>
- <a class="quick" href="/study/notes/templates">
- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
- <path d="M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z M14 3v5h5" />
- </svg>
- <span>Templates</span>
- </a>
- </div>
-
- <input
- class="sidebar-search"
- placeholder={$t("study.library.notes_filter_pages") as string}
- value={searchValue}
- oninput={(e) => onSearchInput((e.target as HTMLInputElement).value)}
- />
-
- {#if sectionFavorites.length > 0}
- <section class="sidebar-section">
- <h3>
- <svg class="section-icon" viewBox="0 0 24 24" width="13" height="13" fill="currentColor" stroke="none" aria-hidden="true">
- <path d="M12 2l2.9 6.5 7.1.6-5.4 4.7 1.7 7-6.3-3.8-6.3 3.8 1.7-7L2 9.1l7.1-.6z" />
- </svg>
- Favoritas
- </h3>
- <ul class="page-list">
- {#each sectionFavorites as p (p.id)}
- <li>
- <button
- class="page-row"
- class:active={selectedPageId === p.id}
- onclick={() => onSelect(p.id)}
- >
- <span class="page-name">{p.title ?? p.name}</span>
- <span class="page-meta">
- {p.block_count} bloco{p.block_count === 1 ? "" : "s"} · {fmtDay(p.updated_at)}
- </span>
- </button>
- </li>
- {/each}
- </ul>
- </section>
- {/if}
-
- {#if sectionRecent.length > 0}
- <section class="sidebar-section">
- <h3>Recentes</h3>
- <ul class="page-list">
- {#each sectionRecent as p (p.id)}
- <li>
- <button
- class="page-row"
- class:active={selectedPageId === p.id}
- onclick={() => onSelect(p.id)}
- >
- <span class="page-name">{p.title ?? p.name}</span>
- <span class="page-meta">{fmtDay(p.updated_at)}</span>
- </button>
- </li>
- {/each}
- </ul>
- </section>
- {/if}
-
- <section class="sidebar-section">
- <h3>{$t("study.library.notes_pages_section")}</h3>
- <ul class="page-list">
- {#each sectionPages.slice(0, recentLimit) as p (p.id)}
- <li>
- <button
- class="page-row"
- class:active={selectedPageId === p.id}
- onclick={() => onSelect(p.id)}
- >
- <span class="page-name">{p.title ?? p.name}</span>
- <span class="page-meta">
- {p.block_count} bloco{p.block_count === 1 ? "" : "s"} · {fmtDay(p.updated_at)}
- </span>
- </button>
- </li>
- {:else}
- <li class="empty">{$t("study.library.notes_no_pages")}</li>
- {/each}
- </ul>
- {#if sectionPages.length > recentLimit}
- <button class="btn ghost sm full" onclick={onShowMore}>
- Mostrar mais
- </button>
- {/if}
- </section>
-
- {#if sectionCursos.length > 0}
- <section class="sidebar-section">
- <h3>
- <svg class="section-icon" viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
- <path d="M4 4h6a3 3 0 0 1 3 3v13a2 2 0 0 0-2-2H4z M20 4h-6a3 3 0 0 0-3 3v13a2 2 0 0 1 2-2h7z" />
- </svg>
- Cursos
- </h3>
- <ul class="page-list">
- {#each sectionCursos as p (p.id)}
- <li>
- <button
- class="page-row"
- class:active={selectedPageId === p.id}
- onclick={() => onSelect(p.id)}
- >
- <span class="page-name">{p.title ?? p.name}</span>
- <span class="page-meta page-name">{p.name}</span>
- </button>
- </li>
- {/each}
- </ul>
- </section>
- {/if}
-
- {#if sectionTags.length > 0}
- <section class="sidebar-section">
- <h3>Tags</h3>
- <div class="tag-cloud">
- {#each sectionTags as tag (tag.page_id)}
- <button class="tag-chip" onclick={() => onSelect(tag.page_id)}>
- <span>#{tag.name}</span>
- <span class="tag-count">{tag.ref_count}</span>
- </button>
- {/each}
- </div>
- </section>
- {/if}
-
- <div
- class="resize-handle"
- role="separator"
- aria-label="Redimensionar sidebar"
- aria-orientation="vertical"
- onpointerdown={onResizeStart}
- onpointermove={onResizeMove}
- onpointerup={onResizeEnd}
- onpointercancel={onResizeEnd}
- ></div>
-</aside>
-
-<style>
- .sidebar {
- position: relative;
- border-right: 1px solid color-mix(in oklab, var(--input-border) 60%, transparent);
- display: flex;
- flex-direction: column;
- gap: 12px;
- padding: 12px;
- overflow-y: auto;
- overflow-x: hidden;
- }
- .sidebar-head {
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- .sidebar-head h2 {
- margin: 0;
- font-size: 16px;
- }
- .quick-actions {
- display: flex;
- flex-direction: column;
- gap: 4px;
- }
- .quick {
- display: flex;
- align-items: center;
- gap: 8px;
- padding: 8px 10px;
- border: 0;
- border-radius: var(--border-radius);
- background: transparent;
- color: var(--secondary);
- font: inherit;
- font-size: 13px;
- text-decoration: none;
- cursor: pointer;
- transition: background 120ms ease;
- }
- .quick:hover {
- background: color-mix(in oklab, var(--accent) 8%, transparent);
- color: var(--text);
- }
- .sidebar-search {
- padding: 8px 10px;
- border: 1px solid var(--input-border);
- border-radius: var(--border-radius);
- background: var(--bg);
- color: var(--text);
- font: inherit;
- font-size: 13px;
- }
- .sidebar-search:focus {
- outline: none;
- border-color: var(--accent);
- }
- .sidebar-section {
- display: flex;
- flex-direction: column;
- gap: 6px;
- }
- .sidebar-section h3 {
- margin: 0;
- font-size: 11px;
- font-weight: 600;
- text-transform: uppercase;
- letter-spacing: 0.05em;
- color: var(--tertiary);
- display: flex;
- align-items: center;
- gap: 6px;
- }
- .section-icon {
- flex-shrink: 0;
- }
- .quick svg {
- flex-shrink: 0;
- color: var(--tertiary);
- }
- .quick:hover svg {
- color: currentColor;
- }
- .page-list {
- list-style: none;
- margin: 0;
- padding: 0;
- display: flex;
- flex-direction: column;
- gap: 2px;
- }
- .page-row {
- width: 100%;
- display: flex;
- flex-direction: column;
- gap: 2px;
- padding: 6px 8px;
- border: 0;
- border-radius: var(--border-radius);
- background: transparent;
- color: var(--text);
- text-align: left;
- cursor: pointer;
- font: inherit;
- transition: background 120ms ease;
- }
- .page-row:hover {
- background: color-mix(in oklab, var(--accent) 6%, transparent);
- }
- .page-row.active {
- background: color-mix(in oklab, var(--accent) 14%, transparent);
- }
- .page-name {
- font-size: 13px;
- font-weight: 500;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .page-meta {
- font-size: 10px;
- color: var(--tertiary);
- }
- .empty {
- color: var(--tertiary);
- font-size: 12px;
- padding: 8px 0;
- }
- .tag-cloud {
- display: flex;
- flex-wrap: wrap;
- gap: 4px;
- }
- .tag-chip {
- display: flex;
- align-items: center;
- gap: 4px;
- padding: 3px 8px;
- border-radius: 999px;
- border: 0;
- background: color-mix(in oklab, var(--accent) 10%, transparent);
- color: var(--accent);
- font: inherit;
- font-size: 11px;
- cursor: pointer;
- }
- .tag-chip:hover {
- background: color-mix(in oklab, var(--accent) 18%, transparent);
- }
- .tag-count {
- color: var(--tertiary);
- font-weight: 500;
- }
- .btn {
- padding: 6px 12px;
- border-radius: var(--border-radius);
- border: 1px solid transparent;
- font: inherit;
- font-size: 12px;
- font-weight: 500;
- cursor: pointer;
- transition: background 150ms ease, border-color 150ms ease;
- }
- .btn.ghost {
- background: transparent;
- border-color: var(--input-border);
- color: var(--text);
- }
- .btn.ghost:hover {
- background: color-mix(in oklab, var(--accent) 8%, transparent);
- }
- .btn.sm {
- padding: 4px 10px;
- font-size: 11px;
- }
- .btn.full {
- width: 100%;
- }
- .resize-handle {
- position: absolute;
- top: 0;
- right: -3px;
- bottom: 0;
- width: 6px;
- cursor: ew-resize;
- background: transparent;
- z-index: 10;
- transition: background 120ms ease;
- }
- .resize-handle:hover,
- .resize-handle:active {
- background: color-mix(in oklab, var(--accent) 30%, transparent);
- }
- @media (prefers-reduced-motion: reduce) {
- .quick,
- .page-row,
- .tag-chip,
- .btn {
- transition: none;
- }
- }
-</style>
diff --git a/src/lib/study-components/player/PlayerShell.svelte b/src/lib/study-components/player/PlayerShell.svelte
index 5de9e2e5..6ebc506d 100644
--- a/src/lib/study-components/player/PlayerShell.svelte
+++ b/src/lib/study-components/player/PlayerShell.svelte
@@ -470,6 +470,8 @@
</button>
</header>
+ <div class="scrim-bottom" aria-hidden="true"></div>
+
<footer class="bottom-bar">
<!-- svelte-ignore a11y_click_events_have_key_events -->
<!-- svelte-ignore a11y_no_static_element_interactions -->
@@ -858,7 +860,6 @@
.bottom-bar {
bottom: 0;
- background: linear-gradient(to top, color-mix(in oklab, black 78%, transparent) 30%, transparent);
display: flex;
flex-direction: column;
gap: 4px;
@@ -872,6 +873,37 @@
pointer-events: none;
}
+ .scrim-bottom {
+ position: absolute;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ height: 38%;
+ min-height: 96px;
+ z-index: 3;
+ pointer-events: none;
+ background: linear-gradient(
+ to top,
+ color-mix(in oklab, black 60%, transparent) 0%,
+ color-mix(in oklab, black 28%, transparent) 45%,
+ transparent 100%
+ );
+ opacity: 0.55;
+ transition: opacity 280ms ease;
+ }
+
+ .shell.controls-visible .scrim-bottom {
+ opacity: 1;
+ }
+
+ .shell.paused .scrim-bottom {
+ opacity: 1;
+ }
+
+ .shell:not(.controls-visible):not(.paused) {
+ cursor: none;
+ }
+
.shell.paused .top-bar,
.shell.paused .bottom-bar {
opacity: 1;
diff --git a/src/lib/study-components/player/SpeedPicker.svelte b/src/lib/study-components/player/SpeedPicker.svelte
deleted file mode 100644
index 465f6285..00000000
--- a/src/lib/study-components/player/SpeedPicker.svelte
+++ /dev/null
@@ -1,161 +0,0 @@
-<script lang="ts">
- type Props = {
- value: number;
- onChange: (next: number) => void;
- };
-
- let { value, onChange }: Props = $props();
- let open = $state(false);
- let trigger = $state<HTMLButtonElement | null>(null);
- let menu = $state<HTMLDivElement | null>(null);
-
- const options = [0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0];
-
- function pick(speed: number) {
- onChange(speed);
- open = false;
- trigger?.focus();
- }
-
- function onDocClick(e: MouseEvent) {
- if (!open) return;
- const target = e.target as Node;
- if (trigger?.contains(target) || menu?.contains(target)) return;
- open = false;
- }
-
- function onKey(e: KeyboardEvent) {
- if (open && e.key === "Escape") {
- open = false;
- trigger?.focus();
- }
- }
-
- $effect(() => {
- if (!open) return;
- document.addEventListener("click", onDocClick);
- document.addEventListener("keydown", onKey);
- return () => {
- document.removeEventListener("click", onDocClick);
- document.removeEventListener("keydown", onKey);
- };
- });
-
- function fmt(v: number): string {
- return Number.isInteger(v) ? `${v}×` : `${v}×`;
- }
-</script>
-
-<div class="speed">
- <button
- type="button"
- class="trigger"
- bind:this={trigger}
- aria-haspopup="listbox"
- aria-expanded={open}
- aria-label="Velocidade de reprodução"
- onclick={() => (open = !open)}
- >
- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
- <circle cx="12" cy="12" r="10" />
- <polyline points="12 6 12 12 15 13" />
- </svg>
- <span class="lbl">{fmt(value)}</span>
- </button>
- {#if open}
- <div class="menu" role="listbox" bind:this={menu}>
- {#each options as o (o)}
- {@const sel = Math.abs(o - value) < 0.001}
- <button
- type="button"
- role="option"
- class="opt"
- class:selected={sel}
- aria-selected={sel}
- onclick={() => pick(o)}
- >
- <span class="check">{sel ? "✓" : ""}</span>
- <span>{fmt(o)}</span>
- </button>
- {/each}
- </div>
- {/if}
-</div>
-
-<style>
- .speed {
- position: relative;
- display: inline-block;
- }
-
- .trigger {
- display: inline-flex;
- align-items: center;
- gap: 6px;
- padding: 6px 10px;
- background: color-mix(in oklab, var(--content-bg) 80%, var(--accent) 4%);
- border: 1px solid color-mix(in oklab, var(--content-border) 70%, transparent);
- border-radius: 8px;
- color: inherit;
- font-size: 12px;
- cursor: pointer;
- transition: background var(--tg-duration-fast, 150ms);
- }
-
- .trigger:hover {
- background: color-mix(in oklab, var(--accent) 10%, var(--content-bg) 90%);
- }
-
- .lbl {
- font-weight: 600;
- font-variant-numeric: tabular-nums;
- }
-
- .menu {
- position: absolute;
- bottom: calc(100% + 6px);
- right: 0;
- min-width: 100px;
- background: var(--content-bg);
- border: 1px solid color-mix(in oklab, var(--content-border) 80%, transparent);
- border-radius: 10px;
- box-shadow: 0 8px 24px color-mix(in oklab, black 30%, transparent);
- padding: 4px;
- z-index: 60;
- display: flex;
- flex-direction: column;
- gap: 2px;
- }
-
- .opt {
- display: flex;
- align-items: center;
- gap: 8px;
- padding: 7px 10px;
- background: transparent;
- border: none;
- border-radius: 6px;
- color: inherit;
- font-size: 13px;
- text-align: left;
- cursor: pointer;
- width: 100%;
- font-variant-numeric: tabular-nums;
- }
-
- .opt:hover {
- background: color-mix(in oklab, var(--accent) 8%, transparent);
- }
-
- .opt.selected {
- color: var(--accent);
- font-weight: 600;
- }
-
- .check {
- width: 14px;
- text-align: center;
- color: var(--accent);
- flex: 0 0 auto;
- }
-</style>
diff --git a/src/lib/study-components/player/TrackPicker.svelte b/src/lib/study-components/player/TrackPicker.svelte
deleted file mode 100644
index 38c08bee..00000000
--- a/src/lib/study-components/player/TrackPicker.svelte
+++ /dev/null
@@ -1,228 +0,0 @@
-<script lang="ts" generics="T extends { path: string; lang: string; label: string; format: string; default: boolean }">
- type Props = {
- label: string;
- icon?: "captions" | "audio";
- tracks: T[];
- selectedLang: string | null;
- onSelect: (lang: string | null) => void;
- showOff?: boolean;
- settingsHref?: string;
- };
-
- let {
- label,
- icon = "captions",
- tracks,
- selectedLang,
- onSelect,
- showOff = true,
- settingsHref,
- }: Props = $props();
-
- let open = $state(false);
- let trigger = $state<HTMLButtonElement | null>(null);
- let menu = $state<HTMLDivElement | null>(null);
-
- const currentLabel = $derived.by(() => {
- if (selectedLang == null) return showOff ? "Off" : tracks[0]?.label ?? "—";
- const found = tracks.find((t) => t.lang === selectedLang);
- return found?.label ?? "—";
- });
-
- function pick(lang: string | null) {
- onSelect(lang);
- open = false;
- trigger?.focus();
- }
-
- function onDocClick(e: MouseEvent) {
- if (!open) return;
- const target = e.target as Node;
- if (trigger?.contains(target) || menu?.contains(target)) return;
- open = false;
- }
-
- function onKey(e: KeyboardEvent) {
- if (open && e.key === "Escape") {
- open = false;
- trigger?.focus();
- }
- }
-
- $effect(() => {
- if (!open) return;
- document.addEventListener("click", onDocClick);
- document.addEventListener("keydown", onKey);
- return () => {
- document.removeEventListener("click", onDocClick);
- document.removeEventListener("keydown", onKey);
- };
- });
-</script>
-
-<div class="picker">
- <button
- type="button"
- class="trigger"
- bind:this={trigger}
- aria-haspopup="listbox"
- aria-expanded={open}
- aria-label={label}
- title={label}
- onclick={() => (open = !open)}
- >
- {#if icon === "captions"}
- <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
- <rect x="3" y="5" width="18" height="14" rx="2" />
- <path d="M7 12h3M14 12h3M7 16h6" />
- </svg>
- {:else}
- <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
- <path d="M11 5L6 9H2v6h4l5 4z" />
- <path d="M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07" />
- </svg>
- {/if}
- <span class="lbl">{currentLabel}</span>
- </button>
- {#if open}
- <div class="menu" role="listbox" aria-label={label} bind:this={menu}>
- {#if showOff}
- {@const isOff = selectedLang == null}
- <button
- type="button"
- role="option"
- class="opt"
- class:selected={isOff}
- aria-selected={isOff}
- onclick={() => pick(null)}
- >
- <span class="check">{isOff ? "✓" : ""}</span>
- <span>Off</span>
- </button>
- <div class="divider"></div>
- {/if}
- {#each tracks as t (t.lang + t.path)}
- {@const sel = t.lang === selectedLang}
- <button
- type="button"
- role="option"
- class="opt"
- class:selected={sel}
- aria-selected={sel}
- onclick={() => pick(t.lang)}
- >
- <span class="check">{sel ? "✓" : ""}</span>
- <span>{t.label}</span>
- <span class="fmt">{t.format.toUpperCase()}</span>
- </button>
- {/each}
- {#if settingsHref}
- <div class="divider"></div>
- <a class="opt cfg" href={settingsHref}>
- <span class="check"></span>
- <span>Configurações…</span>
- </a>
- {/if}
- </div>
- {/if}
-</div>
-
-<style>
- .picker {
- position: relative;
- display: inline-block;
- }
-
- .trigger {
- display: inline-flex;
- align-items: center;
- gap: 6px;
- padding: 6px 10px;
- background: color-mix(in oklab, var(--content-bg) 80%, var(--accent) 4%);
- border: 1px solid color-mix(in oklab, var(--content-border) 70%, transparent);
- border-radius: 8px;
- color: inherit;
- font-size: 12px;
- cursor: pointer;
- transition: background var(--tg-duration-fast, 150ms);
- }
-
- .trigger:hover {
- background: color-mix(in oklab, var(--accent) 10%, var(--content-bg) 90%);
- }
-
- .lbl {
- font-weight: 500;
- max-width: 120px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
-
- .menu {
- position: absolute;
- bottom: calc(100% + 6px);
- right: 0;
- min-width: 200px;
- background: var(--content-bg);
- border: 1px solid color-mix(in oklab, var(--content-border) 80%, transparent);
- border-radius: 10px;
- box-shadow: 0 8px 24px color-mix(in oklab, black 30%, transparent);
- padding: 4px;
- z-index: 60;
- display: flex;
- flex-direction: column;
- gap: 2px;
- }
-
- .opt {
- display: flex;
- align-items: center;
- gap: 8px;
- padding: 7px 10px;
- background: transparent;
- border: none;
- border-radius: 6px;
- color: inherit;
- font-size: 13px;
- text-align: left;
- cursor: pointer;
- width: 100%;
- text-decoration: none;
- }
-
- .opt:hover {
- background: color-mix(in oklab, var(--accent) 8%, transparent);
- }
-
- .opt.selected {
- color: var(--accent);
- font-weight: 600;
- }
-
- .check {
- width: 14px;
- color: var(--accent);
- text-align: center;
- flex: 0 0 auto;
- }
-
- .fmt {
- margin-left: auto;
- font-size: 10px;
- color: color-mix(in oklab, currentColor 50%, transparent);
- font-weight: 500;
- letter-spacing: 0.04em;
- }
-
- .cfg {
- color: color-mix(in oklab, currentColor 70%, transparent);
- font-size: 12px;
- }
-
- .divider {
- height: 1px;
- background: color-mix(in oklab, var(--content-border) 50%, transparent);
- margin: 4px 0;
- }
-</style>
diff --git a/src/lib/study-components/settings/PetsSettingsTab.svelte b/src/lib/study-components/settings/PetsSettingsTab.svelte
deleted file mode 100644
index 45ed450a..00000000
--- a/src/lib/study-components/settings/PetsSettingsTab.svelte
+++ /dev/null
@@ -1,79 +0,0 @@
-<script lang="ts">
- import { onMount } from "svelte";
- import SettingsField from "./SettingsField.svelte";
- import SettingsToggle from "./SettingsToggle.svelte";
- import PetsManager from "$lib/components/PetsManager.svelte";
- import {
- loadDisplayPrefs,
- setDisplayPrefs,
- type DisplayPrefs,
- } from "$lib/pets/display-prefs.svelte";
-
- let prefs = $state<DisplayPrefs | null>(null);
- let busy = $state(false);
-
- onMount(() => {
- void load();
- });
-
- async function load() {
- prefs = await loadDisplayPrefs();
- }
-
- async function update(patch: Partial<DisplayPrefs>) {
- if (busy) return;
- busy = true;
- try {
- prefs = await setDisplayPrefs(patch);
- } finally {
- busy = false;
- }
- }
-</script>
-
-<section class="tab">
- {#if prefs}
- <SettingsField
- label="Mostrar pets na interface"
- description="Mascotes aparecem em painéis, empty states e feedback. Desligado: nenhum mascote em qualquer lugar; suas preferências de pet ativo, animações e galeria continuam salvas."
- >
- <SettingsToggle
- value={prefs.enabled}
- onChange={(v) => update({ enabled: v })}
- ariaLabel="Mostrar pets"
- />
- </SettingsField>
-
- <SettingsField
- label="Animar mascote"
- description="Quando desligado, o mascote aparece em frame único parado. Útil em e-ink ou para reduzir movimento."
- >
- <SettingsToggle
- value={prefs.motion_enabled}
- onChange={(v) => update({ motion_enabled: v })}
- ariaLabel="Animar mascote"
- />
- </SettingsField>
-
- <div class="manager-block" class:gated={!prefs.enabled}>
- <PetsManager />
- </div>
- {/if}
-</section>
-
-<style>
- .tab {
- display: flex;
- flex-direction: column;
- gap: var(--space-4);
- }
-
- .manager-block {
- margin-top: var(--space-3);
- transition: opacity var(--duration-fast) var(--ease-out);
- }
-
- .manager-block.gated {
- opacity: 0.55;
- }
-</style>
diff --git a/src/lib/study-music-components/AlbumPill.svelte b/src/lib/study-music-components/AlbumPill.svelte
deleted file mode 100644
index f260b882..00000000
--- a/src/lib/study-music-components/AlbumPill.svelte
+++ /dev/null
@@ -1,201 +0,0 @@
-<script lang="ts">
- import { goto } from "$app/navigation";
- import { pluginInvoke } from "$lib/plugin-invoke";
- import { musicPlayer, type MusicTrack } from "$lib/study-music/player-store.svelte";
- import CoverImage from "./CoverImage.svelte";
-
- type Album = {
- name: string;
- artist?: string | null;
- cover_path?: string | null;
- year?: number | null;
- first_id?: number | null;
- };
-
- type Props = {
- album: Album;
- href?: string;
- };
-
- let { album, href }: Props = $props();
- let busy = $state(false);
-
- function open() {
- if (href) {
- goto(href);
- return;
- }
- const params = new URLSearchParams({ name: album.name });
- if (album.artist) params.set("artist", album.artist);
- goto(`/study/music/album/by-name?${params.toString()}`);
- }
-
- async function playAlbum(e: MouseEvent) {
- e.stopPropagation();
- if (busy) return;
- busy = true;
- try {
- const args: { name: string; artist?: string } = { name: album.name };
- if (album.artist) args.artist = album.artist;
- const res = await pluginInvoke<{ tracks: MusicTrack[] }>(
- "study",
- "study:music:albums:get",
- args,
- );
- if (res.tracks && res.tracks.length > 0) {
- await musicPlayer.play(res.tracks[0], res.tracks);
- }
- } catch {
- /* ignore */
- } finally {
- busy = false;
- }
- }
-</script>
-
-<div
- class="album-pill"
- role="button"
- tabindex="0"
- onclick={open}
- onkeydown={(e) => {
- if (e.key === "Enter" || e.key === " ") {
- e.preventDefault();
- open();
- }
- }}
->
- <div class="cover">
- <CoverImage
- src={album.cover_path}
- alt={album.name}
- fallbackSeed={album.name + (album.artist ?? "")}
- rounded="sm"
- trackId={album.first_id ?? null}
- />
- <div class="cover-overlay" aria-hidden="true"></div>
- </div>
- <div class="meta">
- <h3 class="title">{album.name}</h3>
- {#if album.artist}
- <p class="sub">{album.artist}</p>
- {/if}
- </div>
- <div class="play-wrap">
- <button
- type="button"
- class="play-btn"
- onclick={playAlbum}
- aria-label="Tocar"
- disabled={busy}
- >
- <svg viewBox="0 0 24 24" width="11" height="11" fill="currentColor" aria-hidden="true"><path d="M8 5v14l11-7z"/></svg>
- </button>
- </div>
-</div>
-
-<style>
- .album-pill {
- display: flex;
- align-items: center;
- gap: 0;
- background: rgba(255, 255, 255, 0.05);
- border: 1px solid rgba(255, 255, 255, 0.05);
- border-radius: 16px;
- cursor: pointer;
- overflow: hidden;
- padding-right: 16px;
- transition: background 300ms ease, border-color 300ms ease;
- }
- .album-pill:hover {
- background: rgba(255, 255, 255, 0.1);
- }
- .album-pill:focus-visible {
- outline: 2px solid var(--accent);
- outline-offset: 2px;
- }
- .cover {
- position: relative;
- flex-shrink: 0;
- width: 80px;
- height: 80px;
- background: rgba(40, 40, 40, 0.5);
- overflow: hidden;
- }
- .cover :global(.cover) {
- border-radius: 0;
- }
- .cover :global(img) {
- transition: transform 500ms ease;
- }
- .album-pill:hover .cover :global(img) {
- transform: scale(1.05);
- }
- .cover-overlay {
- position: absolute;
- inset: 0;
- background: rgba(0, 0, 0, 0);
- transition: background 300ms ease;
- }
- .album-pill:hover .cover-overlay {
- background: rgba(0, 0, 0, 0.2);
- }
- .meta {
- flex: 1;
- min-width: 0;
- padding: 16px;
- display: flex;
- flex-direction: column;
- justify-content: center;
- }
- .title {
- margin: 0;
- color: rgba(255, 255, 255, 0.95);
- font-weight: 700;
- font-size: 14px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .sub {
- margin: 4px 0 0;
- color: rgba(255, 255, 255, 0.5);
- font-weight: 600;
- font-size: 12px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .play-wrap {
- opacity: 0;
- transition: opacity 300ms ease;
- }
- .album-pill:hover .play-wrap {
- opacity: 1;
- }
- .play-btn {
- width: 32px;
- height: 32px;
- padding: 0;
- background: rgba(255, 255, 255, 0.1);
- border: 0;
- border-radius: 50%;
- color: rgba(255, 255, 255, 0.85);
- cursor: pointer;
- display: grid;
- place-items: center;
- transition: background 200ms ease;
- }
- .play-btn:hover {
- background: rgba(255, 255, 255, 0.2);
- }
- @media (max-width: 640px) {
- .cover { width: 64px; height: 64px; }
- .meta { padding: 12px; }
- }
- @media (prefers-reduced-motion: reduce) {
- .album-pill, .cover :global(img), .cover-overlay, .play-wrap, .play-btn {
- transition: none;
- }
- }
-</style>
diff --git a/src/lib/study-music-components/ArtistCircle.svelte b/src/lib/study-music-components/ArtistCircle.svelte
deleted file mode 100644
index d1353577..00000000
--- a/src/lib/study-music-components/ArtistCircle.svelte
+++ /dev/null
@@ -1,101 +0,0 @@
-<script lang="ts">
- import { goto } from "$app/navigation";
- import { convertFileSrc } from "@tauri-apps/api/core";
- import { colorFromString } from "$lib/study-music/format";
-
- type Props = {
- name: string;
- coverPath?: string | null;
- trackCount?: number;
- };
-
- let { name, coverPath, trackCount }: Props = $props();
-
- const cover = $derived.by(() => {
- if (!coverPath) return null;
- try {
- return convertFileSrc(coverPath);
- } catch {
- return coverPath;
- }
- });
-
- const fallbackColor = $derived(colorFromString(name));
- const initial = $derived(name.slice(0, 1).toUpperCase());
-
- function open() {
- goto(`/study/music/artist/by-name?name=${encodeURIComponent(name)}`);
- }
-</script>
-
-<button type="button" class="artist-circle" onclick={open}>
- <span class="circle">
- {#if cover}
- <img src={cover} alt="" loading="lazy" />
- {:else}
- <span class="circle-fallback" style:background={fallbackColor}>{initial}</span>
- {/if}
- </span>
- <span class="name">{name}</span>
- {#if trackCount != null}
- <span class="sub">{trackCount} faixa(s)</span>
- {/if}
-</button>
-
-<style>
- .artist-circle {
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: 6px;
- background: transparent;
- border: 0;
- color: inherit;
- font-family: inherit;
- cursor: pointer;
- padding: 0;
- width: 100%;
- text-align: center;
- }
- .circle {
- width: 100%;
- aspect-ratio: 1 / 1;
- border-radius: 50%;
- overflow: hidden;
- box-shadow: 0 4px 14px color-mix(in oklab, black 24%, transparent);
- transition: transform 120ms ease, box-shadow 120ms ease;
- background: var(--button);
- }
- .artist-circle:hover .circle {
- transform: scale(1.04);
- box-shadow: 0 6px 18px color-mix(in oklab, var(--accent) 40%, transparent);
- }
- .circle img {
- width: 100%;
- height: 100%;
- object-fit: cover;
- display: block;
- }
- .circle-fallback {
- width: 100%;
- height: 100%;
- display: grid;
- place-items: center;
- color: white;
- font-size: clamp(28px, 4vw, 48px);
- font-weight: 800;
- }
- .name {
- font-size: 13px;
- font-weight: 600;
- color: var(--secondary);
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- max-width: 100%;
- }
- .sub {
- font-size: 11px;
- color: var(--tertiary);
- }
-</style>
diff --git a/src/lib/study-music-components/DiscordRpcPanel.svelte b/src/lib/study-music-components/DiscordRpcPanel.svelte
deleted file mode 100644
index cc289a74..00000000
--- a/src/lib/study-music-components/DiscordRpcPanel.svelte
+++ /dev/null
@@ -1,553 +0,0 @@
-<script lang="ts">
- import { pluginInvoke } from "$lib/plugin-invoke";
- import { showToast } from "$lib/stores/toast-store.svelte";
- import { t } from "$lib/i18n";
- import AboutLink from "./AboutLink.svelte";
-
- type Status = {
- enabled: boolean;
- app_id: string;
- large_image_key: string;
- connected: boolean;
- };
-
- type MusicSettings = {
- show_cover: boolean;
- show_buttons: boolean;
- update_interval_ms: number;
- };
-
- type Props = {
- open: boolean;
- onClose: () => void;
- };
-
- let { open, onClose }: Props = $props();
-
- let status = $state<Status | null>(null);
- let music = $state<MusicSettings | null>(null);
- let intervalSecondsInput = $state(5);
- let appIdInput = $state("");
- let imageKeyInput = $state("");
- let busy = $state(false);
- let testResult = $state<"ok" | "fail" | null>(null);
-
- async function load() {
- try {
- status = await pluginInvoke<Status>("study", "study:music:rpc:get_settings");
- appIdInput = status.app_id;
- imageKeyInput = status.large_image_key;
- } catch {
- status = null;
- }
- try {
- music = await pluginInvoke<MusicSettings>(
- "study",
- "study:music:rpc:music_settings:get",
- );
- intervalSecondsInput = Math.round((music.update_interval_ms ?? 5000) / 1000);
- } catch {
- music = null;
- }
- }
-
- $effect(() => {
- if (open) {
- testResult = null;
- void load();
- }
- });
-
- async function setMusicField(
- patch: Partial<MusicSettings>,
- ): Promise<MusicSettings | null> {
- if (busy) return null;
- busy = true;
- try {
- const res = await pluginInvoke<MusicSettings>(
- "study",
- "study:music:rpc:music_settings:set",
- patch,
- );
- music = res;
- intervalSecondsInput = Math.round((res.update_interval_ms ?? 5000) / 1000);
- return res;
- } catch (e) {
- showToast("error", e instanceof Error ? e.message : String(e));
- return null;
- } finally {
- busy = false;
- }
- }
-
- function toggleShowCover() {
- if (!music) return;
- void setMusicField({ show_cover: !music.show_cover });
- }
-
- function toggleShowButtons() {
- if (!music) return;
- void setMusicField({ show_buttons: !music.show_buttons });
- }
-
- function commitInterval() {
- if (!music) return;
- const seconds = Math.max(2, Math.min(30, Math.floor(Number(intervalSecondsInput) || 5)));
- intervalSecondsInput = seconds;
- void setMusicField({ update_interval_ms: seconds * 1000 });
- }
-
- async function toggleEnabled() {
- if (!status || busy) return;
- busy = true;
- try {
- const res = await pluginInvoke<Status>(
- "study",
- "study:music:rpc:set_settings",
- { enabled: !status.enabled },
- );
- status = res;
- } catch (e) {
- showToast("error", e instanceof Error ? e.message : String(e));
- } finally {
- busy = false;
- }
- }
-
- async function saveFields() {
- if (!status || busy) return;
- busy = true;
- try {
- const res = await pluginInvoke<Status>(
- "study",
- "study:music:rpc:set_settings",
- {
- app_id: appIdInput.trim(),
- large_image_key: imageKeyInput.trim(),
- },
- );
- status = res;
- appIdInput = res.app_id;
- imageKeyInput = res.large_image_key;
- showToast("success", $t("study.music.rpc_saved") as string);
- } catch (e) {
- showToast("error", e instanceof Error ? e.message : String(e));
- } finally {
- busy = false;
- }
- }
-
- async function testConnection() {
- if (busy) return;
- busy = true;
- testResult = null;
- try {
- const res = await pluginInvoke<{ ok: boolean }>(
- "study",
- "study:music:rpc:test",
- );
- testResult = res.ok ? "ok" : "fail";
- if (!res.ok) {
- showToast("error", $t("study.music.rpc_test_fail") as string);
- } else {
- showToast("success", $t("study.music.rpc_test_ok") as string);
- }
- await load();
- } catch (e) {
- testResult = "fail";
- showToast("error", e instanceof Error ? e.message : String(e));
- } finally {
- busy = false;
- }
- }
-
- function onKey(e: KeyboardEvent) {
- if (e.key === "Escape") {
- e.preventDefault();
- e.stopPropagation();
- onClose();
- }
- }
-</script>
-
-{#if open}
- <div
- class="overlay"
- role="presentation"
- onclick={(e) => {
- if (e.target === e.currentTarget) onClose();
- }}
- onkeydown={onKey}
- >
- <div class="dialog" role="dialog" aria-modal="true" tabindex="-1">
- <header class="head">
- <div class="head-text">
- <h3>{$t("study.music.rpc_title")}</h3>
- {#if status}
- <span class="state" class:on={status.connected} class:off={!status.connected}>
- {status.connected
- ? $t("study.music.rpc_connected")
- : $t("study.music.rpc_disconnected")}
- </span>
- {/if}
- </div>
- <button type="button" class="close" onclick={onClose} aria-label={$t("study.common.close") as string}>×</button>
- </header>
- <div class="body">
- <p class="hint">{$t("study.music.rpc_intro")}</p>
-
- {#if status === null}
- <p class="muted">{$t("study.common.loading")}</p>
- {:else}
- <label class="toggle">
- <input
- type="checkbox"
- checked={status.enabled}
- onchange={toggleEnabled}
- disabled={busy}
- />
- <span>{$t("study.music.rpc_enable")}</span>
- </label>
-
- {#if music && status.enabled}
- <section class="music-section">
- <h4>{$t("study.music.rpc_music_section")}</h4>
- <label class="row">
- <input
- type="checkbox"
- checked={music.show_cover}
- onchange={toggleShowCover}
- disabled={busy}
- />
- <div class="row-text">
- <span>{$t("study.music.rpc_show_cover")}</span>
- <small>{$t("study.music.rpc_show_cover_hint")}</small>
- </div>
- </label>
- <label class="row">
- <input
- type="checkbox"
- checked={music.show_buttons}
- onchange={toggleShowButtons}
- disabled={busy}
- />
- <div class="row-text">
- <span>{$t("study.music.rpc_show_buttons")}</span>
- <small>{$t("study.music.rpc_show_buttons_hint")}</small>
- </div>
- </label>
- <label class="row interval">
- <div class="row-text">
- <span>{$t("study.music.rpc_update_interval")}</span>
- <small>{$t("study.music.rpc_update_interval_hint")}</small>
- </div>
- <input
- type="number"
- min="2"
- max="30"
- step="1"
- bind:value={intervalSecondsInput}
- onblur={commitInterval}
- onchange={commitInterval}
- disabled={busy}
- />
- </label>
- </section>
- {/if}
-
- <details class="advanced">
- <summary>{$t("study.music.rpc_advanced")}</summary>
- <div class="adv-body">
- <label class="field">
- <span>Application ID</span>
- <input
- type="text"
- bind:value={appIdInput}
- placeholder="1502867748353478656"
- autocomplete="off"
- />
- <small>{$t("study.music.rpc_appid_hint")}</small>
- </label>
- <label class="field">
- <span>{$t("study.music.rpc_large_image")}</span>
- <input
- type="text"
- bind:value={imageKeyInput}
- placeholder="omniget_music"
- autocomplete="off"
- />
- <small>{$t("study.music.rpc_image_hint")}</small>
- </label>
- <button
- type="button"
- class="cta-secondary"
- onclick={saveFields}
- disabled={busy}
- >{$t("study.music.rpc_save")}</button>
- </div>
- </details>
-
- <div class="actions">
- <button type="button" class="cta" onclick={testConnection} disabled={busy || !status.enabled}>
- {$t("study.music.rpc_test")}
- </button>
- {#if testResult === "ok"}
- <span class="ok-badge">✓ {$t("study.music.rpc_test_ok")}</span>
- {:else if testResult === "fail"}
- <span class="fail-badge">✗ {$t("study.music.rpc_test_fail")}</span>
- {/if}
- </div>
-
- <p class="footnote">{$t("study.music.rpc_discord_running")}</p>
- <AboutLink variant="card" />
- {/if}
- </div>
- </div>
- </div>
-{/if}
-
-<style>
- .overlay {
- position: fixed;
- inset: 0;
- background: rgba(0, 0, 0, 0.55);
- z-index: 320;
- display: grid;
- place-items: center;
- backdrop-filter: blur(4px);
- }
- .dialog {
- background: rgb(20, 20, 20);
- color: rgba(255, 255, 255, 0.95);
- border: 1px solid rgba(255, 255, 255, 0.08);
- border-radius: 14px;
- width: min(540px, 92vw);
- max-height: 86vh;
- box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
- display: flex;
- flex-direction: column;
- overflow: hidden;
- }
- .head {
- position: relative;
- display: flex;
- align-items: flex-start;
- justify-content: space-between;
- gap: 12px;
- padding: 18px 20px 8px;
- }
- .head-text { display: flex; flex-direction: column; gap: 4px; }
- .head h3 {
- margin: 0;
- font-size: 16px;
- font-weight: 800;
- }
- .state {
- display: inline-flex;
- align-items: center;
- gap: 6px;
- padding: 2px 10px;
- border-radius: 999px;
- font-size: 11px;
- font-weight: 600;
- width: fit-content;
- }
- .state::before {
- content: "";
- width: 6px;
- height: 6px;
- border-radius: 50%;
- background: currentColor;
- }
- .state.on { background: rgba(34, 197, 94, 0.15); color: rgb(74, 222, 128); }
- .state.off { background: rgba(255, 255, 255, 0.06); color: rgba(255, 255, 255, 0.45); }
- .close {
- width: 28px;
- height: 28px;
- background: transparent;
- border: 0;
- border-radius: 50%;
- color: rgba(255, 255, 255, 0.5);
- font-size: 18px;
- cursor: pointer;
- flex-shrink: 0;
- }
- .body {
- padding: 8px 20px 20px;
- display: flex;
- flex-direction: column;
- gap: 16px;
- }
- .hint {
- margin: 0;
- color: rgba(255, 255, 255, 0.65);
- font-size: 13px;
- line-height: 1.5;
- }
- .muted { color: rgba(255, 255, 255, 0.5); }
- .toggle {
- display: inline-flex;
- align-items: center;
- gap: 10px;
- cursor: pointer;
- font-size: 13px;
- color: rgba(255, 255, 255, 0.85);
- padding: 10px 14px;
- background: rgba(255, 255, 255, 0.04);
- border: 1px solid rgba(255, 255, 255, 0.06);
- border-radius: 10px;
- }
- .toggle input { width: 14px; height: 14px; accent-color: var(--accent); }
- .music-section {
- display: flex;
- flex-direction: column;
- gap: 10px;
- padding: 12px 14px;
- background: rgba(255, 255, 255, 0.03);
- border: 1px solid rgba(255, 255, 255, 0.06);
- border-radius: 10px;
- }
- .music-section h4 {
- margin: 0;
- font-size: 11px;
- font-weight: 700;
- color: rgba(255, 255, 255, 0.55);
- text-transform: uppercase;
- letter-spacing: 0.06em;
- }
- .row {
- display: flex;
- align-items: flex-start;
- gap: 10px;
- cursor: pointer;
- }
- .row input[type="checkbox"] {
- width: 14px;
- height: 14px;
- margin-top: 2px;
- accent-color: var(--accent);
- }
- .row.interval {
- align-items: center;
- justify-content: space-between;
- cursor: default;
- }
- .row.interval input[type="number"] {
- width: 72px;
- padding: 6px 8px;
- background: rgba(0, 0, 0, 0.3);
- border: 1px solid rgba(255, 255, 255, 0.08);
- border-radius: 6px;
- color: rgba(255, 255, 255, 0.95);
- font-family: ui-monospace, monospace;
- font-size: 12px;
- outline: none;
- text-align: right;
- }
- .row.interval input[type="number"]:focus { border-color: var(--accent); }
- .row-text {
- display: flex;
- flex-direction: column;
- gap: 2px;
- }
- .row-text span {
- font-size: 13px;
- color: rgba(255, 255, 255, 0.9);
- }
- .row-text small {
- font-size: 11px;
- line-height: 1.4;
- color: rgba(255, 255, 255, 0.45);
- }
- .advanced {
- background: rgba(0, 0, 0, 0.2);
- border: 1px solid rgba(255, 255, 255, 0.06);
- border-radius: 10px;
- padding: 10px 14px;
- }
- .advanced summary {
- cursor: pointer;
- font-size: 12px;
- font-weight: 600;
- color: rgba(255, 255, 255, 0.7);
- user-select: none;
- }
- .adv-body {
- margin-top: 12px;
- display: flex;
- flex-direction: column;
- gap: 12px;
- }
- .field {
- display: flex;
- flex-direction: column;
- gap: 4px;
- }
- .field span {
- font-size: 11px;
- color: rgba(255, 255, 255, 0.5);
- text-transform: uppercase;
- letter-spacing: 0.06em;
- }
- .field small {
- color: rgba(255, 255, 255, 0.4);
- font-size: 11px;
- line-height: 1.4;
- }
- .field input {
- padding: 8px 10px;
- background: rgba(0, 0, 0, 0.3);
- border: 1px solid rgba(255, 255, 255, 0.08);
- border-radius: 6px;
- color: rgba(255, 255, 255, 0.95);
- font-family: ui-monospace, monospace;
- font-size: 12px;
- outline: none;
- }
- .field input:focus { border-color: var(--accent); }
- .cta-secondary {
- align-self: flex-start;
- padding: 7px 14px;
- border: 1px solid rgba(255, 255, 255, 0.15);
- border-radius: 999px;
- background: transparent;
- color: rgba(255, 255, 255, 0.95);
- font-family: inherit;
- font-size: 12px;
- cursor: pointer;
- }
- .cta-secondary:hover { border-color: var(--accent); color: var(--accent); }
- .actions {
- display: flex;
- align-items: center;
- gap: 12px;
- }
- .cta {
- padding: 8px 18px;
- border: 0;
- border-radius: 999px;
- background: var(--accent);
- color: var(--on-accent, white);
- font-family: inherit;
- font-size: 13px;
- font-weight: 700;
- cursor: pointer;
- }
- .cta:disabled { opacity: 0.5; cursor: default; }
- .ok-badge {
- color: rgb(74, 222, 128);
- font-size: 12px;
- font-weight: 600;
- }
- .fail-badge {
- color: rgb(248, 113, 113);
- font-size: 12px;
- font-weight: 600;
- }
- .footnote {
- margin: 8px 0 0;
- color: rgba(255, 255, 255, 0.4);
- font-size: 11px;
- font-style: italic;
- }
-</style>
diff --git a/src/lib/study-music-components/FeaturedAlbumHero.svelte b/src/lib/study-music-components/FeaturedAlbumHero.svelte
deleted file mode 100644
index 9e8ba05b..00000000
--- a/src/lib/study-music-components/FeaturedAlbumHero.svelte
+++ /dev/null
@@ -1,213 +0,0 @@
-<script lang="ts">
- import { convertFileSrc } from "@tauri-apps/api/core";
- import { goto } from "$app/navigation";
- import { t } from "$lib/i18n";
- import { musicPlayer } from "$lib/study-music/player-store.svelte";
- import { pluginInvoke } from "$lib/plugin-invoke";
- import type { MusicTrack } from "$lib/study-music/player-store.svelte";
-
- type Album = {
- name: string;
- artist: string | null;
- cover_path: string | null;
- track_count: number;
- year: number | null;
- };
-
- type Props = {
- album: Album | null;
- };
-
- let { album }: Props = $props();
-
- const coverUrl = $derived.by(() => {
- if (!album?.cover_path) return null;
- try {
- return convertFileSrc(album.cover_path);
- } catch {
- return album.cover_path;
- }
- });
-
- let busy = $state(false);
-
- async function startListening() {
- if (!album || busy) return;
- busy = true;
- try {
- const args: { name: string; artist?: string } = { name: album.name };
- if (album.artist) args.artist = album.artist;
- const res = await pluginInvoke<{ tracks: MusicTrack[] }>(
- "study",
- "study:music:albums:get",
- args,
- );
- if (res.tracks && res.tracks.length > 0) {
- await musicPlayer.play(res.tracks[0], res.tracks);
- }
- } catch {
- /* ignore */
- } finally {
- busy = false;
- }
- }
-
- function openAlbum() {
- if (!album) return;
- const params = new URLSearchParams({ name: album.name });
- if (album.artist) params.set("artist", album.artist);
- goto(`/study/music/album/by-name?${params.toString()}`);
- }
-</script>
-
-{#if album}
- <section
- class="hero"
- style:background-image={coverUrl ? `url('${coverUrl}')` : "none"}
- >
- <div class="overlay">
- <div class="content">
- <span class="eyebrow">
- <svg viewBox="0 0 24 24" width="11" height="11" fill="currentColor" aria-hidden="true">
- <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/>
- </svg>
- {$t("study.music.featured_album")}
- </span>
- <h1 class="title">{album.name}</h1>
- {#if album.artist}
- <p class="artist">{$t("study.music.by")} {album.artist}</p>
- {/if}
- <div class="actions">
- <button
- type="button"
- class="play-cta"
- onclick={startListening}
- disabled={busy}
- >
- <svg viewBox="0 0 24 24" width="14" height="14" fill="currentColor" aria-hidden="true"><path d="M8 5v14l11-7z"/></svg>
- <span>{$t("study.music.start_listening")}</span>
- </button>
- <button
- type="button"
- class="open-cta"
- onclick={openAlbum}
- aria-label={$t("study.music.open_album") as string}
- title={$t("study.music.open_album") as string}
- >
- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
- <line x1="5" y1="12" x2="19" y2="12"/>
- <polyline points="12 5 19 12 12 19"/>
- </svg>
- </button>
- </div>
- </div>
- </div>
- </section>
-{/if}
-
-<style>
- .hero {
- position: relative;
- width: 100%;
- aspect-ratio: 21 / 9;
- max-height: 380px;
- border-radius: 12px;
- overflow: hidden;
- background-size: cover;
- background-position: center 30%;
- background-color: color-mix(in oklab, var(--accent) 8%, var(--button));
- box-shadow: 0 8px 24px color-mix(in oklab, black 28%, transparent);
- }
- .overlay {
- position: absolute;
- inset: 0;
- display: flex;
- align-items: flex-end;
- background: linear-gradient(
- 90deg,
- color-mix(in oklab, black 70%, transparent) 0%,
- color-mix(in oklab, black 35%, transparent) 50%,
- transparent 80%
- );
- padding: 32px 36px;
- }
- .content {
- display: flex;
- flex-direction: column;
- gap: 10px;
- max-width: 60%;
- color: white;
- }
- .eyebrow {
- display: inline-flex;
- align-items: center;
- gap: 6px;
- font-size: 11px;
- font-weight: 700;
- text-transform: uppercase;
- letter-spacing: 0.12em;
- color: rgba(255, 255, 255, 0.85);
- text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
- }
- .title {
- margin: 0;
- font-size: clamp(36px, 6vw, 80px);
- line-height: 0.95;
- font-weight: 900;
- letter-spacing: -0.02em;
- color: white;
- text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
- overflow-wrap: anywhere;
- }
- .artist {
- margin: 0;
- font-size: 14px;
- color: rgba(255, 255, 255, 0.85);
- text-shadow: 0 1px 6px rgba(0, 0, 0, 0.4);
- }
- .actions {
- display: flex;
- align-items: center;
- gap: 10px;
- margin-top: 10px;
- }
- .play-cta {
- display: inline-flex;
- align-items: center;
- gap: 8px;
- padding: 10px 22px;
- background: var(--accent);
- color: var(--on-accent, white);
- border: 0;
- border-radius: 999px;
- font-family: inherit;
- font-size: 13px;
- font-weight: 700;
- cursor: pointer;
- box-shadow: 0 4px 14px color-mix(in oklab, var(--accent) 40%, transparent);
- transition: transform 120ms ease;
- }
- .play-cta:hover { transform: scale(1.04); }
- .play-cta:disabled { opacity: 0.6; cursor: default; }
- .open-cta {
- width: 38px;
- height: 38px;
- padding: 0;
- background: rgba(255, 255, 255, 0.12);
- border: 1px solid rgba(255, 255, 255, 0.2);
- border-radius: 50%;
- color: white;
- cursor: pointer;
- display: grid;
- place-items: center;
- backdrop-filter: blur(4px);
- transition: background 120ms ease;
- }
- .open-cta:hover {
- background: rgba(255, 255, 255, 0.22);
- }
- @media (max-width: 800px) {
- .overlay { padding: 18px; }
- .content { max-width: 100%; }
- }
-</style>
diff --git a/src/lib/study-music-components/LyricsPanel.svelte b/src/lib/study-music-components/LyricsPanel.svelte
deleted file mode 100644
index 839eca0f..00000000
--- a/src/lib/study-music-components/LyricsPanel.svelte
+++ /dev/null
@@ -1,707 +0,0 @@
-<script lang="ts">
- import { onMount, tick } from "svelte";
- import { musicPlayer } from "$lib/study-music/player-store.svelte";
- import { musicUI } from "$lib/study-music/ui-store.svelte";
- import { lyricsStore } from "$lib/study-music/lyrics-store.svelte";
- import { t } from "$lib/i18n";
- import PasteLyricsModal from "./PasteLyricsModal.svelte";
-
- const USER_SCROLL_LOCKOUT_MS = 750;
- const AUTO_SCROLL_THROTTLE_MS = 33;
- const VIRTUALIZE_THRESHOLD = 300;
-
- let containerEl = $state<HTMLDivElement | null>(null);
- let lineRefs: HTMLLIElement[] = $state([]);
- let pasteOpen = $state(false);
- let reduceMotion = $state(false);
- let editingIdx = $state<number | null>(null);
- let editDraft = $state("");
-
- let _lastUserScrollAt = 0;
- let _lastAutoScrollAt = 0;
- let _isAutoScrolling = false;
- let _autoScrollTimeout: ReturnType<typeof setTimeout> | null = null;
- let _resizeObserver: ResizeObserver | null = null;
- const _lineHeights = new Map<number, number>();
-
- const trackId = $derived(musicPlayer.currentTrack?.id ?? null);
- const status = $derived(lyricsStore.status);
- const activeIdx = $derived(
- status === "synced" && lyricsStore.lines.length > 0
- ? lyricsStore.activeIndex(musicPlayer.currentTime)
- : -1,
- );
- const shouldVirtualize = $derived(lyricsStore.lines.length > VIRTUALIZE_THRESHOLD);
- const showTranslation = $derived(lyricsStore.showTranslation);
- const translationStatus = $derived(lyricsStore.translationStatus);
- const translations = $derived(lyricsStore.translations);
-
- $effect(() => {
- if (!musicUI.lyricsOpen) return;
- if (trackId === null) {
- lyricsStore.reset();
- return;
- }
- void lyricsStore.loadFor(trackId);
- });
-
- $effect(() => {
- if (!musicUI.lyricsOpen) return;
- if (!showTranslation) return;
- if (status !== "synced" || lyricsStore.lines.length === 0) return;
- void lyricsStore.loadTranslation("pt");
- });
-
- $effect(() => {
- if (!musicUI.lyricsOpen) return;
- void activeIdx;
- if (activeIdx < 0) return;
- if (!containerEl) return;
- const now = performance.now();
- if (now - _lastUserScrollAt < USER_SCROLL_LOCKOUT_MS) return;
- if (now - _lastAutoScrollAt < AUTO_SCROLL_THROTTLE_MS) return;
- _lastAutoScrollAt = now;
- void scrollToActive();
- });
-
- async function scrollToActive() {
- await tick();
- const el = lineRefs[activeIdx];
- if (!el || !containerEl) return;
- _isAutoScrolling = true;
- const cRect = containerEl.getBoundingClientRect();
- const offset =
- el.offsetTop - containerEl.offsetTop - cRect.height / 2 + el.offsetHeight / 2;
- containerEl.scrollTo({
- top: offset,
- behavior: reduceMotion ? "instant" : "smooth",
- });
- if (_autoScrollTimeout) clearTimeout(_autoScrollTimeout);
- _autoScrollTimeout = setTimeout(() => {
- _isAutoScrolling = false;
- }, 400);
- }
-
- function onUserInput() {
- if (_isAutoScrolling) return;
- _lastUserScrollAt = performance.now();
- }
-
- function close() {
- musicUI.closeLyrics();
- }
-
- function refresh() {
- if (trackId !== null) {
- void lyricsStore.loadFor(trackId, true);
- }
- }
-
- function openPaste() {
- pasteOpen = true;
- }
-
- function closePaste() {
- pasteOpen = false;
- }
-
- function toggleTranslationClick() {
- lyricsStore.toggleTranslation("pt");
- }
-
- function startEdit(idx: number) {
- if (!showTranslation) return;
- editingIdx = idx;
- editDraft = translations.get(idx)?.translation ?? "";
- }
-
- function cancelEdit() {
- editingIdx = null;
- editDraft = "";
- }
-
- async function saveEdit() {
- if (editingIdx === null) return;
- const idx = editingIdx;
- const text = editDraft.trim();
- if (text.length === 0) {
- cancelEdit();
- return;
- }
- await lyricsStore.setTranslationLine(idx, text);
- cancelEdit();
- }
-
- function onEditKeydown(e: KeyboardEvent) {
- if (e.key === "Enter" && !e.shiftKey) {
- e.preventDefault();
- void saveEdit();
- } else if (e.key === "Escape") {
- e.preventDefault();
- cancelEdit();
- }
- }
-
- async function handleSavedLocal() {
- pasteOpen = false;
- }
-
- onMount(() => {
- if (typeof document === "undefined") return;
- if (typeof window !== "undefined" && "matchMedia" in window) {
- const mq = window.matchMedia("(prefers-reduced-motion: reduce)");
- reduceMotion = mq.matches;
- const listener = (e: MediaQueryListEvent) => {
- reduceMotion = e.matches;
- };
- mq.addEventListener("change", listener);
- return () => mq.removeEventListener("change", listener);
- }
- });
-
- onMount(() => {
- if (typeof document === "undefined") return;
- const handler = (e: KeyboardEvent) => {
- if (!musicUI.lyricsOpen) return;
- const target = e.target as HTMLElement | null;
- if (
- target &&
- (target.tagName === "INPUT" ||
- target.tagName === "TEXTAREA" ||
- target.isContentEditable)
- )
- return;
- if (e.key === "Escape") {
- e.preventDefault();
- e.stopPropagation();
- if (pasteOpen) {
- closePaste();
- } else {
- close();
- }
- }
- };
- document.addEventListener("keydown", handler);
- return () => document.removeEventListener("keydown", handler);
- });
-
- $effect(() => {
- if (typeof ResizeObserver === "undefined") return;
- if (!containerEl) return;
- void lyricsStore.lines.length;
- if (_resizeObserver) {
- _resizeObserver.disconnect();
- }
- _resizeObserver = new ResizeObserver((entries) => {
- for (const entry of entries) {
- const el = entry.target as HTMLElement;
- const idx = Number(el.dataset.idx);
- if (Number.isFinite(idx)) {
- _lineHeights.set(idx, entry.contentRect.height);
- }
- }
- });
- for (const el of lineRefs) {
- if (el) _resizeObserver.observe(el);
- }
- return () => {
- if (_resizeObserver) {
- _resizeObserver.disconnect();
- _resizeObserver = null;
- }
- };
- });
-</script>
-
-{#if musicUI.lyricsOpen}
- <aside class="lyrics-panel" role="complementary">
- <header class="head">
- <h3>{$t("study.music.lyrics_title")}</h3>
- <div class="actions">
- <button
- type="button"
- class="toggle"
- class:on={showTranslation}
- onclick={toggleTranslationClick}
- aria-pressed={showTranslation}
- title={(showTranslation
- ? $t("study.music.lyrics_translation_hide")
- : $t("study.music.lyrics_translation_show")) as string}
- >
- <span class="dot"></span>
- <span class="lbl">PT</span>
- </button>
- <button
- type="button"
- class="ico"
- onclick={refresh}
- title={$t("study.music.lyrics_refresh") as string}
- aria-label={$t("study.music.lyrics_refresh") as string}
- >
- <svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round">
- <polyline points="23 4 23 10 17 10"/>
- <path d="M20.49 15a9 9 0 1 1-2.12-9.36L23 10"/>
- </svg>
- </button>
- <button
- type="button"
- class="ico"
- onclick={close}
- aria-label={$t("study.common.close") as string}
- >×</button>
- </div>
- </header>
-
- {#if showTranslation && status === "synced"}
- {#if translationStatus === "loading"}
- <div class="translation-banner banner-info">
- <span>{$t("study.music.lyrics_translation_loading")}</span>
- </div>
- {:else if translationStatus === "skipped"}
- <div class="translation-banner banner-muted">
- <span>{$t("study.music.lyrics_translation_skipped_pt")}</span>
- </div>
- {:else if translationStatus === "no_translator"}
- <button
- type="button"
- class="translation-banner banner-warn banner-clickable"
- onclick={() => musicUI.openTranslationSettings()}
- >
- <strong>{$t("study.music.lyrics_translation_no_translator")}</strong>
- <span class="muted-inline">{$t("study.music.lyrics_translation_no_translator_hint")}</span>
- </button>
- {:else if translationStatus === "error"}
- <div class="translation-banner banner-error">
- <span>{$t("study.music.lyrics_translation_error")}</span>
- </div>
- {/if}
- {/if}
-
- {#if !musicPlayer.currentTrack}
- <div class="empty">
- <p>{$t("study.music.lyrics_no_track")}</p>
- </div>
- {:else if status === "loading"}
- <div class="loading-skeleton" aria-busy="true" aria-live="polite">
- <span class="skel skel-a"></span>
- <span class="skel skel-b"></span>
- <span class="skel skel-c"></span>
- <p class="muted">{$t("study.music.lyrics_loading")}</p>
- </div>
- {:else if status === "notfound"}
- <div class="empty">
- <p class="empty-title">{$t("study.music.lyrics_not_found")}</p>
- <p class="muted">{$t("study.music.lyrics_lrclib_hint")}</p>
- <button type="button" class="cta" onclick={openPaste}>
- {$t("study.music.lyrics_add_manual")}
- </button>
- </div>
- {:else if status === "error"}
- <div class="empty">
- <p class="empty-title">{$t("study.music.lyrics_error")}</p>
- <p class="muted">{$t("study.music.lyrics_error_hint")}</p>
- <div class="error-actions">
- <button type="button" class="cta" onclick={refresh}>
- {$t("study.music.lyrics_retry")}
- </button>
- <button type="button" class="cta cta-ghost" onclick={openPaste}>
- {$t("study.music.lyrics_add_manual")}
- </button>
- </div>
- </div>
- {:else if status === "synced" && lyricsStore.lines.length > 0}
- <div
- bind:this={containerEl}
- class="scroll synced"
- class:virtualized={shouldVirtualize}
- onwheel={onUserInput}
- ontouchstart={onUserInput}
- onkeydown={onUserInput}
- role="presentation"
- >
- <ul class="lines">
- {#each lyricsStore.lines as line, i (i)}
- <li
- bind:this={lineRefs[i]}
- data-idx={i}
- class="line"
- class:active={i === activeIdx}
- class:past={i < activeIdx}
- >
- <span class="line-original">{line.text || "♪"}</span>
- {#if showTranslation && translationStatus === "available"}
- {#if editingIdx === i}
- <div class="line-edit">
- <input
- type="text"
- class="line-edit-input"
- bind:value={editDraft}
- placeholder={$t("study.music.lyrics_translation_edit_placeholder") as string}
- onkeydown={onEditKeydown}
- autofocus
- />
- <button type="button" class="line-edit-btn save" onclick={saveEdit}>
- {$t("study.music.lyrics_translation_edit_save")}
- </button>
- <button type="button" class="line-edit-btn cancel" onclick={cancelEdit}>
- {$t("study.music.lyrics_translation_edit_cancel")}
- </button>
- </div>
- {:else}
- <button
- type="button"
- class="line-translation"
- class:edited={translations.get(i)?.edited ?? false}
- onclick={() => startEdit(i)}
- title={$t("study.music.lyrics_translation_edit_placeholder") as string}
- >
- <span class="translation-text">
- {translations.get(i)?.translation || "—"}
- </span>
- {#if translations.get(i)?.edited}
- <span class="edited-badge">
- {$t("study.music.lyrics_translation_edited_badge")}
- </span>
- {/if}
- </button>
- {/if}
- {/if}
- </li>
- {/each}
- </ul>
- </div>
- {:else if status === "plain" && lyricsStore.plain}
- <div class="scroll plain">
- {#each lyricsStore.plain.split(/\r?\n/) as line, i (i)}
- <p class="plain-line">{line || " "}</p>
- {/each}
- </div>
- {/if}
-
- {#if lyricsStore.source}
- <footer class="foot">
- <span>{$t("study.music.lyrics_source", { source: lyricsStore.source })}</span>
- {#if showTranslation && translationStatus === "available" && lyricsStore.translator && lyricsStore.translator !== "skipped"}
- <span class="foot-sep">·</span>
- <span>{$t("study.music.lyrics_translation_attribution", { translator: lyricsStore.translator })}</span>
- {/if}
- </footer>
- {/if}
- </aside>
-
- <PasteLyricsModal
- open={pasteOpen}
- {trackId}
- onclose={closePaste}
- onsaved={handleSavedLocal}
- />
-{/if}
-
-<style>
- .lyrics-panel {
- position: fixed;
- top: 14px;
- right: 14px;
- bottom: 96px;
- width: min(420px, 92vw);
- z-index: 95;
- background: rgb(20, 20, 20);
- color: rgba(255, 255, 255, 0.95);
- border: 1px solid rgba(255, 255, 255, 0.08);
- border-radius: 14px;
- box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
- display: flex;
- flex-direction: column;
- overflow: hidden;
- }
- .head {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 14px 16px;
- border-bottom: 1px solid rgba(255, 255, 255, 0.06);
- }
- .head h3 {
- margin: 0;
- font-size: 13px;
- font-weight: 700;
- text-transform: uppercase;
- letter-spacing: 0.06em;
- color: rgba(255, 255, 255, 0.85);
- }
- .actions { display: inline-flex; gap: 4px; }
- .ico {
- width: 28px;
- height: 28px;
- padding: 0;
- background: transparent;
- border: 0;
- border-radius: 50%;
- color: rgba(255, 255, 255, 0.5);
- font-size: 16px;
- line-height: 1;
- cursor: pointer;
- }
- .ico:hover { color: white; background: rgba(255, 255, 255, 0.08); }
- .toggle {
- display: inline-flex;
- align-items: center;
- gap: 6px;
- padding: 4px 10px;
- height: 26px;
- background: rgba(255, 255, 255, 0.04);
- border: 1px solid rgba(255, 255, 255, 0.1);
- border-radius: 999px;
- color: rgba(255, 255, 255, 0.55);
- font-size: 11px;
- font-weight: 600;
- letter-spacing: 0.04em;
- cursor: pointer;
- transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
- }
- .toggle .dot {
- width: 6px;
- height: 6px;
- border-radius: 50%;
- background: rgba(255, 255, 255, 0.3);
- transition: background 160ms ease, box-shadow 160ms ease;
- }
- .toggle.on {
- color: white;
- background: color-mix(in oklab, var(--accent, #7c5cff) 25%, transparent);
- border-color: color-mix(in oklab, var(--accent, #7c5cff) 60%, transparent);
- }
- .toggle.on .dot {
- background: var(--accent, #7c5cff);
- box-shadow: 0 0 8px color-mix(in oklab, var(--accent, #7c5cff) 80%, transparent);
- }
- .toggle:hover { color: white; }
- .translation-banner {
- padding: 8px 14px;
- font-size: 12px;
- line-height: 1.4;
- display: flex;
- flex-direction: column;
- gap: 2px;
- border-bottom: 1px solid rgba(255, 255, 255, 0.04);
- }
- .banner-info { color: rgba(255, 255, 255, 0.7); }
- .banner-muted { color: rgba(255, 255, 255, 0.45); font-style: italic; }
- .banner-warn { color: rgba(255, 200, 120, 0.95); background: rgba(255, 200, 120, 0.06); }
- .banner-clickable {
- width: 100%;
- text-align: left;
- border: 0;
- cursor: pointer;
- align-items: flex-start;
- }
- .banner-clickable:hover { background: rgba(255, 200, 120, 0.12); }
- .banner-error { color: rgba(255, 130, 130, 0.95); background: rgba(255, 130, 130, 0.06); }
- .muted-inline { color: rgba(255, 255, 255, 0.55); font-size: 11px; }
- .line-original { display: block; }
- .line-translation {
- display: inline-flex;
- align-items: center;
- gap: 6px;
- margin-top: 4px;
- padding: 2px 4px;
- background: transparent;
- border: 0;
- border-radius: 6px;
- color: rgba(255, 255, 255, 0.55);
- font-size: 14px;
- font-style: italic;
- line-height: 1.35;
- text-align: left;
- cursor: text;
- transition: background 160ms ease, color 160ms ease;
- }
- .line-translation:hover {
- background: rgba(255, 255, 255, 0.04);
- color: rgba(255, 255, 255, 0.8);
- }
- .line.active .line-translation { color: rgba(255, 255, 255, 0.78); }
- .line-translation.edited { color: rgba(180, 220, 255, 0.85); }
- .edited-badge {
- display: inline-flex;
- align-items: center;
- height: 16px;
- padding: 0 6px;
- border-radius: 999px;
- background: rgba(120, 180, 255, 0.14);
- color: rgba(180, 220, 255, 0.85);
- font-size: 9px;
- font-style: normal;
- font-weight: 600;
- letter-spacing: 0.04em;
- }
- .line-edit {
- display: flex;
- gap: 4px;
- margin-top: 4px;
- }
- .line-edit-input {
- flex: 1;
- min-width: 0;
- padding: 6px 10px;
- background: rgba(255, 255, 255, 0.05);
- border: 1px solid rgba(255, 255, 255, 0.15);
- border-radius: 8px;
- color: white;
- font-size: 14px;
- font-style: italic;
- }
- .line-edit-input:focus {
- outline: none;
- border-color: var(--accent, #7c5cff);
- background: rgba(255, 255, 255, 0.08);
- }
- .line-edit-btn {
- padding: 0 10px;
- height: 32px;
- background: rgba(255, 255, 255, 0.06);
- border: 0;
- border-radius: 8px;
- color: rgba(255, 255, 255, 0.85);
- font-size: 11px;
- font-weight: 600;
- cursor: pointer;
- }
- .line-edit-btn.save {
- background: var(--accent, #7c5cff);
- color: white;
- }
- .line-edit-btn:hover { filter: brightness(1.15); }
- .scroll {
- flex: 1;
- overflow-y: auto;
- padding: 16px 22px 32px;
- scrollbar-width: thin;
- }
- .scroll.virtualized .line {
- content-visibility: auto;
- contain-intrinsic-size: 0 36px;
- }
- .lines {
- list-style: none;
- margin: 0;
- padding: 30vh 0;
- display: flex;
- flex-direction: column;
- gap: 18px;
- }
- .line {
- font-size: 18px;
- line-height: 1.4;
- color: rgba(255, 255, 255, 0.4);
- transition: color 220ms ease, transform 220ms ease, font-size 220ms ease, opacity 220ms ease;
- transform-origin: left;
- opacity: 0.85;
- }
- .line.past {
- color: rgba(255, 255, 255, 0.25);
- opacity: 0.6;
- }
- .line.active {
- color: white;
- font-weight: 700;
- font-size: 22px;
- transform: scale(1.02);
- opacity: 1;
- }
- .plain-line {
- margin: 0 0 10px;
- font-size: 14px;
- line-height: 1.6;
- color: rgba(255, 255, 255, 0.85);
- }
- .empty,
- .loading-skeleton {
- flex: 1;
- display: flex;
- flex-direction: column;
- gap: 12px;
- align-items: center;
- justify-content: center;
- padding: 24px;
- color: rgba(255, 255, 255, 0.65);
- font-size: 13px;
- text-align: center;
- }
- .empty-title {
- margin: 0;
- font-size: 15px;
- font-weight: 600;
- color: rgba(255, 255, 255, 0.92);
- }
- .muted { color: rgba(255, 255, 255, 0.5); font-size: 12px; max-width: 280px; }
- .cta {
- margin-top: 4px;
- padding: 10px 18px;
- background: var(--accent, #7c5cff);
- color: white;
- border: 0;
- border-radius: 999px;
- font-size: 13px;
- font-weight: 600;
- cursor: pointer;
- transition: filter 180ms ease, transform 180ms ease;
- }
- .cta:hover { filter: brightness(1.1); }
- .cta:active { transform: scale(0.98); }
- .cta-ghost {
- background: transparent;
- border: 1px solid rgba(255, 255, 255, 0.18);
- color: rgba(255, 255, 255, 0.85);
- }
- .error-actions {
- display: flex;
- gap: 8px;
- align-items: center;
- flex-wrap: wrap;
- justify-content: center;
- }
- .loading-skeleton {
- gap: 14px;
- }
- .skel {
- display: block;
- height: 14px;
- border-radius: 6px;
- background: linear-gradient(
- 90deg,
- rgba(255, 255, 255, 0.06),
- rgba(255, 255, 255, 0.16),
- rgba(255, 255, 255, 0.06)
- );
- background-size: 200% 100%;
- animation: shimmer 1.4s ease-in-out infinite;
- }
- .skel-a { width: 68%; }
- .skel-b { width: 82%; }
- .skel-c { width: 54%; }
- @keyframes shimmer {
- 0% { background-position: 200% 0; }
- 100% { background-position: -200% 0; }
- }
- @media (prefers-reduced-motion: reduce) {
- .line {
- transition: none;
- }
- .skel {
- animation: none;
- }
- }
- .foot {
- padding: 8px 14px;
- border-top: 1px solid rgba(255, 255, 255, 0.06);
- color: rgba(255, 255, 255, 0.35);
- font-size: 10px;
- text-align: right;
- display: flex;
- justify-content: flex-end;
- gap: 6px;
- flex-wrap: wrap;
- }
- .foot-sep { opacity: 0.4; }
-</style>
diff --git a/src/lib/study-music-components/NavigationTile.svelte b/src/lib/study-music-components/NavigationTile.svelte
deleted file mode 100644
index 5da050ae..00000000
--- a/src/lib/study-music-components/NavigationTile.svelte
+++ /dev/null
@@ -1,101 +0,0 @@
-<script lang="ts">
- import type { Snippet } from "svelte";
- type Props = {
- title: string;
- subtitle?: string | null;
- href?: string | null;
- onClick?: (() => void) | null;
- icon?: Snippet;
- accent?: string | null;
- };
- let { title, subtitle = null, href = null, onClick = null, icon, accent = null }: Props = $props();
- const tag = href ? "a" : "button";
- function handle() {
- onClick?.();
- }
-</script>
-
-{#if href}
- <a class="nav-tile" {href} style:--tile-accent={accent ?? "rgba(255,255,255,0.05)"}>
- <span class="icon">
- {#if icon}{@render icon()}{/if}
- </span>
- <span class="text">
- <span class="title">{title}</span>
- {#if subtitle}<span class="sub">{subtitle}</span>{/if}
- </span>
- </a>
-{:else}
- <button
- type="button"
- class="nav-tile"
- style:--tile-accent={accent ?? "rgba(255,255,255,0.05)"}
- onclick={handle}
- >
- <span class="icon">
- {#if icon}{@render icon()}{/if}
- </span>
- <span class="text">
- <span class="title">{title}</span>
- {#if subtitle}<span class="sub">{subtitle}</span>{/if}
- </span>
- </button>
-{/if}
-
-<style>
- .nav-tile {
- display: flex;
- align-items: center;
- gap: 14px;
- padding: 16px 20px;
- background: linear-gradient(135deg, var(--tile-accent), rgba(255,255,255,0.02));
- border: 1px solid rgba(255, 255, 255, 0.06);
- border-radius: 16px;
- color: inherit;
- cursor: pointer;
- text-align: left;
- text-decoration: none;
- font: inherit;
- transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
- min-width: 0;
- }
- .nav-tile:hover {
- transform: translateY(-2px);
- border-color: rgba(255, 255, 255, 0.18);
- }
- .icon {
- flex: 0 0 auto;
- width: 36px;
- height: 36px;
- border-radius: 12px;
- background: rgba(255, 255, 255, 0.07);
- display: grid;
- place-items: center;
- color: rgba(255, 255, 255, 0.95);
- }
- .text {
- display: flex;
- flex-direction: column;
- gap: 2px;
- min-width: 0;
- }
- .title {
- font-size: 14px;
- font-weight: 700;
- color: white;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .sub {
- font-size: 12px;
- color: rgba(255, 255, 255, 0.55);
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- @media (prefers-reduced-motion: reduce) {
- .nav-tile { transition: none; }
- .nav-tile:hover { transform: none; }
- }
-</style>
diff --git a/src/lib/study-music-components/QueuePanel.svelte b/src/lib/study-music-components/QueuePanel.svelte
deleted file mode 100644
index fe432d68..00000000
--- a/src/lib/study-music-components/QueuePanel.svelte
+++ /dev/null
@@ -1,202 +0,0 @@
-<script lang="ts">
- import { musicPlayer } from "$lib/study-music/player-store.svelte";
- import { musicUI } from "$lib/study-music/ui-store.svelte";
- import { fmtDuration } from "$lib/study-music/format";
- import { t } from "$lib/i18n";
- import CoverImage from "./CoverImage.svelte";
-
- function jumpTo(idx: number) {
- if (idx < 0 || idx >= musicPlayer.queue.length) return;
- musicPlayer.queueIndex = idx;
- void musicPlayer.play(musicPlayer.queue[idx], musicPlayer.queue);
- }
-
- function close() {
- musicUI.closeQueue();
- }
-
- $effect(() => {
- if (!musicUI.queueOpen || typeof document === "undefined") return;
- function onKey(e: KeyboardEvent) {
- if (e.key === "Escape") {
- e.preventDefault();
- close();
- }
- }
- document.addEventListener("keydown", onKey);
- return () => document.removeEventListener("keydown", onKey);
- });
-</script>
-
-{#if musicUI.queueOpen}
- <div class="queue-panel" role="dialog" aria-label={$t("study.music.queue_aria") as string} aria-modal="false" tabindex="-1">
- <header class="head">
- <h3>{$t("study.music.queue_title")}</h3>
- <span class="count">{musicPlayer.queue.length}</span>
- {#if musicPlayer.queue.length > 0}
- <button
- type="button"
- class="clear"
- onclick={() => musicPlayer.clearQueue()}
- title={$t("study.music.queue_clear") as string}
- >{$t("study.music.queue_clear")}</button>
- {/if}
- <button type="button" class="close" onclick={close} aria-label={$t("study.common.close")}>×</button>
- </header>
- {#if musicPlayer.queue.length === 0}
- <p class="muted">{$t("study.music.queue_empty")}</p>
- {:else}
- <ol class="list">
- {#each musicPlayer.queue as track, i (i + ":" + track.id)}
- {@const current = i === musicPlayer.queueIndex}
- <li class="row" class:current>
- <button type="button" class="play-cell" onclick={() => jumpTo(i)}>
- <CoverImage
- src={track.cover_path}
- alt={track.title ?? track.path}
- size={32}
- fallbackSeed={track.album ?? track.title}
- rounded="sm"
- trackId={track.id}
- />
- <span class="info">
- <span class="title">{track.title ?? track.path}</span>
- {#if track.artist}
- <span class="artist">{track.artist}</span>
- {/if}
- </span>
- <span class="dur">{fmtDuration(track.duration_ms)}</span>
- </button>
- </li>
- {/each}
- </ol>
- {/if}
- </div>
-{/if}
-
-<style>
- .queue-panel {
- position: fixed;
- right: 12px;
- bottom: 92px;
- width: 360px;
- max-height: 60vh;
- background: var(--surface, var(--button-elevated));
- border: 1px solid var(--content-border);
- border-radius: 12px;
- box-shadow: 0 16px 48px color-mix(in oklab, black 38%, transparent);
- display: flex;
- flex-direction: column;
- overflow: hidden;
- z-index: 100;
- }
- .head {
- display: flex;
- align-items: center;
- gap: 10px;
- padding: 12px 14px;
- border-bottom: 1px solid color-mix(in oklab, var(--content-border) 60%, transparent);
- }
- .head h3 {
- margin: 0;
- flex: 1;
- font-size: 13px;
- font-weight: 700;
- color: var(--secondary);
- text-transform: uppercase;
- letter-spacing: 0.04em;
- }
- .count {
- font-size: 11px;
- color: var(--tertiary);
- font-variant-numeric: tabular-nums;
- }
- .clear {
- padding: 4px 10px;
- background: transparent;
- border: 1px solid color-mix(in oklab, var(--content-border) 60%, transparent);
- border-radius: 999px;
- color: var(--tertiary);
- font-family: inherit;
- font-size: 11px;
- cursor: pointer;
- }
- .clear:hover {
- color: var(--secondary);
- border-color: var(--secondary);
- }
- .close {
- width: 24px;
- height: 24px;
- padding: 0;
- background: transparent;
- border: 0;
- border-radius: 50%;
- color: var(--tertiary);
- font-size: 18px;
- line-height: 1;
- cursor: pointer;
- }
- .close:hover { color: var(--secondary); background: color-mix(in oklab, var(--accent) 8%, transparent); }
- .list {
- list-style: none;
- margin: 0;
- padding: 6px;
- overflow-y: auto;
- display: flex;
- flex-direction: column;
- gap: 1px;
- }
- .row { padding: 0; }
- .row.current .play-cell { background: color-mix(in oklab, var(--accent) 14%, transparent); }
- .row.current .title { color: var(--accent); }
- .play-cell {
- display: flex;
- align-items: center;
- gap: 10px;
- width: 100%;
- padding: 6px 10px;
- background: transparent;
- border: 0;
- border-radius: 6px;
- color: var(--secondary);
- font-family: inherit;
- text-align: left;
- cursor: pointer;
- transition: background 120ms ease;
- }
- .play-cell:hover { background: color-mix(in oklab, var(--accent) 6%, transparent); }
- .info {
- flex: 1;
- display: flex;
- flex-direction: column;
- min-width: 0;
- overflow: hidden;
- }
- .title {
- font-size: 12px;
- font-weight: 500;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .artist {
- font-size: 10px;
- color: var(--tertiary);
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- .dur {
- font-size: 10px;
- color: var(--tertiary);
- font-variant-numeric: tabular-nums;
- }
- .muted {
- color: var(--tertiary);
- font-size: 12px;
- padding: 14px;
- margin: 0;
- text-align: center;
- }
-</style>
diff --git a/src/lib/study-music-components/SoundCloudError.svelte b/src/lib/study-music-components/SoundCloudError.svelte
index 002b95ad..9cbe84b0 100644
--- a/src/lib/study-music-components/SoundCloudError.svelte
+++ b/src/lib/study-music-components/SoundCloudError.svelte
@@ -1,8 +1,5 @@
<script lang="ts">
- import { onMount } from "svelte";
import { studySoundcloudHumanizeError } from "$lib/study-bridge";
- import MascotSlot from "$lib/components/MascotSlot.svelte";
- import { petsGetActive } from "$lib/pets/sync";
type Props = {
error: string;
@@ -12,21 +9,6 @@
let { error, trackUrl, onRetry }: Props = $props();
let humanized = $state<string>("Erro tecnico. Toca os detalhes pra ver o que aconteceu");
- let petSlug = $state<string | null>(null);
-
- onMount(() => {
- let active = true;
- petsGetActive()
- .then((slug) => {
- if (active) petSlug = slug;
- })
- .catch(() => {
- if (active) petSlug = null;
- });
- return () => {
- active = false;
- };
- });
async function resolve(err: string) {
try {
@@ -52,8 +34,12 @@
</script>
<div class="sc-error" role="alert">
- <div class="pet" aria-hidden="true">
- <MascotSlot slug={petSlug} event="syncError" scale={0.23} fallback="warn" />
+ <div class="icon" aria-hidden="true">
+ <svg viewBox="0 0 24 24" width="28" height="28" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z" />
+ <line x1="12" y1="9" x2="12" y2="13" />
+ <line x1="12" y1="17" x2="12.01" y2="17" />
+ </svg>
</div>
<div class="body">
<p class="kicker">SoundCloud</p>
@@ -91,7 +77,7 @@
color: var(--secondary);
}
- .pet {
+ .icon {
width: 48px;
min-height: 48px;
display: grid;
@@ -100,10 +86,6 @@
overflow: hidden;
}
- .pet :global(.slot-fallback) {
- color: var(--sc-accent);
- }
-
.body {
display: flex;
flex-direction: column;
@@ -206,7 +188,7 @@
grid-template-columns: 1fr;
}
- .pet {
+ .icon {
display: none;
}
}
diff --git a/src/lib/study-music-youtube-components/YoutubeChannelCard.svelte b/src/lib/study-music-youtube-components/YoutubeChannelCard.svelte
index 5905b918..8ba48aed 100644
--- a/src/lib/study-music-youtube-components/YoutubeChannelCard.svelte
+++ b/src/lib/study-music-youtube-components/YoutubeChannelCard.svelte
@@ -31,29 +31,30 @@
flex-direction: column;
align-items: center;
gap: 6px;
- padding: 12px 8px;
+ padding: 16px 8px;
background: transparent;
border: 0;
border-radius: 12px;
- color: var(--secondary);
+ color: #f1f1f1;
cursor: pointer;
text-align: center;
+ transition: background 140ms ease;
}
- .card:hover { background: color-mix(in oklab, var(--button) 30%, transparent); }
+ .card:hover { background: rgba(255, 255, 255, 0.06); }
.avatar {
- width: 96px;
- height: 96px;
+ width: 88px;
+ height: 88px;
border-radius: 50%;
overflow: hidden;
- background: color-mix(in oklab, var(--button) 60%, transparent);
+ background: #272727;
display: block;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.title {
- margin: 6px 0 0 0;
- font-size: 13px;
- font-weight: 600;
- color: var(--secondary);
+ margin: 8px 0 0 0;
+ font-size: 14px;
+ font-weight: 500;
+ color: #f1f1f1;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
@@ -61,7 +62,7 @@
}
.handle, .subs {
margin: 0;
- font-size: 11px;
- color: var(--tertiary);
+ font-size: 12.5px;
+ color: #aaa;
}
</style>
diff --git a/src/lib/study-music-youtube-components/YoutubeError.svelte b/src/lib/study-music-youtube-components/YoutubeError.svelte
index 8008970b..c4bb9612 100644
--- a/src/lib/study-music-youtube-components/YoutubeError.svelte
+++ b/src/lib/study-music-youtube-components/YoutubeError.svelte
@@ -1,5 +1,6 @@
<script lang="ts">
import { onMount } from "svelte";
+ import { t } from "$lib/i18n";
import { studyYoutubeHumanizeError } from "$lib/study-bridge";
type Props = {
@@ -10,7 +11,7 @@
};
let { error, onRetry, fallbackLabel, onFallback }: Props = $props();
- let humanized = $state<string>("Algo deu errado ao falar com o YouTube");
+ let humanized = $state<string>("");
let showDetails = $state(false);
async function resolve(err: string) {
@@ -45,13 +46,13 @@
<line x1="12" y1="16" x2="12" y2="16.01" />
</svg>
<div class="body">
- <p class="msg">{humanized}</p>
+ <p class="msg">{humanized || $t("study.music.youtube_error_generic")}</p>
<div class="actions">
{#if onRetry}
- <button type="button" class="btn primary" onclick={onRetry}>Tentar de novo</button>
+ <button type="button" class="btn primary" onclick={onRetry}>{$t("study.music.youtube_error_retry")}</button>
{/if}
{#if onFallback}
- <button type="button" class="btn ghost" onclick={onFallback}>{fallbackLabel ?? "Ouvir só áudio"}</button>
+ <button type="button" class="btn ghost" onclick={onFallback}>{fallbackLabel ?? ($t("study.music.youtube_error_audio_only") as string)}</button>
{/if}
<button
type="button"
@@ -59,7 +60,7 @@
onclick={() => (showDetails = !showDetails)}
aria-expanded={showDetails}
>
- {showDetails ? "Esconder detalhes" : "Detalhes técnicos"}
+ {showDetails ? $t("study.music.youtube_error_hide_details") : $t("study.music.youtube_error_details")}
</button>
</div>
{#if showDetails}
@@ -73,45 +74,48 @@
display: grid;
grid-template-columns: auto 1fr;
gap: 12px;
- padding: 14px 16px;
- background: color-mix(in oklab, var(--button) 40%, transparent);
- border: 1px solid color-mix(in oklab, var(--content-border) 40%, transparent);
- border-radius: 10px;
- color: var(--secondary);
+ padding: 16px 18px;
+ background: #1f1f1f;
+ border: 1px solid rgba(255, 255, 255, 0.08);
+ border-radius: 12px;
+ color: #f1f1f1;
}
- .yt-error svg { color: var(--tertiary); margin-top: 2px; }
- .body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
- .msg { margin: 0; font-size: 14px; color: var(--secondary); }
- .actions { display: flex; flex-wrap: wrap; gap: 8px; }
+ .yt-error svg { color: #aaa; margin-top: 2px; }
+ .body { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
+ .msg { margin: 0; font-size: 14px; color: #f1f1f1; }
+ .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn {
- padding: 6px 12px;
+ padding: 8px 14px;
border-radius: 999px;
border: 0;
- font-size: 12px;
+ font-size: 13px;
font-weight: 600;
cursor: pointer;
}
- .btn.primary { background: var(--accent); color: #fff; }
+ .btn.primary { background: #cc0000; color: #fff; }
+ .btn.primary:hover { background: #e60000; }
.btn.ghost {
background: transparent;
- color: var(--secondary);
- border: 1px solid color-mix(in oklab, var(--content-border) 50%, transparent);
+ color: #f1f1f1;
+ border: 1px solid rgba(255, 255, 255, 0.22);
}
+ .btn.ghost:hover { background: rgba(255, 255, 255, 0.08); }
.btn.link {
background: transparent;
- color: var(--tertiary);
- padding: 6px 0;
+ color: #aaa;
+ padding: 8px 0;
font-weight: 500;
}
- .btn.link:hover { color: var(--secondary); }
+ .btn.link:hover { color: #f1f1f1; }
.raw {
margin: 0;
- padding: 8px 10px;
- background: color-mix(in oklab, var(--button) 70%, transparent);
- border-radius: 6px;
- font-size: 11px;
- font-family: var(--mono, monospace);
- color: var(--tertiary);
+ padding: 10px 12px;
+ background: #0f0f0f;
+ border: 1px solid rgba(255, 255, 255, 0.06);
+ border-radius: 8px;
+ font-size: 12px;
+ font-family: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
+ color: #aaa;
white-space: pre-wrap;
word-break: break-word;
max-height: 200px;
diff --git a/src/lib/study-music-youtube-components/YoutubePlaylistCard.svelte b/src/lib/study-music-youtube-components/YoutubePlaylistCard.svelte
index 89f5cb94..3b56791b 100644
--- a/src/lib/study-music-youtube-components/YoutubePlaylistCard.svelte
+++ b/src/lib/study-music-youtube-components/YoutubePlaylistCard.svelte
@@ -44,51 +44,55 @@
.card {
display: flex;
flex-direction: column;
- gap: 8px;
+ gap: 10px;
padding: 0;
background: transparent;
border: 0;
text-align: left;
cursor: pointer;
- color: var(--secondary);
+ color: #f1f1f1;
}
.thumb-wrap {
position: relative;
aspect-ratio: 16 / 9;
- border-radius: 8px;
+ border-radius: 12px;
overflow: hidden;
- background: color-mix(in oklab, var(--button) 60%, transparent);
+ background: #272727;
}
- .thumb-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
+ .thumb-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 220ms ease; }
+ .card:hover .thumb-wrap img { transform: scale(1.045); }
.stack-edge {
position: absolute;
- right: -2px;
- top: 4px;
- bottom: 4px;
- width: 4px;
+ right: -3px;
+ top: 5px;
+ bottom: 5px;
+ width: 6px;
border-radius: 0 8px 8px 0;
- background: color-mix(in oklab, var(--button) 80%, transparent);
+ background: rgba(255, 255, 255, 0.18);
}
.count {
position: absolute;
- right: 6px;
- bottom: 6px;
- padding: 2px 6px;
+ right: 8px;
+ bottom: 8px;
+ padding: 3px 5px;
border-radius: 4px;
- background: rgba(0, 0, 0, 0.75);
+ background: rgba(0, 0, 0, 0.8);
color: #fff;
- font-size: 11px;
+ font-size: 12px;
+ font-weight: 600;
+ line-height: 1;
}
.title {
margin: 0;
- font-size: 13px;
- font-weight: 600;
- color: var(--secondary);
- line-height: 1.3;
+ font-size: 14px;
+ font-weight: 500;
+ color: #f1f1f1;
+ line-height: 1.4;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
- .meta { margin: 0; font-size: 11px; color: var(--tertiary); }
+ .card:hover .title { color: #fff; }
+ .meta { margin: 0; font-size: 12.5px; color: #aaa; }
</style>
diff --git a/src/lib/study-music-youtube-components/YoutubeShelf.svelte b/src/lib/study-music-youtube-components/YoutubeShelf.svelte
index b22300ec..cf6831a4 100644
--- a/src/lib/study-music-youtube-components/YoutubeShelf.svelte
+++ b/src/lib/study-music-youtube-components/YoutubeShelf.svelte
@@ -9,7 +9,7 @@
onPlaylistOpen?: (playlistId: string) => void;
minCard?: number;
};
- let { title, items, onPlay, onPlaylistOpen, minCard = 220 }: Props = $props();
+ let { title, items, onPlay, onPlaylistOpen, minCard = 260 }: Props = $props();
</script>
<section class="shelf">
@@ -24,16 +24,17 @@
</section>
<style>
- .shelf { display: flex; flex-direction: column; gap: 12px; }
+ .shelf { display: flex; flex-direction: column; gap: 14px; }
.title {
margin: 0;
- font-size: 16px;
+ font-size: 18px;
font-weight: 700;
- color: var(--secondary);
+ color: #f1f1f1;
+ letter-spacing: -0.01em;
}
.grid {
display: grid;
- grid-template-columns: repeat(auto-fill, minmax(var(--min-card, 220px), 1fr));
- gap: 18px 14px;
+ grid-template-columns: repeat(auto-fill, minmax(var(--min-card, 260px), 1fr));
+ gap: 28px 16px;
}
</style>
diff --git a/src/lib/study-music-youtube-components/YoutubeSkeleton.svelte b/src/lib/study-music-youtube-components/YoutubeSkeleton.svelte
index a50d6bd1..d925054b 100644
--- a/src/lib/study-music-youtube-components/YoutubeSkeleton.svelte
+++ b/src/lib/study-music-youtube-components/YoutubeSkeleton.svelte
@@ -31,8 +31,8 @@
{/each}
<style>
- .skel-card { display: flex; flex-direction: column; gap: 8px; }
- .skel-card .thumb { aspect-ratio: 16 / 9; border-radius: 8px; }
+ .skel-card { display: flex; flex-direction: column; gap: 10px; }
+ .skel-card .thumb { aspect-ratio: 16 / 9; border-radius: 12px; }
.skel-channel { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; }
.skel-channel .avatar { width: 96px; height: 96px; border-radius: 50%; }
.skel-row {
@@ -55,9 +55,9 @@
.shimmer {
background: linear-gradient(
90deg,
- color-mix(in oklab, var(--button) 40%, transparent) 0%,
- color-mix(in oklab, var(--button) 80%, transparent) 50%,
- color-mix(in oklab, var(--button) 40%, transparent) 100%
+ #1f1f1f 0%,
+ #303030 50%,
+ #1f1f1f 100%
);
background-size: 200% 100%;
animation: shimmer 1.6s linear infinite;
@@ -67,6 +67,6 @@
100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
- .shimmer { animation: none; background: color-mix(in oklab, var(--button) 60%, transparent); }
+ .shimmer { animation: none; background: #272727; }
}
</style>
diff --git a/src/lib/study-music-youtube-components/YoutubeVideoCard.svelte b/src/lib/study-music-youtube-components/YoutubeVideoCard.svelte
index b786a595..4bd046ef 100644
--- a/src/lib/study-music-youtube-components/YoutubeVideoCard.svelte
+++ b/src/lib/study-music-youtube-components/YoutubeVideoCard.svelte
@@ -1,5 +1,7 @@
<script lang="ts">
import { goto } from "$app/navigation";
+ import { t } from "$lib/i18n";
+ import { colorFromString } from "$lib/study-music/format";
import type { YoutubeSearchVideoItem } from "$lib/study-bridge";
type Props = {
@@ -8,6 +10,11 @@
};
let { item, onPlay }: Props = $props();
+ const channelInitial = $derived(
+ (item.channel_title ?? "?").trim().charAt(0).toUpperCase() || "?",
+ );
+ const channelColor = $derived(colorFromString(item.channel_title ?? item.video_id));
+
function play() {
if (onPlay) onPlay(item.video_id);
}
@@ -25,27 +32,38 @@
{:else}
<div class="thumb-placeholder"></div>
{/if}
- {#if item.duration_text}
- <span class="duration tabular-nums">{item.duration_text}</span>
- {/if}
+ <span class="thumb-hover" aria-hidden="true"></span>
{#if item.is_live}
- <span class="live">AO VIVO</span>
+ <span class="live">{$t("study.music.youtube_live")}</span>
+ {:else if item.duration_text}
+ <span class="duration tabular-nums">{item.duration_text}</span>
{/if}
</button>
- <div class="meta">
- <button type="button" class="title-btn" onclick={play} title={item.title}>
- <span class="title">{item.title}</span>
- </button>
- {#if item.channel_title}
- <button class="channel" onclick={openChannel} type="button" title={item.channel_title}>
- {item.channel_title}
+
+ <div class="row">
+ <button
+ type="button"
+ class="avatar"
+ onclick={openChannel}
+ style:background={channelColor}
+ title={item.channel_title ?? ""}
+ aria-label={item.channel_title ?? ""}
+ >{channelInitial}</button>
+ <div class="meta">
+ <button type="button" class="title-btn" onclick={play} title={item.title}>
+ <span class="title">{item.title}</span>
</button>
- {/if}
- <p class="stats">
- {#if item.view_count_text}<span>{item.view_count_text}</span>{/if}
- {#if item.view_count_text && item.published_time_text}<span> · </span>{/if}
- {#if item.published_time_text}<span>{item.published_time_text}</span>{/if}
- </p>
+ {#if item.channel_title}
+ <button class="channel" onclick={openChannel} type="button" title={item.channel_title}>
+ {item.channel_title}
+ </button>
+ {/if}
+ <p class="stats">
+ {#if item.view_count_text}<span>{item.view_count_text}</span>{/if}
+ {#if item.view_count_text && item.published_time_text}<span aria-hidden="true"> • </span>{/if}
+ {#if item.published_time_text}<span>{item.published_time_text}</span>{/if}
+ </p>
+ </div>
</div>
</div>
@@ -53,14 +71,14 @@
.card {
display: flex;
flex-direction: column;
- gap: 8px;
+ gap: 12px;
padding: 0;
color: var(--secondary);
}
.thumb-wrap {
position: relative;
aspect-ratio: 16 / 9;
- border-radius: 8px;
+ border-radius: 12px;
overflow: hidden;
background: color-mix(in oklab, var(--button) 60%, transparent);
padding: 0;
@@ -69,70 +87,109 @@
display: block;
width: 100%;
}
- .thumb-wrap:hover { transform: translateY(-2px); transition: transform 120ms; }
- .title-btn {
- padding: 0;
- background: transparent;
- border: 0;
- text-align: left;
- cursor: pointer;
- color: inherit;
- width: 100%;
- }
- .title-btn:hover .title { color: var(--accent); }
- .thumb-wrap img {
+ .thumb-wrap img,
+ .thumb-placeholder {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
+ transition: transform 220ms ease;
}
.thumb-placeholder {
- width: 100%;
- height: 100%;
background: color-mix(in oklab, var(--button) 50%, transparent);
}
- .duration {
+ .thumb-wrap:hover img {
+ transform: scale(1.045);
+ }
+ .thumb-hover {
position: absolute;
- right: 6px;
- bottom: 6px;
- padding: 2px 6px;
- border-radius: 4px;
- background: rgba(0, 0, 0, 0.75);
- color: #fff;
- font-size: 11px;
- font-weight: 500;
+ inset: 0;
+ background: rgba(0, 0, 0, 0);
+ transition: background 160ms ease;
+ pointer-events: none;
}
+ .thumb-wrap:hover .thumb-hover {
+ background: rgba(0, 0, 0, 0.12);
+ }
+ .duration,
.live {
position: absolute;
- left: 6px;
- top: 6px;
- padding: 2px 6px;
+ right: 8px;
+ bottom: 8px;
+ padding: 3px 5px;
border-radius: 4px;
- background: #d33;
+ background: rgba(0, 0, 0, 0.8);
+ color: #fff;
+ font-size: 12px;
+ font-weight: 600;
+ line-height: 1;
+ letter-spacing: 0.01em;
+ }
+ .live {
+ left: 8px;
+ right: auto;
+ background: #cc0000;
+ text-transform: uppercase;
+ letter-spacing: 0.05em;
+ }
+ .row {
+ display: flex;
+ gap: 12px;
+ align-items: flex-start;
+ min-width: 0;
+ }
+ .avatar {
+ flex: 0 0 auto;
+ width: 36px;
+ height: 36px;
+ border-radius: 50%;
+ border: 0;
+ cursor: pointer;
color: #fff;
- font-size: 10px;
+ font-size: 15px;
font-weight: 700;
- letter-spacing: 0.04em;
+ display: grid;
+ place-items: center;
+ line-height: 1;
+ user-select: none;
+ }
+ .meta {
+ display: flex;
+ flex-direction: column;
+ gap: 3px;
+ min-width: 0;
+ flex: 1 1 auto;
+ }
+ .title-btn {
+ padding: 0;
+ background: transparent;
+ border: 0;
+ text-align: left;
+ cursor: pointer;
+ color: inherit;
+ width: 100%;
}
- .meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.title {
margin: 0;
- font-size: 13px;
+ font-size: 14px;
font-weight: 600;
color: var(--secondary);
- line-height: 1.3;
+ line-height: 1.35;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
+ .title-btn:hover .title {
+ color: var(--accent);
+ }
.channel {
margin: 0;
padding: 0;
background: transparent;
border: 0;
color: var(--tertiary);
- font-size: 12px;
+ font-size: 12.5px;
cursor: pointer;
text-align: left;
align-self: flex-start;
@@ -141,10 +198,12 @@
text-overflow: ellipsis;
white-space: nowrap;
}
- .channel:hover { color: var(--accent); }
+ .channel:hover {
+ color: var(--secondary);
+ }
.stats {
margin: 0;
- font-size: 11px;
+ font-size: 12.5px;
color: var(--tertiary);
}
</style>
diff --git a/src/lib/study-music/lyrics-store.svelte.ts b/src/lib/study-music/lyrics-store.svelte.ts
index 09cc70ce..963f7fe2 100644
--- a/src/lib/study-music/lyrics-store.svelte.ts
+++ b/src/lib/study-music/lyrics-store.svelte.ts
@@ -75,9 +75,51 @@ class LyricsStore {
translator = $state<string | null>(null);
showTranslation = $state(false);
+ offsetMs = $state(0);
+
private _lastIdx = -1;
private _lastTranslationKey: string | null = null;
+ private _offsetKey(id: number): string {
+ return `study:lyrics:offset:${id}`;
+ }
+
+ private _loadOffset(id: number) {
+ try {
+ const v =
+ typeof localStorage !== "undefined"
+ ? localStorage.getItem(this._offsetKey(id))
+ : null;
+ const n = v ? parseInt(v, 10) : 0;
+ this.offsetMs = Number.isFinite(n) ? n : 0;
+ } catch {
+ this.offsetMs = 0;
+ }
+ }
+
+ setOffset(ms: number) {
+ const clamped = Math.max(-30000, Math.min(30000, Math.round(ms)));
+ this.offsetMs = clamped;
+ const id = this.trackId;
+ if (id === null) return;
+ try {
+ if (typeof localStorage !== "undefined") {
+ if (clamped === 0) localStorage.removeItem(this._offsetKey(id));
+ else localStorage.setItem(this._offsetKey(id), String(clamped));
+ }
+ } catch {
+ /* persistence is best-effort */
+ }
+ }
+
+ nudgeOffset(deltaMs: number) {
+ this.setOffset(this.offsetMs + deltaMs);
+ }
+
+ resetOffset() {
+ this.setOffset(0);
+ }
+
get notFound(): boolean {
return this.status === "notfound";
}
@@ -92,6 +134,7 @@ class LyricsStore {
return;
}
this.trackId = trackId;
+ this._loadOffset(trackId);
this.lines = [];
this.plain = null;
this.meta = {};
@@ -161,6 +204,7 @@ class LyricsStore {
this.error = null;
this.status = "idle";
this.loading = false;
+ this.offsetMs = 0;
this._lastIdx = -1;
this._resetTranslation();
}
diff --git a/src/lib/study-music/player-store.svelte.ts b/src/lib/study-music/player-store.svelte.ts
index 97de6a69..48f180a2 100644
--- a/src/lib/study-music/player-store.svelte.ts
+++ b/src/lib/study-music/player-store.svelte.ts
@@ -1563,11 +1563,11 @@ class MusicPlayerStore {
const { audio: audioUrl, video: videoUrl } =
await this.resolveYoutubeMedia(videoId);
if (!audioUrl) throw new Error("empty stream url");
+ this.audio.crossOrigin = null;
this.audio.src = audioUrl;
this.youtubeVideoUrl = videoUrl;
void this.refreshYoutubeSponsorBlock(videoId);
await this.audio.play();
- this.ensureEqGraph();
this.saveQueueNow();
this.updateMediaSessionMetadata(track);
void this.refreshDominantColor(track);
@@ -1592,6 +1592,11 @@ class MusicPlayerStore {
try {
const { studyYoutubePlayer } = await import("$lib/study-bridge");
const res = await studyYoutubePlayer({ videoId });
+ if (res.sabr_only) {
+ throw new Error(
+ "SABR-only stream: no directly playable format (format unavailable in this client yet)",
+ );
+ }
const audio = pickBestYoutubeAudio(res);
const video = pickBestYoutubeVideo(res);
if (!audio) throw new Error("no audio format returned");
@@ -1600,15 +1605,21 @@ class MusicPlayerStore {
return { audio, video, legacy: false };
} catch (err) {
console.warn(
- "[study-music] study:youtube:player falhou, caindo para track_stream_url:",
+ "[study-music] study:youtube:player failed, falling back to yt-dlp resolver:",
err,
);
- const legacy = await pluginInvoke<{ url: string }>(
+ const legacy = await pluginInvoke<{ url: string; via?: string }>(
"study",
"study:music:youtube:track_stream_url",
{ video_id: videoId },
);
- return { audio: legacy.url || null, video: null, legacy: true };
+ if (!legacy.url) {
+ throw err instanceof Error
+ ? err
+ : new Error(typeof err === "string" ? err : "youtube resolve failed");
+ }
+ this.youtubeChapters = [];
+ return { audio: legacy.url, video: null, legacy: true };
}
}
@@ -1634,6 +1645,7 @@ class MusicPlayerStore {
if (!url) throw new Error("refresh returned no audio format");
const wasPaused = this.audio.paused;
const t = this.audio.currentTime;
+ this.audio.crossOrigin = null;
this.audio.src = url;
this.audio.currentTime = t;
this.youtubeVideoUrl = videoUrl;
diff --git a/src/lib/study-telegram-bridge.ts b/src/lib/study-telegram-bridge.ts
index 31c30bf8..47f29a92 100644
--- a/src/lib/study-telegram-bridge.ts
+++ b/src/lib/study-telegram-bridge.ts
@@ -186,20 +186,6 @@ export function studyUploadsCreate(args: {
);
}
-const liveUploads = new Map<number, number>();
-
-export function bindLiveUpload(telegramId: number, studyId: number) {
- liveUploads.set(telegramId, studyId);
-}
-
-export function studyIdForUploadId(telegramId: number): number | undefined {
- return liveUploads.get(telegramId);
-}
-
-export function clearLiveUpload(telegramId: number) {
- liveUploads.delete(telegramId);
-}
-
export async function enqueueTelegramUpload(args: {
chat: TelegramChat;
filePath: string;
@@ -218,7 +204,6 @@ export async function enqueueTelegramUpload(args: {
filePath: args.filePath,
caption: args.caption,
});
- bindLiveUpload(tg.id, created.id);
await studyDownloadsUpdate({
id: created.id,
status: "downloading",
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index c7fd7de2..ae55a43e 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -110,6 +110,7 @@
onMount(() => {
let cleanup: (() => void) | undefined;
let unlistenExternal: (() => void) | undefined;
+ let unlistenChannels: (() => void) | undefined;
initDownloadListener().then((fn) => (cleanup = fn));
setTimeout(() => void checkAutoVacuum(), 5000);
void ensureTrackerNotifications();
@@ -151,6 +152,25 @@
})
.catch(() => {});
});
+ listen<{ channel_title: string; auto_download: boolean; videos: unknown[] }>(
+ "channel-new-videos",
+ (event) => {
+ const p = event.payload;
+ const count = p.videos?.length ?? 0;
+ if (count <= 0) return;
+ showToast(
+ "info",
+ $t(
+ p.auto_download
+ ? "toast.channel_new_auto"
+ : "toast.channel_new",
+ { channel: p.channel_title, count },
+ ) as string,
+ );
+ },
+ ).then((fn) => {
+ unlistenChannels = fn;
+ });
refreshUpdateInfo();
initChangelog();
refreshYtdlpStatus();
@@ -167,6 +187,7 @@
return () => {
cleanup?.();
unlistenExternal?.();
+ unlistenChannels?.();
mediaQuery.removeEventListener("change", handleChange);
};
});
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 4459a37e..a6728ee9 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -17,7 +17,7 @@
import P2pReceiveDialog from "$components/p2p/P2pReceiveDialog.svelte";
import HomeHero from "$components/home/HomeHero.svelte";
// Mascot is consumed by HomeHero; keep direct import path live for backward compat if needed
- import { getDownloads } from "$lib/stores/download-store.svelte";
+ import { getDownloads, formatBytes } from "$lib/stores/download-store.svelte";
import { getSettings, updateSettings } from "$lib/stores/settings-store.svelte";
import { showToast } from "$lib/stores/toast-store.svelte";
import { onClipboardUrl } from "$lib/stores/clipboard-monitor";
@@ -83,6 +83,16 @@
let debounceTimer = $state<ReturnType<typeof setTimeout> | null>(null);
let downloadMode = $state<"auto" | "audio" | "mute">("auto");
let selectedQuality = $state("best");
+ let clipStart = $state("");
+ let clipEnd = $state("");
+ let scheduleAt = $state("");
+ let scheduleStop = $state("");
+ let playlistEntries = $state<{ index: number; title: string; url: string }[]>([]);
+ let selectedPlaylistItems = $state<Set<number>>(new Set());
+ let playlistLoading = $state(false);
+ let torrentEntries = $state<{ index: number; path: string; size_bytes: number }[]>([]);
+ let selectedTorrentFiles = $state<Set<number>>(new Set());
+ let torrentLoading = $state(false);
let selectedFormatId = $state<string | null>(null);
let formats = $state<FormatInfo[]>([]);
let loadingFormats = $state(false);
@@ -99,6 +109,7 @@
};
let cookieAccounts = $state<CookieAccount[]>([]);
let selectedCookieSlug = $state<string | null>(null);
+ let cookieHint = $state<"stale" | "expired" | null>(null);
let advancedMode = $state(false);
const STUDY_NOTICE_DISMISS_KEY = "omniget.study_maintenance_notice_dismissed_v1";
let studyNoticeDismissed = $state(
@@ -308,9 +319,52 @@
return value.startsWith("http://") || value.startsWith("https://") || value.startsWith("magnet:") || value.startsWith("p2p:") || value.endsWith(".torrent");
}
+ function isValidTimeBound(v: string): boolean {
+ return /^(\d+:)?\d{1,2}:\d{1,2}(\.\d+)?$|^\d+(\.\d+)?$/.test(v.trim());
+ }
+
+ function buildTimeRange(): string | null {
+ const s = clipStart.trim();
+ const e = clipEnd.trim();
+ if (!s && !e) return null;
+ if (s && !isValidTimeBound(s)) return null;
+ if (e && !isValidTimeBound(e)) return null;
+ return `${s || "0"}-${e || "inf"}`;
+ }
+
+ function toEpochMs(v: string): number | null {
+ if (!v) return null;
+ const ms = new Date(v).getTime();
+ if (Number.isNaN(ms)) return null;
+ return ms;
+ }
+
+ function setSchedulePreset(kind: "1h" | "tonight" | "1d") {
+ const d = new Date();
+ if (kind === "1h") d.setHours(d.getHours() + 1);
+ else if (kind === "1d") d.setDate(d.getDate() + 1);
+ else {
+ d.setHours(22, 0, 0, 0);
+ if (d.getTime() < Date.now()) d.setDate(d.getDate() + 1);
+ }
+ const pad = (n: number) => String(n).padStart(2, "0");
+ scheduleAt = `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}`;
+ }
+
function handleInput() {
if (debounceTimer) clearTimeout(debounceTimer);
clearMediaPreview();
+ clipStart = "";
+ clipEnd = "";
+ scheduleAt = "";
+ scheduleStop = "";
+ cookieHint = null;
+ playlistEntries = [];
+ selectedPlaylistItems = new Set();
+ playlistLoading = false;
+ torrentEntries = [];
+ selectedTorrentFiles = new Set();
+ torrentLoading = false;
const currentSettings = getSettings();
const saved = currentSettings?.last_download_options;
const savedMode = saved?.mode;
@@ -367,6 +421,12 @@
omniState = { kind: "detected", info: result };
invoke("prefetch_media_info", { url: value }).catch(() => {});
loadCookieAccounts(value);
+ if (result.content_type === "playlist") {
+ loadPlaylistEntries(value);
+ }
+ if (isTorrentUrl(value)) {
+ loadTorrentContents(value);
+ }
} else {
omniState = { kind: "unsupported" };
}
@@ -375,6 +435,77 @@
}
}
+ async function loadPlaylistEntries(targetUrl: string) {
+ playlistEntries = [];
+ selectedPlaylistItems = new Set();
+ playlistLoading = true;
+ try {
+ const entries = await invoke<{ index: number; title: string; url: string }[]>(
+ "playlist_entries",
+ { url: targetUrl }
+ );
+ playlistEntries = entries;
+ selectedPlaylistItems = new Set(entries.map((e) => e.index));
+ } catch {
+ playlistEntries = [];
+ } finally {
+ playlistLoading = false;
+ }
+ }
+
+ function togglePlaylistItem(idx: number) {
+ const next = new Set(selectedPlaylistItems);
+ if (next.has(idx)) next.delete(idx);
+ else next.add(idx);
+ selectedPlaylistItems = next;
+ }
+
+ function selectAllPlaylist() {
+ selectedPlaylistItems = new Set(playlistEntries.map((e) => e.index));
+ }
+
+ function selectNonePlaylist() {
+ selectedPlaylistItems = new Set();
+ }
+
+ function isTorrentUrl(value: string): boolean {
+ const v = value.trim().toLowerCase();
+ return v.startsWith("magnet:") || v.endsWith(".torrent");
+ }
+
+ async function loadTorrentContents(targetUrl: string) {
+ torrentEntries = [];
+ selectedTorrentFiles = new Set();
+ torrentLoading = true;
+ try {
+ const entries = await invoke<{ index: number; path: string; size_bytes: number }[]>(
+ "torrent_contents",
+ { url: targetUrl }
+ );
+ torrentEntries = entries;
+ selectedTorrentFiles = new Set(entries.map((e) => e.index));
+ } catch {
+ torrentEntries = [];
+ } finally {
+ torrentLoading = false;
+ }
+ }
+
+ function toggleTorrentFile(idx: number) {
+ const next = new Set(selectedTorrentFiles);
+ if (next.has(idx)) next.delete(idx);
+ else next.add(idx);
+ selectedTorrentFiles = next;
+ }
+
+ function selectAllTorrent() {
+ selectedTorrentFiles = new Set(torrentEntries.map((e) => e.index));
+ }
+
+ function selectNoneTorrent() {
+ selectedTorrentFiles = new Set();
+ }
+
async function loadCookieAccounts(targetUrl: string) {
try {
const result = await invoke<{ domain: string; accounts: CookieAccount[] }>(
@@ -388,9 +519,25 @@
});
cookieAccounts = accounts;
selectedCookieSlug = accounts[0]?.slug ?? null;
+ cookieHint = null;
+ if (accounts.length > 0) {
+ try {
+ const h = await invoke<{ items: { domain: string; slug: string; status: string }[] }>(
+ "cookies_health"
+ );
+ const slug = selectedCookieSlug ?? "_default";
+ const item =
+ h.items.find((it) => it.domain === result.domain && it.slug === slug) ??
+ h.items.find((it) => it.domain === result.domain);
+ if (item && item.status !== "fresh") {
+ cookieHint = item.status === "expired" ? "expired" : "stale";
+ }
+ } catch {}
+ }
} catch {
cookieAccounts = [];
selectedCookieSlug = null;
+ cookieHint = null;
}
}
@@ -510,6 +657,18 @@
return;
}
+ const isPlaylist = info.content_type === "playlist" && playlistEntries.length > 0;
+ if (isPlaylist && selectedPlaylistItems.size === 0) {
+ showToast("error", $t("omnibox.playlist_none_selected") as string);
+ return;
+ }
+
+ const isTorrent = torrentEntries.length > 0;
+ if (isTorrent && selectedTorrentFiles.size === 0) {
+ showToast("error", $t("omnibox.torrent_none_selected") as string);
+ return;
+ }
+
const settings = getSettings();
let outputDir = settings?.download.default_output_dir ?? "";
@@ -536,6 +695,11 @@
formatId: selectedFormatId,
referer: referer.trim() || null,
cookieSlug: selectedCookieSlug,
+ timeRange: buildTimeRange(),
+ playlistItems: isPlaylist ? [...selectedPlaylistItems] : null,
+ torrentFiles: isTorrent ? [...selectedTorrentFiles] : null,
+ scheduledAt: toEpochMs(scheduleAt),
+ stopAt: toEpochMs(scheduleStop),
});
persistLastDownloadOptions();
omniState = { kind: "idle" };
@@ -788,12 +952,104 @@
{#if omniState.kind === "detected"}
<MediaPreview bind:mediaPreview bind:imageLoading={previewImageLoading} />
+ {#if omniState.info.content_type === "playlist"}
+ <div class="playlist-picker">
+ <div class="playlist-head">
+ <span class="playlist-count">
+ {$t('omnibox.playlist_selected', { selected: selectedPlaylistItems.size, total: playlistEntries.length })}
+ </span>
+ {#if !playlistLoading && playlistEntries.length > 0}
+ <div class="playlist-bulk">
+ <button type="button" class="playlist-link" onclick={selectAllPlaylist}>{$t('omnibox.playlist_all')}</button>
+ <button type="button" class="playlist-link" onclick={selectNonePlaylist}>{$t('omnibox.playlist_none')}</button>
+ </div>
+ {/if}
+ </div>
+ {#if playlistLoading}
+ <div class="playlist-status"><span class="feedback-spinner"></span> {$t('omnibox.playlist_loading')}</div>
+ {:else if playlistEntries.length === 0}
+ <span class="playlist-status">{$t('omnibox.playlist_empty')}</span>
+ {:else}
+ <ul class="playlist-list">
+ {#each playlistEntries as entry (entry.index)}
+ <li>
+ <label class="playlist-item">
+ <input
+ type="checkbox"
+ checked={selectedPlaylistItems.has(entry.index)}
+ onchange={() => togglePlaylistItem(entry.index)}
+ />
+ <span class="playlist-idx">{entry.index}.</span>
+ <span class="playlist-title">{entry.title}</span>
+ </label>
+ </li>
+ {/each}
+ </ul>
+ {/if}
+ </div>
+ {/if}
+
+ {#if torrentLoading || torrentEntries.length > 0}
+ <div class="playlist-picker">
+ <div class="playlist-head">
+ <span class="playlist-count">
+ {$t('omnibox.torrent_selected', { selected: selectedTorrentFiles.size, total: torrentEntries.length })}
+ </span>
+ {#if !torrentLoading && torrentEntries.length > 0}
+ <div class="playlist-bulk">
+ <button type="button" class="playlist-link" onclick={selectAllTorrent}>{$t('omnibox.playlist_all')}</button>
+ <button type="button" class="playlist-link" onclick={selectNoneTorrent}>{$t('omnibox.playlist_none')}</button>
+ </div>
+ {/if}
+ </div>
+ {#if torrentLoading}
+ <div class="playlist-status"><span class="feedback-spinner"></span> {$t('omnibox.torrent_loading')}</div>
+ {:else}
+ <ul class="playlist-list">
+ {#each torrentEntries as entry (entry.index)}
+ <li>
+ <label class="playlist-item">
+ <input
+ type="checkbox"
+ checked={selectedTorrentFiles.has(entry.index)}
+ onchange={() => toggleTorrentFile(entry.index)}
+ />
+ <span class="playlist-title">{entry.path}</span>
+ <span class="torrent-size">{formatBytes(entry.size_bytes)}</span>
+ </label>
+ </li>
+ {/each}
+ </ul>
+ {/if}
+ </div>
+ {/if}
+
+ {#if cookieHint}
+ <p class="cookie-hint" class:expired={cookieHint === "expired"} role="status">
+ <svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
+ <path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0Z" />
+ <line x1="12" y1="9" x2="12" y2="13" />
+ <line x1="12" y1="17" x2="12.01" y2="17" />
+ </svg>
+ <span>
+ {cookieHint === "expired"
+ ? $t("omnibox.cookie_hint_expired")
+ : $t("omnibox.cookie_hint_stale")}
+ </span>
+ <button type="button" class="cookie-hint-link" onclick={() => goto("/settings?tab=cookies")}>
+ {$t("omnibox.cookie_hint_action")}
+ </button>
+ </p>
+ {/if}
+
{#if omniState.info.platform === "hotmart"}
<button class="button action-btn" onclick={handleAction}>
{$t('omnibox.go_to_hotmart')}
</button>
{:else}
- <button class="download-primary-btn" onclick={handleAction}>
+ {@const playlistBlocked = omniState.info.content_type === "playlist" && playlistEntries.length > 0 && selectedPlaylistItems.size === 0}
+ {@const torrentBlocked = torrentEntries.length > 0 && selectedTorrentFiles.size === 0}
+ <button class="download-primary-btn" disabled={playlistBlocked || torrentBlocked} onclick={handleAction}>
{$t('omnibox.download')}
</button>
@@ -823,6 +1079,62 @@
</div>
{/if}
+ {#if omniState.info.content_type !== "playlist"}
+ <div class="timerange-wrapper">
+ <span class="timerange-label">{$t('omnibox.timerange_label')}</span>
+ <div class="timerange-inputs">
+ <input
+ class="timerange-input"
+ type="text"
+ placeholder={$t('omnibox.timerange_start')}
+ bind:value={clipStart}
+ spellcheck="false"
+ inputmode="numeric"
+ aria-label={$t('omnibox.timerange_start') as string}
+ />
+ <span class="timerange-sep" aria-hidden="true">—</span>
+ <input
+ class="timerange-input"
+ type="text"
+ placeholder={$t('omnibox.timerange_end')}
+ bind:value={clipEnd}
+ spellcheck="false"
+ inputmode="numeric"
+ aria-label={$t('omnibox.timerange_end') as string}
+ />
+ </div>
+ <span class="timerange-hint">{$t('omnibox.timerange_hint')}</span>
+ </div>
+ {/if}
+
+ <div class="timerange-wrapper">
+ <span class="timerange-label">{$t('omnibox.schedule_label')}</span>
+ <div class="schedule-presets">
+ <button type="button" class="schedule-preset" onclick={() => setSchedulePreset('1h')}>{$t('omnibox.schedule_1h')}</button>
+ <button type="button" class="schedule-preset" onclick={() => setSchedulePreset('tonight')}>{$t('omnibox.schedule_tonight')}</button>
+ <button type="button" class="schedule-preset" onclick={() => setSchedulePreset('1d')}>{$t('omnibox.schedule_1d')}</button>
+ {#if scheduleAt || scheduleStop}
+ <button type="button" class="schedule-preset" onclick={() => { scheduleAt = ""; scheduleStop = ""; }}>{$t('omnibox.schedule_clear')}</button>
+ {/if}
+ </div>
+ <div class="timerange-inputs">
+ <input
+ class="timerange-input schedule-input"
+ type="datetime-local"
+ bind:value={scheduleAt}
+ aria-label={$t('omnibox.schedule_start') as string}
+ />
+ <span class="timerange-sep" aria-hidden="true">—</span>
+ <input
+ class="timerange-input schedule-input"
+ type="datetime-local"
+ bind:value={scheduleStop}
+ aria-label={$t('omnibox.schedule_stop') as string}
+ />
+ </div>
+ <span class="timerange-hint">{$t('omnibox.schedule_hint')}</span>
+ </div>
+
<FormatSelector
platform={omniState.info.platform}
isPlaylist={omniState.info.content_type === "playlist"}
@@ -1184,6 +1496,110 @@
outline-offset: var(--focus-ring-offset);
}
+ .download-primary-btn:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+ }
+
+ .playlist-picker {
+ width: 100%;
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+ padding: 10px 12px;
+ background: var(--button);
+ border: 1px solid var(--input-border);
+ border-radius: var(--border-radius);
+ }
+
+ .playlist-head {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 8px;
+ }
+
+ .playlist-count {
+ font-size: 12.5px;
+ font-weight: 500;
+ color: var(--secondary);
+ }
+
+ .playlist-bulk {
+ display: flex;
+ gap: 10px;
+ }
+
+ .playlist-link {
+ background: none;
+ border: none;
+ padding: 0;
+ font: inherit;
+ font-size: 12px;
+ color: var(--accent);
+ cursor: pointer;
+ }
+
+ .playlist-link:hover {
+ text-decoration: underline;
+ }
+
+ .playlist-status {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ font-size: 12.5px;
+ color: var(--gray);
+ }
+
+ .playlist-list {
+ list-style: none;
+ margin: 0;
+ padding: 0;
+ max-height: 220px;
+ overflow-y: auto;
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+ }
+
+ .playlist-item {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 5px 4px;
+ border-radius: calc(var(--border-radius) - 3px);
+ cursor: pointer;
+ font-size: 13px;
+ color: var(--secondary);
+ }
+
+ .playlist-item:hover {
+ background: var(--button-elevated);
+ }
+
+ .playlist-idx {
+ color: var(--gray);
+ font-variant-numeric: tabular-nums;
+ flex-shrink: 0;
+ }
+
+ .playlist-title {
+ flex: 1;
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+
+ .torrent-size {
+ margin-left: auto;
+ flex-shrink: 0;
+ padding-left: 8px;
+ color: var(--gray);
+ font-variant-numeric: tabular-nums;
+ }
+
.options-panel {
width: 100%;
}
@@ -1251,6 +1667,109 @@
outline: none;
}
+ .timerange-wrapper {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ }
+
+ .timerange-label {
+ font-size: 12.5px;
+ font-weight: 500;
+ color: var(--gray);
+ }
+
+ .timerange-inputs {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ }
+
+ .timerange-input {
+ width: 96px;
+ padding: 6px var(--padding);
+ font-size: 13px;
+ background: var(--button);
+ border: 1px solid var(--input-border);
+ border-radius: calc(var(--border-radius) - 2px);
+ color: var(--secondary);
+ text-align: center;
+ }
+
+ .timerange-input::placeholder {
+ color: var(--gray);
+ }
+
+ .timerange-input:focus-visible {
+ border-color: var(--secondary);
+ outline: none;
+ }
+
+ .timerange-sep {
+ color: var(--gray);
+ }
+
+ .timerange-hint {
+ font-size: 11.5px;
+ color: var(--gray);
+ }
+
+ .schedule-presets {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 6px;
+ margin-bottom: 6px;
+ }
+
+ .schedule-preset {
+ padding: 4px 10px;
+ font-size: 12px;
+ background: var(--button);
+ border: 1px solid var(--input-border);
+ border-radius: calc(var(--border-radius) - 2px);
+ color: var(--text);
+ cursor: pointer;
+ }
+
+ .schedule-preset:hover {
+ background: var(--button-elevated);
+ }
+
+ .schedule-input {
+ width: auto;
+ flex: 1;
+ min-width: 0;
+ }
+
+ .cookie-hint {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ margin: 0;
+ font-size: 12px;
+ color: #f4a72b;
+ }
+ .cookie-hint.expired {
+ color: #e0564f;
+ }
+ .cookie-hint svg {
+ flex-shrink: 0;
+ }
+ .cookie-hint-link {
+ background: none;
+ border: 0;
+ padding: 0;
+ font: inherit;
+ font-size: 12px;
+ color: var(--accent);
+ cursor: pointer;
+ text-decoration: underline;
+ text-underline-offset: 2px;
+ }
+ .cookie-hint-link:hover {
+ filter: brightness(1.15);
+ }
+
.action-btn {
display: flex;
align-items: center;
diff --git a/src/routes/about/project/+page.svelte b/src/routes/about/project/+page.svelte
index 2108f186..39382a39 100644
--- a/src/routes/about/project/+page.svelte
+++ b/src/routes/about/project/+page.svelte
@@ -3,7 +3,7 @@
import { t } from "$lib/i18n";
const GITHUB_URL = "https://github.com/tonhowtf/omniget";
- const APP_VERSION = "0.6.1";
+ const APP_VERSION = "0.6.2";
async function openGitHub() {
await open(GITHUB_URL);
diff --git a/src/routes/downloads/+page.svelte b/src/routes/downloads/+page.svelte
index 91e49918..0d7fd04c 100644
--- a/src/routes/downloads/+page.svelte
+++ b/src/routes/downloads/+page.svelte
@@ -25,6 +25,8 @@
import DownloadSpeedGraph from "$components/download/DownloadSpeedGraph.svelte";
import DownloadLog from "$components/download/DownloadLog.svelte";
import ReencodeDialog from "$components/dialog/ReencodeDialog.svelte";
+ import ToolsPanel from "$components/downloads/ToolsPanel.svelte";
+ import VideoOpsOverlay from "$components/downloads/VideoOpsOverlay.svelte";
import { locale as i18nLocale } from "$lib/i18n";
import { get } from "svelte/store";
import timeAgo from "$lib/time-ago";
@@ -203,6 +205,16 @@
}
}
+ async function removeItemWithFile(id: number) {
+ if (!confirm($t("downloads.delete_file_confirm"))) return;
+ try {
+ await invoke("remove_download", { downloadId: id, deleteFile: true });
+ } catch (e: any) {
+ const msg = typeof e === "string" ? e : e.message ?? $t("common.error");
+ showToast("error", msg);
+ }
+ }
+
async function clearFinished() {
if (!confirm($t("downloads.clear_confirm"))) return;
try {
@@ -246,6 +258,8 @@
reencodePath = path;
}
+ let vopPath = $state<string | null>(null);
+
type HistoryEntry = {
id: number;
url: string;
@@ -261,7 +275,7 @@
kind: QueueKind | null;
};
- let viewMode = $state<"active" | "history">("active");
+ let viewMode = $state<"active" | "history" | "tools">("active");
let historyEntries = $state<HistoryEntry[]>([]);
let historyLoading = $state(false);
@@ -297,6 +311,10 @@
}
}
+ function toggleToolsView() {
+ viewMode = viewMode === "tools" ? "active" : "tools";
+ }
+
async function historyRetry(url: string, platform: string) {
try {
const settings = (await import("$lib/stores/settings-store.svelte")).getSettings();
@@ -424,7 +442,7 @@
});
</script>
-{#if hasDownloads || viewMode === "history"}
+{#if hasDownloads || viewMode !== "active"}
<div class="downloads-page">
<div class="downloads-header">
<div class="downloads-title-row">
@@ -467,6 +485,17 @@
<polyline points="12 7 12 12 15 14" />
</svg>
</button>
+ <button
+ class="history-toggle"
+ class:on={viewMode === "tools"}
+ onclick={toggleToolsView}
+ aria-label={$t('tools.tab') as string}
+ title={$t('tools.tab') as string}
+ >
+ <svg viewBox="0 0 24 24" width="15" height="15" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M14.7 6.3a4 4 0 0 0-5.4 5.4L3 18l3 3 6.3-6.3a4 4 0 0 0 5.4-5.4l-2.6 2.6-2.4-2.4z" />
+ </svg>
+ </button>
</div>
</div>
@@ -549,7 +578,7 @@
{/if}
{/if}
</div>
- {:else}
+ {:else if viewMode === "history"}
<div class="history-view">
{#if historyLoading}
<p class="history-empty">{$t('downloads.history_loading')}</p>
@@ -648,24 +677,38 @@
</ul>
{/if}
</div>
+ {:else}
+ <ToolsPanel />
{/if}
</div>
{:else}
<div class="downloads-empty">
<Mascot emotion="idle" />
<p class="empty-text">{$t('downloads.empty')} <ContextHint text={$t('hints.downloads_empty')} dismissKey="downloads_empty" /></p>
- <button class="history-link" onclick={toggleHistoryView}>
- <svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
- <circle cx="12" cy="12" r="9" />
- <polyline points="12 7 12 12 15 14" />
- </svg>
- {$t('downloads.history_view_link')}
- </button>
+ <div class="empty-links">
+ <button class="history-link" onclick={toggleHistoryView}>
+ <svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
+ <circle cx="12" cy="12" r="9" />
+ <polyline points="12 7 12 12 15 14" />
+ </svg>
+ {$t('downloads.history_view_link')}
+ </button>
+ <button class="history-link" onclick={toggleToolsView}>
+ <svg viewBox="0 0 24 24" width="13" height="13" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
+ <path d="M14.7 6.3a4 4 0 0 0-5.4 5.4L3 18l3 3 6.3-6.3a4 4 0 0 0 5.4-5.4l-2.6 2.6-2.4-2.4z" />
+ </svg>
+ {$t('tools.tab')}
+ </button>
+ </div>
</div>
{/if}
<ReencodeDialog bind:inputPath={reencodePath} />
+{#if vopPath}
+ <VideoOpsOverlay filePath={vopPath} onClose={() => (vopPath = null)} />
+{/if}
+
{#snippet genericItem(item: GenericDownloadItem)}
<div class="download-item" data-status={item.status}>
<div class="item-header">
@@ -836,6 +879,34 @@
{/if}
</button>
{:else if item.status === "complete"}
+ {#if item.filePath && item.queueKind === "video"}
+ <button
+ class="action-icon-btn"
+ onclick={() => (vopPath = item.filePath!)}
+ aria-label={$t('downloads.vop.action_label')}
+ title={$t('downloads.vop.action_label')}
+ >
+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M12 2 2 7l10 5 10-5-10-5Z" />
+ <path d="m2 17 10 5 10-5M2 12l10 5 10-5" />
+ </svg>
+ </button>
+ {/if}
+ {#if item.filePath}
+ <button
+ class="action-icon-btn"
+ onclick={() => removeItemWithFile(item.id)}
+ aria-label={$t('downloads.delete_file')}
+ title={$t('downloads.delete_file')}
+ >
+ <svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
+ <polyline points="3 6 5 6 21 6" />
+ <path d="M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2" />
+ <line x1="10" y1="11" x2="10" y2="17" />
+ <line x1="14" y1="11" x2="14" y2="17" />
+ </svg>
+ </button>
+ {/if}
<button
class="action-icon-btn"
class:confirm-remove={pendingRemove === item.id}
@@ -1567,6 +1638,12 @@
align-items: center;
}
+ .empty-links {
+ display: flex;
+ gap: 12px;
+ flex-wrap: wrap;
+ justify-content: center;
+ }
.history-link {
margin-top: calc(var(--padding) / 2);
display: inline-flex;
diff --git a/src/routes/marketplace/+page.svelte b/src/routes/marketplace/+page.svelte
index 74240f93..ebeb147a 100644
--- a/src/routes/marketplace/+page.svelte
+++ b/src/routes/marketplace/+page.svelte
@@ -162,7 +162,7 @@
await invoke("install_plugin_from_registry", { pluginId: id, repo });
await refreshPlugins();
} catch (e: any) {
- const msg = typeof e === "string" ? e : e?.message ?? "Install failed";
+ const msg = typeof e === "string" ? e : e?.message ?? $t("common.error");
showToast("error", msg);
}
installingId = null;
diff --git a/src/routes/settings/+page.svelte b/src/routes/settings/+page.svelte
index f52485d5..e423fbc6 100644
--- a/src/routes/settings/+page.svelte
+++ b/src/routes/settings/+page.svelte
@@ -17,6 +17,8 @@
import SettingsTypography from "$components/settings/SettingsTypography.svelte";
import SettingsBrowserExtension from "$components/settings/SettingsBrowserExtension.svelte";
import SettingsCookies from "$components/settings/SettingsCookies.svelte";
+ import SettingsChannels from "$components/settings/SettingsChannels.svelte";
+ import SettingsAI from "$components/settings/SettingsAI.svelte";
type DependencyStatus = {
name: string;
@@ -138,9 +140,20 @@
await updateSettings({ download: { video_quality: value } });
}
- type SettingsCategory = "downloads" | "appearance" | "typography" | "network" | "cookies" | "plugins" | "advanced";
+ type SettingsCategory = "downloads" | "appearance" | "typography" | "network" | "cookies" | "channels" | "ai" | "plugins" | "advanced";
let activeCategory = $state<SettingsCategory>("downloads");
+ let tabApplied = false;
+ $effect(() => {
+ if (tabApplied || typeof window === "undefined") return;
+ tabApplied = true;
+ const tab = new URLSearchParams(window.location.search).get("tab");
+ const valid = ["downloads", "appearance", "typography", "network", "cookies", "channels", "ai", "plugins", "advanced"];
+ if (tab && valid.includes(tab)) {
+ activeCategory = tab as SettingsCategory;
+ }
+ });
+
let searchQuery = $state("");
let normalizedQuery = $derived(searchQuery.trim().toLowerCase());
let isSearching = $derived(normalizedQuery.length > 0);
@@ -305,49 +318,6 @@
}, 800);
}
- const YTDLP_FLAG_CATALOG = [
- { flag: "--embed-subs", label: "Embed subtitles" },
- { flag: "--write-thumbnail", label: "Save thumbnail" },
- { flag: "--write-description", label: "Save description" },
- { flag: "--write-comments", label: "Save comments" },
- { flag: "--restrict-filenames", label: "ASCII filenames" },
- { flag: "--no-overwrites", label: "No overwrites" },
- { flag: "--prefer-free-formats", label: "Free formats" },
- { flag: "--force-ipv4", label: "Force IPv4" },
- { flag: "--geo-bypass", label: "Geo bypass" },
- { flag: "--limit-rate", label: "Limit rate", hasValue: true, placeholder: "e.g. 1M" },
- { flag: "--sleep-interval", label: "Sleep interval", hasValue: true, placeholder: "e.g. 5" },
- ];
-
- async function toggleFlag(flag: string) {
- let current = [...(settings?.download?.extra_ytdlp_flags ?? [])];
- const idx = current.findIndex(f => f === flag || f.startsWith(flag + " "));
- if (idx >= 0) {
- current.splice(idx, 1);
- } else {
- current.push(flag);
- }
- await updateSettings({ download: { extra_ytdlp_flags: current } });
- }
-
- async function setFlagValue(flag: string, value: string) {
- let current = [...(settings?.download?.extra_ytdlp_flags ?? [])];
- const idx = current.findIndex(f => f === flag || f.startsWith(flag + " "));
- if (idx >= 0) {
- current[idx] = value ? `${flag} ${value}` : flag;
- }
- await updateSettings({ download: { extra_ytdlp_flags: current } });
- }
-
- function isFlagActive(flag: string): boolean {
- return (settings?.download?.extra_ytdlp_flags ?? []).some(f => f === flag || f.startsWith(flag + " "));
- }
-
- function getFlagValue(flag: string): string {
- const f = (settings?.download?.extra_ytdlp_flags ?? []).find(f => f.startsWith(flag + " "));
- return f ? f.slice(flag.length + 1) : "";
- }
-
async function handleReset() {
if (!confirm($t("settings.advanced.reset_confirm"))) return;
resetting = true;
@@ -403,6 +373,8 @@
["typography", "settings.cat_typography"],
["network", "settings.cat_network"],
["cookies", "settings.cat_cookies"],
+ ["channels", "settings.cat_channels"],
+ ["ai", "settings.cat_ai"],
["plugins", "settings.cat_plugins"],
["advanced", "settings.cat_advanced"],
] as [cat, key] (cat)}
@@ -444,6 +416,14 @@
<SettingsCookies />
{/if}
+ {#if isSearching || activeCategory === "channels"}
+ <SettingsChannels />
+ {/if}
+
+ {#if isSearching || activeCategory === "ai"}
+ <SettingsAI />
+ {/if}
+
{#if isSearching || activeCategory === "advanced"}
<SettingsAdvanced {resetting} onReset={handleReset} />
{/if}
diff --git a/src/routes/study/anki/+page.svelte b/src/routes/study/anki/+page.svelte
index 17f815ef..26570837 100644
--- a/src/routes/study/anki/+page.svelte
+++ b/src/routes/study/anki/+page.svelte
@@ -7,7 +7,6 @@
type AnkiDashboardState,
type AnkiDeckSummary,
} from "$lib/anki-bridge";
- import MascotSlot from "$lib/components/MascotSlot.svelte";
let dashState = $state<AnkiDashboardState | null>(null);
let loading = $state(true);
@@ -117,16 +116,6 @@
{/if}
</div>
</div>
-
- <div class="hero-mascot">
- <MascotSlot
- slug={dashState.pet.slug}
- state={totalToReview === 0 ? "jumping" : "idle"}
- scale={0.75}
- fallback="none"
- />
- <span class="pet-name">{dashState.pet.display_name}</span>
- </div>
</div>
</section>
@@ -134,12 +123,6 @@
<section class="surface-card streak-card">
<header class="streak-head">
<h2 class="section-title">Streak</h2>
- <MascotSlot
- slug={dashState.pet.slug}
- state={dashState.streak.current > 0 ? "waving" : "idle"}
- scale={0.4}
- fallback="none"
- />
</header>
<div class="streak-ring-wrap">
@@ -207,13 +190,6 @@
</section>
{:else}
<section class="surface-card empty-pane">
- <MascotSlot
- slug={dashState.pet.slug}
- state="jumping"
- scale={1}
- fallback="check"
- fallbackLabel="Tudo zerado"
- />
<h2 class="empty-title">Tudo zerado</h2>
<p class="empty-desc">Você revisou todos os cards de hoje. Volte amanhã ou crie novos.</p>
<button type="button" class="btn-cta" onclick={() => goto("/study/anki/decks")}>
@@ -313,21 +289,6 @@
margin-top: var(--space-2);
}
- .hero-mascot {
- display: flex;
- flex-direction: column;
- align-items: center;
- gap: var(--space-2);
- flex-shrink: 0;
- }
-
- .pet-name {
- font-size: var(--text-xs);
- color: var(--text-dim);
- text-transform: uppercase;
- letter-spacing: 0.08em;
- }
-
.pill {
display: inline-flex;
align-items: center;
@@ -639,9 +600,5 @@
flex-direction: column-reverse;
align-items: stretch;
}
- .hero-mascot {
- flex-direction: row;
- justify-content: center;
- }
}
</style>
diff --git a/src/routes/study/anki/settings/+page.svelte b/src/routes/study/anki/settings/+page.svelte
index 75e100b0..732c2436 100644
--- a/src/routes/study/anki/settings/+page.svelte
+++ b/src/routes/study/anki/settings/+page.svelte
@@ -442,13 +442,6 @@
</div>
{/if}
- <div class="pets-moved">
- <span class="pets-moved-text">
- A configuração de pets foi movida para
- <a class="pets-moved-link" href="/study/settings?tab=pets">Configurações &rsaquo; Pets</a>.
- </span>
- </div>
-
{#if loading}
<div class="state">Carregando preferências…</div>
{:else if error}
@@ -1027,25 +1020,6 @@
}
}
- .pets-moved {
- margin-bottom: 24px;
- padding: 12px 16px;
- background: var(--surface);
- border: 1px solid var(--border);
- border-radius: var(--radius-sm);
- color: var(--text-muted);
- font-size: var(--text-sm);
- }
-
- .pets-moved-link {
- color: var(--accent);
- text-decoration: none;
- }
-
- .pets-moved-link:hover {
- text-decoration: underline;
- }
-
.sections {
display: flex;
flex-direction: column;
diff --git a/src/routes/study/music/now-playing/+page.svelte b/src/routes/study/music/now-playing/+page.svelte
index 981488f6..b4219a31 100644
--- a/src/routes/study/music/now-playing/+page.svelte
+++ b/src/routes/study/music/now-playing/+page.svelte
@@ -10,6 +10,7 @@
import ProgressBar from "$lib/study-music-components/ProgressBar.svelte";
import VolumeControl from "$lib/study-music-components/VolumeControl.svelte";
import PlayerErrorBanner from "$lib/study-music-components/PlayerErrorBanner.svelte";
+ import PasteLyricsModal from "$lib/study-music-components/PasteLyricsModal.svelte";
type Tab = "lyrics" | "queue" | "previous";
let tab = $state<Tab>("lyrics");
@@ -18,11 +19,20 @@
const trackId = $derived(track?.id ?? null);
const lyricsLines = $derived(lyricsStore.lines);
const lyricsStatus = $derived(lyricsStore.status);
+ const effectiveTime = $derived(
+ musicPlayer.currentTime + lyricsStore.offsetMs / 1000,
+ );
const activeLyricIdx = $derived(
lyricsStatus === "synced" && lyricsLines.length > 0
- ? lyricsStore.activeIndex(musicPlayer.currentTime)
+ ? lyricsStore.activeIndex(effectiveTime)
: -1,
);
+ const nowMs = $derived(effectiveTime * 1000);
+ const offsetLabel = $derived(
+ (lyricsStore.offsetMs >= 0 ? "+" : "−") +
+ (Math.abs(lyricsStore.offsetMs) / 1000).toFixed(2) +
+ "s",
+ );
const previousTracks = $derived(
musicPlayer.queue.slice(0, Math.max(0, musicPlayer.queueIndex)).reverse(),
);
@@ -30,6 +40,7 @@
const reduceMotion = $derived(musicTheme.reduceAnimationsActive);
+ let pasteOpen = $state(false);
let lyricsContainer = $state<HTMLDivElement | null>(null);
let lineRefs: HTMLLIElement[] = $state([]);
let _lastScrollAt = 0;
@@ -90,6 +101,16 @@
void musicPlayer.toggleFavorite(track.id);
}
+ function retryLyrics() {
+ if (trackId === null) return;
+ void lyricsStore.loadFor(trackId, true);
+ }
+
+ function seekToLine(timeMs: number) {
+ if (lyricsStatus !== "synced") return;
+ musicPlayer.seek(Math.max(0, timeMs / 1000));
+ }
+
const coverSrc = $derived(
track?.cover_path ??
track?.spotify_cover_url ??
@@ -106,6 +127,11 @@
{#if track}
<div class="np-shell">
<PlayerErrorBanner />
+ <PasteLyricsModal
+ open={pasteOpen}
+ {trackId}
+ onclose={() => (pasteOpen = false)}
+ />
<div class="np-backdrop" aria-hidden="true">
{#if coverSrc}
<CoverImage
@@ -280,20 +306,95 @@
<span class="np-skel-bar" style:width="74%"></span>
</div>
{:else if lyricsStatus === "notfound"}
- <p class="np-empty">{$t("study.music.now_playing_lyrics_empty")}</p>
+ <div class="np-lyrics-msg">
+ <p class="np-empty">{$t("study.music.now_playing_lyrics_empty")}</p>
+ <button type="button" class="np-retry" onclick={retryLyrics}
+ >{$t("study.music.now_playing_lyrics_retry")}</button>
+ <button type="button" class="np-retry" onclick={() => (pasteOpen = true)}
+ >{$t("study.music.lyrics_paste_title")}</button>
+ </div>
{:else if lyricsStatus === "error"}
- <p class="np-empty">{$t("study.music.now_playing_lyrics_error")}</p>
+ <div class="np-lyrics-msg">
+ <p class="np-empty">{$t("study.music.now_playing_lyrics_error")}</p>
+ <button type="button" class="np-retry" onclick={retryLyrics}
+ >{$t("study.music.now_playing_lyrics_retry")}</button>
+ <button type="button" class="np-retry" onclick={() => (pasteOpen = true)}
+ >{$t("study.music.lyrics_paste_title")}</button>
+ </div>
+ {:else if lyricsStatus === "plain"}
+ <div class="np-lyrics np-lyrics-plain">
+ <p class="np-plain-note">{$t("study.music.now_playing_lyrics_plain_note")}</p>
+ <pre class="np-plain">{lyricsStore.plain ?? ""}</pre>
+ </div>
{:else if lyricsLines.length === 0}
- <p class="np-empty">{$t("study.music.now_playing_lyrics_empty")}</p>
+ <div class="np-lyrics-msg">
+ <p class="np-empty">{$t("study.music.now_playing_lyrics_empty")}</p>
+ <button type="button" class="np-retry" onclick={retryLyrics}
+ >{$t("study.music.now_playing_lyrics_retry")}</button>
+ <button type="button" class="np-retry" onclick={() => (pasteOpen = true)}
+ >{$t("study.music.lyrics_paste_title")}</button>
+ </div>
{:else}
+ <div class="np-lyrics-head">
+ <div class="np-sync" role="group">
+ <button
+ type="button"
+ class="np-sync-btn"
+ onclick={() => lyricsStore.nudgeOffset(-100)}
+ aria-label={$t("study.music.now_playing_lyrics_sync_earlier") as string}
+ title={$t("study.music.now_playing_lyrics_sync_earlier") as string}
+ >−</button>
+ <button
+ type="button"
+ class="np-sync-val"
+ class:dirty={lyricsStore.offsetMs !== 0}
+ onclick={() => lyricsStore.resetOffset()}
+ aria-label={$t("study.music.now_playing_lyrics_sync_reset") as string}
+ title={$t("study.music.now_playing_lyrics_sync_reset") as string}
+ >{offsetLabel}</button>
+ <button
+ type="button"
+ class="np-sync-btn"
+ onclick={() => lyricsStore.nudgeOffset(100)}
+ aria-label={$t("study.music.now_playing_lyrics_sync_later") as string}
+ title={$t("study.music.now_playing_lyrics_sync_later") as string}
+ >+</button>
+ </div>
+ <div class="np-head-actions">
+ <button
+ type="button"
+ class="np-trans-toggle"
+ onclick={() => (pasteOpen = true)}
+ >{$t("study.music.lyrics_paste_title")}</button>
+ <button
+ type="button"
+ class="np-trans-toggle"
+ onclick={() => lyricsStore.toggleTranslation()}
+ >{lyricsStore.showTranslation
+ ? $t("study.music.now_playing_lyrics_hide_translation")
+ : $t("study.music.now_playing_lyrics_show_translation")}</button>
+ </div>
+ </div>
<div bind:this={lyricsContainer} class="np-lyrics">
<ol>
{#each lyricsLines as line, i (i + ":" + line.text)}
+ {@const tr = lyricsStore.showTranslation
+ ? lyricsStore.translations.get(i)
+ : null}
<li
bind:this={lineRefs[i]}
class="np-line"
class:active={i === activeLyricIdx}
- >{line.text || " "}</li>
+ >
+ <button
+ type="button"
+ class="np-line-btn"
+ onclick={() => seekToLine(line.time_ms)}
+ >{#if i === activeLyricIdx && line.syllables && line.syllables.length > 0}<span class="np-line-words">{#each line.syllables as syl, si (si)}<span class="np-syl" class:sung={nowMs >= syl.time_ms}>{syl.text}</span>{/each}</span>{:else}{line.text || " "}{/if}</button>
+ {#if tr && tr.translation}
+ <span class="np-line-tr">{tr.translation}</span>
+ {/if}
+ </li>
{/each}
</ol>
</div>
@@ -668,6 +769,159 @@
transform: scale(1.02);
transform-origin: left center;
}
+ .np-line-btn {
+ appearance: none;
+ background: none;
+ border: 0;
+ margin: 0;
+ padding: 2px 0;
+ width: 100%;
+ text-align: inherit;
+ font: inherit;
+ color: inherit;
+ cursor: pointer;
+ display: block;
+ }
+ .np-line-btn:focus-visible {
+ outline: 2px solid var(--music-highlight, var(--accent));
+ outline-offset: 2px;
+ border-radius: 4px;
+ }
+ .np-line-tr {
+ display: block;
+ margin-top: 2px;
+ font-size: 13px;
+ font-weight: 500;
+ color: rgba(255, 255, 255, 0.5);
+ }
+ .np-line.active .np-line-tr {
+ color: rgba(255, 255, 255, 0.78);
+ }
+ .np-line-words {
+ display: inline;
+ }
+ .np-syl {
+ color: rgba(255, 255, 255, 0.34);
+ transition: color 180ms ease;
+ }
+ .np-syl.sung {
+ color: rgba(255, 255, 255, 1);
+ }
+
+ .np-lyrics-msg {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ gap: 12px;
+ padding: 32px 8px;
+ }
+ .np-retry {
+ appearance: none;
+ border: 1px solid rgba(255, 255, 255, 0.18);
+ background: rgba(255, 255, 255, 0.06);
+ color: rgba(255, 255, 255, 0.9);
+ font-size: 13px;
+ font-weight: 600;
+ padding: 8px 18px;
+ border-radius: 999px;
+ cursor: pointer;
+ transition: background 120ms ease, border-color 120ms ease;
+ }
+ .np-retry:hover {
+ background: rgba(255, 255, 255, 0.12);
+ border-color: rgba(255, 255, 255, 0.32);
+ }
+
+ .np-lyrics-head {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ gap: 8px;
+ padding: 4px 4px 0;
+ }
+ .np-head-actions {
+ display: inline-flex;
+ align-items: center;
+ gap: 6px;
+ }
+ .np-sync {
+ display: inline-flex;
+ align-items: center;
+ gap: 2px;
+ }
+ .np-sync-btn {
+ appearance: none;
+ border: 1px solid rgba(255, 255, 255, 0.16);
+ background: rgba(255, 255, 255, 0.05);
+ color: rgba(255, 255, 255, 0.78);
+ width: 24px;
+ height: 24px;
+ border-radius: 50%;
+ font-size: 15px;
+ line-height: 1;
+ cursor: pointer;
+ display: grid;
+ place-items: center;
+ transition: background 120ms ease;
+ }
+ .np-sync-btn:hover {
+ background: rgba(255, 255, 255, 0.12);
+ }
+ .np-sync-val {
+ appearance: none;
+ border: 0;
+ background: none;
+ color: rgba(255, 255, 255, 0.45);
+ font-size: 12px;
+ font-variant-numeric: tabular-nums;
+ min-width: 52px;
+ text-align: center;
+ cursor: pointer;
+ padding: 2px 4px;
+ }
+ .np-sync-val.dirty {
+ color: var(--music-highlight, var(--accent));
+ font-weight: 600;
+ }
+ .np-trans-toggle {
+ appearance: none;
+ border: 1px solid rgba(255, 255, 255, 0.16);
+ background: rgba(255, 255, 255, 0.05);
+ color: rgba(255, 255, 255, 0.75);
+ font-size: 12px;
+ font-weight: 600;
+ padding: 5px 12px;
+ border-radius: 999px;
+ cursor: pointer;
+ transition: background 120ms ease, color 120ms ease;
+ }
+ .np-trans-toggle:hover {
+ background: rgba(255, 255, 255, 0.1);
+ color: rgba(255, 255, 255, 0.95);
+ }
+
+ .np-lyrics-plain {
+ padding: 8px 4px 50vh;
+ }
+ .np-plain-note {
+ margin: 0 0 12px;
+ font-size: 12px;
+ font-weight: 600;
+ letter-spacing: 0.04em;
+ text-transform: uppercase;
+ color: rgba(255, 255, 255, 0.4);
+ text-align: center;
+ }
+ .np-plain {
+ margin: 0;
+ font-family: inherit;
+ font-size: 16px;
+ font-weight: 500;
+ line-height: 1.6;
+ color: rgba(255, 255, 255, 0.78);
+ white-space: pre-wrap;
+ word-break: break-word;
+ }
.np-lyrics-skel {
display: flex;
diff --git a/src/routes/study/music/youtube/+page.svelte b/src/routes/study/music/youtube/+page.svelte
index 3031f954..16e584f3 100644
--- a/src/routes/study/music/youtube/+page.svelte
+++ b/src/routes/study/music/youtube/+page.svelte
@@ -18,7 +18,6 @@
type LoopCookieStatus,
} from "$lib/study-bridge";
import NavigationTitle from "$lib/study-music-components/NavigationTitle.svelte";
- import SpeedDialGridItem from "$lib/study-music-components/SpeedDialGridItem.svelte";
import EmptyPlaceholder from "$lib/study-music-components/EmptyPlaceholder.svelte";
import YoutubeSkeleton from "$lib/study-music-youtube-components/YoutubeSkeleton.svelte";
import YoutubeConnectHero from "$lib/study-music-youtube-components/YoutubeConnectHero.svelte";
@@ -198,63 +197,62 @@
</script>
<section class="yt-hub">
- <header class="page-head">
- <h1>{$t("study.music.youtube.hub_title")}</h1>
- <p class="tagline">{$t("study.music.youtube.hub_tagline")}</p>
+ <header class="yt-topbar">
+ <h1 class="yt-brand">{$t("study.music.youtube.hub_title")}</h1>
+ <a
+ class="yt-search"
+ href="/study/music/youtube/search"
+ aria-label={$t("study.music.speed_dial_search") as string}
+ >
+ <svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>
+ <span>{$t("study.music.speed_dial_search")}</span>
+ </a>
</header>
{#if authDerived === "loading"}
<div class="boot-skel">
- <YoutubeSkeleton kind="card" count={3} />
+ <YoutubeSkeleton kind="card" count={6} />
</div>
{:else if authDerived !== "ready"}
- <div class="speed-dial-row anon">
- <SpeedDialGridItem label={$t("study.music.speed_dial_search") as string} href="/study/music/youtube/search">
- {#snippet icon()}
- <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>
- {/snippet}
- </SpeedDialGridItem>
- <SpeedDialGridItem label={$t("study.music.youtube.explore_title") as string} href="/study/music/youtube/explore">
- {#snippet icon()}
- <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><polygon points="16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76"/></svg>
- {/snippet}
- </SpeedDialGridItem>
- </div>
+ <nav class="yt-chips" aria-label={$t("study.music.youtube.hub_title") as string}>
+ <a class="yt-chip" href="/study/music/youtube/search">
+ <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>
+ <span>{$t("study.music.speed_dial_search")}</span>
+ </a>
+ <a class="yt-chip" href="/study/music/youtube/explore">
+ <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><polygon points="16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76"/></svg>
+ <span>{$t("study.music.youtube.explore_title")}</span>
+ </a>
+ </nav>
<YoutubeConnectHero status={authDerived as "missing" | "no_youtube"} filePath={authStatus?.file_path ?? ""} />
{:else}
- <div class="speed-dial-row">
- <SpeedDialGridItem label={$t("study.music.speed_dial_search") as string} href="/study/music/youtube/search">
- {#snippet icon()}
- <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>
- {/snippet}
- </SpeedDialGridItem>
- <SpeedDialGridItem label={$t("study.music.youtube.explore_title") as string} href="/study/music/youtube/explore">
- {#snippet icon()}
- <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><polygon points="16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76"/></svg>
- {/snippet}
- </SpeedDialGridItem>
- <SpeedDialGridItem label={$t("study.music.speed_dial_history") as string} href="/study/music/youtube/history">
- {#snippet icon()}
- <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.74 9.74 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/></svg>
- {/snippet}
- </SpeedDialGridItem>
- <SpeedDialGridItem label={$t("study.music.youtube.shelf_subscriptions") as string} href="/study/music/youtube/explore">
- {#snippet icon()}
- <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 19h16"/><path d="M6 15h12"/><rect x="3" y="3" width="18" height="9" rx="2"/></svg>
- {/snippet}
- </SpeedDialGridItem>
- <SpeedDialGridItem label={$t("study.music.my_playlists_title") as string} href="/study/music/youtube/playlists">
- {#snippet icon()}
- <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15V6"/><path d="M3 18V9"/><path d="M3 18a3 3 0 1 0 6 0V9a3 3 0 1 0-6 0"/><path d="M15 6a3 3 0 1 0 6 0 3 3 0 1 0-6 0"/></svg>
- {/snippet}
- </SpeedDialGridItem>
- <SpeedDialGridItem label={$t("study.music.speed_dial_trending") as string} href="/study/music/youtube/explore">
- {#snippet icon()}
- <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m23 6-9.5 9.5-5-5L1 18"/><path d="M17 6h6v6"/></svg>
- {/snippet}
- </SpeedDialGridItem>
- </div>
+ <nav class="yt-chips" aria-label={$t("study.music.youtube.hub_title") as string}>
+ <a class="yt-chip" href="/study/music/youtube/search">
+ <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>
+ <span>{$t("study.music.speed_dial_search")}</span>
+ </a>
+ <a class="yt-chip" href="/study/music/youtube/explore">
+ <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><polygon points="16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76"/></svg>
+ <span>{$t("study.music.youtube.explore_title")}</span>
+ </a>
+ <a class="yt-chip" href="/study/music/youtube/history">
+ <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12a9 9 0 1 0 9-9 9.74 9.74 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/></svg>
+ <span>{$t("study.music.speed_dial_history")}</span>
+ </a>
+ <a class="yt-chip" href="/study/music/youtube/explore">
+ <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 19h16"/><path d="M6 15h12"/><rect x="3" y="3" width="18" height="9" rx="2"/></svg>
+ <span>{$t("study.music.youtube.shelf_subscriptions")}</span>
+ </a>
+ <a class="yt-chip" href="/study/music/youtube/playlists">
+ <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15V6"/><path d="M3 18V9"/><path d="M3 18a3 3 0 1 0 6 0V9a3 3 0 1 0-6 0"/><path d="M15 6a3 3 0 1 0 6 0 3 3 0 1 0-6 0"/></svg>
+ <span>{$t("study.music.my_playlists_title")}</span>
+ </a>
+ <a class="yt-chip" href="/study/music/youtube/explore">
+ <svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m23 6-9.5 9.5-5-5L1 18"/><path d="M17 6h6v6"/></svg>
+ <span>{$t("study.music.speed_dial_trending")}</span>
+ </a>
+ </nav>
<section class="block">
<NavigationTitle title={$t("study.music.youtube.shelf_continue_watching") as string} seeAllHref="/study/music/youtube/history" />
@@ -413,47 +411,95 @@
.yt-hub {
display: flex;
flex-direction: column;
- gap: 28px;
- color: rgba(255, 255, 255, 0.95);
+ gap: 22px;
+ color: #f1f1f1;
+ background: #0f0f0f;
+ min-height: 100vh;
+ width: 100vw;
+ margin-left: calc(50% - 50vw);
+ margin-top: -16px;
+ margin-bottom: -16px;
+ padding: 0 0 56px;
+ font-family:
+ "Roboto", "YouTube Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
- .page-head h1 {
+ .yt-topbar {
+ position: sticky;
+ top: 0;
+ z-index: 20;
+ display: flex;
+ align-items: center;
+ gap: 24px;
+ padding: 12px 24px;
+ background: rgba(15, 15, 15, 0.92);
+ backdrop-filter: blur(12px);
+ border-bottom: 1px solid rgba(255, 255, 255, 0.07);
+ }
+ .yt-brand {
margin: 0;
- font-size: clamp(28px, 3.5vw, 40px);
- font-weight: 900;
+ font-size: 20px;
+ font-weight: 700;
letter-spacing: -0.02em;
- color: white;
+ color: #fff;
+ white-space: nowrap;
}
- .tagline {
- margin: 4px 0 0;
- color: rgba(255, 255, 255, 0.55);
+ .yt-search {
+ display: flex;
+ align-items: center;
+ gap: 12px;
+ flex: 1;
+ max-width: 640px;
+ padding: 9px 18px;
+ border-radius: 999px;
+ background: #121212;
+ border: 1px solid rgba(255, 255, 255, 0.14);
+ color: #aaa;
font-size: 14px;
+ text-decoration: none;
+ transition: border-color 140ms ease, background 140ms ease;
}
- .speed-dial-row {
- display: grid;
- grid-template-columns: repeat(6, 1fr);
- gap: 10px;
+ .yt-search:hover {
+ border-color: rgba(255, 255, 255, 0.3);
+ background: #1a1a1a;
}
- .speed-dial-row.anon {
- grid-template-columns: repeat(2, 1fr);
- max-width: 480px;
+ .yt-search svg { color: #aaa; flex: 0 0 auto; }
+ .yt-chips {
+ display: flex;
+ gap: 10px;
+ overflow-x: auto;
+ padding: 4px 24px 6px;
+ scrollbar-width: none;
}
- @media (max-width: 760px) {
- .speed-dial-row {
- grid-template-columns: repeat(3, 1fr);
- }
- .speed-dial-row.anon {
- grid-template-columns: repeat(2, 1fr);
- }
+ .yt-chips::-webkit-scrollbar { display: none; }
+ .yt-chip {
+ display: inline-flex;
+ align-items: center;
+ gap: 8px;
+ flex: 0 0 auto;
+ padding: 8px 14px;
+ border-radius: 999px;
+ background: rgba(255, 255, 255, 0.08);
+ color: #f1f1f1;
+ font-size: 13px;
+ font-weight: 500;
+ text-decoration: none;
+ white-space: nowrap;
+ transition: background 140ms ease;
}
+ .yt-chip svg { color: #f1f1f1; }
+ .yt-chip:hover { background: rgba(255, 255, 255, 0.16); }
+ .yt-chip:active { background: rgba(255, 255, 255, 0.22); }
.boot-skel {
display: grid;
- grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
- gap: 14px;
+ grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
+ gap: 16px;
+ padding: 8px 24px 0;
}
.block {
display: flex;
flex-direction: column;
gap: 14px;
+ padding: 0 24px;
}
.seed-hint {
margin: -4px 0 0;
@@ -461,19 +507,30 @@
font-size: 13px;
}
.h-scroll {
- display: flex;
- gap: 18px;
+ display: grid;
+ grid-auto-flow: column;
+ grid-auto-columns: minmax(260px, 1fr);
+ grid-template-rows: 1fr;
+ gap: 16px;
overflow-x: auto;
overflow-y: visible;
- padding: 4px 2px 16px;
- scrollbar-width: none;
+ padding: 2px 2px 14px;
+ scrollbar-width: thin;
+ scrollbar-color: #5a5a5a transparent;
scroll-behavior: smooth;
+ scroll-snap-type: x proximity;
+ }
+ .h-scroll::-webkit-scrollbar { height: 8px; }
+ .h-scroll::-webkit-scrollbar-thumb {
+ background: #5a5a5a;
+ border-radius: 4px;
}
- .h-scroll::-webkit-scrollbar { display: none; }
+ .h-scroll::-webkit-scrollbar-track { background: transparent; }
.continue-card,
.discover-card {
flex: 0 0 auto;
+ width: 100%;
background: transparent;
border: 0;
padding: 0;
@@ -481,70 +538,85 @@
color: inherit;
cursor: pointer;
font: inherit;
+ scroll-snap-align: start;
}
- .continue-card { width: 160px; }
- .discover-card { width: 176px; }
.cover {
position: relative;
- aspect-ratio: 1 / 1;
+ aspect-ratio: 16 / 9;
border-radius: 12px;
overflow: hidden;
- background: rgba(40, 40, 40, 0.6);
+ background: #272727;
margin-bottom: 10px;
- transition: transform 200ms ease;
- }
- .continue-card:hover .cover,
- .discover-card:hover .cover {
- transform: scale(1.02);
}
- .cover img {
+ .cover img,
+ .cover-fallback {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
+ transition: transform 220ms ease;
}
- .cover-fallback {
- width: 100%;
- height: 100%;
+ .continue-card:hover .cover img,
+ .discover-card:hover .cover img {
+ transform: scale(1.045);
+ }
+ .cover::after {
+ content: "";
+ position: absolute;
+ inset: 0;
+ background: rgba(0, 0, 0, 0);
+ transition: background 160ms ease;
+ }
+ .continue-card:hover .cover::after,
+ .discover-card:hover .cover::after {
+ background: rgba(0, 0, 0, 0.12);
}
.progress-track {
position: absolute;
- left: 6px;
- right: 6px;
- bottom: 6px;
- height: 3px;
- background: rgba(0, 0, 0, 0.5);
- border-radius: 2px;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ height: 4px;
+ background: rgba(255, 255, 255, 0.25);
overflow: hidden;
+ z-index: 1;
}
.progress-fill {
height: 100%;
- background: var(--accent);
- border-radius: inherit;
+ background: #f00;
+ border-radius: 0;
}
.card-title {
margin: 0;
- font-size: 13px;
- font-weight: 700;
- color: white;
+ font-size: 14px;
+ font-weight: 500;
+ color: #f1f1f1;
+ line-height: 1.4;
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- padding: 0 2px;
+ padding: 0;
+ }
+ .continue-card:hover .card-title,
+ .discover-card:hover .card-title {
+ color: #fff;
}
.card-sub {
- margin: 2px 0 0;
- font-size: 11px;
- font-weight: 600;
- color: rgba(255, 255, 255, 0.55);
+ margin: 4px 0 0;
+ font-size: 12.5px;
+ font-weight: 400;
+ color: #aaa;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
- padding: 0 2px;
+ padding: 0;
}
@media (prefers-reduced-motion: reduce) {
- .cover, .continue-card:hover .cover, .discover-card:hover .cover {
+ .cover img,
+ .continue-card:hover .cover img,
+ .discover-card:hover .cover img {
transition: none;
transform: none;
}
diff --git a/src/routes/study/music/youtube/channel/[id]/+page.svelte b/src/routes/study/music/youtube/channel/[id]/+page.svelte
index 81fd4bc5..4ba45abc 100644
--- a/src/routes/study/music/youtube/channel/[id]/+page.svelte
+++ b/src/routes/study/music/youtube/channel/[id]/+page.svelte
@@ -251,7 +251,14 @@
display: flex;
flex-direction: column;
gap: 16px;
- padding: 0 20px 32px;
+ margin: -16px;
+ padding: 20px 24px 48px;
+ background: #0f0f0f;
+ color: #f1f1f1;
+ min-height: 100%;
+ border-radius: 14px;
+ font-family:
+ "Roboto", "YouTube Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
.sticky-row {
display: flex;
diff --git a/src/routes/study/music/youtube/explore/+page.svelte b/src/routes/study/music/youtube/explore/+page.svelte
index 37f285c4..6bfd2213 100644
--- a/src/routes/study/music/youtube/explore/+page.svelte
+++ b/src/routes/study/music/youtube/explore/+page.svelte
@@ -276,9 +276,14 @@
<style>
.explore {
- padding: 24px 24px 96px;
- max-width: 1200px;
- margin: 0 auto;
+ margin: -16px;
+ padding: 20px 24px 48px;
+ background: #0f0f0f;
+ color: #f1f1f1;
+ min-height: 100%;
+ border-radius: 14px;
+ font-family:
+ "Roboto", "YouTube Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
display: grid;
gap: 28px;
}
diff --git a/src/routes/study/music/youtube/search/+page.svelte b/src/routes/study/music/youtube/search/+page.svelte
index 1a9b6b64..aa38a7cb 100644
--- a/src/routes/study/music/youtube/search/+page.svelte
+++ b/src/routes/study/music/youtube/search/+page.svelte
@@ -365,7 +365,19 @@
</section>
<style>
- .search-page { display: flex; flex-direction: column; gap: 20px; }
+ .search-page {
+ display: flex;
+ flex-direction: column;
+ gap: 20px;
+ margin: -16px;
+ padding: 20px 24px 48px;
+ background: #0f0f0f;
+ color: #f1f1f1;
+ min-height: 100%;
+ border-radius: 14px;
+ font-family:
+ "Roboto", "YouTube Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
+ }
.search-box {
position: relative;
display: flex;
diff --git a/src/routes/study/settings/+page.svelte b/src/routes/study/settings/+page.svelte
index 72f595d1..829a9a08 100644
--- a/src/routes/study/settings/+page.svelte
+++ b/src/routes/study/settings/+page.svelte
@@ -14,7 +14,6 @@
import BehaviorSettingsTab from "$lib/study-components/settings/BehaviorSettingsTab.svelte";
import LibrarySettingsTab from "$lib/study-components/settings/LibrarySettingsTab.svelte";
import MaintenanceTab from "$lib/study-components/settings/MaintenanceTab.svelte";
- import PetsSettingsTab from "$lib/study-components/settings/PetsSettingsTab.svelte";
import MusicSettingsTab from "$lib/study-components/settings/MusicSettingsTab.svelte";
import DiagnosticTab from "$lib/study-components/settings/DiagnosticTab.svelte";
import NotesSettingsTab from "$lib/study-components/notes/NotesSettingsTab.svelte";
@@ -30,8 +29,7 @@
| "youtube"
| "diagnostic"
| "notes"
- | "maintenance"
- | "pets";
+ | "maintenance";
const TABS = $derived<{ key: TabKey; label: string }[]>([
{ key: "player", label: "Player" },
@@ -44,7 +42,6 @@
{ key: "diagnostic", label: $t("study.settings.tab_diagnostic") as string },
{ key: "notes", label: "Notas" },
{ key: "maintenance", label: "Manutenção" },
- { key: "pets", label: "Pets" },
]);
let activeTab = $state<TabKey>("player");
@@ -215,8 +212,6 @@
<NotesSettingsTab onToast={showToast} />
{:else if activeTab === "maintenance"}
<MaintenanceTab onToast={showToast} />
- {:else if activeTab === "pets"}
- <PetsSettingsTab />
{/if}
</div>
diff --git a/static/pets/animations.json b/static/pets/animations.json
deleted file mode 100644
index 24fe7f08..00000000
--- a/static/pets/animations.json
+++ /dev/null
@@ -1,730 +0,0 @@
-{
- "boba": [
- {
- "name": "idle",
- "row": 0,
- "frame_count": 6,
- "fps": 6
- },
- {
- "name": "walk_right",
- "row": 1,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "walk_left",
- "row": 2,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "wave",
- "row": 3,
- "frame_count": 4,
- "fps": 8
- },
- {
- "name": "tiny",
- "row": 4,
- "frame_count": 5,
- "fps": 8
- },
- {
- "name": "sad",
- "row": 5,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "sleep",
- "row": 6,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "happy",
- "row": 7,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "extra",
- "row": 8,
- "frame_count": 6,
- "fps": 8
- }
- ],
- "boxcat": [
- {
- "name": "idle",
- "row": 0,
- "frame_count": 6,
- "fps": 6
- },
- {
- "name": "walk_right",
- "row": 1,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "walk_left",
- "row": 2,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "wave",
- "row": 3,
- "frame_count": 4,
- "fps": 8
- },
- {
- "name": "tiny",
- "row": 4,
- "frame_count": 5,
- "fps": 8
- },
- {
- "name": "sad",
- "row": 5,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "sleep",
- "row": 6,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "happy",
- "row": 7,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "extra",
- "row": 8,
- "frame_count": 6,
- "fps": 8
- }
- ],
- "byte-bunny": [
- {
- "name": "idle",
- "row": 0,
- "frame_count": 6,
- "fps": 6
- },
- {
- "name": "walk_right",
- "row": 1,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "walk_left",
- "row": 2,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "wave",
- "row": 3,
- "frame_count": 4,
- "fps": 8
- },
- {
- "name": "tiny",
- "row": 4,
- "frame_count": 5,
- "fps": 8
- },
- {
- "name": "sad",
- "row": 5,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "sleep",
- "row": 6,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "happy",
- "row": 7,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "extra",
- "row": 8,
- "frame_count": 6,
- "fps": 8
- }
- ],
- "cache-capy": [
- {
- "name": "idle",
- "row": 0,
- "frame_count": 6,
- "fps": 6
- },
- {
- "name": "walk_right",
- "row": 1,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "walk_left",
- "row": 2,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "wave",
- "row": 3,
- "frame_count": 4,
- "fps": 8
- },
- {
- "name": "tiny",
- "row": 4,
- "frame_count": 5,
- "fps": 8
- },
- {
- "name": "sad",
- "row": 5,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "sleep",
- "row": 6,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "happy",
- "row": 7,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "extra",
- "row": 8,
- "frame_count": 6,
- "fps": 8
- }
- ],
- "cash-cuy": [
- {
- "name": "idle",
- "row": 0,
- "frame_count": 6,
- "fps": 6
- },
- {
- "name": "walk_right",
- "row": 1,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "walk_left",
- "row": 2,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "wave",
- "row": 3,
- "frame_count": 4,
- "fps": 8
- },
- {
- "name": "tiny",
- "row": 4,
- "frame_count": 5,
- "fps": 8
- },
- {
- "name": "sad",
- "row": 5,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "sleep",
- "row": 6,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "happy",
- "row": 7,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "extra",
- "row": 8,
- "frame_count": 6,
- "fps": 8
- }
- ],
- "cosmo": [
- {
- "name": "idle",
- "row": 0,
- "frame_count": 6,
- "fps": 6
- },
- {
- "name": "walk_right",
- "row": 1,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "walk_left",
- "row": 2,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "wave",
- "row": 3,
- "frame_count": 4,
- "fps": 8
- },
- {
- "name": "tiny",
- "row": 4,
- "frame_count": 5,
- "fps": 8
- },
- {
- "name": "sad",
- "row": 5,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "sleep",
- "row": 6,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "happy",
- "row": 7,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "extra",
- "row": 8,
- "frame_count": 6,
- "fps": 8
- }
- ],
- "kebo": [
- {
- "name": "idle",
- "row": 0,
- "frame_count": 6,
- "fps": 6
- },
- {
- "name": "walk_right",
- "row": 1,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "walk_left",
- "row": 2,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "wave",
- "row": 3,
- "frame_count": 4,
- "fps": 8
- },
- {
- "name": "tiny",
- "row": 4,
- "frame_count": 5,
- "fps": 8
- },
- {
- "name": "sad",
- "row": 5,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "sleep",
- "row": 6,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "happy",
- "row": 7,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "extra",
- "row": 8,
- "frame_count": 6,
- "fps": 8
- }
- ],
- "noir-webling": [
- {
- "name": "idle",
- "row": 0,
- "frame_count": 6,
- "fps": 6
- },
- {
- "name": "walk_right",
- "row": 1,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "walk_left",
- "row": 2,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "wave",
- "row": 3,
- "frame_count": 4,
- "fps": 8
- },
- {
- "name": "tiny",
- "row": 4,
- "frame_count": 5,
- "fps": 8
- },
- {
- "name": "sad",
- "row": 5,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "sleep",
- "row": 6,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "happy",
- "row": 7,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "extra",
- "row": 8,
- "frame_count": 6,
- "fps": 8
- }
- ],
- "nukey": [
- {
- "name": "idle",
- "row": 0,
- "frame_count": 6,
- "fps": 6
- },
- {
- "name": "walk_right",
- "row": 1,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "walk_left",
- "row": 2,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "wave",
- "row": 3,
- "frame_count": 4,
- "fps": 8
- },
- {
- "name": "tiny",
- "row": 4,
- "frame_count": 5,
- "fps": 8
- },
- {
- "name": "sad",
- "row": 5,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "sleep",
- "row": 6,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "happy",
- "row": 7,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "extra",
- "row": 8,
- "frame_count": 6,
- "fps": 8
- }
- ],
- "pixel-panda": [
- {
- "name": "idle",
- "row": 0,
- "frame_count": 6,
- "fps": 6
- },
- {
- "name": "walk_right",
- "row": 1,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "walk_left",
- "row": 2,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "wave",
- "row": 3,
- "frame_count": 4,
- "fps": 8
- },
- {
- "name": "tiny",
- "row": 4,
- "frame_count": 5,
- "fps": 8
- },
- {
- "name": "sad",
- "row": 5,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "sleep",
- "row": 6,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "happy",
- "row": 7,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "extra",
- "row": 8,
- "frame_count": 6,
- "fps": 8
- }
- ],
- "prompt-penguin": [
- {
- "name": "idle",
- "row": 0,
- "frame_count": 6,
- "fps": 6
- },
- {
- "name": "walk_right",
- "row": 1,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "walk_left",
- "row": 2,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "wave",
- "row": 3,
- "frame_count": 4,
- "fps": 8
- },
- {
- "name": "tiny",
- "row": 4,
- "frame_count": 5,
- "fps": 8
- },
- {
- "name": "sad",
- "row": 5,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "sleep",
- "row": 6,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "happy",
- "row": 7,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "extra",
- "row": 8,
- "frame_count": 6,
- "fps": 8
- }
- ],
- "scoop": [
- {
- "name": "idle",
- "row": 0,
- "frame_count": 6,
- "fps": 6
- },
- {
- "name": "walk_right",
- "row": 1,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "walk_left",
- "row": 2,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "wave",
- "row": 3,
- "frame_count": 4,
- "fps": 8
- },
- {
- "name": "tiny",
- "row": 4,
- "frame_count": 5,
- "fps": 8
- },
- {
- "name": "sad",
- "row": 5,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "sleep",
- "row": 6,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "happy",
- "row": 7,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "extra",
- "row": 8,
- "frame_count": 6,
- "fps": 8
- }
- ],
- "socksy": [
- {
- "name": "idle",
- "row": 0,
- "frame_count": 6,
- "fps": 6
- },
- {
- "name": "walk_right",
- "row": 1,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "walk_left",
- "row": 2,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "wave",
- "row": 3,
- "frame_count": 4,
- "fps": 8
- },
- {
- "name": "tiny",
- "row": 4,
- "frame_count": 5,
- "fps": 8
- },
- {
- "name": "sad",
- "row": 5,
- "frame_count": 8,
- "fps": 8
- },
- {
- "name": "sleep",
- "row": 6,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "happy",
- "row": 7,
- "frame_count": 6,
- "fps": 8
- },
- {
- "name": "extra",
- "row": 8,
- "frame_count": 6,
- "fps": 8
- }
- ]
-}
\ No newline at end of file
diff --git a/static/pets/boba/README.md b/static/pets/boba/README.md
deleted file mode 100644
index 0ec060ef..00000000
--- a/static/pets/boba/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# Boba
-
-A tiny otter sipping bubble tea while keeping you company in Codex.
-
-## Install locally
-
-```bash
-mkdir -p ~/.codex/pets/boba
-unzip boba.zip -d ~/.codex/pets/boba
-```
-
-Generated for Petdex.
diff --git a/static/pets/boba/metadata.json b/static/pets/boba/metadata.json
deleted file mode 100644
index cc65b202..00000000
--- a/static/pets/boba/metadata.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "id": "boba",
- "slug": "boba",
- "displayName": "Boba",
- "description": "A tiny otter sipping bubble tea while keeping you company in Codex.",
- "spritesheetPath": "/pets/boba/spritesheet.webp",
- "petJsonPath": "/pets/boba/pet.json",
- "approvalState": "approved",
- "featured": true,
- "kind": "creature",
- "vibes": ["cozy", "playful"],
- "tags": ["otter", "drink", "cozy"],
- "importedAt": "2026-05-02T06:48:36.386Z",
- "qa": {
- "contactSheetPath": "/pets/boba/contact-sheet.png"
- }
-}
diff --git a/static/pets/boba/pet.json b/static/pets/boba/pet.json
deleted file mode 100644
index 96437543..00000000
--- a/static/pets/boba/pet.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "id": "boba",
- "displayName": "Boba",
- "description": "A tiny otter sipping bubble tea while keeping you company in Codex.",
- "spritesheetPath": "spritesheet.webp"
-}
diff --git a/static/pets/boba/spritesheet.webp b/static/pets/boba/spritesheet.webp
deleted file mode 100644
index 83ebad4a..00000000
Binary files a/static/pets/boba/spritesheet.webp and /dev/null differ
diff --git a/static/pets/boxcat/README.md b/static/pets/boxcat/README.md
deleted file mode 100644
index 6d470700..00000000
--- a/static/pets/boxcat/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# Boxcat
-
-A tiny cat tucked inside a cardboard box for cozy coding sessions.
-
-## Install locally
-
-```bash
-mkdir -p ~/.codex/pets/boxcat
-unzip boxcat.zip -d ~/.codex/pets/boxcat
-```
-
-Generated for Petdex.
diff --git a/static/pets/boxcat/metadata.json b/static/pets/boxcat/metadata.json
deleted file mode 100644
index ae08dc6a..00000000
--- a/static/pets/boxcat/metadata.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "id": "boxcat",
- "slug": "boxcat",
- "displayName": "Boxcat",
- "description": "A tiny cat tucked inside a cardboard box for cozy coding sessions.",
- "spritesheetPath": "/pets/boxcat/spritesheet.webp",
- "petJsonPath": "/pets/boxcat/pet.json",
- "approvalState": "approved",
- "kind": "creature",
- "vibes": ["cozy"],
- "tags": ["cat", "box", "cozy"],
- "importedAt": "2026-05-02T06:48:36.441Z",
- "qa": {
- "contactSheetPath": "/pets/boxcat/contact-sheet.png"
- }
-}
diff --git a/static/pets/boxcat/pet.json b/static/pets/boxcat/pet.json
deleted file mode 100644
index c410db22..00000000
--- a/static/pets/boxcat/pet.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "id": "boxcat",
- "displayName": "Boxcat",
- "description": "A tiny cat tucked inside a cardboard box for cozy coding sessions.",
- "spritesheetPath": "spritesheet.webp"
-}
diff --git a/static/pets/boxcat/spritesheet.webp b/static/pets/boxcat/spritesheet.webp
deleted file mode 100644
index 0a824d93..00000000
Binary files a/static/pets/boxcat/spritesheet.webp and /dev/null differ
diff --git a/static/pets/byte-bunny/README.md b/static/pets/byte-bunny/README.md
deleted file mode 100644
index 322e81cf..00000000
--- a/static/pets/byte-bunny/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# Byte Bunny
-
-A tiny rabbit holding a little keyboard key like a lucky charm.
-
-## Install locally
-
-```bash
-mkdir -p ~/.codex/pets/byte-bunny
-unzip byte-bunny.zip -d ~/.codex/pets/byte-bunny
-```
-
-Generated for Petdex.
diff --git a/static/pets/byte-bunny/metadata.json b/static/pets/byte-bunny/metadata.json
deleted file mode 100644
index 9c34c6ca..00000000
--- a/static/pets/byte-bunny/metadata.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "id": "byte-bunny",
- "slug": "byte-bunny",
- "displayName": "Byte Bunny",
- "description": "A tiny rabbit holding a little keyboard key like a lucky charm.",
- "spritesheetPath": "/pets/byte-bunny/spritesheet.webp",
- "petJsonPath": "/pets/byte-bunny/pet.json",
- "approvalState": "approved",
- "kind": "creature",
- "vibes": ["focused"],
- "tags": ["rabbit", "keyboard", "coding"],
- "importedAt": "2026-05-02T05:50:43.053Z",
- "qa": {
- "contactSheetPath": "/pets/byte-bunny/contact-sheet.png"
- }
-}
diff --git a/static/pets/byte-bunny/pet.json b/static/pets/byte-bunny/pet.json
deleted file mode 100644
index b2dc3c8f..00000000
--- a/static/pets/byte-bunny/pet.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "id": "byte-bunny",
- "displayName": "Byte Bunny",
- "description": "A tiny rabbit holding a little keyboard key like a lucky charm.",
- "spritesheetPath": "spritesheet.webp"
-}
diff --git a/static/pets/byte-bunny/spritesheet.webp b/static/pets/byte-bunny/spritesheet.webp
deleted file mode 100644
index c788800a..00000000
Binary files a/static/pets/byte-bunny/spritesheet.webp and /dev/null differ
diff --git a/static/pets/cache-capy/README.md b/static/pets/cache-capy/README.md
deleted file mode 100644
index 6a56d8d5..00000000
--- a/static/pets/cache-capy/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# Cache Capy
-
-A calm capybara carrying a tiny cache box for patient builds.
-
-## Install locally
-
-```bash
-mkdir -p ~/.codex/pets/cache-capy
-unzip cache-capy.zip -d ~/.codex/pets/cache-capy
-```
-
-Generated for Petdex.
diff --git a/static/pets/cache-capy/metadata.json b/static/pets/cache-capy/metadata.json
deleted file mode 100644
index 6d1c7095..00000000
--- a/static/pets/cache-capy/metadata.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "id": "cache-capy",
- "slug": "cache-capy",
- "displayName": "Cache Capy",
- "description": "A calm capybara carrying a tiny cache box for patient builds.",
- "spritesheetPath": "/pets/cache-capy/spritesheet.webp",
- "petJsonPath": "/pets/cache-capy/pet.json",
- "approvalState": "approved",
- "kind": "creature",
- "vibes": ["calm"],
- "tags": ["capybara", "cache", "calm"],
- "importedAt": "2026-05-02T06:13:26.116Z",
- "qa": {
- "contactSheetPath": "/pets/cache-capy/contact-sheet.png"
- }
-}
diff --git a/static/pets/cache-capy/pet.json b/static/pets/cache-capy/pet.json
deleted file mode 100644
index 3bf2f443..00000000
--- a/static/pets/cache-capy/pet.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "id": "cache-capy",
- "displayName": "Cache Capy",
- "description": "A calm capybara carrying a tiny cache box for patient builds.",
- "spritesheetPath": "spritesheet.webp"
-}
diff --git a/static/pets/cache-capy/spritesheet.webp b/static/pets/cache-capy/spritesheet.webp
deleted file mode 100644
index e37dcfe4..00000000
Binary files a/static/pets/cache-capy/spritesheet.webp and /dev/null differ
diff --git a/static/pets/cash-cuy/README.md b/static/pets/cash-cuy/README.md
deleted file mode 100644
index 409d9542..00000000
--- a/static/pets/cash-cuy/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# Cash Cuy
-
-A tiny magical guinea pig that brings money luck to your Codex workspace.
-
-## Install locally
-
-```bash
-mkdir -p ~/.codex/pets/cash-cuy
-unzip cash-cuy.zip -d ~/.codex/pets/cash-cuy
-```
-
-Generated for Petdex.
diff --git a/static/pets/cash-cuy/metadata.json b/static/pets/cash-cuy/metadata.json
deleted file mode 100644
index 76e94126..00000000
--- a/static/pets/cash-cuy/metadata.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "id": "cash-cuy",
- "slug": "cash-cuy",
- "displayName": "Cash Cuy",
- "description": "A tiny magical guinea pig that brings money luck to your Codex workspace.",
- "spritesheetPath": "/pets/cash-cuy/spritesheet.webp",
- "petJsonPath": "/pets/cash-cuy/pet.json",
- "approvalState": "approved",
- "kind": "creature",
- "vibes": ["playful", "cheerful"],
- "tags": ["codex-pet", "cuy", "money", "magic", "peru"],
- "importedAt": "2026-05-02T08:11:08.332Z",
- "qa": {
- "contactSheetPath": "/pets/cash-cuy/contact-sheet.png"
- }
-}
diff --git a/static/pets/cash-cuy/pet.json b/static/pets/cash-cuy/pet.json
deleted file mode 100644
index 0a578a8c..00000000
--- a/static/pets/cash-cuy/pet.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "id": "cash-cuy",
- "displayName": "Cash Cuy",
- "description": "A tiny magical guinea pig that brings money luck to your Codex workspace.",
- "spritesheetPath": "spritesheet.webp"
-}
diff --git a/static/pets/cash-cuy/spritesheet.webp b/static/pets/cash-cuy/spritesheet.webp
deleted file mode 100644
index 34ddc74f..00000000
Binary files a/static/pets/cash-cuy/spritesheet.webp and /dev/null differ
diff --git a/static/pets/cosmo/README.md b/static/pets/cosmo/README.md
deleted file mode 100644
index 425b7a16..00000000
--- a/static/pets/cosmo/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# Crafternauta
-
-A tiny yellow astronaut companion with a black visor face and cheerful expression.
-
-## Install locally
-
-```bash
-mkdir -p ~/.codex/pets/cosmo
-unzip cosmo.zip -d ~/.codex/pets/cosmo
-```
-
-Generated for Petdex.
diff --git a/static/pets/cosmo/metadata.json b/static/pets/cosmo/metadata.json
deleted file mode 100644
index 64ca171e..00000000
--- a/static/pets/cosmo/metadata.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "id": "cosmo",
- "slug": "cosmo",
- "displayName": "Crafternauta",
- "description": "A tiny yellow astronaut companion with a black visor face and cheerful expression.",
- "spritesheetPath": "/pets/cosmo/spritesheet.webp",
- "petJsonPath": "/pets/cosmo/pet.json",
- "approvalState": "approved",
- "featured": true,
- "kind": "character",
- "vibes": ["cheerful"],
- "tags": ["astronaut", "space", "yellow", "cheerful"],
- "importedAt": "2026-05-02T04:13:44.032Z",
- "qa": {}
-}
diff --git a/static/pets/cosmo/pet.json b/static/pets/cosmo/pet.json
deleted file mode 100644
index 33e55142..00000000
--- a/static/pets/cosmo/pet.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "id": "cosmo",
- "displayName": "Crafternauta",
- "description": "A tiny yellow astronaut companion with a black visor face and cheerful expression.",
- "spritesheetPath": "spritesheet.webp"
-}
diff --git a/static/pets/cosmo/spritesheet.webp b/static/pets/cosmo/spritesheet.webp
deleted file mode 100644
index 1f98565d..00000000
Binary files a/static/pets/cosmo/spritesheet.webp and /dev/null differ
diff --git a/static/pets/kebo/README.md b/static/pets/kebo/README.md
deleted file mode 100644
index 49029f67..00000000
--- a/static/pets/kebo/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# Kebo
-
-A tiny white koala fintech companion with purple accents, black shirt, and cheerful money check-in energy.
-
-## Install locally
-
-```bash
-mkdir -p ~/.codex/pets/kebo
-unzip kebo.zip -d ~/.codex/pets/kebo
-```
-
-Generated for Petdex.
diff --git a/static/pets/kebo/metadata.json b/static/pets/kebo/metadata.json
deleted file mode 100644
index a8878105..00000000
--- a/static/pets/kebo/metadata.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "id": "kebo",
- "slug": "kebo",
- "displayName": "Kebo",
- "description": "A tiny white koala fintech companion with purple accents, black shirt, and cheerful money check-in energy.",
- "spritesheetPath": "/pets/kebo/spritesheet.webp",
- "petJsonPath": "/pets/kebo/pet.json",
- "approvalState": "approved",
- "featured": true,
- "kind": "creature",
- "vibes": ["focused", "cheerful"],
- "tags": ["koala", "fintech", "purple"],
- "importedAt": "2026-05-02T04:50:35.397Z",
- "qa": {
- "contactSheetPath": "/pets/kebo/contact-sheet.png"
- }
-}
diff --git a/static/pets/kebo/pet.json b/static/pets/kebo/pet.json
deleted file mode 100644
index 28d28e38..00000000
--- a/static/pets/kebo/pet.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "id": "kebo",
- "displayName": "Kebo",
- "description": "A tiny white koala fintech companion with purple accents, black shirt, and cheerful money check-in energy.",
- "spritesheetPath": "spritesheet.webp"
-}
diff --git a/static/pets/kebo/spritesheet.webp b/static/pets/kebo/spritesheet.webp
deleted file mode 100644
index 67a4c47a..00000000
Binary files a/static/pets/kebo/spritesheet.webp and /dev/null differ
diff --git a/static/pets/manifest.json b/static/pets/manifest.json
deleted file mode 100644
index 5b95bc14..00000000
--- a/static/pets/manifest.json
+++ /dev/null
@@ -1,70 +0,0 @@
-{
- "generatedAt": "2026-05-02T09:11:12.044Z",
- "pets": [
- {
- "slug": "boba",
- "displayName": "Boba",
- "packPath": "/packs/boba.zip"
- },
- {
- "slug": "boxcat",
- "displayName": "Boxcat",
- "packPath": "/packs/boxcat.zip"
- },
- {
- "slug": "byte-bunny",
- "displayName": "Byte Bunny",
- "packPath": "/packs/byte-bunny.zip"
- },
- {
- "slug": "cache-capy",
- "displayName": "Cache Capy",
- "packPath": "/packs/cache-capy.zip"
- },
- {
- "slug": "cash-cuy",
- "displayName": "Cash Cuy",
- "packPath": "/packs/cash-cuy.zip"
- },
- {
- "slug": "cosmo",
- "displayName": "Crafternauta",
- "packPath": "/packs/cosmo.zip"
- },
- {
- "slug": "kebo",
- "displayName": "Kebo",
- "packPath": "/packs/kebo.zip"
- },
- {
- "slug": "noir-webling",
- "displayName": "Noir Webling",
- "packPath": "/packs/noir-webling.zip"
- },
- {
- "slug": "nukey",
- "displayName": "Nukey",
- "packPath": "/packs/nukey.zip"
- },
- {
- "slug": "pixel-panda",
- "displayName": "Pixel Panda",
- "packPath": "/packs/pixel-panda.zip"
- },
- {
- "slug": "prompt-penguin",
- "displayName": "Prompt Penguin",
- "packPath": "/packs/prompt-penguin.zip"
- },
- {
- "slug": "scoop",
- "displayName": "Scoop",
- "packPath": "/packs/scoop.zip"
- },
- {
- "slug": "socksy",
- "displayName": "Socksy",
- "packPath": "/packs/socksy.zip"
- }
- ]
-}
\ No newline at end of file
diff --git a/static/pets/noir-webling/README.md b/static/pets/noir-webling/README.md
deleted file mode 100644
index d20ed7e2..00000000
--- a/static/pets/noir-webling/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# Noir Webling
-
-A tiny monochrome spider detective in a fedora and trench coat, built for shadowy Codex investigations.
-
-## Install locally
-
-```bash
-mkdir -p ~/.codex/pets/noir-webling
-unzip noir-webling.zip -d ~/.codex/pets/noir-webling
-```
-
-Generated for Petdex.
diff --git a/static/pets/noir-webling/metadata.json b/static/pets/noir-webling/metadata.json
deleted file mode 100644
index e1e1f6e1..00000000
--- a/static/pets/noir-webling/metadata.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "id": "noir-webling",
- "slug": "noir-webling",
- "displayName": "Noir Webling",
- "description": "A tiny monochrome spider detective in a fedora and trench coat, built for shadowy Codex investigations.",
- "spritesheetPath": "/pets/noir-webling/spritesheet.webp",
- "petJsonPath": "/pets/noir-webling/pet.json",
- "approvalState": "approved",
- "featured": true,
- "kind": "creature",
- "vibes": ["focused", "mischievous"],
- "tags": ["noir", "detective", "monochrome", "web"],
- "importedAt": "2026-05-02T07:37:04.708Z",
- "qa": {}
-}
diff --git a/static/pets/noir-webling/pet.json b/static/pets/noir-webling/pet.json
deleted file mode 100644
index fbad7bdb..00000000
--- a/static/pets/noir-webling/pet.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "id": "noir-webling",
- "displayName": "Noir Webling",
- "description": "A tiny monochrome spider detective in a fedora and trench coat, built for shadowy Codex investigations.",
- "spritesheetPath": "spritesheet.webp"
-}
diff --git a/static/pets/noir-webling/spritesheet.webp b/static/pets/noir-webling/spritesheet.webp
deleted file mode 100644
index ebbe3446..00000000
Binary files a/static/pets/noir-webling/spritesheet.webp and /dev/null differ
diff --git a/static/pets/nukey/README.md b/static/pets/nukey/README.md
deleted file mode 100644
index a8133228..00000000
--- a/static/pets/nukey/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# Nukey
-
-A tiny friendly microwave companion for snack-fueled builds.
-
-## Install locally
-
-```bash
-mkdir -p ~/.codex/pets/nukey
-unzip nukey.zip -d ~/.codex/pets/nukey
-```
-
-Generated for Petdex.
diff --git a/static/pets/nukey/metadata.json b/static/pets/nukey/metadata.json
deleted file mode 100644
index c5cdbbf5..00000000
--- a/static/pets/nukey/metadata.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "id": "nukey",
- "slug": "nukey",
- "displayName": "Nukey",
- "description": "A tiny friendly microwave companion for snack-fueled builds.",
- "spritesheetPath": "/pets/nukey/spritesheet.webp",
- "petJsonPath": "/pets/nukey/pet.json",
- "approvalState": "approved",
- "kind": "object",
- "vibes": ["cozy"],
- "tags": ["object-pet", "snacks", "cozy"],
- "importedAt": "2026-05-02T06:50:07.952Z",
- "qa": {
- "contactSheetPath": "/pets/nukey/contact-sheet.png"
- }
-}
diff --git a/static/pets/nukey/pet.json b/static/pets/nukey/pet.json
deleted file mode 100644
index cd068e68..00000000
--- a/static/pets/nukey/pet.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "id": "nukey",
- "displayName": "Nukey",
- "description": "A tiny friendly microwave companion for snack-fueled builds.",
- "spritesheetPath": "spritesheet.webp"
-}
diff --git a/static/pets/nukey/spritesheet.webp b/static/pets/nukey/spritesheet.webp
deleted file mode 100644
index 7fe9c2d1..00000000
Binary files a/static/pets/nukey/spritesheet.webp and /dev/null differ
diff --git a/static/pets/pixel-panda/README.md b/static/pets/pixel-panda/README.md
deleted file mode 100644
index 9fbf90b3..00000000
--- a/static/pets/pixel-panda/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# Pixel Panda
-
-A gentle panda holding a tiny pixel brush.
-
-## Install locally
-
-```bash
-mkdir -p ~/.codex/pets/pixel-panda
-unzip pixel-panda.zip -d ~/.codex/pets/pixel-panda
-```
-
-Generated for Petdex.
diff --git a/static/pets/pixel-panda/metadata.json b/static/pets/pixel-panda/metadata.json
deleted file mode 100644
index 09d44f4c..00000000
--- a/static/pets/pixel-panda/metadata.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "id": "pixel-panda",
- "slug": "pixel-panda",
- "displayName": "Pixel Panda",
- "description": "A gentle panda holding a tiny pixel brush.",
- "spritesheetPath": "/pets/pixel-panda/spritesheet.webp",
- "petJsonPath": "/pets/pixel-panda/pet.json",
- "approvalState": "approved",
- "kind": "creature",
- "vibes": ["playful"],
- "tags": ["panda", "pixel", "art"],
- "importedAt": "2026-05-02T06:13:26.163Z",
- "qa": {
- "contactSheetPath": "/pets/pixel-panda/contact-sheet.png"
- }
-}
diff --git a/static/pets/pixel-panda/pet.json b/static/pets/pixel-panda/pet.json
deleted file mode 100644
index 68b164e8..00000000
--- a/static/pets/pixel-panda/pet.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "id": "pixel-panda",
- "displayName": "Pixel Panda",
- "description": "A gentle panda holding a tiny pixel brush.",
- "spritesheetPath": "spritesheet.webp"
-}
diff --git a/static/pets/pixel-panda/spritesheet.webp b/static/pets/pixel-panda/spritesheet.webp
deleted file mode 100644
index eae836ad..00000000
Binary files a/static/pets/pixel-panda/spritesheet.webp and /dev/null differ
diff --git a/static/pets/prompt-penguin/README.md b/static/pets/prompt-penguin/README.md
deleted file mode 100644
index b33943bc..00000000
--- a/static/pets/prompt-penguin/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# Prompt Penguin
-
-A small penguin holding a folded prompt scroll.
-
-## Install locally
-
-```bash
-mkdir -p ~/.codex/pets/prompt-penguin
-unzip prompt-penguin.zip -d ~/.codex/pets/prompt-penguin
-```
-
-Generated for Petdex.
diff --git a/static/pets/prompt-penguin/metadata.json b/static/pets/prompt-penguin/metadata.json
deleted file mode 100644
index fa45b8b6..00000000
--- a/static/pets/prompt-penguin/metadata.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "id": "prompt-penguin",
- "slug": "prompt-penguin",
- "displayName": "Prompt Penguin",
- "description": "A small penguin holding a folded prompt scroll.",
- "spritesheetPath": "/pets/prompt-penguin/spritesheet.webp",
- "petJsonPath": "/pets/prompt-penguin/pet.json",
- "approvalState": "approved",
- "kind": "creature",
- "vibes": ["focused"],
- "tags": ["penguin", "prompt", "scroll"],
- "importedAt": "2026-05-02T06:13:26.208Z",
- "qa": {
- "contactSheetPath": "/pets/prompt-penguin/contact-sheet.png"
- }
-}
diff --git a/static/pets/prompt-penguin/pet.json b/static/pets/prompt-penguin/pet.json
deleted file mode 100644
index d4844721..00000000
--- a/static/pets/prompt-penguin/pet.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "id": "prompt-penguin",
- "displayName": "Prompt Penguin",
- "description": "A small penguin holding a folded prompt scroll.",
- "spritesheetPath": "spritesheet.webp"
-}
diff --git a/static/pets/prompt-penguin/spritesheet.webp b/static/pets/prompt-penguin/spritesheet.webp
deleted file mode 100644
index 6f47861c..00000000
Binary files a/static/pets/prompt-penguin/spritesheet.webp and /dev/null differ
diff --git a/static/pets/scoop/README.md b/static/pets/scoop/README.md
deleted file mode 100644
index a02b7207..00000000
--- a/static/pets/scoop/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# Scoop
-
-A tiny ice cream cone digital pet with a cheerful face.
-
-## Install locally
-
-```bash
-mkdir -p ~/.codex/pets/scoop
-unzip scoop.zip -d ~/.codex/pets/scoop
-```
-
-Generated for Petdex.
diff --git a/static/pets/scoop/metadata.json b/static/pets/scoop/metadata.json
deleted file mode 100644
index adad4be2..00000000
--- a/static/pets/scoop/metadata.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
- "id": "scoop",
- "slug": "scoop",
- "displayName": "Scoop",
- "description": "A tiny ice cream cone digital pet with a cheerful face.",
- "spritesheetPath": "/pets/scoop/spritesheet.webp",
- "petJsonPath": "/pets/scoop/pet.json",
- "approvalState": "approved",
- "featured": true,
- "kind": "object",
- "vibes": ["cheerful"],
- "tags": ["sweet", "object-pet", "cute"],
- "importedAt": "2026-05-02T06:48:36.531Z",
- "qa": {
- "contactSheetPath": "/pets/scoop/contact-sheet.png"
- }
-}
diff --git a/static/pets/scoop/pet.json b/static/pets/scoop/pet.json
deleted file mode 100644
index 93cab90b..00000000
--- a/static/pets/scoop/pet.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "id": "scoop",
- "displayName": "Scoop",
- "description": "A tiny ice cream cone digital pet with a cheerful face.",
- "spritesheetPath": "spritesheet.webp"
-}
diff --git a/static/pets/scoop/spritesheet.webp b/static/pets/scoop/spritesheet.webp
deleted file mode 100644
index ee502588..00000000
Binary files a/static/pets/scoop/spritesheet.webp and /dev/null differ
diff --git a/static/pets/socksy/README.md b/static/pets/socksy/README.md
deleted file mode 100644
index 975727aa..00000000
--- a/static/pets/socksy/README.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# Socksy
-
-A tiny loyal sock elf with oversized ears and gentle green eyes.
-
-## Install locally
-
-```bash
-mkdir -p ~/.codex/pets/socksy
-unzip socksy.zip -d ~/.codex/pets/socksy
-```
-
-Generated for Petdex.
diff --git a/static/pets/socksy/metadata.json b/static/pets/socksy/metadata.json
deleted file mode 100644
index 804bdcf8..00000000
--- a/static/pets/socksy/metadata.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "id": "socksy",
- "slug": "socksy",
- "displayName": "Socksy",
- "description": "A tiny loyal sock elf with oversized ears and gentle green eyes.",
- "spritesheetPath": "/pets/socksy/spritesheet.webp",
- "petJsonPath": "/pets/socksy/pet.json",
- "approvalState": "approved",
- "kind": "creature",
- "vibes": [
- "calm",
- "focused"
- ],
- "tags": [
- "codex-pet",
- "elf",
- "loyal",
- "magic",
- "sock"
- ],
- "importedAt": "2026-05-02T09:10:09.930Z",
- "qa": {
- "contactSheetPath": "/pets/socksy/contact-sheet.png"
- }
-}
diff --git a/static/pets/socksy/pet.json b/static/pets/socksy/pet.json
deleted file mode 100644
index 9a62c34a..00000000
--- a/static/pets/socksy/pet.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "id": "socksy",
- "displayName": "Socksy",
- "description": "A tiny loyal sock elf with oversized ears and gentle green eyes.",
- "spritesheetPath": "spritesheet.webp"
-}
diff --git a/static/pets/socksy/spritesheet.webp b/static/pets/socksy/spritesheet.webp
deleted file mode 100644
index 10aa82f1..00000000
Binary files a/static/pets/socksy/spritesheet.webp and /dev/null differ
diff --git a/tools/detect-pet-frames.mjs b/tools/detect-pet-frames.mjs
deleted file mode 100644
index df59a67f..00000000
--- a/tools/detect-pet-frames.mjs
+++ /dev/null
@@ -1,114 +0,0 @@
-import { spawn } from "node:child_process";
-import { readdir, writeFile } from "node:fs/promises";
-import { join } from "node:path";
-
-const PETS_DIR = "static/pets";
-const SHEET_W = 1536;
-const SHEET_H = 1872;
-const COLS = 8;
-const ROWS = 9;
-const FRAME_W = SHEET_W / COLS;
-const FRAME_H = SHEET_H / ROWS;
-const ALPHA_THRESHOLD = 8;
-const FILL_THRESHOLD = 0.04;
-
-function decodeWebp(path) {
- return new Promise((resolve, reject) => {
- const proc = spawn("ffmpeg", [
- "-loglevel",
- "error",
- "-i",
- path,
- "-f",
- "rawvideo",
- "-pix_fmt",
- "rgba",
- "-",
- ]);
- const chunks = [];
- proc.stdout.on("data", (c) => chunks.push(c));
- proc.stderr.on("data", () => {});
- proc.on("error", reject);
- proc.on("close", (code) => {
- if (code !== 0) {
- reject(new Error(`ffmpeg exited ${code}`));
- return;
- }
- resolve(Buffer.concat(chunks));
- });
- });
-}
-
-function frameHasContent(rgba, frameX, frameY) {
- let nonEmpty = 0;
- const total = FRAME_W * FRAME_H;
- for (let dy = 0; dy < FRAME_H; dy++) {
- const y = frameY + dy;
- const rowOffset = y * SHEET_W * 4;
- for (let dx = 0; dx < FRAME_W; dx++) {
- const x = frameX + dx;
- const alphaIdx = rowOffset + x * 4 + 3;
- if (rgba[alphaIdx] > ALPHA_THRESHOLD) nonEmpty++;
- }
- }
- return nonEmpty / total > FILL_THRESHOLD;
-}
-
-function defaultName(row) {
- const names = ["idle", "walk_right", "walk_left", "wave", "tiny", "sad", "sleep", "happy", "extra"];
- return names[row] ?? `row_${row}`;
-}
-
-function defaultFps(row) {
- if (row === 0) return 6;
- return 8;
-}
-
-async function analyzePet(slug, sheetPath) {
- const rgba = await decodeWebp(sheetPath);
- const expected = SHEET_W * SHEET_H * 4;
- if (rgba.length !== expected) {
- throw new Error(`size mismatch for ${slug}: got ${rgba.length}, expected ${expected}`);
- }
- const animations = [];
- for (let row = 0; row < ROWS; row++) {
- let count = 0;
- for (let col = 0; col < COLS; col++) {
- const has = frameHasContent(rgba, col * FRAME_W, row * FRAME_H);
- if (has) count = col + 1;
- }
- if (count === 0) continue;
- animations.push({
- name: defaultName(row),
- row,
- frame_count: count,
- fps: defaultFps(row),
- });
- }
- return animations;
-}
-
-async function main() {
- const entries = await readdir(PETS_DIR, { withFileTypes: true });
- const result = {};
- for (const entry of entries) {
- if (!entry.isDirectory()) continue;
- const slug = entry.name;
- const sheet = join(PETS_DIR, slug, "spritesheet.webp");
- try {
- const anims = await analyzePet(slug, sheet);
- result[slug] = anims;
- console.log(`${slug}: ${anims.map((a) => `${a.name}=${a.frame_count}`).join(", ")}`);
- } catch (err) {
- console.error(`${slug}: ${err.message}`);
- }
- }
- const out = join(PETS_DIR, "animations.json");
- await writeFile(out, JSON.stringify(result, null, 2));
- console.log(`wrote ${out}`);
-}
-
-main().catch((err) => {
- console.error(err);
- process.exit(1);
-});