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(portable): say plainly that the WebView is not portable on macOS (#267)

P0L1T319277334399c
diff --git a/src-tauri/src/commands/app_lifecycle.rs b/src-tauri/src/commands/app_lifecycle.rs
index 6b721b87..129a741a 100644
--- a/src-tauri/src/commands/app_lifecycle.rs
+++ b/src-tauri/src/commands/app_lifecycle.rs
@@ -24,3 +24,31 @@ pub fn get_debug_info(app: AppHandle) -> DebugInfo {
proxy_enabled: settings.proxy.enabled,
}
}
+
+#[derive(Debug, Serialize)]
+pub struct PortableInfo {
+ pub is_portable: bool,
+ pub data_dir: Option<String>,
+ /// Whether the UI should warn that the WebView is not portable here.
+ ///
+ /// Only macOS: wry does not read `data_directory` on WKWebView, so the
+ /// session data stays under `~/Library` no matter where the app runs from.
+ /// Windows and Linux redirect it in `lib.rs`, so there is nothing to warn
+ /// about there. See issue #227.
+ pub macos_webview_notice: bool,
+}
+
+/// Reports what portable mode actually covers on this platform.
+///
+/// Reads the same environment `main.rs` publishes rather than re-detecting
+/// `portable.txt`, so there is a single source of truth for the mode.
+#[tauri::command]
+pub fn get_portable_info() -> PortableInfo {
+ let is_portable = std::env::var("OMNIGET_PORTABLE").ok().as_deref() == Some("1");
+
+ PortableInfo {
+ is_portable,
+ data_dir: std::env::var("OMNIGET_DATA_DIR").ok(),
+ macos_webview_notice: cfg!(target_os = "macos") && is_portable,
+ }
+}
diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs
index 5afb5fac..e4fd8143 100644
--- a/src-tauri/src/lib.rs
+++ b/src-tauri/src/lib.rs
@@ -1007,6 +1007,7 @@ pub fn run() {
commands::p2p::p2p_resume_send,
commands::app_lifecycle::force_exit_app,
commands::app_lifecycle::get_debug_info,
+ commands::app_lifecycle::get_portable_info,
])
.build(tauri::generate_context!())
.expect("error while building tauri application")
diff --git a/src/components/settings/SettingsStorage.svelte b/src/components/settings/SettingsStorage.svelte
index 90879ebf..9d1a34d8 100644
--- a/src/components/settings/SettingsStorage.svelte
+++ b/src/components/settings/SettingsStorage.svelte
@@ -25,7 +25,14 @@
map: { media_duration_secs: number; spans: unknown[] };
};
+ type PortableInfo = {
+ is_portable: boolean;
+ data_dir: string | null;
+ macos_webview_notice: boolean;
+ };
+
let stats = $state<StoreStats | null>(null);
+ let portable = $state<PortableInfo | null>(null);
let running = $state(false);
let probing = $state(false);
@@ -58,6 +65,14 @@
}
}
+ async function loadPortable() {
+ try {
+ portable = await invoke<PortableInfo>("get_portable_info");
+ } catch {
+ portable = null;
+ }
+ }
+
async function runDedupe() {
const chosen = await open({
multiple: true,
@@ -127,6 +142,7 @@
$effect(() => {
void loadStats();
+ void loadPortable();
});
</script>
@@ -134,6 +150,30 @@
<h5 class="section-title">{$t("settings.storage.title")}</h5>
<p class="muted">{$t("settings.storage.description")}</p>
+ {#if portable?.is_portable}
+ <div class="card portable-card">
+ <div class="setting-row">
+ <div class="setting-col">
+ <span class="setting-label">{$t("settings.storage.portable_label")}</span>
+ <span class="setting-path wrap">
+ {$t("settings.storage.portable_active", { dir: portable.data_dir ?? "<app>/data" })}
+ </span>
+ </div>
+ </div>
+
+ <!-- O modo portatil nao cobre o WebView no macOS, e o usuario que leva o
+ pendrive para outra maquina precisa saber disso antes, nao depois. -->
+ {#if portable.macos_webview_notice}
+ <div class="divider"></div>
+ <div class="setting-row">
+ <div class="setting-col">
+ <span class="setting-path wrap">{$t("settings.storage.portable_macos_notice")}</span>
+ </div>
+ </div>
+ {/if}
+ </div>
+ {/if}
+
<div class="card">
<div class="setting-row">
<div class="setting-col">
@@ -171,3 +211,17 @@
</div>
</div>
</section>
+
+<style>
+ .portable-card {
+ margin-bottom: var(--padding);
+ }
+
+ /* O caminho de dados e o aviso do macOS sao frases inteiras, nao rotulos:
+ sem isto ficam numa linha so e sao cortados. */
+ .wrap {
+ white-space: normal;
+ word-break: break-word;
+ line-height: 1.5;
+ }
+</style>
diff --git a/src/lib/i18n/el.json b/src/lib/i18n/el.json
index 15a72c2d..727b0552 100644
--- a/src/lib/i18n/el.json
+++ b/src/lib/i18n/el.json
@@ -922,7 +922,10 @@
"silence_running": "Μέτρηση…",
"pick_media": "Επιλέξτε αρχείο πολυμέσων",
"silence_none": "Σχεδόν καθόλου σιωπή σε αυτό το αρχείο",
- "silence_done": "Βρέθηκε σιωπή {{saved}} — ο player μπορεί να την προσπερνά"
+ "silence_done": "Βρέθηκε σιωπή {{saved}} — ο player μπορεί να την προσπερνά",
+ "portable_label": "Portable Mode",
+ "portable_active": "Portable mode is active. OmniGet's data is stored in {{dir}}.",
+ "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/tonhowtf/omniget/issues/227."
},
"dependencies": {
"title": "Εξαρτήσεις",
diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json
index 47720a84..7f1444f8 100644
--- a/src/lib/i18n/en.json
+++ b/src/lib/i18n/en.json
@@ -940,7 +940,10 @@
"silence_running": "Measuring…",
"pick_media": "Pick a media file",
"silence_none": "Almost no silence in this file",
- "silence_done": "{{saved}} of silence found — playback can skip it"
+ "silence_done": "{{saved}} of silence found — playback can skip it",
+ "portable_label": "Portable Mode",
+ "portable_active": "Portable mode is active. OmniGet's data is stored in {{dir}}.",
+ "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/tonhowtf/omniget/issues/227."
},
"dependencies": {
"title": "Dependencies",
diff --git a/src/lib/i18n/es.json b/src/lib/i18n/es.json
index b595a919..32928658 100644
--- a/src/lib/i18n/es.json
+++ b/src/lib/i18n/es.json
@@ -922,7 +922,10 @@
"silence_running": "Midiendo…",
"pick_media": "Elige un archivo multimedia",
"silence_none": "Casi no hay silencio en este archivo",
- "silence_done": "{{saved}} de silencio encontrado: el reproductor puede saltarlo"
+ "silence_done": "{{saved}} de silencio encontrado: el reproductor puede saltarlo",
+ "portable_label": "Portable Mode",
+ "portable_active": "Portable mode is active. OmniGet's data is stored in {{dir}}.",
+ "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/tonhowtf/omniget/issues/227."
},
"dependencies": {
"title": "Dependencias",
diff --git a/src/lib/i18n/fr.json b/src/lib/i18n/fr.json
index b54e7383..ff782f6a 100644
--- a/src/lib/i18n/fr.json
+++ b/src/lib/i18n/fr.json
@@ -922,7 +922,10 @@
"silence_running": "Mesure en cours…",
"pick_media": "Choisissez un fichier multimédia",
"silence_none": "Presque aucun silence dans ce fichier",
- "silence_done": "{{saved}} de silence trouvé — le lecteur peut le sauter"
+ "silence_done": "{{saved}} de silence trouvé — le lecteur peut le sauter",
+ "portable_label": "Portable Mode",
+ "portable_active": "Portable mode is active. OmniGet's data is stored in {{dir}}.",
+ "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/tonhowtf/omniget/issues/227."
},
"dependencies": {
"title": "Dépendances",
diff --git a/src/lib/i18n/it.json b/src/lib/i18n/it.json
index c83d0bb4..db0367c1 100644
--- a/src/lib/i18n/it.json
+++ b/src/lib/i18n/it.json
@@ -922,7 +922,10 @@
"silence_running": "Misurazione…",
"pick_media": "Scegli un file multimediale",
"silence_none": "Quasi nessun silenzio in questo file",
- "silence_done": "{{saved}} di silenzio trovato — il player può saltarlo"
+ "silence_done": "{{saved}} di silenzio trovato — il player può saltarlo",
+ "portable_label": "Portable Mode",
+ "portable_active": "Portable mode is active. OmniGet's data is stored in {{dir}}.",
+ "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/tonhowtf/omniget/issues/227."
},
"dependencies": {
"title": "Dipendenze",
diff --git a/src/lib/i18n/ja.json b/src/lib/i18n/ja.json
index c2097aa3..7d190bb5 100644
--- a/src/lib/i18n/ja.json
+++ b/src/lib/i18n/ja.json
@@ -922,7 +922,10 @@
"silence_running": "測定中…",
"pick_media": "メディアファイルを選択",
"silence_none": "このファイルにはほとんど無音がありません",
- "silence_done": "無音 {{saved}} 分を検出 — 再生時にスキップできます"
+ "silence_done": "無音 {{saved}} 分を検出 — 再生時にスキップできます",
+ "portable_label": "Portable Mode",
+ "portable_active": "Portable mode is active. OmniGet's data is stored in {{dir}}.",
+ "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/tonhowtf/omniget/issues/227."
},
"dependencies": {
"title": "依存関係",
diff --git a/src/lib/i18n/keys.ts b/src/lib/i18n/keys.ts
index 202ad215..c4b6443a 100644
--- a/src/lib/i18n/keys.ts
+++ b/src/lib/i18n/keys.ts
@@ -1555,6 +1555,9 @@ export type TranslationKeys =
| 'settings.storage.description'
| 'settings.storage.pick_files'
| 'settings.storage.pick_media'
+ | 'settings.storage.portable_active'
+ | 'settings.storage.portable_label'
+ | 'settings.storage.portable_macos_notice'
| 'settings.storage.silence_action'
| 'settings.storage.silence_done'
| 'settings.storage.silence_hint'
diff --git a/src/lib/i18n/pt.json b/src/lib/i18n/pt.json
index 0c272a56..42d6882d 100644
--- a/src/lib/i18n/pt.json
+++ b/src/lib/i18n/pt.json
@@ -922,7 +922,10 @@
"silence_running": "Medindo…",
"pick_media": "Escolha um arquivo de mídia",
"silence_none": "Quase nenhum silêncio neste arquivo",
- "silence_done": "{{saved}} de silêncio encontrado — o player pode pular"
+ "silence_done": "{{saved}} de silêncio encontrado — o player pode pular",
+ "portable_label": "Portable Mode",
+ "portable_active": "Portable mode is active. OmniGet's data is stored in {{dir}}.",
+ "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/tonhowtf/omniget/issues/227."
},
"dependencies": {
"title": "Dependências",
diff --git a/src/lib/i18n/ru.json b/src/lib/i18n/ru.json
index ee233c6e..e7473793 100644
--- a/src/lib/i18n/ru.json
+++ b/src/lib/i18n/ru.json
@@ -922,7 +922,10 @@
"silence_running": "Измерение…",
"pick_media": "Выберите медиафайл",
"silence_none": "В этом файле почти нет пауз",
- "silence_done": "Найдено тишины: {{saved}} — плеер может её пропускать"
+ "silence_done": "Найдено тишины: {{saved}} — плеер может её пропускать",
+ "portable_label": "Portable Mode",
+ "portable_active": "Portable mode is active. OmniGet's data is stored in {{dir}}.",
+ "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/tonhowtf/omniget/issues/227."
},
"dependencies": {
"title": "Зависимости",
diff --git a/src/lib/i18n/zh-TW.json b/src/lib/i18n/zh-TW.json
index dee14814..08edf795 100644
--- a/src/lib/i18n/zh-TW.json
+++ b/src/lib/i18n/zh-TW.json
@@ -922,7 +922,10 @@
"silence_running": "測量中…",
"pick_media": "選擇一個媒體檔案",
"silence_none": "這個檔案幾乎沒有靜音",
- "silence_done": "發現 {{saved}} 的靜音 —— 播放時可以略過"
+ "silence_done": "發現 {{saved}} 的靜音 —— 播放時可以略過",
+ "portable_label": "Portable Mode",
+ "portable_active": "Portable mode is active. OmniGet's data is stored in {{dir}}.",
+ "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/tonhowtf/omniget/issues/227."
},
"dependencies": {
"title": "相依元件",
diff --git a/src/lib/i18n/zh.json b/src/lib/i18n/zh.json
index 1edd21d4..9c24b548 100644
--- a/src/lib/i18n/zh.json
+++ b/src/lib/i18n/zh.json
@@ -922,7 +922,10 @@
"silence_running": "测量中…",
"pick_media": "选择一个媒体文件",
"silence_none": "这个文件几乎没有静音",
- "silence_done": "发现 {{saved}} 的静音 —— 播放时可以跳过"
+ "silence_done": "发现 {{saved}} 的静音 —— 播放时可以跳过",
+ "portable_label": "Portable Mode",
+ "portable_active": "Portable mode is active. OmniGet's data is stored in {{dir}}.",
+ "portable_macos_notice": "On macOS the WebView still stores its session data under ~/Library, and portable mode cannot redirect it. Only OmniGet's own data is portable here — see github.com/tonhowtf/omniget/issues/227."
},
"dependencies": {
"title": "依赖项",