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

+74 -37
View File
@@ -20,7 +20,7 @@ import { Link } from 'react-router-dom';
import type { DeployProvider } from '@/contexts/DeploySettingsContext';
import type { PresetDeployProvider } from '@/lib/deploy/types';
import { PRESET_DEPLOY_PROVIDERS } from '@/lib/deployProviderPresets';
import { ShakespeareDeployForm } from '@/components/deploy/ShakespeareDeployForm';
import { NpanelDeployForm } from '@/components/deploy/NpanelDeployForm';
import { NetlifyDeployForm } from '@/components/deploy/NetlifyDeployForm';
import { VercelDeployForm } from '@/components/deploy/VercelDeployForm';
import { NsiteDeployForm } from '@/components/deploy/NsiteDeployForm';
@@ -29,7 +29,7 @@ import { DenoDeployForm } from '@/components/deploy/DenoDeployForm';
import { RailwayDeployForm } from '@/components/deploy/RailwayDeployForm';
import { cn } from '@/lib/utils';
import { DeployAdapter } from '@/lib/deploy/types';
import { ShakespeareAdapter } from '@/lib/deploy/ShakespeareAdapter';
import { NpanelAdapter } from '@/lib/deploy/NpanelAdapter';
import { NsiteAdapter } from '@/lib/deploy/NsiteAdapter';
import { NetlifyAdapter } from '@/lib/deploy/NetlifyAdapter';
import { VercelAdapter } from '@/lib/deploy/VercelAdapter';
@@ -74,12 +74,11 @@ function renderProviderIcon(provider: DeployProvider, preset: PresetDeployProvid
// Use baseURL from configured provider, falling back to preset baseURL
const baseURL = ('baseURL' in provider && provider.baseURL) || preset?.baseURL;
// For Shakespeare, special handling for host field
const shakespeareUrl = provider.type === 'shakespeare' && 'host' in provider && provider.host
? normalizeUrl(provider.host)
: undefined;
// A gateway is recognised by the domain it serves, not by its API origin —
// that is the name the user picked it for and the one with an icon.
const gatewayUrl = provider.type === 'npanel' ? normalizeUrl(provider.domain) : undefined;
const url = shakespeareUrl || baseURL;
const url = gatewayUrl || baseURL;
if (url) {
return (
@@ -100,8 +99,10 @@ interface DeployStepsProps {
onClose: () => void;
}
interface ShakespeareFormData {
interface NpanelFormData {
subdomain: string;
siteTitle: string;
siteDescription: string;
}
interface NsiteFormData {
@@ -152,7 +153,7 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
const [isDeploying, setIsDeploying] = useState(false);
const [deployResult, setDeployResult] = useState<{ url: string } | null>(null);
const [error, setError] = useState<string | null>(null);
const [isShakespeareFormValid, setIsShakespeareFormValid] = useState(true);
const [isNpanelFormValid, setIsNpanelFormValid] = useState(true);
// .nsite/config.json state — loaded once on mount, used to skip config form on re-deploy
const [nsiteVfsConfig, setNsiteVfsConfig] = useState<NsiteVfsConfig | null>(null);
@@ -187,8 +188,10 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
}, [fs, projectsPath, projectId]);
// Provider-specific form data
const [shakespeareForm, setShakespeareForm] = useState<ShakespeareFormData>({
const [npanelForm, setNpanelForm] = useState<NpanelFormData>({
subdomain: projectId,
siteTitle: projectName || projectId,
siteDescription: '',
});
const [nsiteForm, setNsiteForm] = useState<NsiteFormData>({
siteTitle: '',
@@ -245,18 +248,36 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
let adapter: DeployAdapter;
if (selectedProvider.type === 'shakespeare') {
if (selectedProvider.type === 'npanel') {
if (!user) {
throw new Error('You must be logged in with Nostr to use Shakespeare Deploy');
throw new Error('You must be logged in with Nostr to deploy here.');
}
const shakespeareProvider = selectedProvider;
adapter = new ShakespeareAdapter({
const npanelProvider = selectedProvider;
const subdomain = npanelForm.subdomain.trim();
if (!subdomain) {
throw new Error('Choose an address for this site.');
}
const sourceUrl = await resolveNsiteSourceUrl(
await git.getRemoteURL(projectPath, 'origin')
);
adapter = new NpanelAdapter({
fs,
nostr,
signer: user.signer,
host: shakespeareProvider.host,
subdomain: shakespeareForm.subdomain || undefined,
corsProxy: shakespeareProvider.proxy ? config.corsProxy : undefined,
dashboardHost: npanelProvider.dashboardHost,
domain: npanelProvider.domain,
subdomain,
// The gateway serves the site, so it is also the gateway whose URL the
// underlying nsite deploy reports.
gateway: npanelProvider.domain,
relayUrls: npanelProvider.relayUrls,
blossomServers: npanelProvider.blossomServers,
siteTitle: npanelForm.siteTitle || undefined,
siteDescription: npanelForm.siteDescription || undefined,
sourceUrl,
});
} else if (selectedProvider.type === 'nsite') {
const nsiteProvider = selectedProvider;
@@ -375,12 +396,14 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
});
// Save project-specific settings (updateSettings now automatically sets currentProvider)
if (selectedProvider.type === 'shakespeare') {
if (selectedProvider.type === 'npanel') {
await updateProjectSettings(selectedProviderId, {
type: 'shakespeare',
type: 'npanel',
url: result.url,
data: {
subdomain: shakespeareForm.subdomain || undefined,
subdomain: npanelForm.subdomain.trim() || undefined,
siteTitle: npanelForm.siteTitle || undefined,
siteDescription: npanelForm.siteDescription || undefined,
},
});
} else if (selectedProvider.type === 'nsite') {
@@ -516,7 +539,7 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
setDeployResult(null);
setError(null);
// Reset forms
setShakespeareForm({ subdomain: projectId });
setNpanelForm({ subdomain: projectId, siteTitle: projectName || projectId, siteDescription: '' });
setNsiteForm({ siteTitle: '', siteDescription: '', dTag: '' });
setNetlifyForm({ siteId: '', siteName: '' });
setVercelForm({ projectName: projectName || projectId, teamId: '' });
@@ -528,12 +551,20 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
onClose();
};
const handleShakespeareSubdomainChange = useCallback((subdomain: string) => {
setShakespeareForm({ subdomain });
const handleNpanelSubdomainChange = useCallback((subdomain: string) => {
setNpanelForm(prev => ({ ...prev, subdomain }));
}, []);
const handleShakespeareValidationChange = useCallback((isValid: boolean) => {
setIsShakespeareFormValid(isValid);
const handleNpanelSiteTitleChange = useCallback((siteTitle: string) => {
setNpanelForm(prev => ({ ...prev, siteTitle }));
}, []);
const handleNpanelSiteDescriptionChange = useCallback((siteDescription: string) => {
setNpanelForm(prev => ({ ...prev, siteDescription }));
}, []);
const handleNpanelValidationChange = useCallback((isValid: boolean) => {
setIsNpanelFormValid(isValid);
}, []);
const handleNsiteSiteTitleChange = useCallback((siteTitle: string) => {
@@ -578,18 +609,24 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
const renderProviderFields = () => {
if (!selectedProvider) return null;
if (selectedProvider.type === 'shakespeare') {
const shakespeareProvider = selectedProvider;
if (selectedProvider.type === 'npanel') {
const npanelProvider = selectedProvider;
const savedConfig = projectSettings.providers[selectedProviderId];
const savedSubdomain = savedConfig?.type === 'shakespeare' ? savedConfig.data.subdomain : undefined;
const saved = savedConfig?.type === 'npanel' ? savedConfig.data : undefined;
return (
<ShakespeareDeployForm
host={shakespeareProvider.host}
<NpanelDeployForm
dashboardHost={npanelProvider.dashboardHost}
domain={npanelProvider.domain}
projectId={projectId}
savedSubdomain={savedSubdomain}
onSubdomainChange={handleShakespeareSubdomainChange}
onValidationChange={handleShakespeareValidationChange}
projectName={projectName}
savedSubdomain={saved?.subdomain}
savedSiteTitle={saved?.siteTitle}
savedSiteDescription={saved?.siteDescription}
onSubdomainChange={handleNpanelSubdomainChange}
onSiteTitleChange={handleNpanelSiteTitleChange}
onSiteDescriptionChange={handleNpanelSiteDescriptionChange}
onValidationChange={handleNpanelValidationChange}
/>
);
}
@@ -906,11 +943,11 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
{selectedProvider && renderProviderFields()}
{selectedProvider?.type === 'shakespeare' && !user && (
{selectedProvider?.type === 'npanel' && !user && (
<Alert>
<AlertCircle className="h-4 w-4" />
<AlertDescription>
You must be logged in with Nostr to use Shakespeare Deploy.{' '}
You must be logged in with Nostr to publish a site.{' '}
<Link
to="/settings/nostr"
className="underline hover:no-underline"
@@ -950,8 +987,8 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
onClick={handleDeploy}
disabled={
isDeploying ||
(selectedProvider.type === 'shakespeare' && !user) ||
(selectedProvider.type === 'shakespeare' && !isShakespeareFormValid) ||
(selectedProvider.type === 'npanel' && !user) ||
(selectedProvider.type === 'npanel' && !isNpanelFormValid) ||
(selectedProvider.type === 'nsite' && !user) ||
(selectedProvider.type === 'nsite' && !nsiteForm.dTag) ||
(selectedProvider.type === 'netlify' && !netlifyForm.siteId && !netlifyForm.siteName) ||