fix(desktop): corrige tela de desativacao duplicada no app Tauri
All checks were successful
All checks were successful
- Adiciona verificacao de isMachineActive antes de redirecionar para handshake - Remove mensagens de erro antigas com erro gramatical - Corrige texto do template HTML de desativacao no servidor - Corrige mensagem de erro na API de sessions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
1a0574e7f4
commit
f4a3b22aab
3 changed files with 12 additions and 14 deletions
|
|
@ -1349,6 +1349,10 @@ const resolvedAppUrl = useMemo(() => {
|
|||
|
||||
const openSystem = useCallback(async () => {
|
||||
if (!token) return
|
||||
if (!isMachineActive) {
|
||||
setIsLaunchingSystem(false)
|
||||
return
|
||||
}
|
||||
setIsLaunchingSystem(true)
|
||||
|
||||
// Recarrega store do disco para pegar dados que o Rust salvou diretamente
|
||||
|
|
@ -1408,7 +1412,6 @@ const resolvedAppUrl = useMemo(() => {
|
|||
setError(null)
|
||||
}
|
||||
if (!currentActive) {
|
||||
setError("Esta dispositivo está desativada. Entre em contato com o suporte da Rever para reativar o acesso.")
|
||||
setIsLaunchingSystem(false)
|
||||
return
|
||||
}
|
||||
|
|
@ -1416,14 +1419,8 @@ const resolvedAppUrl = useMemo(() => {
|
|||
}
|
||||
} else {
|
||||
if (res.status === 423) {
|
||||
const payload = await res.clone().json().catch(() => null)
|
||||
const message =
|
||||
payload && typeof payload === "object" && typeof (payload as { error?: unknown }).error === "string"
|
||||
? ((payload as { error?: string }).error ?? "").trim()
|
||||
: ""
|
||||
setIsMachineActive(false)
|
||||
setIsLaunchingSystem(false)
|
||||
setError(message.length > 0 ? message : "Esta dispositivo está desativada. Entre em contato com o suporte da Rever.")
|
||||
return
|
||||
}
|
||||
// Se sessão falhar, tenta identificar token inválido/expirado
|
||||
|
|
@ -1473,7 +1470,7 @@ const resolvedAppUrl = useMemo(() => {
|
|||
const url = `${safeAppUrl}/machines/handshake?token=${encodeURIComponent(token)}&redirect=${encodeURIComponent(redirectTarget)}`
|
||||
logDesktop("openSystem:redirect", { url: url.replace(/token=[^&]+/, "token=***") })
|
||||
window.location.href = url
|
||||
}, [token, config?.accessRole, config?.machineId, resolvedAppUrl, store])
|
||||
}, [token, config?.accessRole, config?.machineId, resolvedAppUrl, store, isMachineActive])
|
||||
|
||||
async function reprovision() {
|
||||
if (!store) return
|
||||
|
|
@ -1578,10 +1575,11 @@ const resolvedAppUrl = useMemo(() => {
|
|||
if (!token) return
|
||||
if (autoLaunchRef.current) return
|
||||
if (!tokenVerifiedRef.current) return
|
||||
if (!isMachineActive) return // Não redireciona se a máquina estiver desativada
|
||||
autoLaunchRef.current = true
|
||||
setIsLaunchingSystem(true)
|
||||
openSystem()
|
||||
}, [token, status, config?.accessRole, openSystem, tokenValidationTick])
|
||||
}, [token, status, config?.accessRole, openSystem, tokenValidationTick, isMachineActive])
|
||||
|
||||
// Quando há token persistido (dispositivo já provisionado) e ainda não
|
||||
// disparamos o auto-launch, exibimos diretamente a tela de loading da
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue