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

A group's site is published and deleted from its settings, and linked

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

A group's settings get a Site page: it shows where the group's website is, how many files it has and when it was published, publishes a folder chosen in the browser, and deletes the site. The group's own page links to the site, as "Website", while it has one.

Claude Opus 5.5

What changes

Settings, Site (/g/<handle>/settings/site), for those who configure the group, as a tab after Profile.

  • With no site, the empty box: "Nothing published yet".
  • With one, a row: the address, its file count and the day it was published. "Open" goes to the site; "Delete" asks first ("Delete this site?") and calls deleteSite.
  • "Publish a site" opens a dialog: a folder (webkitdirectory), and, optionally, the page for addresses that aren't found (notFound) and one page for every address (fallback). Sent in place, it calls putSite.

Publishing from the browser (siteFiles in lib/server/settings.ts). It does what opensocial site publish does:

  • each file at its path under the folder, the folder's own name taken off;
  • files whose names start with a dot left out;
  • each sent as text if it is UTF-8, as bytes otherwise.

A form sends each file by its name alone, so the dialog sends the paths beside the files (webkitRelativePath, in the files' order), and the server falls back to the names.

The group's page links to the site as "Website", after Moderation and Settings, for anyone signed in, while it has one. Where the site is and whether there is one come from the fyi.opensocial.site record in the group's public repo (lib/server/site.ts), read through com.atproto.repo.getRecord. The address comes over the console's own scheme, so just dev links to https://<label>.groups.localtest.me.

Docs. docs/design/sites.md:

  • its opening no longer says a page reads live data from the host's methods. In its sandbox nobody is signed in, and the methods don't let another origin read their answers, as the spike for at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3mzlk7gxpmi3j showed;
  • Publishing describes the console's page, and what the console and the command do to a folder.

Pictures. harness/look/seeds/site.mjs publishes a small site to Riders, for just look. Every guide that shows the settings tabs is drawn again by just shots, the new tab in them.

Why

Two items of at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3mzlk7gxpmi3j: "The console shows a group's site: a link to it, and a way to publish or take it down", and sites.md's promise of live data. Until now a site could be published only by the command, MCP, or an app writing the record.

How it was checked

  • New e2e flow, "publishing a site from a folder, and deleting it":

    • it publishes a folder with a page, a page under it, a PNG and a .DS_Store through the dialog;
    • it reads the record back from the host: three files at their paths under the folder, the pages text/html, the PNG image/png at its byte length (so bytes reach the host whole), the dot-file left out;
    • it checks the group page's Website link and its address;
    • it deletes the site, and the link goes.

    All 34 flows pass locally.

  • just look: the Site page empty and published, the publish dialog both before and after a site, the delete dialog, and the group page as its admin and as a non-member, desktop light and phone dark. A reviewer agent that had not written them critiqued them against the ui skill's house rules. Fixed from it:

    • the heading's act is named as its dialog ("Publish a site");
    • the intro and empty state reworded;
    • the delete sentence says what will happen;
    • the address is drawn monospace, as handles are;
    • the row's name is plain, with "Open" as a row act;
    • the group page's link says "Website" and comes last.
  • npm run check, just fmt. The rest is left to CI.

Shortcomings

  • The folder field is the browser's own control ("Choose Files", "No file chosen"), as the picture dialogs' file fields are. at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3mzmcwkorihas lists that for every file field. A styled one belongs there, made once for all of them.
  • No guide shows publishing a site yet.
  • A folder is sent in one request. It is as large as the console's BODY_SIZE_LIMIT lets it be, which the deploy sets to the host's BLOB_UPLOAD_LIMIT, as putSite takes it.

published-alice-desktop-light.png

publish-alice-desktop-light.png

delete-alice-desktop-light.png

group-bob-phone-dark.png

Approved

This adds a Site page to a group's settings (publish a folder, delete the site) and a "Website" link on the group's page. I read the whole code diff and found nothing that must change. I did not open the regenerated PNGs. The .txt snapshots only gain the new "Site" tab link.

The path handling in siteFiles holds up. It takes off the folder name, skips dot-segments, and falls back to file names when paths is missing. The e2e flow covers the main path.

Two small things you could fix later:

  • siteOf calls error() on any getRecord failure other than RecordNotFound. It is now called from the group page's load, so a transient failure reading the public repo turns a public page into an error page for a link that is only a nicety. Catching the failure there and returning null would be safer. The settings page can keep surfacing the error.
  • JSON.parse of the paths field in siteFiles throws a 500 on malformed input. A try/catch falling back to file names would turn that into the same fallback a missing field gets.
web/src/lib/server/site.tsline 26Outdated

These lines can no longer be read.

review.knotless.dev

This turns any non-404 failure into an error page. Called from the group page's load, it makes the whole public page depend on the link. Consider returning null there.

web/src/lib/server/settings.tsline 511Outdated

These lines can no longer be read.

review.knotless.dev

Malformed paths throws a 500 here. Falling back to file names would match the missing-field case.

Merged as dbb0aaa