From 88e1fff253e13643266f57f1504881ebd874571b Mon Sep 17 00:00:00 2001 From: le king fu Date: Mon, 13 Apr 2026 12:37:09 -0400 Subject: [PATCH] fix: wire single-instance plugin for OAuth deep-link callback The Maximus Account sign-in flow was broken in v0.7.0: clicking "Sign in" opened Logto in the browser, but when the OAuth2 callback fired simpl-resultat://auth/callback?code=..., the OS launched a second app instance instead of routing the URL to the running one. The second instance had no PKCE verifier in memory, and the original instance never received the deep-link event, leaving it stuck in "loading". Fix: register tauri-plugin-single-instance (with the deep-link feature) as the first plugin. It forwards the callback URL to the existing process, which triggers the existing deep-link://new-url listener and completes the token exchange. Co-Authored-By: Claude Opus 4.6 (1M context) --- CHANGELOG.fr.md | 5 +++++ CHANGELOG.md | 5 +++++ package.json | 2 +- src-tauri/Cargo.lock | 19 ++++++++++++++++++- src-tauri/Cargo.toml | 3 ++- src-tauri/src/lib.rs | 10 +++++++++- src-tauri/tauri.conf.json | 2 +- 7 files changed, 41 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.fr.md b/CHANGELOG.fr.md index 2d7b2b2..c63b5cf 100644 --- a/CHANGELOG.fr.md +++ b/CHANGELOG.fr.md @@ -2,6 +2,11 @@ ## [Non publié] +## [0.7.1] - 2026-04-13 + +### Corrigé +- Connexion Compte Maximus : le callback OAuth2 revient maintenant correctement dans l'instance en cours au lieu de lancer une deuxième instance et de laisser l'app d'origine bloquée en « chargement » (#51, #65) + ## [0.7.0] - 2026-04-11 ### Ajouté diff --git a/CHANGELOG.md b/CHANGELOG.md index 9312649..820bf28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ ## [Unreleased] +## [0.7.1] - 2026-04-13 + +### Fixed +- Maximus Account sign-in: the OAuth2 callback now correctly returns to the running app instead of launching a second instance and leaving the original one stuck in "loading" (#51, #65) + ## [0.7.0] - 2026-04-11 ### Added diff --git a/package.json b/package.json index 3c04892..ddad378 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "simpl_result_scaffold", "private": true, - "version": "0.7.0", + "version": "0.7.1", "license": "GPL-3.0-only", "type": "module", "scripts": { diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index a9dda2f..eaba746 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -4280,7 +4280,7 @@ checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" [[package]] name = "simpl-result" -version = "0.6.7" +version = "0.7.1" dependencies = [ "aes-gcm", "argon2", @@ -4303,6 +4303,7 @@ dependencies = [ "tauri-plugin-dialog", "tauri-plugin-opener", "tauri-plugin-process", + "tauri-plugin-single-instance", "tauri-plugin-sql", "tauri-plugin-updater", "tokio", @@ -5055,6 +5056,22 @@ dependencies = [ "tauri-plugin", ] +[[package]] +name = "tauri-plugin-single-instance" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a33a5b7d78f0dec4406b003ea87c40bf928d801b6fd9323a556172c91d8712c1" +dependencies = [ + "serde", + "serde_json", + "tauri", + "tauri-plugin-deep-link", + "thiserror 2.0.18", + "tracing", + "windows-sys 0.60.2", + "zbus", +] + [[package]] name = "tauri-plugin-sql" version = "2.3.2" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 71d1ae0..ab08249 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "simpl-result" -version = "0.7.0" +version = "0.7.1" description = "Personal finance management app" license = "GPL-3.0-only" authors = ["you"] @@ -26,6 +26,7 @@ tauri-plugin-dialog = "2" tauri-plugin-updater = "2" tauri-plugin-process = "2" tauri-plugin-deep-link = "2" +tauri-plugin-single-instance = { version = "2", features = ["deep-link"] } libsqlite3-sys = { version = "0.30", features = ["bundled"] } rusqlite = { version = "0.32", features = ["bundled"] } serde = { version = "1", features = ["derive"] } diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index c696613..2d7846f 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -2,7 +2,7 @@ mod commands; mod database; use std::sync::Mutex; -use tauri::{Emitter, Listener}; +use tauri::{Emitter, Listener, Manager}; use tauri_plugin_sql::{Migration, MigrationKind}; #[cfg_attr(mobile, tauri::mobile_entry_point)] @@ -84,6 +84,14 @@ pub fn run() { ]; tauri::Builder::default() + // Single-instance plugin MUST be registered first. With the `deep-link` + // feature, it forwards `simpl-resultat://` URLs to the running instance + // so the OAuth2 callback reaches the process that holds the PKCE verifier. + .plugin(tauri_plugin_single_instance::init(|app, _argv, _cwd| { + if let Some(window) = app.get_webview_window("main") { + let _ = window.set_focus(); + } + })) .manage(commands::auth_commands::OAuthState { code_verifier: Mutex::new(None), }) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 1a33e29..4395c40 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "Simpl Resultat", - "version": "0.7.0", + "version": "0.7.1", "identifier": "com.simpl.resultat", "build": { "beforeDevCommand": "npm run dev",