feat(gui): the person is asked when a web assistant wants to connect (P15 B1, D-83)
The window shows a card, over any page of the company and on the Connect page, that says in plain words who is asking (the product by where it is sent back to, never by what it calls itself), where it will be sent back to, the internet address it asked from and what it will be able to do: read and draft, and post only if the box is ticked. Allow and Don't allow answer through the owner and the admin socket (ledger-host AppServer::web_decide); nothing on the web page approves. Each web connection shows what it may do, with a button to let it post or stop. Revoke stays the one row of 'Who can reach these books'. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
4c36c1f020
commit
c9b6614688
7 files changed
+688
-12
No files matched your search
@@ -203,6 +203,50 @@ pub struct TokenRow {
|
||||
pub created: String,
|
||||
}
|
||||
|
||||
/// A web assistant waiting for the person to allow it (plan P15 D-83): who
|
||||
/// is asking, as the server saw it. What it calls itself is its own word,
|
||||
/// cleaned and never trusted; where it is sent back to and the address it
|
||||
/// asked from are what the server saw.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct WebRequest {
|
||||
/// What an answer names.
|
||||
pub id: String,
|
||||
/// The company it asks to reach.
|
||||
pub book: String,
|
||||
/// The product recognised by where it is sent back to ("Claude on
|
||||
/// the web"), else what it calls itself.
|
||||
pub client_name: String,
|
||||
/// Whether the product is one Wanderbooks recognises.
|
||||
pub recognised: bool,
|
||||
/// The address it is sent back to, in full.
|
||||
pub redirect: String,
|
||||
/// That address's host.
|
||||
pub redirect_host: String,
|
||||
/// The caller's address, as the relay said it.
|
||||
pub from: String,
|
||||
/// It asked to post entries too.
|
||||
pub wants_post: bool,
|
||||
/// Seconds until it is turned away unanswered.
|
||||
pub expires_in_secs: u64,
|
||||
}
|
||||
|
||||
/// A web connection the person allowed.
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub struct WebApproval {
|
||||
/// Its id.
|
||||
pub id: String,
|
||||
/// The company.
|
||||
pub book: String,
|
||||
/// What it is called.
|
||||
pub label: String,
|
||||
/// The key that carries it: what "Who can reach these books" revokes.
|
||||
pub token_id: String,
|
||||
/// It may post entries (else read and draft).
|
||||
pub may_post: bool,
|
||||
/// When it last did anything (unix seconds).
|
||||
pub last_used: Option<i64>,
|
||||
}
|
||||
|
||||
/// Who is connected and who may connect, across the open companies.
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq)]
|
||||
pub struct Roster {
|
||||
@@ -210,6 +254,10 @@ pub struct Roster {
|
||||
pub assistants: Vec<Assistant>,
|
||||
/// Every live token.
|
||||
pub tokens: Vec<TokenRow>,
|
||||
/// Web assistants waiting for the person.
|
||||
pub web_pending: Vec<WebRequest>,
|
||||
/// Web connections the person allowed.
|
||||
pub web_approvals: Vec<WebApproval>,
|
||||
}
|
||||
|
||||
/// The owner's actions, done by the program the viewer runs in (ledger-cli
|
||||
@@ -272,6 +320,16 @@ pub trait Owner: Send + Sync {
|
||||
fn serve_revoke(&self, _book: &str, _name: &str, _id: &str) -> Result<String, String> {
|
||||
Err("not here".into())
|
||||
}
|
||||
/// The person's answer to a web assistant waiting to be allowed:
|
||||
/// `approve` it or refuse it; `post` lets it post entries too, not
|
||||
/// only read and draft. `Ok` says what was done, in words. Blocks.
|
||||
fn web_decide(&self, _id: &str, _approve: bool, _post: bool) -> Result<String, String> {
|
||||
Err("not here".into())
|
||||
}
|
||||
/// Let a web connection post entries, or take that away. Blocks.
|
||||
fn web_set_post(&self, _approval: &str, _post: bool) -> Result<String, String> {
|
||||
Err("not here".into())
|
||||
}
|
||||
/// This program run with `words`, as a line to type in a terminal (the
|
||||
/// program's own path, the words, the data root if one was named): what
|
||||
/// the Connect page shows for an assistant it has no button for.
|
||||
|
||||
Reference in new issue
Block a user