Onboarding: --listen override and auto-pick free port; live TLS demo verified
This commit is contained in:
+79
-12
@@ -692,29 +692,96 @@ async fn registry_page() -> Response {
|
||||
.into_response()
|
||||
}
|
||||
|
||||
const REGISTRY_PAGE: &str = r#"<!doctype html>
|
||||
<html><head><meta charset="utf-8"><title>FRX membership</title></head>
|
||||
const REGISTRY_PAGE: &str = r##"<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>FRX — Federated Retrieval Exchange</title>
|
||||
<style>
|
||||
* { box-sizing: border-box; }
|
||||
body { font-family: ui-sans-serif, system-ui, -apple-system, sans-serif; line-height: 1.55;
|
||||
max-width: 44rem; margin: 0 auto; padding: 2.5rem 1rem; color: #1c1c1e; background: #f7f7f9; }
|
||||
h1 { font-size: 1.7rem; margin-bottom: 0.2rem; }
|
||||
h2 { font-size: 1.05rem; margin-top: 2.2rem; }
|
||||
.tag { color: #555; margin-top: 0; }
|
||||
.card { background: #fff; border: 1px solid #ddd; border-radius: 10px; padding: 1.1rem 1.25rem; }
|
||||
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; }
|
||||
input, button { font: inherit; border: 1px solid #bbb; border-radius: 6px; padding: 0.45rem 0.6rem; }
|
||||
input { width: 100%; margin: 0.2rem 0 0.9rem; }
|
||||
button { background: #174ea6; color: #fff; border: none; cursor: pointer; padding: 0.5rem 1rem; border-radius: 6px; }
|
||||
button:hover { background: #0f3d91; }
|
||||
#out { display: none; background: #101418; color: #d6f5d6; padding: 0.85rem 1rem;
|
||||
border-radius: 8px; white-space: pre-wrap; word-break: break-all; margin-top: 1rem; }
|
||||
.muted { color: #666; font-size: 0.92rem; }
|
||||
ol { padding-left: 1.3rem; }
|
||||
a { color: #174ea6; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Request FRX membership</h1>
|
||||
<h1>FRX</h1>
|
||||
<p class="tag">Federated Retrieval Exchange — a membership federation for retrieval.</p>
|
||||
<p>Members answer broadcast queries from content they already hold. The protocol is deliberately
|
||||
small: signed messages, budgets, honest truncation, aggregate courtesy. No announce stream, no
|
||||
scores on the wire, no in-protocol payment.</p>
|
||||
<p>Everything else — matching, ranking, retention, trust — is local.</p>
|
||||
|
||||
<h2>Join the federation</h2>
|
||||
<div class="card">
|
||||
<form id="f">
|
||||
<label>Organization or handle <input name="label" required pattern="[A-Za-z0-9-]+"></label><br>
|
||||
<label>Signup code <input name="code" type="password"></label><br>
|
||||
<label>Organization or handle<br>
|
||||
<input name="label" required pattern="[A-Za-z0-9 -]+" placeholder="acme-docs"></label><br>
|
||||
<label>Signup code (issued by the membership authority)<br>
|
||||
<input name="code" type="password" placeholder="signup code"></label><br>
|
||||
<button type="submit">Request membership</button>
|
||||
</form>
|
||||
<pre id="out" style="white-space:pre-wrap"></pre>
|
||||
<pre id="out"></pre>
|
||||
</div>
|
||||
|
||||
<h2>After you get credentials</h2>
|
||||
<ol>
|
||||
<li>Install the single static binary: <code>frxd</code>.</li>
|
||||
<li>Run <code>frxd --onboarding</code> and paste the credential block it gives you.</li>
|
||||
<li>The wizard binds your keys, verifies the signed registry, and wires your relays — no domains, DNS, or ports needed on your side.</li>
|
||||
</ol>
|
||||
|
||||
<h2>Who is in</h2>
|
||||
<p class="muted" id="members">…</p>
|
||||
<p class="muted"><small>The registry is a signed, versioned, public snapshot: <code>GET /registry.json</code>. Membership is governed by the MA — questions and codes come from there.</small></p>
|
||||
|
||||
<script>
|
||||
const out = document.getElementById("out");
|
||||
document.getElementById("f").onsubmit = async (e) => {
|
||||
e.preventDefault();
|
||||
const label = e.target.label.value, code = e.target.code.value;
|
||||
const res = await fetch("/v1/signup", {method: "POST", headers: {"content-type": "application/json"}, body: JSON.stringify({label, code})});
|
||||
const res = await fetch("/v1/signup", {
|
||||
method: "POST",
|
||||
headers: {"content-type": "application/json"},
|
||||
body: JSON.stringify({label, code})
|
||||
});
|
||||
const body = await res.json();
|
||||
document.getElementById("out").textContent = res.ok
|
||||
? "Membership approved. Run `frxd --onboarding` and paste:\n\n" + body.credentials + "\n"
|
||||
: "Failed: " + (body.error || res.status);
|
||||
out.style.display = "block";
|
||||
out.textContent = res.ok
|
||||
? "Membership approved.\n\nRun `frxd --onboarding` and paste this block:\n\n" + body.credentials + "\n"
|
||||
: "Failed: " + (body.error || ("http " + res.status));
|
||||
};
|
||||
|
||||
(async () => {
|
||||
try {
|
||||
const res = await fetch("/registry.json");
|
||||
const doc = await res.json();
|
||||
const ids = doc.members.map((m) => m.id);
|
||||
document.getElementById("members").textContent = doc.members.length === 0
|
||||
? "The registry is empty — be the first member."
|
||||
: doc.members.length + " member(s): " + ids.join(", ") + " · registry v" + doc.version;
|
||||
} catch (e) {
|
||||
document.getElementById("members").textContent = "registry unavailable";
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
</body></html>
|
||||
"#;
|
||||
</body>
|
||||
</html>
|
||||
"##;
|
||||
|
||||
pub async fn status(config_path: &Path) -> Result<()> {
|
||||
let config = Config::load(config_path)?;
|
||||
|
||||
Reference in New Issue
Block a user