[extension] Redesign: the popup in layout C with the custos room, Custos's theme, a new password on sign-up and change-password forms, Save or Update

This commit is contained in:
2026-12-03 01:11:52 +01:00
parent f5dd4b0f54
commit 48dc3dde01
8 changed files with 788 additions and 179 deletions
+12 -4
View File
@@ -1,13 +1,14 @@
//! custos-native: the browser extension's native messaging host (docs/BROWSER.md). Firefox, Edge or Chrome
//! starts it when the extension connects, and talks to it over stdin/stdout in native messaging frames. It
//! forwards five requests to the desktop Custos over its Domi pipe and returns the answers:
//! forwards six requests to the desktop Custos over its Domi pipe and returns the answers:
//!
//! - `browser_status`: is Custos running, and this connection's match code;
//! - `browser_status`: is Custos running, this connection's match code, and Custos's theme;
//! - `browser_match { origin, top }`: the logins for a frame (title, username, has 2FA; never a password);
//! - `browser_fill { id, origin, top }`: one login's username, password and 2FA code, when it matches;
//! - `browser_totp { id, origin, top }`: only the 2FA code, for the popup;
//! - `browser_save { origin, top, username, password, title }`: offer a new login (or a changed password);
//! Custos shows a card and stores it only on *Save*.
//! Custos shows a card and stores it only on *Save*;
//! - `browser_generate { origin, top }`: a new password for a sign-up or change-password form, stored nowhere.
//!
//! The host adds nothing and decides nothing: Custos checks the origins against the login and asks the user
//! once whether this host may use web logins. It forwards only those requests, rebuilt from their known fields,
@@ -25,7 +26,7 @@ use serde_json::{Value, json};
use zeroize::Zeroizing;
const PIPE: &str = r"\\.\pipe\custos-domi";
const OPS: &[&str] = &["browser_status", "browser_match", "browser_fill", "browser_totp", "browser_save"];
const OPS: &[&str] = &["browser_status", "browser_match", "browser_fill", "browser_totp", "browser_save", "browser_generate"];
/// The connection: who started the host, and its session.
struct Conn {
@@ -310,6 +311,13 @@ mod tests {
assert!(save.get("extra").is_none());
// The browser's name: Firefox from the arguments, whatever the extension says; Chromium names itself.
let f = conn(Browser::Firefox);
assert_eq!(
rebuild(br#"{"op":"browser_generate","origin":"https://a.cz","top":"https://a.cz","length":4,"id":"x"}"#, &c).unwrap(),
json!({ "op": "browser_generate", "origin": "https://a.cz", "top": "https://a.cz", "app": "Custos for your browser",
"browser": "chromium", "session": c.session }),
"a new password is asked for by origin only; the extension chooses nothing else",
);
assert_eq!(rebuild(br#"{"op":"browser_generate"}"#, &c), Err("bad_request"));
assert_eq!(rebuild(br#"{"op":"browser_status","browser":"chrome"}"#, &f).unwrap()["browser"], "firefox");
assert_eq!(rebuild(br#"{"op":"browser_status","browser":"lynx"}"#, &c).unwrap()["browser"], "chromium");
// Custos's other Domi requests never pass through the browser's host.