chadtmiller.com/group-host
atmosphere group host
0
0
The proposal's November changes take in main's console messages
.claude/skills/ui/SKILL.md+10−0
| @@ -127,6 +127,16 @@ than inventing. | ||
| ||
## House rules | ||
| ||
**Messages.** Every word on a page is a message in | ||
`web/messages/en.json`, called as `m.<key>()` (keys start with the | ||
component's name: `invites_empty_title`), so the rules below are held | ||
there. A sentence is one message, with its parameters (`{group}`) and | ||
any component inside it as markup (`{#person/} loses access to | ||
{group}.`, drawn by `ParaglideMessage`), never pieces joined, as other | ||
languages order words their own way. A count is a plural message. A | ||
refusal from the host is said by its error's name (`#lib/errors.ts`). | ||
`node harness/strings.mjs` finds words written into markup. | ||
| ||
**Case.** Sentence case everywhere: buttons, links, headings, menu | ||
items, field labels, dialog titles, notes and errors ("Invite someone", | ||
"Asking to join", "Sign out"). Only the first word and proper nouns take | ||
.knotless/workflows/web.yml+4−1
| @@ -2,7 +2,8 @@ | ||
# harness and the docs site are formatted as `just fmt` leaves them | ||
# (oxfmt), that each component uses only its own layer and those below | ||
# (harness/layers.mjs), that every dialog's title is its own fixed words | ||
# (harness/dialogs.mjs), the SDK's types and tests (packages/sdk, which the | ||
# (harness/dialogs.mjs), that every word a page shows is a message | ||
# (harness/strings.mjs), the SDK's types and tests (packages/sdk, which the | ||
# site shell builds on), and svelte-check, which fails on any warning. The | ||
# packages are kept between runs and installed again only when a lockfile | ||
# changes. | ||
| @@ -32,6 +33,8 @@ steps: | ||
run: node harness/layers.mjs | ||
- name: dialogs | ||
run: node harness/dialogs.mjs | ||
- name: strings | ||
run: node harness/strings.mjs | ||
- name: sdk check | ||
run: cd packages/sdk && npm run check | ||
- name: sdk test | ||
crates/group-host/src/moderation.rs+17−3
| @@ -701,7 +701,10 @@ impl Host { | ||
} | ||
| ||
/// Defines one of the group's own labels, or changes one it defines, in | ||
/// its labeler, the label among the values it applies. | ||
/// its labeler, the label among the values it applies. A change replaces | ||
/// how apps show it but only the name and description in the given | ||
/// language: the definition keeps its other languages, in their order, | ||
/// and a new language goes after them. | ||
pub async fn put_label_definition( | ||
State(host): State<Arc<Host>>, | ||
headers: HeaderMap, | ||
| @@ -715,17 +718,28 @@ pub async fn put_label_definition( | ||
return Err(invalid("label is lowercase letters and hyphens")); | ||
} | ||
let or = |key: &str, unless: &str| body[key].as_str().unwrap_or(unless).to_string(); | ||
let lang = or("lang", "en"); | ||
let labeler = host.labeler_of(group)?; | ||
let mut locales: Vec<Value> = labeler["policies"]["labelValueDefinitions"] | ||
.as_array() | ||
.and_then(|ds| ds.iter().find(|d| d["identifier"] == label)) | ||
.and_then(|d| d["locales"].as_array().cloned()) | ||
.unwrap_or_default(); | ||
let locale = json!({"lang": lang, "name": body["name"], "description": body["description"]}); | ||
match locales.iter_mut().find(|l| l["lang"] == lang.as_str()) { | ||
Some(same) => *same = locale, | ||
None => locales.push(locale), | ||
} | ||
let mut definition = json!({ | ||
"identifier": label, | ||
"severity": or("severity", "inform"), | ||
"blurs": or("blurs", "none"), | ||
"defaultSetting": or("defaultSetting", "warn"), | ||
"locales": [{"lang": or("lang", "en"), "name": body["name"], "description": body["description"]}], | ||
"locales": locales, | ||
}); | ||
if body["adultOnly"] == true { | ||
definition["adultOnly"] = json!(true); | ||
} | ||
let labeler = host.labeler_of(group)?; | ||
let defined = definition.clone(); | ||
let change = |values: &mut Vec<Value>, definitions: &mut Vec<Value>| { | ||
if !values.contains(&json!(label)) { | ||
crates/group-host/tests/moderation.rs+25−1
| @@ -983,8 +983,28 @@ async fn defines_the_groups_own_labels_for_one_who_configures_it() { | ||
let again = json!({"group": did, "label": "troll", "name": "Troll", "description": "Baits people.", "lang": "sl", "severity": "alert", "blurs": "content", "defaultSetting": "hide", "adultOnly": true}); | ||
let (_, changed) = call(&h, &alice, "putLabelDefinition", again).await; | ||
assert_eq!(changed["adultOnly"], true); | ||
assert_eq!(changed["locales"][0]["lang"], "sl"); | ||
assert_eq!(changed["severity"], "alert"); | ||
// It keeps its English name beside the Slovenian one. | ||
assert_eq!(changed["locales"][0]["lang"], "en"); | ||
assert_eq!(changed["locales"][1]["lang"], "sl"); | ||
assert_eq!(labels().await, json!([changed])); | ||
// A French name joins them, and a new English one replaces only the | ||
// English, in its place. | ||
let fr = json!({"group": did, "label": "troll", "name": "Troll (fr)", "description": "Cherche la bagarre.", "lang": "fr"}); | ||
let (status, _) = call(&h, &alice, "putLabelDefinition", fr).await; | ||
assert_eq!(status, 200); | ||
let en = json!({"group": did, "label": "troll", "name": "Provoker", "description": "Stirs things up."}); | ||
let (status, changed) = call(&h, &alice, "putLabelDefinition", en).await; | ||
assert_eq!(status, 200); | ||
let fr = json!({"lang": "fr", "name": "Troll (fr)", "description": "Cherche la bagarre."}); | ||
assert_eq!( | ||
changed["locales"], | ||
json!([ | ||
{"lang": "en", "name": "Provoker", "description": "Stirs things up."}, | ||
{"lang": "sl", "name": "Troll", "description": "Baits people."}, | ||
fr, | ||
]) | ||
); | ||
let meta = meta_space(&did); | ||
let labeler = h | ||
.host | ||
| @@ -995,6 +1015,10 @@ async fn defines_the_groups_own_labels_for_one_who_configures_it() { | ||
json!(["!hide", "!takedown", "troll"]) | ||
); | ||
assert_eq!(labeler["subjectTypes"], json!(["account", "record"])); | ||
assert_eq!( | ||
labeler["policies"]["labelValueDefinitions"], | ||
json!([changed]) | ||
); | ||
// atproto's own values, and anything else, are not the group's to define. | ||
for label in ["!hide", "Troll", "spam bot", ""] { | ||
let body = json!({"group": did, "label": label, "name": "x", "description": "x"}); | ||
docs/design/moderation.md+3−1
| @@ -221,7 +221,9 @@ should show what wears it (`severity`, `blurs`, `defaultSetting`, | ||
defines, and none of its own. | ||
| ||
`putLabelDefinition` defines one, or changes the one with that value, | ||
and adds it to the values the labeler applies. `deleteLabelDefinition` | ||
and adds it to the values the labeler applies. A change replaces its | ||
name and meaning in one language and keeps the others, so naming a | ||
label in French leaves its English name. `deleteLabelDefinition` | ||
takes both away, and labels already applied stay. Each needs | ||
`group.configure`, and writes the labeler as the group, like any change | ||
to its meta space. A group's own label is lowercase letters and hyphens, | ||
docs/guides/shots/recovery-added-dark.png+0−0
A binary file, not shown.
docs/guides/shots/recovery-added.png+0−0
A binary file, not shown.
docs/guides/shots/recovery-dialog-dark.png+0−0
A binary file, not shown.
docs/guides/shots/recovery-dialog.png+0−0
A binary file, not shown.
docs/guides/shots/recovery-dialog.txt+6−0
| @@ -2,6 +2,12 @@ | ||
- heading "Add a recovery key" [level=2] | ||
- button "Close": × | ||
- paragraph: A key you hold. With it you can recover the group, or move it, without this host. | ||
- paragraph: | ||
- text: No key yet? Make one in a terminal with | ||
- link "goat": | ||
- text: . Paste the public key it prints here, and keep the secret key somewhere safe. | ||
- code: goat key generate | ||
- button "Copy" | ||
- text: A key of yours, as a did:key | ||
- textbox "A key of yours, as a did:key": | ||
- /placeholder: did:key:z… | ||
docs/guides/shots/recovery-refused-dark.png+0−0
A binary file, not shown.
docs/guides/shots/recovery-refused.png+0−0
A binary file, not shown.
docs/guides/shots/recovery-refused.txt+7−1
| @@ -2,10 +2,16 @@ | ||
- heading "Add a recovery key" [level=2] | ||
- button "Close": × | ||
- paragraph: A key you hold. With it you can recover the group, or move it, without this host. | ||
- paragraph: | ||
- text: No key yet? Make one in a terminal with | ||
- link "goat": | ||
- text: . Paste the public key it prints here, and keep the secret key somewhere safe. | ||
- code: goat key generate | ||
- button "Copy" | ||
- text: A key of yours, as a did:key | ||
- textbox "A key of yours, as a did:key": | ||
- /placeholder: did:key:z… | ||
- text: did:key:<key> | ||
- paragraph: not a did:key the directory takes (secp256k1 or P-256) | ||
- paragraph: That isn’t a key this host takes. Use a did:key for secp256k1 or P-256. | ||
- button "Cancel" | ||
- button "Add" | ||
docs/guides/shots/recovery-removed-dark.png+0−0
A binary file, not shown.
docs/guides/shots/recovery-removed.png+0−0
A binary file, not shown.
docs/guides/shots/recovery-tab-dark.png+0−0
A binary file, not shown.
docs/guides/shots/recovery-tab.png+0−0
A binary file, not shown.
docs/guides/shots/starting-card-done-dark.png+0−0
A binary file, not shown.
docs/guides/shots/starting-new-dark.png+0−0
A binary file, not shown.
docs/guides/shots/starting-new.png+0−0
A binary file, not shown.
docs/guides/shots/starting-new.txt+6−3
| @@ -4,13 +4,16 @@ | ||
- main: | ||
- heading "Start a group" [level=1] | ||
- text: Name | ||
- textbox "Name" | ||
- textbox "Name": | ||
- /placeholder: Riverside Book Club | ||
- text: Its address | ||
- textbox "Its address .groups.test" | ||
- textbox "Its address .groups.test": | ||
- /placeholder: riverside-book-club | ||
- text: .groups.test | ||
- paragraph: This is the group's handle and web address. You can change it. | ||
- text: What it is for (optional) | ||
- textbox "What it is for (optional)" | ||
- textbox "What it is for (optional)": | ||
- /placeholder: We meet monthly to talk about our favorite books 📚 | ||
- text: How people join | ||
- combobox "How people join": | ||
- option "An admin approves who joins" [selected] | ||
docs/guides/shots/starting-taken-dark.png+0−0
A binary file, not shown.
docs/guides/shots/starting-taken.png+0−0
A binary file, not shown.
docs/guides/shots/starting-taken.txt+8−3
| @@ -4,15 +4,20 @@ | ||
- main: | ||
- heading "Start a group" [level=1] | ||
- text: Name | ||
- textbox "Name": Book club | ||
- textbox "Name": | ||
- /placeholder: Riverside Book Club | ||
- text: Book club | ||
- text: Its address | ||
- textbox "Its address .groups.test": riders | ||
- textbox "Its address .groups.test": | ||
- /placeholder: riverside-book-club | ||
- text: riders | ||
- text: .groups.test | ||
- paragraph: | ||
- text: riders.groups.test is taken. | ||
- button "Use riders-2.groups.test" | ||
- text: What it is for (optional) | ||
- textbox "What it is for (optional)" | ||
- textbox "What it is for (optional)": | ||
- /placeholder: We meet monthly to talk about our favorite books 📚 | ||
- text: How people join | ||
- combobox "How people join": | ||
- option "An admin approves who joins" [selected] | ||
docs/guides/shots/starting-words.txt+9−9
| @@ -226,13 +226,13 @@ | ||
- option "South Sudan" | ||
- option "Spain" | ||
- option "Sri Lanka" | ||
- option "St. Barthélemy" | ||
- option "St. Helena" | ||
- option "St. Kitts & Nevis" | ||
- option "St. Lucia" | ||
- option "St. Martin" | ||
- option "St. Pierre & Miquelon" | ||
- option "St. Vincent & Grenadines" | ||
- option "St Barthélemy" | ||
- option "St Helena" | ||
- option "St Kitts & Nevis" | ||
- option "St Lucia" | ||
- option "St Martin" | ||
- option "St Pierre & Miquelon" | ||
- option "St Vincent & the Grenadines" | ||
- option "Sudan" | ||
- option "Suriname" | ||
- option "Svalbard & Jan Mayen" | ||
| @@ -253,14 +253,14 @@ | ||
- option "Turkmenistan" | ||
- option "Turks & Caicos Islands" | ||
- option "Tuvalu" | ||
- option "U.S. Outlying Islands" | ||
- option "U.S. Virgin Islands" | ||
- option "Uganda" | ||
- option "Ukraine" | ||
- option "United Arab Emirates" | ||
- option "United Kingdom" | ||
- option "United States" | ||
- option "Uruguay" | ||
- option "US Outlying Islands" | ||
- option "US Virgin Islands" | ||
- option "Uzbekistan" | ||
- option "Vanuatu" | ||
- option "Vatican City" | ||
docs/guides/recovery-keys.md+5−3
docs/guides/starting-a-group.md+1−1
docs/reference/api.md+1−1
docs/development.md+31−1
harness/dialogs.mjs+6−2
harness/strings.mjsnew+113−0
lexicons/fyi/opensocial/putLabelDefinition.json+4−4
web/messages/en.jsonnew+751−0
751 lines changed: not loaded until asked for.
web/project.inlang/settings.jsonnew+9−0
web/shell/shell.ts+3−2
web/shell/vite.config.ts+3−1
web/src/lib/atoms/Copy.svelte+4−1
web/src/lib/molecules/BackToApp.svelte+8−2
web/src/lib/molecules/ConfirmDialog.svelte+3−1
web/src/lib/molecules/DeleteGroup.svelte+8−3
web/src/lib/molecules/Dialog.svelte+2−1
web/src/lib/molecules/Facts.svelte+13−3
web/src/lib/molecules/FormDialog.svelte+2−1
web/src/lib/molecules/HandleInput.svelte+2−1
web/src/lib/molecules/LeaveGuard.svelte+5−4
web/src/lib/molecules/Links.svelte+2−1
web/src/lib/molecules/MoveSignIn.svelte+4−3
web/src/lib/molecules/Permissions.svelte+31−18
web/src/lib/molecules/PickMany.svelte+7−8
web/src/lib/molecules/Rules.svelte+2−1
web/src/lib/molecules/SaveBar.svelte+7−4
web/src/lib/molecules/SignIn.svelte+2−1
web/src/lib/molecules/Standing.svelte+12−7
web/src/lib/molecules/SubjectHistory.svelte+7−4
web/src/lib/molecules/SwitchedOff.svelte+8−5
web/src/lib/molecules/UserMenu.svelte+19−10
web/src/lib/organisms/AccountMove.svelte+22−17
web/src/lib/organisms/AppPasswords.svelte+40−16
web/src/lib/organisms/AuthorizeRequest.svelte+34−22
web/src/lib/organisms/ConnectAiApp.svelte+8−7
web/src/lib/organisms/ConnectedApps.svelte+7−8
web/src/lib/organisms/FindAccount.svelte+4−3
web/src/lib/organisms/GroupActivity.svelte+12−9
web/src/lib/organisms/GroupApps.svelte+24−15
web/src/lib/organisms/GroupHandle.svelte+25−16
web/src/lib/organisms/GroupList.svelte+2−1
web/src/lib/organisms/GroupSite.svelte+53−50
web/src/lib/organisms/Invitations.svelte+6−3
web/src/lib/organisms/InviteDialog.svelte+14−5
web/src/lib/organisms/Invites.svelte+3−4
web/src/lib/organisms/JoinPanel.svelte+19−18
web/src/lib/organisms/JoinRequests.svelte+4−3
web/src/lib/organisms/LabelsEditor.svelte+47−33
web/src/lib/organisms/LinksEditor.svelte+21−7
web/src/lib/organisms/MemberList.svelte+37−26
web/src/lib/organisms/ModerationQueue.svelte+23−9
web/src/lib/organisms/NewGroupForm.svelte+20−12
web/src/lib/organisms/ProfileForm.svelte+26−23
web/src/lib/organisms/ProfilePictures.svelte+15−11
web/src/lib/organisms/RecoveryKeys.svelte+30−13
web/src/lib/organisms/ReportDialog.svelte+15−6
web/src/lib/organisms/ReviewDialog.svelte+43−41
web/src/lib/organisms/RolesEditor.svelte+30−14
web/src/lib/organisms/RulesEditor.svelte+20−8
web/src/lib/organisms/SignInDialog.svelte+10−8
web/src/lib/organisms/SiteDomain.svelte+31−14
web/src/lib/organisms/SwitchOff.svelte+6−5
web/src/lib/organisms/Visibility.svelte+7−7
web/src/lib/server/settings.ts+22−32
web/src/lib/server/site.ts+2−1
web/src/lib/activity.ts+61−27
web/src/lib/asGroup.ts+2−3
web/src/lib/data.ts+9−8
web/src/lib/dates.ts+28−18
web/src/lib/errors.tsnew+131−0
web/src/lib/forms.ts+5−4
web/src/lib/labels.tsnew+20−0
web/src/lib/locale.tsnew+34−0
web/src/lib/moderation.ts+24−16
web/src/lib/permissions.ts+39−44
web/src/lib/places.ts+14−13
web/src/lib/reasons.ts+11−9
web/src/lib/saving.svelte.ts+2−1
web/src/routes/authorize/+page.server.ts+2−1
web/src/routes/authorize/+page.svelte+5−4
web/src/routes/g/[handle]/moderation/+page.server.ts+5−3
web/src/routes/g/[handle]/moderation/+page.svelte+20−8
web/src/routes/g/[handle]/settings/apps/+page.svelte+10−6
web/src/routes/g/[handle]/settings/labels/+page.svelte+8−5
web/src/routes/g/[handle]/settings/recovery/+page.svelte+11−7
web/src/routes/g/[handle]/settings/roles/+page.svelte+8−5
web/src/routes/g/[handle]/settings/rules/+page.svelte+8−5
web/src/routes/g/[handle]/settings/site/+page.svelte+15−10
web/src/routes/g/[handle]/settings/+layout.svelte+22−12
web/src/routes/g/[handle]/settings/+page.svelte+17−14
web/src/routes/g/[handle]/+page.server.ts+2−1
web/src/routes/g/[handle]/+page.svelte+20−17
web/src/routes/move/+page.server.ts+2−4
web/src/routes/move/+page.svelte+6−8
web/src/routes/new/+page.server.ts+2−4
web/src/routes/new/+page.svelte+11−5
web/src/routes/+error.svelte+9−8
web/src/routes/+page.svelte+7−6
web/src/app.html+1−1
web/src/hooks.server.ts+20−1
web/package-lock.json+1013−47
1060 lines changed: not loaded until asked for.