chadtmiller.com/group-host
atmosphere group host
0
0
A site's pages report what they see, as the visitor
.claude/skills/docs/context.md+1−1
| @@ -55,7 +55,7 @@ for more. | ||
Design: `README.md` (overview), `spaces.md`, `groups.md`, | ||
`membership.md`, `signing-in.md`, `moderation.md`, `mcp.md`, | ||
`recovery.md`, `moving.md`. Reference: `../reference/api.md`, `mcp.md`, | ||
`cli.md`, `config.md`. `../development.md`. Link to them rather than | ||
`site-kit.md`, `cli.md`, `config.md`. `../development.md`. Link to them rather than | ||
restating them. | ||
| ||
A method is named in code, never linked by hand: the docs site links it | ||
crates/group-host/src/site_kit.js+10−1
| @@ -33,7 +33,10 @@ | ||
}); | ||
const tell = (type, body = {}) => parent.postMessage({ os: 1, type, ...body }, '*'); | ||
const os = { | ||
/** The group whose site this is: `{did, handle}`. */ | ||
/** | ||
* The group whose site this is: `{did, handle, console}`, `console` | ||
* the address of the host's console, where its members manage it. | ||
*/ | ||
group: () => ask('group'), | ||
/** Who is looking: `{signedIn, did, handle}`. */ | ||
me: () => ask('me'), | ||
| @@ -43,6 +46,12 @@ | ||
* show with `URL.createObjectURL`. | ||
*/ | ||
call: (method, params = {}) => ask('call', { method, params }), | ||
/** | ||
* One of the host's procedures the site acts by, as whoever is looking: | ||
* `input` its JSON, answered with what the method answers. Such as | ||
* `fyi.opensocial.createReport`, reporting what they see. | ||
*/ | ||
act: (method, input = {}) => ask('act', { method, input }), | ||
/** | ||
* Uploads `file`, a picture (a `File` or `Blob` of an `image/` type), to | ||
* the visitor's own PDS, for a record the site writes to point to. | ||
crates/group-host/src/sites.rs+40−19
| @@ -71,7 +71,8 @@ fn blob_of(file: &Value) -> Option<atproto::Cid> { | ||
} | ||
| ||
/// Refuses a site the host would not serve: one whose paths [`paths`] | ||
/// refuses, a file naming no blob, or a read that is none of [`READS`]. | ||
/// refuses, a file naming no blob, or a read or an act that is none of | ||
/// [`READS`] or [`ACTS`]. | ||
pub fn check(site: &Value) -> Result<(), XrpcError> { | ||
paths(site)?; | ||
for file in site["files"].as_array().into_iter().flatten() { | ||
| @@ -80,7 +81,7 @@ pub fn check(site: &Value) -> Result<(), XrpcError> { | ||
return Err(refused(format!("{path} names no blob"))); | ||
} | ||
} | ||
reads(site) | ||
methods(site) | ||
} | ||
| ||
/// The host's methods a site's pages may ask, as whoever is looking and | ||
| @@ -94,12 +95,26 @@ pub const READS: &[&str] = &[ | ||
"fyi.opensocial.getViewer", | ||
]; | ||
| ||
/// The methods a site's `reads` name. | ||
fn reads_of(site: &Value) -> Vec<&str> { | ||
let all = site["reads"].as_array().into_iter().flatten(); | ||
/// The host's procedures a site's pages may ask, as whoever is looking and | ||
/// signed in: those that act for the visitor alone, and that the host | ||
/// checks as it checks the same from anywhere. Reporting what they see, | ||
/// or appealing what was done to them. | ||
pub const ACTS: &[&str] = &["fyi.opensocial.createReport"]; | ||
| ||
/// The methods a site's `reads`, or its `acts`, name. | ||
fn named<'a>(site: &'a Value, key: &str) -> Vec<&'a str> { | ||
let all = site[key].as_array().into_iter().flatten(); | ||
all.filter_map(|r| r["method"].as_str()).collect() | ||
} | ||
| ||
fn reads_of(site: &Value) -> Vec<&str> { | ||
named(site, "reads") | ||
} | ||
| ||
fn acts_of(site: &Value) -> Vec<&str> { | ||
named(site, "acts") | ||
} | ||
| ||
/// What a site's `writes` name: each a type of the group's spaces, and a | ||
/// collection its pages may write there in the visitor's own repo. | ||
fn writes_of(site: &Value) -> Vec<(&str, &str)> { | ||
| @@ -109,16 +124,21 @@ fn writes_of(site: &Value) -> Vec<(&str, &str)> { | ||
.collect() | ||
} | ||
| ||
/// Whether a site asks for its visitor's session: to read, or to write. | ||
/// Whether a site asks for its visitor's session: to read, act or write. | ||
fn is_live(site: &Value) -> bool { | ||
!reads_of(site).is_empty() || !writes_of(site).is_empty() | ||
!reads_of(site).is_empty() || !acts_of(site).is_empty() || !writes_of(site).is_empty() | ||
} | ||
| ||
/// Refuses a site whose `reads` name a method that is none of [`READS`]. | ||
fn reads(site: &Value) -> Result<(), XrpcError> { | ||
match reads_of(site).into_iter().find(|m| !READS.contains(m)) { | ||
/// Refuses a site whose `reads` or `acts` name a method that is none of | ||
/// [`READS`] or [`ACTS`]. | ||
fn methods(site: &Value) -> Result<(), XrpcError> { | ||
if let Some(method) = reads_of(site).into_iter().find(|m| !READS.contains(m)) { | ||
let said = format!("{method} is none of the methods a site's pages may ask"); | ||
return Err(refused(said)); | ||
} | ||
match acts_of(site).into_iter().find(|m| !ACTS.contains(m)) { | ||
Some(method) => Err(refused(format!( | ||
"{method} is none of the methods a site's pages may ask" | ||
"{method} is none of the acts a site's pages may ask" | ||
))), | ||
None => Ok(()), | ||
} | ||
| @@ -538,8 +558,8 @@ fn script(bytes: Vec<u8>) -> Response { | ||
} | ||
| ||
/// The site's OAuth client document, at its address `origin`: `atproto`; | ||
/// leave to ask each of its `reads`, and `getViewer`, of the host; and to | ||
/// make each of its `writes` in the visitor's own repo, in the group | ||
/// leave to ask each of its `reads` and `acts`, and `getViewer`, of the | ||
/// host; and to make each of its `writes` in the visitor's own repo, in the group | ||
/// `did`'s spaces of that type alone, with pictures they upload for those | ||
/// records to point to. | ||
fn client_metadata(host: &Host, did: &str, handle: &str, origin: &str, site: &Value) -> Response { | ||
| @@ -551,8 +571,8 @@ fn client_metadata(host: &Host, did: &str, handle: &str, origin: &str, site: &Va | ||
.to_string(); | ||
let mut scope = vec!["atproto".to_string()]; | ||
let viewer = "fyi.opensocial.getViewer"; | ||
let reads = reads_of(site); | ||
for method in reads.iter().chain([&viewer]).collect::<BTreeSet<_>>() { | ||
let asked = reads_of(site).into_iter().chain(acts_of(site)); | ||
for method in asked.chain([viewer]).collect::<BTreeSet<_>>() { | ||
scope.push(format!("rpc:{method}?{aud}")); | ||
} | ||
let writes = "action=create&action=update&action=delete"; | ||
| @@ -587,9 +607,9 @@ fn client_metadata(host: &Host, did: &str, handle: &str, origin: &str, site: &Va | ||
| ||
/// The page around a site's pages at `path`: the group's page there in a | ||
/// sandboxed frame, and what the host's script needs to sign its visitor | ||
/// in, ask `reads` and make `writes` as them. | ||
/// in, ask `reads` and `acts`, and make `writes` as them. | ||
fn shell(host: &Host, did: &str, handle: &str, site: &Value, path: &str) -> Response { | ||
let reads = reads_of(site); | ||
let (reads, acts) = (reads_of(site), acts_of(site)); | ||
let (status, html) = host.page_at(did, site, path); | ||
let head = site_head::preview(html.as_deref().unwrap_or_default(), handle); | ||
let writes: Vec<Value> = writes_of(site) | ||
| @@ -600,6 +620,7 @@ fn shell(host: &Host, did: &str, handle: &str, site: &Value, path: &str) -> Resp | ||
"group": did, | ||
"handle": handle, | ||
"reads": reads, | ||
"acts": acts, | ||
"writes": writes, | ||
"aud": format!("{}#opensocial", host.config.service_did), | ||
"handleResolver": host.config.site_handle_resolver, | ||
| @@ -687,12 +708,12 @@ pub async fn put_site( | ||
let group = configuring(&host, &headers, &body, "putSite").await?; | ||
host.active(&group)?; | ||
let mut site = json!({"$type": SITE, "files": [], "createdAt": iso(now_millis())}); | ||
for key in ["fallback", "notFound", "reads", "writes"] { | ||
for key in ["fallback", "notFound", "reads", "acts", "writes"] { | ||
if let Some(given) = body.get(key) { | ||
site[key] = given.clone(); | ||
} | ||
} | ||
reads(&site)?; | ||
methods(&site)?; | ||
let given = body["files"].as_array().expect("its lexicon requires it"); | ||
let names: Vec<Value> = given.iter().map(|f| json!({"path": f["path"]})).collect(); | ||
paths(&json!({"files": names, "fallback": site["fallback"], "notFound": site["notFound"]}))?; | ||
crates/group-host/tests/sites.rs+56−0
| @@ -646,6 +646,62 @@ async fn a_site_reads_only_what_the_host_lets_a_page_read() { | ||
); | ||
} | ||
| ||
#[tokio::test] | ||
async fn a_site_acts_as_its_visitor_only_as_the_host_lets_a_page() { | ||
let h = start(&[], false).await; | ||
let (did, [alice, ..]) = group(&h).await; | ||
let files = json!([{"path": "index.html", "text": "<p>the board</p>"}]); | ||
| ||
// A procedure that is no act a page may ask is refused, such as one | ||
// that would make the visitor's group for them. | ||
let acts = json!([{"method": format!("{NS}.createGroup")}]); | ||
let said = call( | ||
&h, | ||
&alice, | ||
"putSite", | ||
json!({"group": did, "files": files, "acts": acts}), | ||
) | ||
.await; | ||
assert_eq!(error(&said), (400, "InvalidSite")); | ||
let message = said.1["message"].as_str().unwrap(); | ||
assert!( | ||
message.contains("createGroup is none of the acts"), | ||
"{message}" | ||
); | ||
| ||
// Reporting, though it reads and writes nothing, has its pages served | ||
// in the page that holds a session, which is told what they may do. | ||
let acts = json!([{"method": format!("{NS}.createReport")}]); | ||
let said = call( | ||
&h, | ||
&alice, | ||
"putSite", | ||
json!({"group": did, "files": files, "acts": acts}), | ||
) | ||
.await; | ||
assert_eq!(said.0, 200, "{}", said.1); | ||
let shell = page(&h, "/").await; | ||
let (_, config) = shell_of(&shell); | ||
assert_eq!(config["acts"], json!([format!("{NS}.createReport")])); | ||
| ||
// Its OAuth client asks the host for that, as for a read. | ||
let client = page(&h, "/client-metadata.json").await; | ||
let doc: Json = serde_json::from_str(&client.body).unwrap(); | ||
let scope: Vec<&str> = doc["scope"].as_str().unwrap().split(' ').collect(); | ||
let aud = "aud=did%3Aweb%3Ahost.test%23opensocial"; | ||
let wanted = [ | ||
"atproto".to_string(), | ||
format!("rpc:{NS}.createReport?{aud}"), | ||
format!("rpc:{NS}.getViewer?{aud}"), | ||
]; | ||
assert_eq!(scope, wanted); | ||
| ||
// The record says so, for any app that reads it. | ||
let kept = h.host.store.record(&did, SITE, "self").unwrap().unwrap(); | ||
let site = atproto::drisl::decode(&kept.value).unwrap().to_json(); | ||
assert_eq!(site["acts"], acts); | ||
} | ||
| ||
#[tokio::test] | ||
async fn a_site_that_writes_asks_its_visitor_for_those_writes_alone() { | ||
let h = start(&[], false).await; | ||
crates/group-host-mcp/src/lib.rs+5−3
| @@ -396,10 +396,12 @@ const TOOLS: &[(&str, &[&str], &str, Made)] = &[ | ||
of it, each as text or as bytes, in place of the site there; a file the group holds \ | ||
already is used again. Its pages run sandboxed, each in an origin of its own, with no \ | ||
cookies or storage. A site that names `reads`, methods of the host's such as \ | ||
fyi.opensocial.listMembers, or `writes`, records of a collection in a type of the \ | ||
fyi.opensocial.listMembers, `acts`, procedures of the host's such as \ | ||
fyi.opensocial.createReport, or `writes`, records of a collection in a type of the \ | ||
group's spaces, is served in a page of the host's that signs its visitor in: its pages \ | ||
ask those reads as whoever is looking, with `os.call` from `/_os/kit.js`, and make \ | ||
those writes in that person's own repo, with `os.create`, `os.put` and `os.delete`.", | ||
ask those reads as whoever is looking, with `os.call` from `/_os/kit.js`, those acts \ | ||
with `os.act`, and make those writes in that person's own repo, with `os.create`, \ | ||
`os.put` and `os.delete`.", | ||
Made::Method("putSite", None), | ||
), | ||
( | ||
crates/opensocial/src/lib.rs+13−9
| @@ -59,10 +59,12 @@ role | ||
add to what a role may do, or with --undo take it away | ||
site | ||
site publish <group> <dir> [--fallback <path>] [--not-found <path>] [--reads <methods>] | ||
[--writes <space:collection,…>] | ||
[--acts <methods>] [--writes <space:collection,…>] | ||
publish the files under <dir> as the group's website, at its | ||
address, in place of the one there; with --reads, the host's | ||
methods its pages may ask as whoever signs in on it; with | ||
--acts, the host's procedures they may ask as that person, such | ||
as createReport; with | ||
--writes, the records they may write in that person's own repo, | ||
each a type of the group's spaces and a collection there | ||
site delete <group> take the group's website down | ||
| @@ -679,7 +681,7 @@ pub async fn run(args: &[String], env: &Env) -> Result<String> { | ||
Ok(stats_lines(&said)) | ||
} | ||
["site", "publish", rest @ ..] => { | ||
let a = parse(rest, &["fallback", "not-found", "reads", "writes"])?; | ||
let a = parse(rest, &["fallback", "not-found", "reads", "acts", "writes"])?; | ||
let [group, dir] = a.take()?; | ||
let mut given = json!({"files": site_files(std::path::Path::new(dir))?}); | ||
for (flag, name) in [("fallback", "fallback"), ("not-found", "not_found")] { | ||
| @@ -688,13 +690,15 @@ pub async fn run(args: &[String], env: &Env) -> Result<String> { | ||
} | ||
} | ||
// Each method by its NSID, or its name alone, as one of ours. | ||
if let Some(reads) = a.flags.get("reads") { | ||
let methods = reads.split(',').map(str::trim).filter(|r| !r.is_empty()); | ||
let named = |r: &str| match r.contains('.') { | ||
true => r.to_string(), | ||
false => m(r), | ||
}; | ||
given["reads"] = methods.map(|r| json!({"method": named(r)})).collect(); | ||
let named = |r: &str| match r.contains('.') { | ||
true => r.to_string(), | ||
false => m(r), | ||
}; | ||
for key in ["reads", "acts"] { | ||
if let Some(listed) = a.flags.get(key) { | ||
let methods = listed.split(',').map(str::trim).filter(|r| !r.is_empty()); | ||
given[key] = methods.map(|r| json!({"method": named(r)})).collect(); | ||
} | ||
} | ||
// Each a type of the group's spaces and a collection there. | ||
if let Some(writes) = a.flags.get("writes") { | ||
docs/design/sites.md+39−21
| @@ -4,10 +4,11 @@ A group can have a website: a front page that says who it is, or as many | ||
pages as it likes. The host serves it at the group's address, | ||
`https://<address>/`, as static files, the way they were published. It has | ||
no templates, no build step and no rendering on the server. A site that | ||
names `reads` may also show the group as each visitor may see it, and one | ||
that names `writes` may write in the group's spaces as each visitor may, | ||
once they sign in on it, through a page the host serves around its own | ||
([live data](#live-data)). | ||
names `reads` may also show the group as each visitor may see it, one | ||
that names `acts` may act for each visitor, such as reporting what they | ||
see, and one that names `writes` may write in the group's spaces as each | ||
visitor may, once they sign in on it, through a page the host serves | ||
around its own ([live data](#live-data)). | ||
| ||
## What a site is | ||
| ||
| @@ -30,9 +31,12 @@ It may also name two of those files: | ||
And it may name `reads`, up to 20 of the host's methods its pages may | ||
ask as whoever signs in on it: `fyi.opensocial.getGroup`, `listMembers`, | ||
`listSpaceRecords`, `getSpaceBlob`, `getActor` and `getViewer`, and no | ||
others. And `writes`, up to 20 kinds of record its pages may write in that | ||
person's own repo, each a type of the group's spaces and a collection | ||
there, such as `fyi.opensocial.acceptance` in `fyi.opensocial.members`. | ||
others. And `acts`, up to 20 of the host's procedures its pages may ask | ||
as that person, each acting for them alone: for now | ||
`fyi.opensocial.createReport` only. And `writes`, up to 20 kinds of | ||
record its pages may write in that person's own repo, each a type of the | ||
group's spaces and a collection there, such as `fyi.opensocial.acceptance` | ||
in `fyi.opensocial.members`. | ||
| ||
A site has 1 to 2000 files. Each publish replaces the record whole, and | ||
deleting the record takes the site down. A blob only the old record held | ||
| @@ -57,8 +61,9 @@ and publishes a folder chosen in the browser, or deletes the site, asked | ||
to be sure of. Publishing takes a `404.html` at the folder's top as | ||
`notFound`, and keeps `fallback`, `reads` and `writes` under Advanced, | ||
filled as the site has them. The `opensocial site publish` command reads a folder | ||
and sends its files, with `--reads` naming methods by NSID or by their | ||
last part, and `--writes` each write as `<space>:<collection>`; `site delete` takes the site down. Both leave out files whose | ||
and sends its files, with `--reads` and `--acts` naming methods by NSID or | ||
by their last part, and `--writes` each write as `<space>:<collection>`; | ||
`site delete` takes the site down. Both leave out files whose | ||
names start with a dot, send each file as text if it is UTF-8 and as | ||
bytes otherwise, and take the folder's own name off each path. An AI app | ||
connected over MCP publishes with `site_publish`, writing each file as | ||
| @@ -69,8 +74,8 @@ An app signed in as the group may also write the record itself, with | ||
that write to the same rules: the record is kept at `self`, the member who | ||
approved the app must hold `group.configure`, every path must be one a | ||
file may be at and none given twice, every file must name a blob, | ||
`fallback` and `notFound` must name files of the site, and `reads` must | ||
name only the methods above. A refused site is `InvalidSite`. | ||
`fallback` and `notFound` must name files of the site, and `reads` and | ||
`acts` must name only the methods above. A refused site is `InvalidSite`. | ||
| ||
A path is `/`-separated, with no leading `/`, and no empty, `.` or `..` | ||
segment, backslash or control character. | ||
| @@ -185,7 +190,7 @@ and the page asks the host, and writes at the visitor's own PDS, as them. | ||
| ||
### The page around a site | ||
| ||
A site that names `reads` or `writes` is served differently. Each page of it is the | ||
A site that names `reads`, `acts` or `writes` is served differently. Each page of it is the | ||
host's own page, which holds the visitor's session and shows the | ||
site's page in a sandboxed frame beneath it, filling the window. The | ||
site's files are under `/_site/` there, sandboxed as above, and a file | ||
| @@ -205,8 +210,8 @@ client of its own, a public one whose client id is | ||
`https://<address>/client-metadata.json`, and whose callback is | ||
`/_os/callback` there; behind a proxy that names the host it was asked | ||
as `X-Forwarded-Host`, as Caddy does, both are at that name instead. Its | ||
scope is `atproto`; for each of the site's `reads` and `getViewer`, | ||
`rpc:<method>?aud=<the host's service DID>#opensocial`; and for each of | ||
scope is `atproto`; for each of the site's `reads` and `acts`, and | ||
`getViewer`, `rpc:<method>?aud=<the host's service DID>#opensocial`; and for each of | ||
its `writes`, `space:<type>?authority=<the group>&collection=<collection>` | ||
with every action. It can ask the host those methods, and write those | ||
records in the visitor's own repo in this group's spaces of those types, | ||
| @@ -221,28 +226,31 @@ copied link opens the page they are on. | ||
### What a page asks | ||
| ||
A page loads `/_os/kit.js`, which gives it `os`. Each ask is a message to | ||
the host's page, which answers it: | ||
the host's page, which answers it. [The site kit](../reference/site-kit.md) | ||
gives each ask's parameters, answers and refusals, and an example page: | ||
| ||
| Ask | Answer | | ||
| --- | --- | | ||
| `os.group()` | `{did, handle}` of the group whose site it is | | ||
| `os.group()` | `{did, handle, console}` of the group whose site it is, `console` the address of the host's console | | ||
| `os.me()` | `{signedIn, did, handle}` of who is looking | | ||
| `os.call(method, params)` | the method's answer, asked as the visitor: its JSON, or a `Blob` for one that answers a file (`getSpaceBlob`) | | ||
| `os.act(method, input)` | the procedure's answer, `input` its JSON, asked as the visitor: `createReport`'s `id` and `createdAt` | | ||
| `os.upload(file)` | the blob reference of `file`, a picture, uploaded to the visitor's own PDS for a record the site writes to point to | | ||
| `os.create(space, collection, record, {rkey})` | the `uri` and `cid` of `record` written in the visitor's own repo in `space`, one of the group's (`at://<group>/space/<type>/<skey>`) | | ||
| `os.put(space, collection, rkey, record)` | the same, at `rkey`, in place of what is there | | ||
| `os.delete(space, collection, rkey)` | the visitor's record at `rkey` deleted | | ||
| `os.signIn({hint})` | opens the sign-in dialog, `hint` filled in as the handle | | ||
| `os.signOut()` | signs the visitor out | | ||
| `os.onChange(fn)` | calls `fn` with `os.me()`'s answer whenever it changes | | ||
| `os.onChange(fn)` | calls `fn` with `os.me()`'s answer when it changes in place, as on signing out; signing in loads the page again | | ||
| ||
`<os-sign-in>` is a button in the page's own markup, which the page's own | ||
styles style: "Sign in" while nobody is, the visitor's handle and "Sign | ||
out" once someone is. | ||
| ||
`os.call` is refused for a method the site does not name in `reads`, and a | ||
`os.call` is refused for a method the site does not name in `reads`, | ||
`os.act` for one it does not name in `acts`, and a | ||
write for a collection, or a space, its `writes` do not name, or a space | ||
of another's. Asked while nobody is signed in, either is refused with | ||
of another's. Asked while nobody is signed in, each is refused with | ||
`locked` and the reason `sign in`; when the host or the visitor's PDS | ||
refuses the visitor (401 or 403), with `locked` and `not for you`. A page | ||
shows what it may, and asks the visitor to sign in for the rest. A read | ||
| @@ -253,8 +261,9 @@ write in a space is, and the space's access record still says whether | ||
they may write there ([spaces](spaces.md)): `writes` asks no more of the | ||
visitor than the group lets them do. The host hears of it as of any | ||
member's write, so it is in the next `listSpaceRecords`. A sign-in from | ||
before the site named a write, which the PDS refuses for want of scope, | ||
is forgotten, refused with `sign in`, so that signing in again grants it. | ||
before the site named a write or an act, which the PDS refuses for want | ||
of scope, is forgotten, refused with `sign in`, so that signing in again | ||
grants it. | ||
| ||
A site that names `writes` may also upload pictures: its sign-in asks the | ||
visitor's PDS for `blob:image/*` too, and `os.upload` takes only a file of | ||
| @@ -263,6 +272,15 @@ in a space that points to it makes it the space's, and anyone who reads | ||
the space reads it with `getSpaceBlob`, which the site names in `reads` to | ||
show it. A site with no `writes` uploads nothing. | ||
| ||
An act, like a read, goes through the visitor's PDS to the host, and the | ||
host takes it as it takes the same from that person anywhere else: a | ||
report from a site's page is checked, and kept in the group's queue, as | ||
any report is ([moderation](moderation.md)). A page can send moderators | ||
to it with the console's address `os.group()` answers: the group's | ||
Moderation page there, `<console>/g/<handle>/moderation?review=<subject>`, | ||
opens the Review of the account (by its DID) or the record (by its URI) | ||
named, whatever its status. | ||
| ||
### Signing in | ||
| ||
The dialog is the console's, drawn by the host's page over the site: | ||
docs/reference/api.md+6−6
| @@ -127,16 +127,16 @@ A group's website ([sites](../design/sites.md)). | ||
| ||
| Method | What it does | | ||
| --- | --- | | ||
| `POST fyi.opensocial.putSite` | publishes a group's site whole from the files given, each as text or bytes, in place of the one there, with the host's methods its pages may read (`reads`) and the records they may write in whoever signs in's own repo in the group's spaces (`writes`); takes a body as large as `BLOB_UPLOAD_LIMIT` | | ||
| `POST fyi.opensocial.putSite` | publishes a group's site whole from the files given, each as text or bytes, in place of the one there, with the host's methods its pages may read (`reads`), the procedures they may ask (`acts`), and the records they may write in whoever signs in's own repo in the group's spaces (`writes`), all as that person; takes a body as large as `BLOB_UPLOAD_LIMIT` | | ||
| `POST fyi.opensocial.deleteSite` | takes a group's site down | | ||
| `POST fyi.opensocial.putSiteDomain` | serves a group's site at its handle's own domain, once that domain answers as this host; its address and `www.` under the domain redirect there | | ||
| `POST fyi.opensocial.deleteSiteDomain` | serves a group's site at its address alone again | | ||
| `GET /tls/ask?domain=<domain>` | 200 if the proxy in front may get a certificate for `domain`: a group's own domain, or `www.` under it, while the group is on; else 404 | | ||
| `GET`, `HEAD` `https://<address>/<path>` | a file of the site of the group whose address the request's `Host` names, sandboxed; the host keeps `/.well-known/` and `/xrpc/` there for itself. For a site that names `reads` or `writes`, a page is the host's page around the site's, holding the visitor's session, with the site's page's title and preview tags and the status it would have | | ||
| `GET https://<address>/_site/<path>` | for a site that names `reads` or `writes`, the file the frame shows, sandboxed, as above | | ||
| `GET https://<address>/client-metadata.json` | for a site that names `reads` or `writes`, its OAuth client's metadata: a public client asking `atproto`, an `rpc:` scope for each read and `getViewer`, for each write a `space:` scope of its type, with `authority` the group, its collection, and every action, and with any write `blob:image/*`, named for the request's `X-Forwarded-Host` if a proxy sends one, else its `Host` | | ||
| `GET https://<address>/_os/kit.js` | for a site that names `reads` or `writes`, the script its pages load for `os` | | ||
| `GET https://<address>/_os/shell.js` | for a site that names `reads` or `writes`, the host's page's script, from `SITE_SHELL_DIR`; 404 without it | | ||
| `GET`, `HEAD` `https://<address>/<path>` | a file of the site of the group whose address the request's `Host` names, sandboxed; the host keeps `/.well-known/` and `/xrpc/` there for itself. For a site that names `reads`, `acts` or `writes`, a page is the host's page around the site's, holding the visitor's session, with the site's page's title and preview tags and the status it would have | | ||
| `GET https://<address>/_site/<path>` | for a site that names `reads`, `acts` or `writes`, the file the frame shows, sandboxed, as above | | ||
| `GET https://<address>/client-metadata.json` | for a site that names `reads`, `acts` or `writes`, its OAuth client's metadata: a public client asking `atproto`, an `rpc:` scope for each read, each act and `getViewer`, for each write a `space:` scope of its type, with `authority` the group, its collection, and every action, and with any write `blob:image/*`, named for the request's `X-Forwarded-Host` if a proxy sends one, else its `Host` | | ||
| `GET https://<address>/_os/kit.js` | for a site that names `reads`, `acts` or `writes`, the script its pages load for `os` ([the site kit](site-kit.md)) | | ||
| `GET https://<address>/_os/shell.js` | for a site that names `reads`, `acts` or `writes`, the host's page's script, from `SITE_SHELL_DIR`; 404 without it | | ||
| ||
As the spaces' authority and the PDS of the group's own repo in each, the | ||
host answers the space alpha's methods: | ||
docs/reference/cli.md+1−1
| @@ -89,7 +89,7 @@ an MCP client acts in one group. | ||
| ||
| Command | What it does | | ||
| --- | --- | | ||
| `site publish <group> <dir> [--fallback <path>] [--not-found <path>] [--reads <methods>] [--writes <space:collection,…>]` | publishes the files under `<dir>`, but those whose names start with a dot, as the group's website at its address, in place of the one there: each as text if it is UTF-8, else as bytes. `--reads` names, comma-separated, the host's methods its pages may ask as whoever signs in on it, each by NSID or by its last part (`getGroup,listMembers`); `--writes`, comma-separated, the records they may write in that person's own repo, each a type of the group's spaces and a collection there (`fyi.opensocial.members:fyi.opensocial.acceptance`) ([live data](../design/sites.md#live-data)) | | ||
| `site publish <group> <dir> [--fallback <path>] [--not-found <path>] [--reads <methods>] [--acts <methods>] [--writes <space:collection,…>]` | publishes the files under `<dir>`, but those whose names start with a dot, as the group's website at its address, in place of the one there: each as text if it is UTF-8, else as bytes. `--reads` names, comma-separated, the host's methods its pages may ask as whoever signs in on it, each by NSID or by its last part (`getGroup,listMembers`); `--acts`, the same way, the procedures they may ask as that person (`createReport`); `--writes`, comma-separated, the records they may write in that person's own repo, each a type of the group's spaces and a collection there (`fyi.opensocial.members:fyi.opensocial.acceptance`) ([live data](../design/sites.md#live-data)) | | ||
| `site delete <group>` | takes the group's website down | | ||
| `site domain <group> [--undo]` | serves the group's website at its handle's own domain once that domain reaches this host, its address and `www.` redirecting there; with `--undo`, at its address alone again ([on its own domain](../design/sites.md#on-its-own-domain)) | | ||
| ||
docs/reference/mcp.md+1−1
| @@ -103,7 +103,7 @@ its icon. | ||
| ||
| Tool | Command | Lexicon | What it does | | ||
| --- | --- | --- | --- | | ||
| `site_publish` | `site publish` | `fyi.opensocial.putSite` | publishes the group's website whole, from `files`, each `{path, text}` or `{path, bytes}`, with `fallback` and `not_found` naming files of them, `reads` the host's methods its pages may ask as whoever signs in, and `writes` the records they may write in that person's own repo, each `{space, collection}`; the command reads the files from a folder | | ||
| `site_publish` | `site publish` | `fyi.opensocial.putSite` | publishes the group's website whole, from `files`, each `{path, text}` or `{path, bytes}`, with `fallback` and `not_found` naming files of them, `reads` the host's methods its pages may ask as whoever signs in, `acts` the procedures they may ask as that person, and `writes` the records they may write in that person's own repo, each `{space, collection}`; the command reads the files from a folder | | ||
| `site_delete` | `site delete` | `fyi.opensocial.deleteSite` | takes the group's website down | | ||
| `site_domain` | `site domain` | `fyi.opensocial.putSiteDomain` | serves the group's website at its handle's own domain once it reaches this host; with `undo`, `fyi.opensocial.deleteSiteDomain`, at its address alone again | | ||
| ||