diff --git a/src-tauri/src/cloudflare.rs b/src-tauri/src/cloudflare.rs index c8d3e513..4a49d67e 100644 --- a/src-tauri/src/cloudflare.rs +++ b/src-tauri/src/cloudflare.rs @@ -324,12 +324,16 @@ pub async fn cloudflare_start_oauth(app: tauri::AppHandle) -> Result r.map_err(|_| "Authorization timed out - please try again.".to_string())??, + _ = cancelled => return Err("cancelled".to_string()), + }; let token = exchange_code(&code, &verifier, &redirect_uri).await?; diff --git a/src-tauri/src/db/oracle.rs b/src-tauri/src/db/oracle.rs index 42a3ed60..c9c3872f 100644 --- a/src-tauri/src/db/oracle.rs +++ b/src-tauri/src/db/oracle.rs @@ -110,7 +110,14 @@ pub(crate) fn client_dir_candidates(explicit: &str) -> Vec { let mut parents: Vec = Vec::new(); if let Some(home) = dirs_home() { parents.push(home.clone()); - parents.push(home.join("Downloads")); + // Not on macOS: Downloads is a protected folder there, and listing it + // (even just to look for an `instantclient_*`) makes macOS ask whether + // Stroke may read your Downloads, at launch, for a client most people + // never use. Unzipped there, it is found once its path is set in the + // connection or STROKE_ORACLE_CLIENT_DIR. + if !cfg!(target_os = "macos") { + parents.push(home.join("Downloads")); + } parents.push(home.join("oracle")); } if cfg!(target_os = "windows") { diff --git a/src-tauri/src/db/terminal.rs b/src-tauri/src/db/terminal.rs index a947c8a2..8ffe6e02 100644 --- a/src-tauri/src/db/terminal.rs +++ b/src-tauri/src/db/terminal.rs @@ -310,7 +310,13 @@ fn install_dirs() -> Vec { // and SQLcl unzipped next to it. out.extend(super::oracle::client_dir_candidates("")); if let Some(home) = home_dir() { - for parent in [home.clone(), home.join("Downloads"), home.join("oracle")] { + // Downloads only off macOS: touching it there raises the "would like + // to access files in your Downloads folder" prompt (see oracle.rs). + let mut parents = vec![home.clone(), home.join("oracle")]; + if !cfg!(target_os = "macos") { + parents.push(home.join("Downloads")); + } + for parent in parents { out.push(parent.join("sqlcl").join("bin")); } } diff --git a/src-tauri/src/providers/mod.rs b/src-tauri/src/providers/mod.rs index f4bdcf65..17b8cf77 100644 --- a/src-tauri/src/providers/mod.rs +++ b/src-tauri/src/providers/mod.rs @@ -57,7 +57,7 @@ const TOKEN_PROXY: &str = "https://stroke.click/api/oauth/token"; // drops the callback listener future, which frees the localhost port instead of // holding it until the 5-minute timeout. static OAUTH_CANCEL: OnceLock = OnceLock::new(); -fn oauth_cancel() -> &'static tokio::sync::Notify { +pub(crate) fn oauth_cancel() -> &'static tokio::sync::Notify { OAUTH_CANCEL.get_or_init(tokio::sync::Notify::new) } diff --git a/src/lib/components/AiChat.svelte b/src/lib/components/AiChat.svelte index 09b18e48..e3c8caff 100644 --- a/src/lib/components/AiChat.svelte +++ b/src/lib/components/AiChat.svelte @@ -302,7 +302,10 @@ } = $props(); /** A statement that changes the schema, so the sidebar must reload. @param {string} sql */ - const isDdl = (sql) => /^\s*(?:--[^\n]*\n\s*)*(create|alter|drop|rename|truncate|comment\s+on)\b/i.test(sql ?? "") || /;\s*(create|alter|drop|rename|truncate)\b/i.test(sql ?? ""); + // A statement that changes the catalog, wherever it sits in the batch: at the + // start, after a `;`, or after a `--` or `/* */` comment (an agent often opens + // with `SET search_path ...;` or a comment line before its CREATE VIEW). + const isDdl = (sql) => /(?:^|;|\*\/|\n)\s*(?:--[^\n]*\n\s*)*(create|alter|drop|rename|truncate|comment\s+on)\b/i.test(sql ?? ""); $effect(() => { if (isActive) { @@ -2886,7 +2889,9 @@ : s, ), })); - if (t.name === "execute_sql" && !res.is_error && isDdl(t.detail)) onschemadirty(); + // An empty detail means the result beat the call's full input here: the + // SQL is unknown, so the sidebar re-reads rather than miss a CREATE VIEW. + if (t.name === "execute_sql" && !res.is_error && (!t.detail || isDdl(t.detail))) onschemadirty(); const parsed = t.name === "execute_sql" && !res.is_error ? parseSqlResult(out) : null; // Rows still get their table; a failure is already shown in the fold. if (parsed && parsed.total > 0) { diff --git a/src/lib/components/CellEditorPanel.svelte b/src/lib/components/CellEditorPanel.svelte index 4c5a140a..487f02fa 100644 --- a/src/lib/components/CellEditorPanel.svelte +++ b/src/lib/components/CellEditorPanel.svelte @@ -50,7 +50,9 @@ import X from '@lucide/svelte/icons/x' import { cn } from '$lib/utils.js' import { toast } from '$lib/components/ui/sonner/toast.svelte.js' - import Kbd from './Kbd.svelte' + import { detectOs } from '$lib/platform.js' + /** The stage shortcut as one glyph run: ⌘↵ on a Mac, Ctrl↵ elsewhere. */ + const modEnter = detectOs() === 'macos' ? '⌘↵' : 'Ctrl ↵' let { open = $bindable(false), @@ -677,16 +679,20 @@ > - + + {/if} + {/snippet} + {#snippet footer()} + {#if authUrl} + Browser didn't open? + + + {linkCopied ? 'Link copied' : ''} + {:else} +