From 8175e14fb06e9be5d32c5b84d983067777117551 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Mon, 19 Jan 2026 15:17:05 -0600 Subject: [PATCH] Add Flatpak sandbox section in Settings UI Features: - New Settings section that appears ONLY when running in Flatpak - Displays clear instructions for granting filesystem permissions - Copy-paste ready commands for common scenarios (NAS, SSHFS) - Explains Flatseal as GUI alternative - Professional, defensive UX per prompt requirements The section is completely hidden when not in Flatpak. Users see actionable guidance with examples. --- src/lib/components/views/SettingsView.svelte | 106 +++++++++++++++++++ 1 file changed, 106 insertions(+) diff --git a/src/lib/components/views/SettingsView.svelte b/src/lib/components/views/SettingsView.svelte index e7daf3f53..13688009e 100644 --- a/src/lib/components/views/SettingsView.svelte +++ b/src/lib/components/views/SettingsView.svelte @@ -98,6 +98,10 @@ // Offline mode state let offlineStatus = $state(getOfflineStatus()); let offlineSettings = $state(getOfflineSettings()); + + // Flatpak detection state + let isFlatpak = $state(false); + let flatpakHelpText = $state(''); let isCheckingNetwork = $state(false); // Section navigation @@ -452,6 +456,9 @@ // Load playback preferences loadPlaybackPreferences(); + // Detect if running in Flatpak + loadFlatpakStatus(); + // Check for legacy downloads checkLegacyDownloads(); @@ -842,6 +849,17 @@ } } + async function loadFlatpakStatus() { + try { + isFlatpak = await invoke('is_running_in_flatpak'); + if (isFlatpak) { + flatpakHelpText = await invoke('get_flatpak_help_text'); + } + } catch (err) { + console.error('Failed to check Flatpak status:', err); + } + } + async function loadAudioSettings() { try { const settings = await invoke('get_audio_settings'); @@ -1885,6 +1903,32 @@ + + + {#if isFlatpak} +
+

Flatpak Sandbox

+
+

+ QBZ is running inside a Flatpak sandbox. For offline libraries on NAS, network mounts, or external disks, direct filesystem access is required. +

+
+

Grant Filesystem Access

+

Use Flatseal (GUI) or run this command:

+
flatpak override --user --filesystem=/path/to/music com.blitzfc.qbz
+

Examples

+
# CIFS / Samba mount
+flatpak override --user --filesystem=/mnt/nas com.blitzfc.qbz
+
+# SSHFS mount
+flatpak override --user --filesystem=$HOME/music-nas com.blitzfc.qbz
+

+ Note: This setting is persistent and survives reboots and updates. +

+
+
+
+ {/if} {#if isCheckingNetwork} @@ -2475,6 +2519,68 @@ transform: rotate(360deg); } } + + /* Flatpak section styles */ + .flatpak-section { + background-color: var(--bg-tertiary); + border: 1px solid rgba(99, 102, 241, 0.2); + border-radius: 8px; + padding: 20px; + } + + .flatpak-info { + color: var(--text-secondary); + } + + .flatpak-intro { + font-size: 14px; + line-height: 1.6; + margin-bottom: 20px; + color: var(--text-primary); + } + + .flatpak-guide h4 { + font-size: 14px; + font-weight: 600; + color: var(--text-primary); + margin-bottom: 8px; + margin-top: 16px; + } + + .flatpak-guide h4:first-child { + margin-top: 0; + } + + .flatpak-guide p { + font-size: 13px; + line-height: 1.5; + margin-bottom: 8px; + } + + .code-block { + background-color: var(--bg-secondary); + border: 1px solid var(--border-subtle); + border-radius: 6px; + padding: 12px; + font-family: 'Fira Code', 'Courier New', monospace; + font-size: 12px; + color: var(--accent-primary); + overflow-x: auto; + margin: 8px 0 16px 0; + white-space: pre; + } + + .flatpak-note { + font-size: 12px; + color: var(--text-muted); + font-style: italic; + margin-top: 12px; + } + + .flatpak-note strong { + color: var(--text-secondary); + font-weight: 600; + }