Deploy to the gateway that actually serves shakespeare.wtf now

Shakespeare Deploy uploaded a zip to a host that kept the files itself. That
host has been replaced: those domains are served out of nsite manifests, so a
deploy through the old API has been succeeding and changing nothing anyone can
see. This replaces it.

NpanelAdapter is NsiteAdapter plus a name. The site is an ordinary nsite under
the user's own key — same event, readable by any nsite client, gateway or no
gateway — and the second half of the deploy asks the gateway to point a hostname
at it. Its predecessor claimed names implicitly, by watching relays and
reserving whichever d tag it saw first; this one keeps an explicit row, which is
what makes a name something its owner holds rather than something they won a
race for. The hostname is asked about before it is claimed, because "nobody
holds this", "I already hold this" and "somebody else holds this" are three
different acts and creating-then-reading-the-409 cannot tell the last two apart.

The name field checks availability as you type, against an endpoint that takes
no credentials: somebody choosing a name has not decided to make an account yet.
A name this project already deployed to is not reported as taken — it is theirs.
An unreachable gateway reports available, because being wrong that way costs a
clear error at deploy time, and being wrong the other way tells someone a free
name is taken and they settle for worse.

Also fixes readDeploySettings, which swallowed a missing file and an unreadable
one alike and answered "no providers" to both. The default provider it was meant
to hand new users had therefore never reached anybody: it was written, saved
back as an empty list on the next render, and gone. The two cases are now
distinct, because inventing defaults for a file that exists but will not parse
would silently replace whatever the user had.

Providers and per-project deploy records saved under the old type are migrated
on load rather than dropped. The project file holds one record per provider a
project ever deployed to, so rejecting one entry would take a Netlify site id
and a Vercel project id with it.

Verified end to end against the live gateway: a fresh key self-enrolled,
uploaded a blob, published a manifest, claimed a name, and the site served
publicly with the SPA fallback working on a deep path.

The package-lock version bump is npm reconciling it with package.json, which
had drifted before this work.
This commit is contained in:
Alex Gleason committed 2026-09-13 12:54:30 -05:00
1 parent 4d36e2d3ff
commit fc26a8b27b
19 files changed
+1083 -353

No files matched your search

+69 -23
View File
@@ -23,7 +23,7 @@ import {
SelectValue,
} from '@/components/ui/select';
import type {
ShakespeareDeployProvider,
NpanelProvider,
NetlifyProvider,
VercelProvider,
NsiteProvider,
@@ -34,7 +34,7 @@ import type {
// Type for provider without the 'id' field (will be generated)
type DeployProviderInput =
| Omit<ShakespeareDeployProvider, 'id'>
| Omit<NpanelProvider, 'id'>
| Omit<NetlifyProvider, 'id'>
| Omit<VercelProvider, 'id'>
| Omit<NsiteProvider, 'id'>
@@ -54,14 +54,14 @@ export function AddCustomProviderDialog({
onAdd,
}: AddCustomProviderDialogProps) {
const { t } = useTranslation();
const [customProviderType, setCustomProviderType] = useState<'shakespeare' | 'netlify' | 'vercel' | 'nsite' | 'cloudflare' | 'deno' | 'railway' | ''>('');
const [customProviderType, setCustomProviderType] = useState<'npanel' | 'netlify' | 'vercel' | 'nsite' | 'cloudflare' | 'deno' | 'railway' | ''>('');
const [customName, setCustomName] = useState('');
const [customApiKey, setCustomApiKey] = useState('');
const [customAccountId, setCustomAccountId] = useState('');
const [customOrganizationId, setCustomOrganizationId] = useState('');
const [customBaseURL, setCustomBaseURL] = useState('');
const [customBaseDomain, setCustomBaseDomain] = useState('');
const [customHost, setCustomHost] = useState('');
const [customDashboardHost, setCustomDashboardHost] = useState('');
const [customProxy, setCustomProxy] = useState(false);
const [customGateway, setCustomGateway] = useState('');
const [customRelayUrls, setCustomRelayUrls] = useState<string[]>([]);
@@ -73,12 +73,15 @@ export function AddCustomProviderDialog({
// Build provider object based on type
let provider: DeployProviderInput;
if (customProviderType === 'shakespeare') {
if (customProviderType === 'npanel') {
if (!customDashboardHost.trim() || !customGateway.trim()) return;
provider = {
type: 'shakespeare',
type: 'npanel',
name: customName.trim(),
...(customHost?.trim() && { host: customHost.trim() }),
...(customProxy && { proxy: true }),
dashboardHost: customDashboardHost.trim(),
domain: customGateway.trim(),
relayUrls: customRelayUrls.length > 0 ? customRelayUrls : ['wss://relay.ditto.pub'],
blossomServers: customBlossomServers.length > 0 ? customBlossomServers : ['https://blossom.ditto.pub/', 'https://blossom.dreamith.to/'],
};
} else if (customProviderType === 'nsite') {
provider = {
@@ -151,7 +154,7 @@ export function AddCustomProviderDialog({
setCustomOrganizationId('');
setCustomBaseURL('');
setCustomBaseDomain('');
setCustomHost('');
setCustomDashboardHost('');
setCustomProxy(false);
setCustomGateway('');
setCustomRelayUrls([]);
@@ -160,12 +163,22 @@ export function AddCustomProviderDialog({
onOpenChange(false);
};
const isValid = customProviderType && customName.trim() &&
(customProviderType === 'shakespeare' || customProviderType === 'nsite' ||
(customApiKey.trim() &&
(customProviderType !== 'cloudflare' || customAccountId.trim()) &&
(customProviderType !== 'deno' || customOrganizationId.trim()) &&
(customProviderType !== 'railway' || true)));
const hasRequiredFields = () => {
// A gateway is named by two hosts and reached with a Nostr key, so there is
// no API key to ask for — but it cannot be guessed at either.
if (customProviderType === 'npanel') {
return Boolean(customDashboardHost.trim() && customGateway.trim());
}
// Plain nsite needs nothing beyond a name: it has defaults for the rest.
if (customProviderType === 'nsite') return true;
if (!customApiKey.trim()) return false;
if (customProviderType === 'cloudflare') return Boolean(customAccountId.trim());
if (customProviderType === 'deno') return Boolean(customOrganizationId.trim());
return true;
};
const isValid = Boolean(customProviderType && customName.trim() && hasRequiredFields());
return (
<Dialog open={open} onOpenChange={onOpenChange}>
@@ -184,7 +197,7 @@ export function AddCustomProviderDialog({
</Label>
<Select
value={customProviderType}
onValueChange={(value: 'shakespeare' | 'netlify' | 'vercel' | 'nsite' | 'cloudflare' | 'deno' | 'railway') => {
onValueChange={(value: 'npanel' | 'netlify' | 'vercel' | 'nsite' | 'cloudflare' | 'deno' | 'railway') => {
setCustomProviderType(value);
// Reset form when provider type changes
setCustomApiKey('');
@@ -192,7 +205,7 @@ export function AddCustomProviderDialog({
setCustomOrganizationId('');
setCustomBaseURL('');
setCustomBaseDomain('');
setCustomHost('');
setCustomDashboardHost('');
setCustomProxy(false);
setCustomGateway('');
setCustomRelayUrls([]);
@@ -203,7 +216,7 @@ export function AddCustomProviderDialog({
<SelectValue placeholder={t('selectProviderType')} />
</SelectTrigger>
<SelectContent>
<SelectItem value="shakespeare">Shakespeare Deploy</SelectItem>
<SelectItem value="npanel">nsite gateway</SelectItem>
<SelectItem value="nsite">nsite</SelectItem>
<SelectItem value="netlify">Netlify</SelectItem>
<SelectItem value="vercel">Vercel</SelectItem>
@@ -228,20 +241,53 @@ export function AddCustomProviderDialog({
/>
</div>
{customProviderType === 'shakespeare' ? (
{customProviderType === 'npanel' ? (
<>
<p className="text-sm text-muted-foreground">
{t('shakespeareDeployNostrAuth')}
</p>
<div className="grid gap-2">
<Label htmlFor="custom-host">Host (Optional)</Label>
<Label htmlFor="custom-domain">
Domain <span className="text-destructive">*</span>
</Label>
<Input
id="custom-host"
id="custom-domain"
placeholder="shakespeare.wtf"
value={customHost}
onChange={(e) => setCustomHost(e.target.value)}
value={customGateway}
onChange={(e) => setCustomGateway(e.target.value)}
/>
<p className="text-xs text-muted-foreground">
Sites get a name under this domain.
</p>
</div>
<div className="grid gap-2">
<Label htmlFor="custom-dashboard-host">
Gateway API <span className="text-destructive">*</span>
</Label>
<Input
id="custom-dashboard-host"
placeholder="npanel.shakespeare.to"
value={customDashboardHost}
onChange={(e) => setCustomDashboardHost(e.target.value)}
/>
<p className="text-xs text-muted-foreground">
Where names are claimed. Usually a different host from the one above.
</p>
</div>
<UrlListEditor
label="Relay URLs"
items={customRelayUrls}
onChange={setCustomRelayUrls}
protocol="wss"
placeholder="relay.ditto.pub"
/>
<UrlListEditor
label="Blossom Servers"
items={customBlossomServers}
onChange={setCustomBlossomServers}
protocol="https"
placeholder="blossom.ditto.pub"
/>
</>
) : customProviderType === 'nsite' ? (
<>