mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
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.
86 lines
2.2 KiB
TypeScript
86 lines
2.2 KiB
TypeScript
import { createContext } from 'react';
|
|
|
|
export interface BaseDeployProvider {
|
|
id: string;
|
|
name: string;
|
|
}
|
|
|
|
/**
|
|
* A gateway that serves nsites under a domain it hands out names on.
|
|
*
|
|
* The site is an ordinary nsite under the user's own key; what the gateway adds
|
|
* is the hostname, which it has to be asked for. `dashboardHost` is where that
|
|
* asking happens and `domain` is what the site is served under — usually two
|
|
* different names, and never assumed to be the same one.
|
|
*/
|
|
export interface NpanelProvider extends BaseDeployProvider {
|
|
type: 'npanel';
|
|
dashboardHost: string;
|
|
domain: string;
|
|
relayUrls: string[];
|
|
blossomServers: string[];
|
|
}
|
|
|
|
export interface NetlifyProvider extends BaseDeployProvider {
|
|
type: 'netlify';
|
|
apiKey: string;
|
|
baseURL?: string;
|
|
proxy?: boolean;
|
|
}
|
|
|
|
export interface VercelProvider extends BaseDeployProvider {
|
|
type: 'vercel';
|
|
apiKey: string;
|
|
baseURL?: string;
|
|
proxy?: boolean;
|
|
}
|
|
|
|
export interface NsiteProvider extends BaseDeployProvider {
|
|
type: 'nsite';
|
|
gateway: string;
|
|
relayUrls: string[];
|
|
blossomServers: string[];
|
|
}
|
|
|
|
export interface CloudflareProvider extends BaseDeployProvider {
|
|
type: 'cloudflare';
|
|
apiKey: string;
|
|
accountId: string;
|
|
baseURL?: string;
|
|
baseDomain?: string;
|
|
proxy?: boolean;
|
|
}
|
|
|
|
export interface DenoDeployProvider extends BaseDeployProvider {
|
|
type: 'deno';
|
|
apiKey: string;
|
|
organizationId: string;
|
|
baseURL?: string;
|
|
baseDomain?: string;
|
|
proxy?: boolean;
|
|
}
|
|
|
|
export interface RailwayProvider extends BaseDeployProvider {
|
|
type: 'railway';
|
|
apiKey: string;
|
|
baseURL?: string;
|
|
proxy?: boolean;
|
|
}
|
|
|
|
export type DeployProvider = NpanelProvider | NetlifyProvider | VercelProvider | NsiteProvider | CloudflareProvider | DenoDeployProvider | RailwayProvider;
|
|
|
|
export interface DeploySettings {
|
|
providers: DeployProvider[];
|
|
}
|
|
|
|
export interface DeploySettingsContextType {
|
|
settings: DeploySettings;
|
|
updateSettings: (settings: Partial<DeploySettings>) => void;
|
|
removeProvider: (index: number) => void;
|
|
setProviders: (providers: DeployProvider[]) => void;
|
|
isConfigured: boolean;
|
|
isInitialized: boolean;
|
|
}
|
|
|
|
export const DeploySettingsContext = createContext<DeploySettingsContextType | undefined>(undefined);
|