fix(host,gui): the Connect page's keys: never replaced, no admin, revoked by id, a quoted command, a leftover file said

Make the key asks the server first and never replaces: a live key whose copy
is missing here may be in use, so it is said in words and left alone. A
page-made key carries read, write and post, not admin (the connect command
keeps its scopes). Revoke names the key's id, so a stale row cannot end a
newer key of the same name; a revoke that leaves the token file says the key
is dead and where the file is. The copyable command is single-quoted for a
POSIX shell and PowerShell, and refused when cmd.exe would act on a part.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
swaitsandClaude Fable 5.2 committed 2026-11-21 10:23:11 -07:00
1 parent e34b18ec73
commit fd847701e8
8 files changed
+588 -55

No files matched your search

+2 -1
View File
@@ -187,7 +187,7 @@ impl Owner for Fake {
.clone()
.unwrap_or_else(|| Ok(Roster::default()))
}
fn serve_revoke(&self, book: &str, name: &str) -> Result<String, String> {
fn serve_revoke(&self, book: &str, name: &str, _id: &str) -> Result<String, String> {
self.note(format!("revoke {book} {name}"));
if let Some(Ok(r)) = self.roster.lock().unwrap().as_mut() {
r.tokens.retain(|t| !(t.book == book && t.name == name));
@@ -246,6 +246,7 @@ fn session(book: &str, token: &str, program: &str, running: u32, last: Option<&s
fn token(book: &str, name: &str) -> TokenRow {
TokenRow {
id: format!("tok_{book}_{name}"),
book: book.into(),
name: name.into(),
scopes: ["books:read", "books:write", "books:post"]