From 25849b8537699fb8de594ab5e3c6220ee7bc09c0 Mon Sep 17 00:00:00 2001 From: 4aiman Date: Fri, 29 May 2026 21:27:31 +0300 Subject: [PATCH] Fix export: use Tauri save_file instead of blob, text button labels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Export was broken on Android — blob download (URL.createObjectURL) doesn't work in WebView. Now uses Tauri save_file command which triggers SAF file picker (same as GPX export). Replaced cryptic arrow icons with readable text: "Импорт" / "Экспорт" on both recipes and supplements screens. --- frontend/js/main.js | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/frontend/js/main.js b/frontend/js/main.js index 15cb8e8..34a5328 100644 --- a/frontend/js/main.js +++ b/frontend/js/main.js @@ -1425,8 +1425,8 @@ async function renderRecipes(container) {

Рецепты

- - + +
@@ -3432,8 +3432,8 @@ async function renderSupplements(container) {

Добавки

- - + +
@@ -4280,8 +4280,18 @@ function addZoomDisplay(map) { // Export/Import: recipes, supplements // --------------------------------------------------------------------------- -function downloadFile(filename, content, mimeType) { - const blob = new Blob([content], { type: mimeType || "application/json" }); +async function downloadFile(filename, content) { + // Use Tauri save_file (works on Android via SAF) + try { + if (window.__TAURI__) { + await window.__TAURI__.core.invoke("save_file", { filename, content }); + return; + } + } catch (e) { + console.error("[download] Tauri save error:", e); + } + // Fallback for desktop browsers + const blob = new Blob([content], { type: "application/json" }); const a = document.createElement("a"); a.href = URL.createObjectURL(blob); a.download = filename;