Terminal: the socket's end says itself whether the sign-in was refused
ci / check (push) Failing after 3s
ci / start (push) Failing after 3s

The closing callback gets the End as it is (End::unauthorized), instead of
lib.rs reading the code back out of the JSON sent to the page -- which left
End::unauthorized unused and CI's -D warnings refused the build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
HomerandClaude Opus 5.5 committed 2026-11-10 09:09:21 +00:00
1 parent ac0d4ce623
commit 3ef0bbaad3
2 files changed
+22 -13

No files matched your search

+13 -11
View File
@@ -546,18 +546,20 @@ fn terminal_open(
};
let url = terminal::url(&app_url, &target, cols, rows)?;
let h = handle.clone();
Ok(app.terminals.open(url, token, move |down| {
if down.kind == "end" {
h.state::<App>().terminals.forget(down.id);
let refused = down.data.get("code").and_then(Value::as_u64)
== Some(u64::from(terminal::CLOSE_UNAUTHORIZED))
|| down.data.get("status").and_then(Value::as_u64) == Some(401);
if refused {
token_refused(&h);
let on_end = handle.clone();
Ok(app.terminals.open(
url,
token,
move |down| {
let _ = h.emit("terminal", down);
},
move |id, end| {
on_end.state::<App>().terminals.forget(id);
if end.unauthorized() {
token_refused(&on_end);
}
}
let _ = h.emit("terminal", down);
}))
},
))
}
/// Keys typed (or pasted) into a terminal, as text: sent to the shell as its bytes.