Skip to content

Commit f46d45e

Browse files
committed
Settings: Push SMB settings to Rust on change
- Add typed wrappers `setDirectSmbConnection`, `setFilterSafeSaveArtifacts`, `setSmbConcurrency` in `$lib/tauri-commands/settings.ts` and re-export via the barrel. - Wire three new `case` arms in `settings-applier.ts` so `network.directSmbConnection`, `advanced.filterSafeSaveArtifacts`, and `network.smbConcurrency` push to the backend immediately on every change. No more restart needed.
1 parent aa331c4 commit f46d45e

3 files changed

Lines changed: 46 additions & 0 deletions

File tree

apps/desktop/src/lib/settings/settings-applier.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import {
1111
setIndexingEnabled,
1212
setMtpEnabled,
1313
setDiskSpaceThreshold,
14+
setDirectSmbConnection,
15+
setFilterSafeSaveArtifacts,
16+
setSmbConcurrency,
1417
} from '$lib/tauri-commands'
1518

1619
const log = getAppLogger('settings-applier')
@@ -95,6 +98,18 @@ function handleSettingChange(id: string, value: unknown): void {
9598
// Update disk space poller threshold
9699
void setDiskSpaceThreshold(value as number)
97100
break
101+
case 'network.directSmbConnection':
102+
// Flip the backend flag that controls auto-upgrading SMB mounts to smb2
103+
void setDirectSmbConnection(value as boolean)
104+
break
105+
case 'advanced.filterSafeSaveArtifacts':
106+
// Toggle .sb-* noise filtering in the SMB watcher
107+
void setFilterSafeSaveArtifacts(value as boolean)
108+
break
109+
case 'network.smbConcurrency':
110+
// Update SMB batch-copy concurrency (backend clamps 1..=32)
111+
void setSmbConcurrency(value as number)
112+
break
98113
// MCP server (developer.mcpEnabled, developer.mcpPort) is handled directly
99114
// by McpServerSection.svelte in the settings window, not here. This avoids
100115
// double-firing since both windows receive setting change events.

apps/desktop/src/lib/tauri-commands/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,9 @@ export {
283283
getMcpPort,
284284
updateFileWatcherDebounce,
285285
updateServiceResolveTimeout,
286+
setDirectSmbConnection,
287+
setFilterSafeSaveArtifacts,
288+
setSmbConcurrency,
286289
setIndexingEnabled,
287290
getDirStatsBatch,
288291
getE2eStartPath,

apps/desktop/src/lib/tauri-commands/settings.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,34 @@ export async function updateServiceResolveTimeout(timeoutMs: number): Promise<vo
4343
await invoke('update_service_resolve_timeout', { timeoutMs })
4444
}
4545

46+
/**
47+
* Enables or disables automatic upgrade of SMB mounts to direct smb2 connections.
48+
* Pushed live from the settings UI whenever `network.directSmbConnection` changes.
49+
* @param enabled - True to enable direct SMB connections
50+
*/
51+
export async function setDirectSmbConnection(enabled: boolean): Promise<void> {
52+
await invoke('set_direct_smb_connection', { enabled })
53+
}
54+
55+
/**
56+
* Toggles filtering of macOS safe-save artifacts (`.sb-*` files) in the SMB watcher.
57+
* Pushed live from the settings UI whenever `advanced.filterSafeSaveArtifacts` changes.
58+
* @param enabled - True to filter artifacts
59+
*/
60+
export async function setFilterSafeSaveArtifacts(enabled: boolean): Promise<void> {
61+
await invoke('set_filter_safe_save_artifacts_cmd', { enabled })
62+
}
63+
64+
/**
65+
* Updates the SMB concurrency limit used by the batch copy engine.
66+
* Clamped to `1..=32` in the Rust side. Pushed live from the settings UI
67+
* whenever `network.smbConcurrency` changes.
68+
* @param value - Desired concurrency (will be clamped)
69+
*/
70+
export async function setSmbConcurrency(value: number): Promise<void> {
71+
await invoke('set_smb_concurrency_cmd', { value })
72+
}
73+
4674
// ============================================================================
4775
// MCP server commands
4876
// ============================================================================

0 commit comments

Comments
 (0)