~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

A group's pictures and who sees its profile, set in the console

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:host/images

What changes

The host serves a group's images, any of them, at /img/{did}/{cid}, to whoever may see a record that holds the image:

  • anyone, for a record in its public repo;
  • anyone, for its profile while the group is declared, since listGroups shows that profile to anyone;
  • for a record in a space, whoever that space lets read, as the console's session cookie says.

Only PNG, JPEG, WebP, GIF and AVIF are served, with nosniff, a sandboxing CSP, and private, immutable caching, since a CID names its bytes. A group switched off shows none. The lexicon's avatar and banner descriptions now name this URL; the old /img/{did}/avatar they named was never served here.

The console's settings gain two sections:

  • Pictures: upload, replace and take away the avatar and banner.
  • Who sees it: anyone, and found on the network; or its members alone, to others just its handle. A note says hiding it can't take back what someone has already seen. This sets the meta space's readers through updateSpace, which also makes or removes the declaration.

Avatars and banners show on a group's page and in the lists of groups.

The console passes /img/ on to the host, in its build and in vite dev. just dev and the e2e world raise the console's BODY_SIZE_LIMIT past the Node adapter's 512K, and config.md says a deployment must too, or an upload past it is refused before the host sees it.

Host::session_cookie is public, so a test can be signed in to the console as someone, as the host itself signs them in.

Why

You asked for avatar upload and a visibility setting in the console; the host had both, but nothing showed them. You also asked that the image route be generic rather than serving only the avatar and banner, so any image a page draws (a photo in a space, say) is served by one rule: who may read a record that holds it.

How it was checked

  • Host: group_config.rs covers images in a listed profile, in the profile of a hidden group (a member sees them, a stranger and someone not signed in don't), in the public repo, and in a space this host doesn't govern. It also covers a file that is no image, one no record holds, a CID that isn't one, and a group switched off. blobs.rs is at 100% here.
  • Console: two new flows. One uploads an avatar, sees it drawn on the group's page from the host, and takes it away. The other hides the group's profile, sees listGroups drop its name, and shows it again. All 24 flows pass on my machine.

Shortcomings

  • No hiding from the host's list. listGroups still lists every group on the host, a hidden one by its handle alone. I left that as it is rather than change what the host lists in a console pull.
  • Some profile fields aren't editable yet. Where it meets, topics and languages are kept but still can't be changed in the console.
  • People's avatars aren't served. A member's avatar is described as served at /img/actor/..., which this host doesn't serve.

🤖 Generated with Claude Code

Approved

This adds a generic /img/{did}/{cid} route. It serves an image to whoever may read a record that holds it: public repo, listed profile, or a governed space via the console cookie. It also adds Pictures and Who-sees-it sections to the settings page, and shows avatars and banners on the group page and in group lists. The access logic in may_see reads correctly. A switched-off group, ungoverned spaces, non-image MIME types and loose blobs all return 404. The headers are safe: nosniff, a sandboxing CSP, and private caching. updateProfile keeps an image when the key is absent, so uploading one picture does not drop the other. The tests and docs cover the change. I did not run the checks.

One small thing, which does not block approval. In web/src/routes/g/[handle]/settings/+page.server.ts, picture and unpicture use the posted slot as an object key without checking it. A hand-crafted form could post slot=displayName and null or overwrite another profile field. Only a configurer can do this, and the host validates the result, but restricting slot to avatar or banner is a one-line fix.

web/src/routes/g/[handle]/settings/+page.server.tsline 71Outdated

These lines can no longer be read.

review.knotless.dev

slot is used as a profile key as posted. Check it is avatar or banner here and in picture, so a hand-made form can't null or replace displayName or another field.

Approved

The only change since my last review is the settings page now opening afresh after saving who sees a group, instead of reloading. That avoids a resubmitted form and looks fine.

My earlier note is still open, and it was never a blocker. picture (line 67) and unpicture (line 71) in +page.server.ts still use the posted slot as a profile key unchecked. A hand-made form from a configurer could null or overwrite displayName or another field. Restricting slot to avatar or banner is a one-line fix.

web/src/routes/g/[handle]/settings/+page.server.tsline 71Outdated

These lines can no longer be read.

review.knotless.dev

slot is still unchecked here and at line 67. Allow only avatar or banner.

Merged as fa868fb