Repository navigation
Custom domain (rebuilt on main) - #151
Merged
Merged
Conversation
Rebuilt from #141 (by Reynaldi Chernando) on top of main, where publishing now runs through publishProject (the popover and the chat's Publish card) and address changes through changePublishedAddress. - "Use custom domain" / "Change domain" beside the site address opens Puter's domain dialog (puter.hosting.attach). The free plan gets the upgrade dialog, which now lists the benefit. - Before a first publish, the own-domain route reserves the name, opens the dialog and publishes behind it. publishProject takes the reserved name (ui.reserved), reuses one a failed try left behind, and holds back any other publish, including the chat card's, while the name is reserved. - The popover checks a pending domain until it serves the site, and a connected one each time it opens. Once working, the domain is the address the popover, share view, copy button and sidebar show. - Changing the address asks first when a domain depends on it. The question sits in changePublishedAddress, so the popover and the chat card both ask, ahead of the busy checks. Settings asks too. - savePublishedFields keeps fields a caller leaves out, and changes domains inside the file lock, alongside main's AI note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The popover's progress note says "Pick or add your domain in Puter's window" while a first publish goes out with its domain. The flag behind it stayed on afterwards, so a later publish from the chat's Publish card showed it too when the popover was opened mid-publish. It now clears when that publish ends, whether it worked or not.
An own-domain first publish reserves its puter.site name and connects the domain to it before the publish runs. When that publish failed and the user closed the popover, the next open filled the address field with a random name. Publish then created that site and deleted the reserved one, leaving the domain on an address that no longer exists. The field now starts with the reserved name.
After an own-domain first publish that didn't land, Use custom domain went back to the name that try had reserved, even when the user had typed another one, and put that name back in the field. A plain Publish already uses the typed name. Use custom domain now does too, and removes the reserved site it replaces so it doesn't take one of the account's site slots. A typed name that is taken leaves the reserved one in place.
The own-domain route reserves a project's puter.site name before its first publish. When that publish never landed, the name is in neither of the URLs deleteChat removes, so deleting the project left the site on the account, holding one of its limited site slots.
Before an address change, the warning told every user with a domain that it "shows your site" and "stops working". A domain still waiting for its DNS records, or one already found not working, does neither. Those now read that the domain is set up for the current address and won't work with the new one.
Check now, Connect again and Change domain were disabled while they worked. The popover re-renders to show that, and a disabled button can't hold focus, so focus fell back to the popover itself and a keyboard user had to tab back to where they were. They are now aria-disabled while busy, which keeps them focusable, and their click handlers ignore them until they are free.
The popover re-renders when a turn ends or a domain check changes something, and puts focus back on the control that had it, found by its first class and data-action. The record copy buttons had no data-action and share their first class with the site's Copy link button, so focus on one jumped to Copy link at the top. Each now has its own.
Connecting a domain takes it off any other project that had it. To find that project, every published project's saved file was downloaded in parallel, and each file holds the project's whole conversation, so one connect could pull tens of megabytes. The project list now keeps each project's domain hostname (publishedDomainHost, in any state), and only the project listed with it is updated, with no other reads.
Once a domain works, the popover shows the site's puter.site address on an "Also at" line under the URL row. That line could neither wrap nor shrink, so a long address scrolled the popover sideways: 56px on a phone in a headless Chrome check, 7px on desktop. It now ends in an ellipsis like the URL row above it, with the whole address in its title.
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Do not merge yet: this waits until custom domains are available to all accounts, as #141 did.
Rebuilds #141 on current main. Since #141 branched, #149 (publish from chat) and #150 changed publishing a lot, so this ports the custom-domain feature onto the new code instead of merging the old branch.
What changed while porting
doPublishis now a thin popover wrapper aroundpublishProject(ui). The reserved-name logic moved intopublishProject, with the name passed asui.reserved. This logic covers reusing a name left by a failed try, and deleting it when a different name is typed. The popover-only parts stay indoPublish: the "Pick or add your domain in Puter's window" progress text, the share URL, and landing on the site view.changePublishedAddress, so the popover and the chat's Change-address card both ask it. It's asked before the busy checks. The change stops if the user opens another project or the address moves while the question is open. It returns{ changed: false, cancelled: true }, which leaves the popover editor open and the card unchanged. Settings asks before its waits, as in custom domain #141.savePublishedFieldscombines both sides. It keeps the PR's optional fields and in-lock domain updates, plus main's AI-note argument.test-custom-domain.mjsthat read the olddoPublishsource now check the new structure. There are new checks for the cancel paths. custom domain #141's reserved-name tests intest-publish-rollback.mjsstill run.Not changed (possible follow-ups)
Review fixes
Each is its own commit, with a test that fails without it.
aria-disabledwhile busy instead ofdisabled, so focus stays on them through the re-render. Each DNS record's copy button has its owndata-action, so a re-render no longer moves focus to the site's Copy link button.publishedDomainHost), and only that project is updated.Still open: the reserved name for an own-domain publish is kept in memory only. After a page reload, a failed try's reserved site is forgotten and stays on the account.
Testing
npm testpasses, and so doesvite build.