Порівняти коміти

...
Автор SHA1 Повідомлення Дата
l0ng-ai 8662f341d7 fix(settings): change the local data directory without an open project
The Caches settings were trusted-only, so the welcome window could neither
show the current location nor apply a custom directory. The directory is an
app-wide setting: reading it now runs everywhere, and changing it runs
outside Restricted Mode. The Linux GTK file chooser and the global hotkey
probe had the same gate and failed in the welcome window too.

Fixes #6886
2026-11-30 11:15:30 +08:00
6 змінених файлів з 21 додано та 15 видалено

No files matched your search

+1 -1
Переглянути файл
@@ -414,7 +414,7 @@ pub fn register(dispatcher: &mut Dispatcher, shell: Arc<WebShellState>) {
});
// Caches & LSP & Web & Workspace & HTTP helpers already available through ide-host dependencies.
dispatcher.add("caches_local_data_info", TrustClass::Trusted, |c| async move {
dispatcher.add("caches_local_data_info", TrustClass::Always, |c| async move {
let current = c.host.local_data_dir.to_string_lossy().into_owned();
Ok(LocalDataInfo {
default_dir: current.clone(),
+5 -3
Переглянути файл
@@ -48,7 +48,8 @@ pub struct LocalDataInfo {
pub env_override: bool,
}
#[desktop_command(trust = trusted)]
/// Read-only, and the welcome window shows it too: no project needed.
#[desktop_command(trust = always)]
#[tauri::command]
#[specta::specta]
pub fn caches_local_data_info(app: AppHandle, state: State<'_, AppState>) -> IdeResult<LocalDataInfo> {
@@ -65,8 +66,9 @@ pub fn caches_local_data_info(app: AppHandle, state: State<'_, AppState>) -> Ide
/// Stores (`Some`) or clears (`None`, an empty string counts) the custom
/// local-data root; with `migrate`, the current tree moves at the next start.
/// Returns the directory that takes effect after a restart. The caller
/// restarts the IDE (see `app_restart`).
#[desktop_command(trust = trusted)]
/// restarts the IDE (see `app_restart`). An app-wide setting, so it works from
/// the welcome window too; a Restricted Mode project window can't change it.
#[desktop_command(trust = outside_restricted)]
#[tauri::command]
#[specta::specta]
pub fn caches_set_local_data_dir(
+4 -3
Переглянути файл
@@ -33,8 +33,9 @@ pub struct GtkPickOptions {
}
/// True when the plugin's dialogs can't be shown here: Linux with no portal service on the session
/// bus (running or activatable) and no `zenity`.
#[desktop_command(trust = trusted)]
/// bus (running or activatable) and no `zenity`. Every window picks files (the welcome
/// window opens projects with it), so no trust check.
#[desktop_command(trust = always)]
#[tauri::command]
#[specta::specta]
pub async fn file_dialog_needs_gtk() -> bool {
@@ -51,7 +52,7 @@ pub async fn file_dialog_needs_gtk() -> bool {
}
/// Shows a GTK file chooser attached to `window`. `None` when the user cancels.
#[desktop_command(trust = trusted)]
#[desktop_command(trust = always)]
#[tauri::command]
#[specta::specta]
pub async fn gtk_pick_paths(window: tauri::Window, options: GtkPickOptions) -> IdeResult<Option<Vec<IpcPath>>> {
+1 -1
Переглянути файл
@@ -11,7 +11,7 @@ use ide_core::IdeResult;
/// Reports which of `combos` (single-stroke `Alt+Shift+R`-style bindings) are
/// already registered to another app. Empty everywhere but Windows.
#[desktop_command(trust = trusted)]
#[desktop_command(trust = always)]
#[tauri::command]
#[specta::specta]
pub fn system_probe_hotkeys(combos: Vec<String>) -> IdeResult<Vec<String>> {
+5 -5
Переглянути файл
@@ -103,9 +103,9 @@ build_compile_file trusted project_host bin
build_model trusted project_host bindings async
build_run trusted project_host bindings async
build_sync trusted project_host bindings async
caches_local_data_info trusted desktop bindings sync
caches_local_data_info always desktop bindings sync
caches_schedule_invalidation always desktop bindings sync
caches_set_local_data_dir trusted desktop bindings sync
caches_set_local_data_dir outside_restricted desktop bindings sync
cancel_request always project_host bindings sync
cancel_task always project_host bindings sync
clear_caches always desktop bindings async
@@ -307,7 +307,7 @@ docker_snapshot trusted project_host bin
docker_volume_sizes trusted project_host bindings async
end_process trusted desktop bindings async
env_reload always project_host bindings async
file_dialog_needs_gtk trusted desktop bindings async
file_dialog_needs_gtk always desktop bindings async
find_dirs always project_host bindings async
find_files always project_host bindings async
find_files_named always project_host bindings async
@@ -359,7 +359,7 @@ gradle_dependencies trusted project_host bin
gradle_link_projects trusted project_host bindings async
gradle_published_catalog trusted project_host bindings async
gradle_unlink_projects trusted project_host bindings async
gtk_pick_paths trusted desktop bindings async
gtk_pick_paths always desktop bindings async
history_content always project_host bindings async
history_list always project_host bindings async
history_list_dir always project_host bindings async
@@ -749,7 +749,7 @@ syntax_node_at always project_host bin
syntax_structural_ranges always project_host bindings async
syntax_support always project_host bindings sync
system_font_families always desktop bindings async
system_probe_hotkeys trusted desktop bindings sync
system_probe_hotkeys always desktop bindings sync
term_attach always project_host bindings async
term_available_shells always project_host bindings sync
term_default_shell always project_host bindings sync
+5 -2
Переглянути файл
@@ -329,6 +329,7 @@ export const commands = {
* Returns the refreshed model; a failed build is reported in its `syncError`.
*/
buildSync: (tool: BuildTool, request: RequestId, offline: boolean, profiles: string[], buildDir: string | null, onProgress: Channel<SyncProgress>) => typedError<BuildModel, IdeError>(__TAURI_INVOKE("build_sync", { tool, request, offline, profiles, buildDir, onProgress })),
/** Read-only, and the welcome window shows it too: no project needed. */
cachesLocalDataInfo: () => typedError<LocalDataInfo, IdeError>(__TAURI_INVOKE("caches_local_data_info")),
/** Schedules the invalidation for the next start (`None` cancels a pending one). */
cachesScheduleInvalidation: (options: {
@@ -343,7 +344,8 @@ export const commands = {
* Stores (`Some`) or clears (`None`, an empty string counts) the custom
* local-data root; with `migrate`, the current tree moves at the next start.
* Returns the directory that takes effect after a restart. The caller
* restarts the IDE (see `app_restart`).
* restarts the IDE (see `app_restart`). An app-wide setting, so it works from
* the welcome window too; a Restricted Mode project window can't change it.
*/
cachesSetLocalDataDir: (path: string | null, migrate: boolean) => typedError<string, IdeError>(__TAURI_INVOKE("caches_set_local_data_dir", { path, migrate })),
cancelRequest: (id: RequestId) => __TAURI_INVOKE<void>("cancel_request", { id }),
@@ -782,7 +784,8 @@ export const commands = {
envReload: () => typedError<EnvReloaded, IdeError>(__TAURI_INVOKE("env_reload")),
/**
* True when the plugin's dialogs can't be shown here: Linux with no portal service on the session
* bus (running or activatable) and no `zenity`.
* bus (running or activatable) and no `zenity`. Every window picks files (the welcome
* window opens projects with it), so no trust check.
*/
fileDialogNeedsGtk: () => __TAURI_INVOKE<boolean>("file_dialog_needs_gtk"),
/** Folders holding indexed files, for `@` references. */