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.

fix(i18n): fix Telegram plugin raw keys, UI separator scaling and add ETA format unit tests (#266)

P0L1T3b97ef97c3c06
diff --git a/src/lib/download-format.test.ts b/src/lib/download-format.test.ts
new file mode 100644
index 00000000..2ee56945
--- /dev/null
+++ b/src/lib/download-format.test.ts
@@ -0,0 +1,67 @@
+import { describe, expect, it } from 'vitest';
+import { formatBytes, formatEta, formatSpeed } from './download-format';
+
+describe('download-format utilities', () => {
+ describe('formatBytes', () => {
+ it('formats bytes under 1KB correctly', () => {
+ expect(formatBytes(0)).toBe('0 B');
+ expect(formatBytes(512)).toBe('512 B');
+ });
+
+ it('formats kilobytes correctly', () => {
+ expect(formatBytes(1024)).toBe('1.0 KB');
+ expect(formatBytes(1536)).toBe('1.5 KB');
+ });
+
+ it('formats megabytes correctly', () => {
+ expect(formatBytes(1024 * 1024)).toBe('1.0 MB');
+ expect(formatBytes(234 * 1024 * 1024)).toBe('234.0 MB');
+ expect(formatBytes(512 * 1024 * 1024)).toBe('512.0 MB');
+ });
+
+ it('formats gigabytes correctly', () => {
+ expect(formatBytes(1024 * 1024 * 1024)).toBe('1.00 GB');
+ expect(formatBytes(2.5 * 1024 * 1024 * 1024)).toBe('2.50 GB');
+ });
+ });
+
+ describe('formatSpeed', () => {
+ it('formats 0 or negative speed as 0 KB/s', () => {
+ expect(formatSpeed(0)).toBe('0 KB/s');
+ expect(formatSpeed(-100)).toBe('0 KB/s');
+ });
+
+ it('formats KB/s speed', () => {
+ expect(formatSpeed(512 * 1024)).toBe('512 KB/s');
+ });
+
+ it('formats MB/s speed', () => {
+ expect(formatSpeed(2.5 * 1024 * 1024)).toBe('2.5 MB/s');
+ });
+ });
+
+ describe('formatEta', () => {
+ it('returns empty string for non-positive or non-finite values', () => {
+ expect(formatEta(null)).toBe('');
+ expect(formatEta(undefined)).toBe('');
+ expect(formatEta(0)).toBe('');
+ expect(formatEta(-10)).toBe('');
+ expect(formatEta(NaN)).toBe('');
+ expect(formatEta(Infinity)).toBe('');
+ });
+
+ it('formats seconds (< 60s)', () => {
+ expect(formatEta(45)).toBe('45s');
+ });
+
+ it('formats minutes and seconds (< 1h)', () => {
+ expect(formatEta(200)).toBe('3m 20s');
+ expect(formatEta(180)).toBe('3m');
+ });
+
+ it('formats hours and minutes (>= 1h)', () => {
+ expect(formatEta(3600)).toBe('1h');
+ expect(formatEta(3660)).toBe('1h 1m');
+ });
+ });
+});
diff --git a/src/lib/download-format.ts b/src/lib/download-format.ts
new file mode 100644
index 00000000..eba86031
--- /dev/null
+++ b/src/lib/download-format.ts
@@ -0,0 +1,25 @@
+export function formatBytes(bytes: number): string {
+ if (bytes < 1024) return `${bytes} B`;
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
+ if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
+ return `${(bytes / (1024 * 1024 * 1024)).toFixed(2)} GB`;
+}
+
+export function formatSpeed(bytesPerSec: number): string {
+ if (bytesPerSec <= 0) return "0 KB/s";
+ if (bytesPerSec < 1024 * 1024) return `${(bytesPerSec / 1024).toFixed(0)} KB/s`;
+ return `${(bytesPerSec / (1024 * 1024)).toFixed(1)} MB/s`;
+}
+
+export function formatEta(seconds: number | null | undefined): string {
+ if (seconds == null || seconds <= 0 || !Number.isFinite(seconds)) return "";
+ if (seconds < 60) return `${Math.round(seconds)}s`;
+ if (seconds < 3600) {
+ const m = Math.floor(seconds / 60);
+ const s = Math.round(seconds % 60);
+ return s > 0 ? `${m}m ${s}s` : `${m}m`;
+ }
+ const h = Math.floor(seconds / 3600);
+ const m = Math.round((seconds % 3600) / 60);
+ return m > 0 ? `${h}h ${m}m` : `${h}h`;
+}
diff --git a/src/lib/i18n/el.json b/src/lib/i18n/el.json
index 7913f5a3..15a72c2d 100644
--- a/src/lib/i18n/el.json
+++ b/src/lib/i18n/el.json
@@ -589,6 +589,71 @@
"toast_replaced": "Αντικαταστάθηκε το αρχικό. Εξοικονομήθηκαν {{saved}} ({{pct}}%) με {{encoder}}"
},
"telegram": {
+ "title": "Πλατφόρμα Telegram",
+ "checking_session": "Έλεγχος συνεδρίας...",
+ "login": "Είσοδος",
+ "logout": "Έξοδος",
+ "logged_as": "Έγινε είσοδος ως {{phone}}",
+ "phone_label": "Αριθμός τηλεφώνου",
+ "phone_placeholder": "+30 690 123 4567",
+ "phone_hint": "Συμπεριλάβετε τον κωδικό χώρας",
+ "send_code": "Αποστολή κωδικού",
+ "sending_code": "Αποστολή...",
+ "code_label": "Κωδικός επαλήθευσης",
+ "code_placeholder": "00000",
+ "code_hint": "Στείλαμε κωδικό στην εφαρμογή Telegram",
+ "verify": "Επαλήθευση",
+ "verifying": "Γίνεται η επαλήθευση...",
+ "invalid_code": "Μη έγκυρος κωδικός. Δοκιμάστε ξανά.",
+ "password_label": "Κωδικός πρόσβασης δύο παραγόντων",
+ "password_placeholder": "Ο κωδικός σας δύο παραγόντων",
+ "password_hint": "Υπόδειξη: {{hint}}",
+ "password_submit": "Επιβεβαίωση",
+ "password_verifying": "Επαλήθευση...",
+ "invalid_password": "Μη έγκυρος κωδικός. Δοκιμάστε ξανά.",
+ "chats_title": "Οι συνομιλίες σας",
+ "loading_chats": "Φόρτωση συνομιλίων...",
+ "chats_error": "Αποτυχία φόρτωσης συνομιλίων",
+ "no_chats": "Δεν βρέθηκαν συνομιλίες.",
+ "chat_count": "{{count}} συνομιλίες",
+ "chat_count_one": "{{count}} συνομιλία",
+ "chat_type_private": "Ιδιωτική",
+ "chat_type_group": "Ομάδα",
+ "chat_type_channel": "Κανάλι",
+ "media_title": "Μέσα",
+ "loading_media": "Φόρτωση μέσων...",
+ "no_media": "Δεν βρέθηκαν μέσα σε αυτήν την συνομιλία.",
+ "media_error": "Αποτυχία φόρτωσης μέσων",
+ "filter_all": "Όλα",
+ "filter_photo": "Φωτογραφίες",
+ "filter_video": "Βίντεο",
+ "filter_document": "Αρχεία",
+ "filter_audio": "Ηχητικά",
+ "search_files": "Αναζήτηση αρχείων...",
+ "searching": "Αναζήτηση...",
+ "back_to_chats": "Πίσω στις συνομιλίες",
+ "download_btn": "Λήψη",
+ "downloading": "Μεταφόρτωση...",
+ "downloaded": "Ολοκληρωμένα",
+ "choose_folder": "Επιλογή φακέλου μεταφορτώσεων",
+ "unknown_error": "Άγνωστο σφάλμα",
+ "download_all": "Λήψη όλων",
+ "batch_progress": "{{done}} από {{total}} αρχεία",
+ "batch_cancelled": "Διαδοχική μεταφόρτωση ακυρώθηκε",
+ "batch_complete": "Όλα τα αρχεία έχουν μεταφορτωθεί",
+ "load_more": "Φόρτωση επιπλέον",
+ "status_waiting": "Αναμονή",
+ "status_skipped": "Παραλήφθηκε",
+ "status_error": "Σφάλμα",
+ "file_count": "{{count}} αντικείμενα",
+ "cancel_batch": "Ακύρωση",
+ "qr_title": "Σαρώστε για είσοδο",
+ "qr_instruction": "Ανοίξτε το Telegram στο τηλέφωνο σας, και πηγαίντε Ρυθμίσεις > Συσκευές > Σύνδεση συσκευής desktop",
+ "qr_loading": "Δημιουργία κωδικού QR...",
+ "qr_error": "Αποτυχία δημιουργίας κωδικού QR",
+ "or_separator": "ή",
+ "use_phone": "Κάνε χρήση αριθμού τηλεφώνου",
+ "back_to_qr": "Πίσω στον κωδικό QR",
"upload_title": "Upload to Telegram / Leech Bot",
"auth_user_session": "User Session",
"auth_bot_token": "Bot Token",
diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json
index 72880bd2..47720a84 100644
--- a/src/lib/i18n/en.json
+++ b/src/lib/i18n/en.json
@@ -671,7 +671,44 @@
"qr_error": "Failed to generate QR code",
"or_separator": "or",
"use_phone": "Use phone number instead",
- "back_to_qr": "Back to QR code"
+ "back_to_qr": "Back to QR code",
+ "upload_title": "Upload to Telegram / Leech Bot",
+ "auth_user_session": "User Session",
+ "auth_bot_token": "Bot Token",
+ "destination_chat": "Destination Chat / Channel",
+ "dest_placeholder": "@channel_name, chat_id or -100123456789",
+ "user_session_hint": "Select from your chat list or type a Chat ID / @channel_username",
+ "bot_token_label": "Bot Token",
+ "bot_chat_id_label": "Target Chat ID / Username",
+ "custom_filename_label": "Custom Filename & Extension",
+ "custom_filename_hint": "Rename file or change extension before uploading to Telegram",
+ "custom_thumbnail_label": "Custom Thumbnail",
+ "pick_thumbnail": "Pick image from disk…",
+ "caption_label": "Upload Caption (Optional)",
+ "caption_placeholder": "Add a caption or notes for Telegram media post...",
+ "tier_limit_label": "Telegram File Limit Mode",
+ "tier_free": "Free Tier",
+ "tier_premium": "Premium Tier",
+ "split_warning": "File size ({{size}}) exceeds {{limit}} Telegram limit. Will auto-split into {{parts}} parts.",
+ "start_upload": "Start Telegram Upload",
+ "uploading": "Uploading to Telegram...",
+ "upload_success": "Uploaded to Telegram successfully!",
+ "upload_failed": "Telegram upload failed.",
+ "error_no_chat": "Please select or enter a destination chat ID or @username.",
+ "error_no_bot_token": "Please enter a valid Bot Token.",
+ "error_invalid_bot_token": "Invalid Bot Token format. Expected format: 123456789:ABCdef...",
+ "error_no_file": "No source file provided for upload.",
+ "send_as_label": "Send Media As",
+ "send_as_video": "Video (Streamable)",
+ "send_as_document": "Document / File",
+ "send_as_audio": "Audio Track",
+ "send_to_telegram": "Upload to Telegram",
+ "err_bot_not_started": "Bot not started by user. Open Telegram, search your bot, and press /start first.",
+ "err_bot_not_member": "Bot is not in the destination chat. Add your bot as Administrator with 'Post Messages' permission.",
+ "err_chat_not_found": "Destination chat not found. Verify the @username or numeric Chat ID (-100...).",
+ "err_unauthorized": "Invalid Bot Token. Check token from @BotFather.",
+ "err_bot_file_too_large": "File exceeds Telegram Bot API limit (50MB). Switch to 'User Session' mode for files up to 2GB/4GB.",
+ "err_rate_limit": "Telegram rate limit reached. Please wait a moment before retrying."
},
"settings": {
"title": "Settings",
@@ -4112,44 +4149,5 @@
"test_title": "Tracking notifications are working",
"test_body": "You will see notifications like this when your packages move."
}
- },
- "telegram": {
- "upload_title": "Upload to Telegram / Leech Bot",
- "auth_user_session": "User Session",
- "auth_bot_token": "Bot Token",
- "destination_chat": "Destination Chat / Channel",
- "dest_placeholder": "@channel_name, chat_id or -100123456789",
- "user_session_hint": "Select from your chat list or type a Chat ID / @channel_username",
- "bot_token_label": "Bot Token",
- "bot_chat_id_label": "Target Chat ID / Username",
- "custom_filename_label": "Custom Filename & Extension",
- "custom_filename_hint": "Rename file or change extension before uploading to Telegram",
- "custom_thumbnail_label": "Custom Thumbnail",
- "pick_thumbnail": "Pick image from disk…",
- "caption_label": "Upload Caption (Optional)",
- "caption_placeholder": "Add a caption or notes for Telegram media post...",
- "tier_limit_label": "Telegram File Limit Mode",
- "tier_free": "Free Tier",
- "tier_premium": "Premium Tier",
- "split_warning": "File size ({{size}}) exceeds {{limit}} Telegram limit. Will auto-split into {{parts}} parts.",
- "start_upload": "Start Telegram Upload",
- "uploading": "Uploading to Telegram...",
- "upload_success": "Uploaded to Telegram successfully!",
- "upload_failed": "Telegram upload failed.",
- "error_no_chat": "Please select or enter a destination chat ID or @username.",
- "error_no_bot_token": "Please enter a valid Bot Token.",
- "error_invalid_bot_token": "Invalid Bot Token format. Expected format: 123456789:ABCdef...",
- "error_no_file": "No source file provided for upload.",
- "send_as_label": "Send Media As",
- "send_as_video": "Video (Streamable)",
- "send_as_document": "Document / File",
- "send_as_audio": "Audio Track",
- "send_to_telegram": "Upload to Telegram",
- "err_bot_not_started": "Bot not started by user. Open Telegram, search your bot, and press /start first.",
- "err_bot_not_member": "Bot is not in the destination chat. Add your bot as Administrator with 'Post Messages' permission.",
- "err_chat_not_found": "Destination chat not found. Verify the @username or numeric Chat ID (-100...).",
- "err_unauthorized": "Invalid Bot Token. Check token from @BotFather.",
- "err_bot_file_too_large": "File exceeds Telegram Bot API limit (50MB). Switch to 'User Session' mode for files up to 2GB/4GB.",
- "err_rate_limit": "Telegram rate limit reached. Please wait a moment before retrying."
}
}
diff --git a/src/lib/i18n/es.json b/src/lib/i18n/es.json
index 0f725cf2..b595a919 100644
--- a/src/lib/i18n/es.json
+++ b/src/lib/i18n/es.json
@@ -589,6 +589,71 @@
"toast_replaced": "Original sustituido. Ahorrado {{saved}} ({{pct}}%) con {{encoder}}"
},
"telegram": {
+ "title": "Telegram",
+ "checking_session": "Comprobando sesión...",
+ "login": "Iniciar sesión",
+ "logout": "Cerrar sesión",
+ "logged_as": "Sesión iniciada como {{phone}}",
+ "phone_label": "Número de teléfono",
+ "phone_placeholder": "+34 600 000 000",
+ "phone_hint": "Incluye el código de país",
+ "send_code": "Enviar código",
+ "sending_code": "Enviando...",
+ "code_label": "Código de verificación",
+ "code_placeholder": "00000",
+ "code_hint": "Enviamos un código a tu app de Telegram",
+ "verify": "Verificar",
+ "verifying": "Verificando...",
+ "invalid_code": "Código no válido. Inténtalo de nuevo.",
+ "password_label": "Contraseña de dos factores",
+ "password_placeholder": "Tu contraseña 2FA",
+ "password_hint": "Pista: {{hint}}",
+ "password_submit": "Confirmar",
+ "password_verifying": "Verificando...",
+ "invalid_password": "Contraseña no válida. Inténtalo de nuevo.",
+ "chats_title": "Tus chats",
+ "loading_chats": "Cargando chats...",
+ "chats_error": "Error al cargar chats",
+ "no_chats": "No hay chats.",
+ "chat_count": "{{count}} chats",
+ "chat_count_one": "{{count}} chat",
+ "chat_type_private": "Privado",
+ "chat_type_group": "Grupo",
+ "chat_type_channel": "Canal",
+ "media_title": "Multimedia",
+ "loading_media": "Cargando multimedia...",
+ "no_media": "No se encontró multimedia en este chat.",
+ "media_error": "Error al cargar multimedia",
+ "filter_all": "Todo",
+ "filter_photo": "Fotos",
+ "filter_video": "Vídeos",
+ "filter_document": "Archivos",
+ "filter_audio": "Audio",
+ "search_files": "Buscar archivos...",
+ "searching": "Buscando...",
+ "back_to_chats": "Volver a chats",
+ "download_btn": "Descargar",
+ "downloading": "Descargando...",
+ "downloaded": "Descargado",
+ "choose_folder": "Elegir carpeta de descarga",
+ "unknown_error": "Error desconocido",
+ "download_all": "Descargar todo",
+ "batch_progress": "{{done}} de {{total}} archivos",
+ "batch_cancelled": "Descarga en lote cancelada",
+ "batch_complete": "Todos los archivos descargados",
+ "load_more": "Cargar más",
+ "status_waiting": "Esperando",
+ "status_skipped": "Omitido",
+ "status_error": "Error",
+ "file_count": "{{count}} elementos",
+ "cancel_batch": "Cancelar",
+ "qr_title": "Escanea para iniciar sesión",
+ "qr_instruction": "Abre Telegram en tu teléfono y ve a Ajustes > Dispositivos > Vincular dispositivo de escritorio",
+ "qr_loading": "Generando código QR...",
+ "qr_error": "Error al generar código QR",
+ "or_separator": "o",
+ "use_phone": "Usar número de teléfono",
+ "back_to_qr": "Volver al código QR",
"upload_title": "Upload to Telegram / Leech Bot",
"auth_user_session": "User Session",
"auth_bot_token": "Bot Token",
diff --git a/src/lib/i18n/fr.json b/src/lib/i18n/fr.json
index 004340e3..b54e7383 100644
--- a/src/lib/i18n/fr.json
+++ b/src/lib/i18n/fr.json
@@ -589,6 +589,71 @@
"toast_replaced": "Original remplacé. Économisé {{saved}} ({{pct}}%) avec {{encoder}}"
},
"telegram": {
+ "title": "Telegram",
+ "checking_session": "Vérification de la session...",
+ "login": "Se connecter",
+ "logout": "Se déconnecter",
+ "logged_as": "Connecté en tant que {{phone}}",
+ "phone_label": "Numéro de téléphone",
+ "phone_placeholder": "+33 6 12 34 56 78",
+ "phone_hint": "Incluez l'indicatif du pays",
+ "send_code": "Envoyer le code",
+ "sending_code": "Envoi...",
+ "code_label": "Code de vérification",
+ "code_placeholder": "00000",
+ "code_hint": "Nous avons envoyé un code à votre application Telegram",
+ "verify": "Vérifier",
+ "verifying": "Vérification...",
+ "invalid_code": "Code invalide. Veuillez réessayer.",
+ "password_label": "Mot de passe à deux facteurs",
+ "password_placeholder": "Votre mot de passe 2FA",
+ "password_hint": "Indice : {{hint}}",
+ "password_submit": "Confirmer",
+ "password_verifying": "Vérification...",
+ "invalid_password": "Mot de passe invalide. Veuillez réessayer.",
+ "chats_title": "Vos discussions",
+ "loading_chats": "Chargement des discussions...",
+ "chats_error": "Échec du chargement des discussions",
+ "no_chats": "Aucune discussion trouvée.",
+ "chat_count": "{{count}} discussions",
+ "chat_count_one": "{{count}} discussion",
+ "chat_type_private": "Privé",
+ "chat_type_group": "Groupe",
+ "chat_type_channel": "Canal",
+ "media_title": "Médias",
+ "loading_media": "Chargement des médias...",
+ "no_media": "Aucun média trouvé dans cette discussion.",
+ "media_error": "Échec du chargement des médias",
+ "filter_all": "Tout",
+ "filter_photo": "Photos",
+ "filter_video": "Vidéos",
+ "filter_document": "Fichiers",
+ "filter_audio": "Audio",
+ "search_files": "Rechercher des fichiers...",
+ "searching": "Recherche...",
+ "back_to_chats": "Retour aux discussions",
+ "download_btn": "Télécharger",
+ "downloading": "Téléchargement...",
+ "downloaded": "Téléchargé",
+ "choose_folder": "Choisir le dossier de téléchargement",
+ "unknown_error": "Erreur inconnue",
+ "download_all": "Tout télécharger",
+ "batch_progress": "{{done}} sur {{total}} fichiers",
+ "batch_cancelled": "Téléchargement groupé annulé",
+ "batch_complete": "Tous les fichiers téléchargés",
+ "load_more": "Charger plus",
+ "status_waiting": "En attente",
+ "status_skipped": "Ignoré",
+ "status_error": "Erreur",
+ "file_count": "{{count}} éléments",
+ "cancel_batch": "Annuler",
+ "qr_title": "Scannez pour vous connecter",
+ "qr_instruction": "Ouvrez Telegram sur votre téléphone, allez dans Paramètres > Appareils > Associer un appareil",
+ "qr_loading": "Génération du QR code...",
+ "qr_error": "Échec de la génération du QR code",
+ "or_separator": "ou",
+ "use_phone": "Utiliser un numéro de téléphone",
+ "back_to_qr": "Retour au QR code",
"upload_title": "Upload to Telegram / Leech Bot",
"auth_user_session": "User Session",
"auth_bot_token": "Bot Token",
diff --git a/src/lib/i18n/it.json b/src/lib/i18n/it.json
index 1bdd0602..c83d0bb4 100644
--- a/src/lib/i18n/it.json
+++ b/src/lib/i18n/it.json
@@ -589,6 +589,71 @@
"toast_replaced": "Originale sostituito. Risparmiato {{saved}} ({{pct}}%) con {{encoder}}"
},
"telegram": {
+ "title": "Telegram",
+ "checking_session": "Verifica sessione...",
+ "login": "Accedi",
+ "logout": "Esci",
+ "logged_as": "Connesso come {{phone}}",
+ "phone_label": "Numero di telefono",
+ "phone_placeholder": "+39 333 123 4567",
+ "phone_hint": "Includi il prefisso internazionale",
+ "send_code": "Invia codice",
+ "sending_code": "Invio in corso...",
+ "code_label": "Codice di verifica",
+ "code_placeholder": "00000",
+ "code_hint": "Abbiamo inviato un codice alla tua app Telegram",
+ "verify": "Verifica",
+ "verifying": "Verifica in corso...",
+ "invalid_code": "Codice non valido. Riprova.",
+ "password_label": "Password a due fattori",
+ "password_placeholder": "La tua password 2FA",
+ "password_hint": "Suggerimento: {{hint}}",
+ "password_submit": "Conferma",
+ "password_verifying": "Verifica in corso...",
+ "invalid_password": "Password non valida. Riprova.",
+ "chats_title": "Le tue chat",
+ "loading_chats": "Caricamento chat...",
+ "chats_error": "Impossibile caricare le chat",
+ "no_chats": "Nessuna chat trovata.",
+ "chat_count": "{{count}} chat",
+ "chat_count_one": "{{count}} chat",
+ "chat_type_private": "Privata",
+ "chat_type_group": "Gruppo",
+ "chat_type_channel": "Canale",
+ "media_title": "Media",
+ "loading_media": "Caricamento media...",
+ "no_media": "Nessun media trovato in questa chat.",
+ "media_error": "Impossibile caricare i media",
+ "filter_all": "Tutti",
+ "filter_photo": "Foto",
+ "filter_video": "Video",
+ "filter_document": "File",
+ "filter_audio": "Audio",
+ "search_files": "Cerca file...",
+ "searching": "Ricerca in corso...",
+ "back_to_chats": "Torna alle chat",
+ "download_btn": "Scarica",
+ "downloading": "Download in corso...",
+ "downloaded": "Scaricato",
+ "choose_folder": "Scegli cartella di download",
+ "unknown_error": "Errore sconosciuto",
+ "download_all": "Scarica tutto",
+ "batch_progress": "{{done}} di {{total}} file",
+ "batch_cancelled": "Download in blocco annullato",
+ "batch_complete": "Tutti i file scaricati",
+ "load_more": "Carica altri",
+ "status_waiting": "In attesa",
+ "status_skipped": "Saltato",
+ "status_error": "Errore",
+ "file_count": "{{count}} elementi",
+ "cancel_batch": "Annulla",
+ "qr_title": "Scansiona per accedere",
+ "qr_instruction": "Apri Telegram sul telefono, vai su Impostazioni > Dispositivi > Collega dispositivo desktop",
+ "qr_loading": "Generazione codice QR...",
+ "qr_error": "Impossibile generare il codice QR",
+ "or_separator": "oppure",
+ "use_phone": "Usa il numero di telefono",
+ "back_to_qr": "Torna al codice QR",
"upload_title": "Upload to Telegram / Leech Bot",
"auth_user_session": "User Session",
"auth_bot_token": "Bot Token",
diff --git a/src/lib/i18n/ja.json b/src/lib/i18n/ja.json
index 803bdc63..c2097aa3 100644
--- a/src/lib/i18n/ja.json
+++ b/src/lib/i18n/ja.json
@@ -589,6 +589,71 @@
"toast_replaced": "元のファイルを置き換えました。{{encoder}} で {{saved}}({{pct}}%)節約しました"
},
"telegram": {
+ "title": "Telegram",
+ "checking_session": "セッションを確認中...",
+ "login": "ログイン",
+ "logout": "ログアウト",
+ "logged_as": "{{phone}} でログイン中",
+ "phone_label": "電話番号",
+ "phone_placeholder": "+81 90 1234 5678",
+ "phone_hint": "国番号を含めてください",
+ "send_code": "コードを送信",
+ "sending_code": "送信中...",
+ "code_label": "認証コード",
+ "code_placeholder": "00000",
+ "code_hint": "Telegramアプリにコードを送信しました",
+ "verify": "確認",
+ "verifying": "確認中...",
+ "invalid_code": "無効なコードです。もう一度お試しください。",
+ "password_label": "二段階認証パスワード",
+ "password_placeholder": "2FAパスワードを入力",
+ "password_hint": "ヒント: {{hint}}",
+ "password_submit": "確認",
+ "password_verifying": "確認中...",
+ "invalid_password": "無効なパスワードです。もう一度お試しください。",
+ "chats_title": "あなたのチャット",
+ "loading_chats": "チャットを読み込み中...",
+ "chats_error": "チャットの読み込みに失敗しました",
+ "no_chats": "チャットが見つかりません。",
+ "chat_count": "{{count}} チャット",
+ "chat_count_one": "{{count}} チャット",
+ "chat_type_private": "プライベート",
+ "chat_type_group": "グループ",
+ "chat_type_channel": "チャンネル",
+ "media_title": "メディア",
+ "loading_media": "メディアを読み込み中...",
+ "no_media": "このチャットにメディアが見つかりません。",
+ "media_error": "メディアの読み込みに失敗しました",
+ "filter_all": "すべて",
+ "filter_photo": "写真",
+ "filter_video": "動画",
+ "filter_document": "ファイル",
+ "filter_audio": "音声",
+ "search_files": "ファイルを検索...",
+ "searching": "検索中...",
+ "back_to_chats": "チャット一覧に戻る",
+ "download_btn": "ダウンロード",
+ "downloading": "ダウンロード中...",
+ "downloaded": "ダウンロード済み",
+ "choose_folder": "ダウンロードフォルダを選択",
+ "unknown_error": "不明なエラー",
+ "download_all": "すべてダウンロード",
+ "batch_progress": "{{done}} / {{total}} ファイル",
+ "batch_cancelled": "一括ダウンロードがキャンセルされました",
+ "batch_complete": "すべてのファイルをダウンロードしました",
+ "load_more": "さらに読み込む",
+ "status_waiting": "待機中",
+ "status_skipped": "スキップ",
+ "status_error": "エラー",
+ "file_count": "{{count}} 件",
+ "cancel_batch": "キャンセル",
+ "qr_title": "スキャンしてログイン",
+ "qr_instruction": "スマートフォンでTelegramを開き、設定 > デバイス > デスクトップデバイスをリンク に進んでください",
+ "qr_loading": "QRコードを生成中...",
+ "qr_error": "QRコードの生成に失敗しました",
+ "or_separator": "または",
+ "use_phone": "電話番号でログイン",
+ "back_to_qr": "QRコードに戻る",
"upload_title": "Upload to Telegram / Leech Bot",
"auth_user_session": "User Session",
"auth_bot_token": "Bot Token",
diff --git a/src/lib/i18n/keys.ts b/src/lib/i18n/keys.ts
index 40f23dc5..202ad215 100644
--- a/src/lib/i18n/keys.ts
+++ b/src/lib/i18n/keys.ts
@@ -3585,15 +3585,37 @@ export type TranslationKeys =
| 'telegram.auth_bot_token'
| 'telegram.auth_user_session'
+ | 'telegram.back_to_chats'
+ | 'telegram.back_to_qr'
+ | 'telegram.batch_cancelled'
+ | 'telegram.batch_complete'
+ | 'telegram.batch_progress'
| 'telegram.bot_chat_id_label'
| 'telegram.bot_token_label'
+ | 'telegram.cancel_batch'
| 'telegram.caption_label'
| 'telegram.caption_placeholder'
+ | 'telegram.chat_count'
+ | 'telegram.chat_count_one'
+ | 'telegram.chat_type_channel'
+ | 'telegram.chat_type_group'
+ | 'telegram.chat_type_private'
+ | 'telegram.chats_error'
+ | 'telegram.chats_title'
+ | 'telegram.checking_session'
+ | 'telegram.choose_folder'
+ | 'telegram.code_hint'
+ | 'telegram.code_label'
+ | 'telegram.code_placeholder'
| 'telegram.custom_filename_hint'
| 'telegram.custom_filename_label'
| 'telegram.custom_thumbnail_label'
| 'telegram.dest_placeholder'
| 'telegram.destination_chat'
+ | 'telegram.download_all'
+ | 'telegram.download_btn'
+ | 'telegram.downloaded'
+ | 'telegram.downloading'
| 'telegram.err_bot_file_too_large'
| 'telegram.err_bot_not_member'
| 'telegram.err_bot_not_started'
@@ -3604,22 +3626,65 @@ export type TranslationKeys =
| 'telegram.error_no_bot_token'
| 'telegram.error_no_chat'
| 'telegram.error_no_file'
+ | 'telegram.file_count'
+ | 'telegram.filter_all'
+ | 'telegram.filter_audio'
+ | 'telegram.filter_document'
+ | 'telegram.filter_photo'
+ | 'telegram.filter_video'
+ | 'telegram.invalid_code'
+ | 'telegram.invalid_password'
+ | 'telegram.load_more'
+ | 'telegram.loading_chats'
+ | 'telegram.loading_media'
+ | 'telegram.logged_as'
+ | 'telegram.login'
+ | 'telegram.logout'
+ | 'telegram.media_error'
+ | 'telegram.media_title'
+ | 'telegram.no_chats'
+ | 'telegram.no_media'
+ | 'telegram.or_separator'
+ | 'telegram.password_hint'
+ | 'telegram.password_label'
+ | 'telegram.password_placeholder'
+ | 'telegram.password_submit'
+ | 'telegram.password_verifying'
+ | 'telegram.phone_hint'
+ | 'telegram.phone_label'
+ | 'telegram.phone_placeholder'
| 'telegram.pick_thumbnail'
+ | 'telegram.qr_error'
+ | 'telegram.qr_instruction'
+ | 'telegram.qr_loading'
+ | 'telegram.qr_title'
+ | 'telegram.search_files'
+ | 'telegram.searching'
| 'telegram.send_as_audio'
| 'telegram.send_as_document'
| 'telegram.send_as_label'
| 'telegram.send_as_video'
+ | 'telegram.send_code'
| 'telegram.send_to_telegram'
+ | 'telegram.sending_code'
| 'telegram.split_warning'
| 'telegram.start_upload'
+ | 'telegram.status_error'
+ | 'telegram.status_skipped'
+ | 'telegram.status_waiting'
| 'telegram.tier_free'
| 'telegram.tier_limit_label'
| 'telegram.tier_premium'
+ | 'telegram.title'
+ | 'telegram.unknown_error'
| 'telegram.upload_failed'
| 'telegram.upload_success'
| 'telegram.upload_title'
| 'telegram.uploading'
+ | 'telegram.use_phone'
| 'telegram.user_session_hint'
+ | 'telegram.verify'
+ | 'telegram.verifying'
| 'terms_note.agreement'
| 'terms_note.link'
diff --git a/src/lib/i18n/pt.json b/src/lib/i18n/pt.json
index a66bb712..0c272a56 100644
--- a/src/lib/i18n/pt.json
+++ b/src/lib/i18n/pt.json
@@ -589,6 +589,71 @@
"toast_replaced": "Substituiu o original. Economizou {{saved}} ({{pct}}%) usando {{encoder}}"
},
"telegram": {
+ "title": "Telegram",
+ "checking_session": "Verificando sessão...",
+ "login": "Entrar",
+ "logout": "Sair",
+ "logged_as": "Logado como {{phone}}",
+ "phone_label": "Número de telefone",
+ "phone_placeholder": "+55 11 91234 5678",
+ "phone_hint": "Inclua o código do país",
+ "send_code": "Enviar código",
+ "sending_code": "Enviando...",
+ "code_label": "Código de verificação",
+ "code_placeholder": "00000",
+ "code_hint": "Enviamos um código para o seu Telegram",
+ "verify": "Verificar",
+ "verifying": "Verificando...",
+ "invalid_code": "Código inválido. Tente novamente.",
+ "password_label": "Senha de dois fatores",
+ "password_placeholder": "Sua senha 2FA",
+ "password_hint": "Dica: {{hint}}",
+ "password_submit": "Confirmar",
+ "password_verifying": "Verificando...",
+ "invalid_password": "Senha inválida. Tente novamente.",
+ "chats_title": "Seus Chats",
+ "loading_chats": "Carregando chats...",
+ "chats_error": "Erro ao carregar chats",
+ "no_chats": "Nenhum chat encontrado.",
+ "chat_count": "{{count}} chats",
+ "chat_count_one": "{{count}} chat",
+ "chat_type_private": "Privado",
+ "chat_type_group": "Grupo",
+ "chat_type_channel": "Canal",
+ "media_title": "Mídia",
+ "loading_media": "Carregando mídia...",
+ "no_media": "Nenhuma mídia encontrada neste chat.",
+ "media_error": "Erro ao carregar mídia",
+ "filter_all": "Tudo",
+ "filter_photo": "Fotos",
+ "filter_video": "Vídeos",
+ "filter_document": "Arquivos",
+ "filter_audio": "Áudio",
+ "search_files": "Buscar arquivos...",
+ "searching": "Buscando...",
+ "back_to_chats": "Voltar aos chats",
+ "download_btn": "Baixar",
+ "downloading": "Baixando...",
+ "downloaded": "Baixado",
+ "choose_folder": "Escolher pasta de download",
+ "unknown_error": "Erro desconhecido",
+ "download_all": "Baixar tudo",
+ "batch_progress": "{{done}} de {{total}} arquivos",
+ "batch_cancelled": "Download em lote cancelado",
+ "batch_complete": "Todos os arquivos baixados",
+ "load_more": "Carregar mais",
+ "status_waiting": "Aguardando",
+ "status_skipped": "Pulado",
+ "status_error": "Erro",
+ "file_count": "{{count}} itens",
+ "cancel_batch": "Cancelar",
+ "qr_title": "Escaneie para entrar",
+ "qr_instruction": "Abra o Telegram no celular, vá em Configurações > Dispositivos > Conectar dispositivo",
+ "qr_loading": "Gerando QR code...",
+ "qr_error": "Falha ao gerar QR code",
+ "or_separator": "ou",
+ "use_phone": "Usar número de telefone",
+ "back_to_qr": "Voltar ao QR code",
"upload_title": "Upload to Telegram / Leech Bot",
"auth_user_session": "User Session",
"auth_bot_token": "Bot Token",
diff --git a/src/lib/i18n/ru.json b/src/lib/i18n/ru.json
index e037be71..ee233c6e 100644
--- a/src/lib/i18n/ru.json
+++ b/src/lib/i18n/ru.json
@@ -589,6 +589,71 @@
"toast_replaced": "Исходный файл заменён. Сэкономлено {{saved}} ({{pct}}%) с помощью {{encoder}}"
},
"telegram": {
+ "title": "Telegram",
+ "checking_session": "Проверка сеанса…",
+ "login": "Войти",
+ "logout": "Выйти",
+ "logged_as": "Вошли как {{phone}}",
+ "phone_label": "Номер телефона",
+ "phone_placeholder": "+7 123 456 7890",
+ "phone_hint": "Укажите номер вместе с кодом страны",
+ "send_code": "Отправить код",
+ "sending_code": "Отправка…",
+ "code_label": "Код подтверждения",
+ "code_placeholder": "00000",
+ "code_hint": "Мы отправили код в ваше приложение Telegram",
+ "verify": "Подтвердить",
+ "verifying": "Проверка…",
+ "invalid_code": "Неверный код. Попробуйте ещё раз.",
+ "password_label": "Пароль двухфакторной аутентификации",
+ "password_placeholder": "Ваш 2FA пароль",
+ "password_hint": "Подсказка: {{hint}}",
+ "password_submit": "Подтвердить",
+ "password_verifying": "Проверка…",
+ "invalid_password": "Неверный пароль. Попробуйте ещё раз.",
+ "chats_title": "Ваши чаты",
+ "loading_chats": "Загрузка чатов…",
+ "chats_error": "Не удалось загрузить чаты",
+ "no_chats": "Чаты не найдены.",
+ "chat_count": "Чатов: {{count}}",
+ "chat_count_one": "{{count}} чат",
+ "chat_type_private": "Личный",
+ "chat_type_group": "Группа",
+ "chat_type_channel": "Канал",
+ "media_title": "Медиа",
+ "loading_media": "Загрузка медиа…",
+ "no_media": "В этом чате медиа не найдены.",
+ "media_error": "Не удалось загрузить медиа",
+ "filter_all": "Все",
+ "filter_photo": "Фото",
+ "filter_video": "Видео",
+ "filter_document": "Файлы",
+ "filter_audio": "Аудио",
+ "search_files": "Поиск файлов…",
+ "searching": "Поиск…",
+ "back_to_chats": "Назад к чатам",
+ "download_btn": "Скачать",
+ "downloading": "Скачивание…",
+ "downloaded": "Скачано",
+ "choose_folder": "Выберите папку загрузок",
+ "unknown_error": "Неизвестная ошибка",
+ "download_all": "Скачать всё",
+ "batch_progress": "{{done}} из {{total}} файлов",
+ "batch_cancelled": "Пакетное скачивание отменено",
+ "batch_complete": "Все файлы скачаны",
+ "load_more": "Загрузить ещё",
+ "status_waiting": "Ожидание",
+ "status_skipped": "Пропущено",
+ "status_error": "Ошибка",
+ "file_count": "Элементов: {{count}}",
+ "cancel_batch": "Отмена",
+ "qr_title": "Сканируйте QR-код для входа",
+ "qr_instruction": "Откройте Telegram на телефоне, перейдите в Настройки → Устройства → Подключить устройство",
+ "qr_loading": "Генерация QR-кода…",
+ "qr_error": "Не удалось создать QR-код",
+ "or_separator": "или",
+ "use_phone": "Использовать номер телефона",
+ "back_to_qr": "Назад к QR-коду",
"upload_title": "Upload to Telegram / Leech Bot",
"auth_user_session": "User Session",
"auth_bot_token": "Bot Token",
diff --git a/src/lib/i18n/zh-TW.json b/src/lib/i18n/zh-TW.json
index 6f8b7604..dee14814 100644
--- a/src/lib/i18n/zh-TW.json
+++ b/src/lib/i18n/zh-TW.json
@@ -589,6 +589,71 @@
"toast_replaced": "已取代原始檔案。使用 {{encoder}} 節省 {{saved}}({{pct}}%)"
},
"telegram": {
+ "title": "Telegram",
+ "checking_session": "正在檢查登入狀態...",
+ "login": "登入",
+ "logout": "登出",
+ "logged_as": "已登入為 {{phone}}",
+ "phone_label": "電話號碼",
+ "phone_placeholder": "+1 234 567 8900",
+ "phone_hint": "請包含國碼",
+ "send_code": "傳送驗證碼",
+ "sending_code": "傳送中...",
+ "code_label": "驗證碼",
+ "code_placeholder": "00000",
+ "code_hint": "系統已將驗證碼傳送到您的 Telegram 應用程式",
+ "verify": "驗證",
+ "verifying": "驗證中...",
+ "invalid_code": "驗證碼無效。請再試一次。",
+ "password_label": "雙重驗證密碼",
+ "password_placeholder": "您的 2FA 密碼",
+ "password_hint": "提示: {{hint}}",
+ "password_submit": "確認",
+ "password_verifying": "驗證中...",
+ "invalid_password": "密碼無效。請再試一次。",
+ "chats_title": "您的聊天",
+ "loading_chats": "正在載入聊天...",
+ "chats_error": "載入聊天失敗",
+ "no_chats": "找不到任何聊天。",
+ "chat_count": "{{count}} 個聊天",
+ "chat_count_one": "{{count}} 個聊天",
+ "chat_type_private": "私人",
+ "chat_type_group": "群組",
+ "chat_type_channel": "頻道",
+ "media_title": "媒體",
+ "loading_media": "正在載入媒體...",
+ "no_media": "此聊天沒有任何媒體。",
+ "media_error": "載入媒體失敗",
+ "filter_all": "全部",
+ "filter_photo": "照片",
+ "filter_video": "影片",
+ "filter_document": "檔案",
+ "filter_audio": "音訊",
+ "search_files": "搜尋檔案...",
+ "searching": "搜尋中...",
+ "back_to_chats": "返回聊天",
+ "download_btn": "下載",
+ "downloading": "下載中...",
+ "downloaded": "已下載",
+ "choose_folder": "選擇下載資料夾",
+ "unknown_error": "未知錯誤",
+ "download_all": "全部下載",
+ "batch_progress": "{{done}} / {{total}} 個檔案",
+ "batch_cancelled": "大量下載已取消",
+ "batch_complete": "所有檔案已下載",
+ "load_more": "載入更多",
+ "status_waiting": "等待中",
+ "status_skipped": "已略過",
+ "status_error": "錯誤",
+ "file_count": "{{count}} 個項目",
+ "cancel_batch": "取消",
+ "qr_title": "掃描以登入",
+ "qr_instruction": "在手機開啟 Telegram,前往 設定 > 裝置 > 連結桌面裝置",
+ "qr_loading": "正在產生 QR Code...",
+ "qr_error": "產生 QR Code 失敗",
+ "or_separator": "或",
+ "use_phone": "改用電話號碼",
+ "back_to_qr": "返回 QR Code",
"upload_title": "Upload to Telegram / Leech Bot",
"auth_user_session": "User Session",
"auth_bot_token": "Bot Token",
diff --git a/src/lib/i18n/zh.json b/src/lib/i18n/zh.json
index beafcf57..1edd21d4 100644
--- a/src/lib/i18n/zh.json
+++ b/src/lib/i18n/zh.json
@@ -589,6 +589,71 @@
"toast_replaced": "已替换原始文件。使用 {{encoder}} 节省 {{saved}}({{pct}}%)"
},
"telegram": {
+ "title": "Telegram",
+ "checking_session": "正在检查登录状态...",
+ "login": "登录",
+ "logout": "退出登录",
+ "logged_as": "已登录为 {{phone}}",
+ "phone_label": "手机号",
+ "phone_placeholder": "+86 138 0000 0000",
+ "phone_hint": "请包含国家区号",
+ "send_code": "发送验证码",
+ "sending_code": "正在发送...",
+ "code_label": "验证码",
+ "code_placeholder": "00000",
+ "code_hint": "验证码已发送到您的 Telegram 应用",
+ "verify": "验证",
+ "verifying": "正在验证...",
+ "invalid_code": "验证码无效,请重试。",
+ "password_label": "两步验证密码",
+ "password_placeholder": "您的 2FA 密码",
+ "password_hint": "提示:{{hint}}",
+ "password_submit": "确认",
+ "password_verifying": "正在验证...",
+ "invalid_password": "密码错误,请重试。",
+ "chats_title": "我的对话",
+ "loading_chats": "正在加载对话...",
+ "chats_error": "加载对话失败",
+ "no_chats": "未找到对话。",
+ "chat_count": "{{count}} 个对话",
+ "chat_count_one": "{{count}} 个对话",
+ "chat_type_private": "私聊",
+ "chat_type_group": "群组",
+ "chat_type_channel": "频道",
+ "media_title": "媒体",
+ "loading_media": "正在加载媒体...",
+ "no_media": "该对话中未找到媒体文件。",
+ "media_error": "加载媒体失败",
+ "filter_all": "全部",
+ "filter_photo": "图片",
+ "filter_video": "视频",
+ "filter_document": "文件",
+ "filter_audio": "音频",
+ "search_files": "搜索文件...",
+ "searching": "搜索中...",
+ "back_to_chats": "返回对话列表",
+ "download_btn": "下载",
+ "downloading": "下载中...",
+ "downloaded": "已下载",
+ "choose_folder": "选择下载文件夹",
+ "unknown_error": "未知错误",
+ "download_all": "全部下载",
+ "batch_progress": "{{done}}/{{total}} 个文件",
+ "batch_cancelled": "批量下载已取消",
+ "batch_complete": "全部文件下载完成",
+ "load_more": "加载更多",
+ "status_waiting": "等待中",
+ "status_skipped": "已跳过",
+ "status_error": "错误",
+ "file_count": "{{count}} 项",
+ "cancel_batch": "取消",
+ "qr_title": "扫码登录",
+ "qr_instruction": "打开手机上的 Telegram,前往 设置 > 设备 > 关联桌面设备",
+ "qr_loading": "正在生成二维码...",
+ "qr_error": "生成二维码失败",
+ "or_separator": "或",
+ "use_phone": "使用手机号登录",
+ "back_to_qr": "返回二维码",
"upload_title": "Upload to Telegram / Leech Bot",
"auth_user_session": "User Session",
"auth_bot_token": "Bot Token",
diff --git a/src/lib/stores/download-store.svelte.ts b/src/lib/stores/download-store.svelte.ts
index 15011333..2dbc2dd9 100644
--- a/src/lib/stores/download-store.svelte.ts
+++ b/src/lib/stores/download-store.svelte.ts
@@ -409,29 +409,5 @@ export function upsertGenericProgress(
scheduleFlush();
}
-export function formatBytes(bytes: number): string {
- if (bytes < 1024) return `${bytes} B`;
- if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
- if (bytes < 1024 * 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
- return `${(bytes / (1024 * 1024 * 1024)).toFixed(2)} GB`;
-}
-
-export function formatSpeed(bytesPerSec: number): string {
- if (bytesPerSec <= 0) return "0 KB/s";
- if (bytesPerSec < 1024 * 1024) return `${(bytesPerSec / 1024).toFixed(0)} KB/s`;
- return `${(bytesPerSec / (1024 * 1024)).toFixed(1)} MB/s`;
-}
-
-export function formatEta(seconds: number | null | undefined): string {
- if (seconds == null || seconds <= 0 || !Number.isFinite(seconds)) return "";
- if (seconds < 60) return `${Math.round(seconds)}s`;
- if (seconds < 3600) {
- const m = Math.floor(seconds / 60);
- const s = Math.round(seconds % 60);
- return s > 0 ? `${m}m ${s}s` : `${m}m`;
- }
- const h = Math.floor(seconds / 3600);
- const m = Math.round((seconds % 3600) / 60);
- return m > 0 ? `${h}h ${m}m` : `${h}h`;
-}
+export { formatBytes, formatSpeed, formatEta } from "../download-format";
diff --git a/src/routes/telegram/+page.svelte b/src/routes/telegram/+page.svelte
index f7bc2bf5..88aa67a0 100644
--- a/src/routes/telegram/+page.svelte
+++ b/src/routes/telegram/+page.svelte
@@ -1047,7 +1047,7 @@
<p class="qr-instruction">{$t("telegram.qr_instruction")}</p>
</div>
- <div class="separator">
+ <div class="or-divider">
<span class="separator-line"></span>
<span class="separator-text">{$t("telegram.or_separator")}</span>
<span class="separator-line"></span>
@@ -1732,7 +1732,7 @@
line-height: 1.6;
}
- .separator {
+ .or-divider {
display: flex;
align-items: center;
gap: var(--padding);