feat(desktop): open system in default browser via opener plugin (fallback to in-webview) to avoid localhost navigation issues

This commit is contained in:
Esdras Renan 2025-10-10 00:49:02 -03:00
parent ae6beeb4c9
commit cf45e36f32

View file

@ -1,5 +1,6 @@
import { invoke } from "@tauri-apps/api/core"
import { Store } from "@tauri-apps/plugin-store"
import { open as openExternal } from "@tauri-apps/plugin-opener"
type MachineOs = {
name: string
@ -698,7 +699,13 @@ function redirectToApp(config: AgentConfig) {
return
}
const url = `${config.appUrl}/machines/handshake?token=${encodeURIComponent(token)}`
window.location.replace(url)
try {
await openExternal(url)
setAlert("Abrindo o Sistema de Chamados no navegador padrão…", "success")
} catch {
// fallback: navegar dentro da WebView
window.location.replace(url)
}
}
void perform()
}