From 402a90cf4b36f8c6167ccbc4c10aead1a61172f2 Mon Sep 17 00:00:00 2001 From: Flavio Fois Date: Tue, 10 Feb 2026 22:31:36 +0100 Subject: [PATCH] feat: add download functionality for attachments, images, and PDFs; update version to 1.5.4 --- TODO.md | 1 + config.ini | 2 +- frontend/messages/en.json | 9 ++-- frontend/messages/it.json | 12 +++-- frontend/src/lib/components/MailViewer.svelte | 27 +++++++++++ frontend/src/routes/image/+page.svelte | 16 +++++++ frontend/src/routes/pdf/+page.svelte | 47 ++++++++++++++++--- installer/installer.iss | 2 +- 8 files changed, 101 insertions(+), 15 deletions(-) diff --git a/TODO.md b/TODO.md index 959fda4..6a1ecb3 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,7 @@ # New Features - [ ] Add an option to select the folder to save Attachments to, instead of always saving to the Downloads folder. - [ ] Create a sorta of "Bug Reporter" loader, to load the .ZIP file with the Bug Report data, and replicate the same enviroment as the user, to investigate the issue. (EML file, settings) +- [x] Add a "Download" button to the MailViewer, PDF and Image viewer, to download the file instead of just opening it. # Existing Features - [ ] Add seperated "Updater" binary, that will start on User login (via Scheduled Task), with a silent install mode. diff --git a/config.ini b/config.ini index ac457af..601a4f8 100644 --- a/config.ini +++ b/config.ini @@ -1,7 +1,7 @@ [EMLy] SDK_DECODER_SEMVER = 1.3.2 SDK_DECODER_RELEASE_CHANNEL = stable -GUI_SEMVER = 1.5.3 +GUI_SEMVER = 1.5.4 GUI_RELEASE_CHANNEL = beta LANGUAGE = it UPDATE_CHECK_ENABLED = false diff --git a/frontend/messages/en.json b/frontend/messages/en.json index 407d4a5..969600e 100644 --- a/frontend/messages/en.json +++ b/frontend/messages/en.json @@ -26,10 +26,10 @@ "settings_preview_page_description": "Modify settings related to the preview page", "settings_preview_builtin_label": "Use built-in preview for images", "settings_preview_builtin_hint": "Uses EMLy's built-in image previewer for supported image file types.", - "settings_preview_builtin_info": "Info: If disabled, image files will be treated as downloads instead of being previewed within the app.", + "settings_preview_builtin_info": "Info: If disabled, image files will be opened by the computer's default app instead of being previewed within the app.", "settings_preview_pdf_builtin_label": "Use built-in viewer for PDFs", "settings_preview_pdf_builtin_hint": "Uses EMLy's built-in viewer for PDF files.", - "settings_preview_pdf_builtin_info": "Info: If disabled, PDF files will be treated as downloads instead of being previewed within the app.", + "settings_preview_pdf_builtin_info": "Info: If disabled, PDF files will be opened by the computer's default app instead of being previewed within the app.", "settings_msg_converter_title": "MSG Handling", "settings_msg_converter_description": "Configure how MSG files are processed.", "settings_msg_converter_label": "Use MSG to EML converter", @@ -69,6 +69,8 @@ "mail_open_btn_title": "Open another file", "mail_close_btn_label": "Close", "mail_close_btn_title": "Close", + "mail_download_btn_label": "Download", + "mail_download_btn_title": "Download", "mail_from": "From:", "mail_to": "To:", "mail_cc": "Cc:", @@ -79,8 +81,9 @@ "mail_error_image": "Failed to open image file.", "settings_toast_language_changed": "Language changed successfully!", "settings_toast_language_change_failed": "Failed to change language.", - "mail_open_btn_text": "Open EML/MSG File", + "mail_open_btn_text": "Open File", "mail_close_btn_text": "Close", + "mail_download_btn_text": "Download", "settings_danger_reset_dialog_description_part1": "This action cannot be undone.", "settings_danger_reset_dialog_description_part2": "This will permanently delete your current settings and return the app to its default state.", "mail_error_opening": "Failed to open EML file.", diff --git a/frontend/messages/it.json b/frontend/messages/it.json index eca16be..ad7f190 100644 --- a/frontend/messages/it.json +++ b/frontend/messages/it.json @@ -26,10 +26,10 @@ "settings_preview_page_description": "Modifica le impostazioni relative alla pagina di anteprima", "settings_preview_builtin_label": "Usa anteprima integrata per le immagini", "settings_preview_builtin_hint": "Usa il visualizzatore di immagini integrato di EMLy per i tipi di file immagini supportati.", - "settings_preview_builtin_info": "Info: Se disabilitato, i file immagine verranno trattati come download anziché essere visualizzati all'interno dell'app.", + "settings_preview_builtin_info": "Info: Se disabilitato, i file immagine verranno aperti tramite l'app di default attuale anziché essere visualizzati all'interno dell'app.", "settings_preview_pdf_builtin_label": "Usa visualizzatore integrato per PDF", "settings_preview_pdf_builtin_hint": "Usa il visualizzatore integrato di EMLy per i file PDF.", - "settings_preview_pdf_builtin_info": "Info: Se disabilitato, i file PDF verranno trattati come download invece di essere visualizzati nell'app.", + "settings_preview_pdf_builtin_info": "Info: Se disabilitato, i file PDF verranno aperti tramite l'app di default attuale invece di essere visualizzati nell'app.", "settings_msg_converter_title": "Gestione MSG", "settings_msg_converter_description": "Configura come vengono elaborati i file MSG.", "settings_msg_converter_label": "Usa convertitore MSG in EML", @@ -79,7 +79,7 @@ "mail_error_image": "Impossibile aprire il file immagine.", "settings_toast_language_changed": "Lingua cambiata con successo!", "settings_toast_language_change_failed": "Impossibile cambiare lingua.", - "mail_open_btn_text": "Apri file EML/MSG", + "mail_open_btn_text": "Apri file", "mail_close_btn_text": "Chiudi", "settings_danger_reset_dialog_description_part1": "Questa azione non può essere annullata.", "settings_danger_reset_dialog_description_part2": "Questo eliminerà permanentemente le tue impostazioni attuali e riporterà l'app allo stato predefinito.", @@ -215,5 +215,9 @@ "pdf_error_no_data_desc": "Nessun dato PDF fornito. Apri questa finestra dall'applicazione principale EMLy.", "pdf_error_timeout": "Timeout caricamento PDF. Il worker potrebbe non essersi inizializzato correttamente.", "pdf_error_parsing": "Errore nel parsing del PDF: ", - "pdf_error_rendering": "Errore nel rendering della pagina: " + "pdf_error_rendering": "Errore nel rendering della pagina: ", + "mail_download_btn_label": "Scarica", + "mail_download_btn_title": "Scarica", + "mail_download_btn_text": "Scarica" + } diff --git a/frontend/src/lib/components/MailViewer.svelte b/frontend/src/lib/components/MailViewer.svelte index 349919c..74844b6 100644 --- a/frontend/src/lib/components/MailViewer.svelte +++ b/frontend/src/lib/components/MailViewer.svelte @@ -9,6 +9,7 @@ Signature, FileCode, Loader2, + Download, } from '@lucide/svelte'; import { sidebarOpen } from '$lib/stores/app'; import { onDestroy, onMount } from 'svelte'; @@ -35,6 +36,7 @@ isEmailFile, } from '$lib/utils/mail'; import { settingsStore } from '$lib/stores/settings.svelte'; + import { Separator } from "$lib/components/ui/separator"; // ============================================================================ // State @@ -59,6 +61,21 @@ mailState.clear(); } + function onDownloadAttachments() { + if (!mailState.currentEmail || !mailState.currentEmail.attachments) return; + + mailState.currentEmail.attachments.forEach((att) => { + const base64 = arrayBufferToBase64(att.data); + const dataUrl = createDataUrl(att.contentType, base64); + const link = document.createElement('a'); + link.href = dataUrl; + link.download = att.filename; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + }); + } + async function onOpenMail() { isLoading = true; loadingText = m.layout_loading_text(); @@ -224,6 +241,16 @@ {mailState.currentEmail.subject || m.mail_subject_no_subject()}
+ +
diff --git a/frontend/src/routes/pdf/+page.svelte b/frontend/src/routes/pdf/+page.svelte index e5bedf5..ea9fae8 100644 --- a/frontend/src/routes/pdf/+page.svelte +++ b/frontend/src/routes/pdf/+page.svelte @@ -1,5 +1,5 @@
@@ -202,6 +233,10 @@

{filename || m.pdf_viewer_title()}

+ +
diff --git a/installer/installer.iss b/installer/installer.iss index 8e61fb7..e35102c 100644 --- a/installer/installer.iss +++ b/installer/installer.iss @@ -1,6 +1,6 @@ #define ApplicationName 'EMLy' #define ApplicationVersion GetVersionNumbersString('EMLy.exe') -#define ApplicationVersion '1.5.3_beta' +#define ApplicationVersion '1.5.4_beta' [Languages] Name: "english"; MessagesFile: "compiler:Default.isl"