mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-03 07:57:22 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
710cf8b6ef | ||
|
|
502fa612e0 | ||
|
|
90d6bc50b9 | ||
|
|
9c48425c01 | ||
|
|
344a73c6c3 | ||
|
|
4928819a0e | ||
|
|
9d91542ec6 |
No files matched your search
@@ -28,24 +28,6 @@ test:
|
||||
- npm run build
|
||||
- npm run test
|
||||
|
||||
deploy:
|
||||
stage: deploy
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
when: never
|
||||
- if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $DEPLOY_SSH_KEY && $DEPLOY_TARGET
|
||||
script:
|
||||
- npm ci
|
||||
- npm run build
|
||||
- cp dist/index.html dist/404.html
|
||||
- apt-get update -qq && apt-get install -y --no-install-recommends rsync openssh-client >/dev/null
|
||||
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
|
||||
- echo "$DEPLOY_SSH_KEY" | tr -d '\r' > ~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519
|
||||
- ssh-keyscan -H "${DEPLOY_TARGET##*@}" >> ~/.ssh/known_hosts 2>/dev/null
|
||||
- rsync -av --exclude=/sw.js --exclude=/index.html -e "ssh -i ~/.ssh/id_ed25519" dist/ "${DEPLOY_TARGET}:/"
|
||||
- rsync -av -e "ssh -i ~/.ssh/id_ed25519" dist/index.html "${DEPLOY_TARGET}:/"
|
||||
- rsync -av -e "ssh -i ~/.ssh/id_ed25519" dist/sw.js "${DEPLOY_TARGET}:/"
|
||||
|
||||
deploy-nsite:
|
||||
stage: deploy
|
||||
timeout: 10 minutes
|
||||
|
||||
@@ -1,5 +1,23 @@
|
||||
# Changelog
|
||||
|
||||
## [9.16.3] - 2026-09-14
|
||||
|
||||
### Added
|
||||
- Take back your sites one at a time — every name waiting for you now has its own Publish, Show, and Delete buttons, so you can keep the few you want and clear out the rest
|
||||
- Show opens a site by its Nostr address before you decide about it, so you can look at names that never loaded in a browser
|
||||
|
||||
### Changed
|
||||
- Deleting a name only gives it up on shakespeare.wtf — anything published to Nostr stays yours
|
||||
- Names that couldn't be taken back safely can now be cleared out, instead of only explaining why they were stuck
|
||||
|
||||
## [9.16.2] - 2026-09-13
|
||||
|
||||
### Changed
|
||||
- Deploy settings now says how many of your names are waiting to be taken back, and stays quiet when there are none
|
||||
|
||||
### Fixed
|
||||
- Names you published before shakespeare.wtf changed hands are recognized as yours as you type them — the Deploy screen offers to hand them back instead of reporting them taken by somebody else
|
||||
|
||||
## [9.16.1] - 2026-09-13
|
||||
|
||||
### Fixed
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "shakespeare.diy",
|
||||
"version": "9.15.0",
|
||||
"version": "9.16.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "shakespeare.diy",
|
||||
"version": "9.15.0",
|
||||
"version": "9.16.2",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"@capacitor/app": "^8.1.0",
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
"description": "Build custom apps with AI assistance using Shakespeare, an open-source development environment",
|
||||
"homepage": "https://shakespeare.diy",
|
||||
"license": "AGPL-3.0-or-later",
|
||||
"version": "9.16.1",
|
||||
"version": "9.16.3",
|
||||
"type": "module",
|
||||
"author": {
|
||||
"name": "shakespeare.diy",
|
||||
|
||||
@@ -1,5 +1,23 @@
|
||||
# Changelog
|
||||
|
||||
## [9.16.3] - 2026-09-14
|
||||
|
||||
### Added
|
||||
- Take back your sites one at a time — every name waiting for you now has its own Publish, Show, and Delete buttons, so you can keep the few you want and clear out the rest
|
||||
- Show opens a site by its Nostr address before you decide about it, so you can look at names that never loaded in a browser
|
||||
|
||||
### Changed
|
||||
- Deleting a name only gives it up on shakespeare.wtf — anything published to Nostr stays yours
|
||||
- Names that couldn't be taken back safely can now be cleared out, instead of only explaining why they were stuck
|
||||
|
||||
## [9.16.2] - 2026-09-13
|
||||
|
||||
### Changed
|
||||
- Deploy settings now says how many of your names are waiting to be taken back, and stays quiet when there are none
|
||||
|
||||
### Fixed
|
||||
- Names you published before shakespeare.wtf changed hands are recognized as yours as you type them — the Deploy screen offers to hand them back instead of reporting them taken by somebody else
|
||||
|
||||
## [9.16.1] - 2026-09-13
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -17,7 +17,8 @@ import { useNostrPublish } from '@/hooks/useNostrPublish';
|
||||
import { useGit } from '@/hooks/useGit';
|
||||
import { NostrURI } from '@/lib/NostrURI';
|
||||
import { Link } from 'react-router-dom';
|
||||
import type { DeployProvider } from '@/contexts/DeploySettingsContext';
|
||||
import type { DeployProvider, NpanelProvider } from '@/contexts/DeploySettingsContext';
|
||||
import { NpanelMigrationDialog } from '@/components/deploy/NpanelMigrationDialog';
|
||||
import type { PresetDeployProvider } from '@/lib/deploy/types';
|
||||
import { PRESET_DEPLOY_PROVIDERS } from '@/lib/deployProviderPresets';
|
||||
import { NpanelDeployForm } from '@/components/deploy/NpanelDeployForm';
|
||||
@@ -154,6 +155,24 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
|
||||
const [deployResult, setDeployResult] = useState<{ url: string } | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [isNpanelFormValid, setIsNpanelFormValid] = useState(true);
|
||||
/**
|
||||
* The gateway whose held names are being looked at, if any.
|
||||
*
|
||||
* Owned here rather than by the name field, because what someone recognising
|
||||
* one of their names wants is usually all of them, and because the dialog
|
||||
* that hands them back outlives the field that prompted it.
|
||||
*/
|
||||
const [migratingProvider, setMigratingProvider] = useState<NpanelProvider | null>(null);
|
||||
|
||||
/**
|
||||
* Whether the deploy failed because the gateway is holding the name for this
|
||||
* user, which is a refusal with something to do about it.
|
||||
*
|
||||
* Read off the sentence npanel sent rather than a status code, since the 409
|
||||
* it arrives as also covers a name somebody else holds and a name that is
|
||||
* simply configured already.
|
||||
*/
|
||||
const heldName = error !== null && /being held for you/i.test(error);
|
||||
|
||||
// .nsite/config.json state — loaded once on mount, used to skip config form on re-deploy
|
||||
const [nsiteVfsConfig, setNsiteVfsConfig] = useState<NsiteVfsConfig | null>(null);
|
||||
@@ -627,6 +646,7 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
|
||||
onSiteTitleChange={handleNpanelSiteTitleChange}
|
||||
onSiteDescriptionChange={handleNpanelSiteDescriptionChange}
|
||||
onValidationChange={handleNpanelValidationChange}
|
||||
onTakeBackSites={() => setMigratingProvider(npanelProvider)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -978,7 +998,22 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
|
||||
{error && (
|
||||
<Alert variant="destructive">
|
||||
<AlertCircle className="h-4 w-4" />
|
||||
<AlertDescription>{error}</AlertDescription>
|
||||
<AlertDescription className="space-y-2">
|
||||
<p>{error}</p>
|
||||
{/* The gateway refuses a name it is holding for this user
|
||||
and says to take it back instead. Saying so and leaving
|
||||
them to find out where is the worst of both. */}
|
||||
{heldName && selectedProvider?.type === 'npanel' && (
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => setMigratingProvider(selectedProvider)}
|
||||
>
|
||||
Take back your sites
|
||||
</Button>
|
||||
)}
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
@@ -1015,6 +1050,14 @@ export function DeploySteps({ projectId, projectName, onClose }: DeployStepsProp
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{migratingProvider && (
|
||||
<NpanelMigrationDialog
|
||||
open
|
||||
onOpenChange={(open) => !open && setMigratingProvider(null)}
|
||||
provider={migratingProvider}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useState, useEffect, useRef, useCallback } from 'react';
|
||||
import { AlertCircle, Check, Loader2 } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Label } from '@/components/ui/label';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Textarea } from '@/components/ui/textarea';
|
||||
@@ -24,12 +25,21 @@ interface NpanelDeployFormProps {
|
||||
onSiteTitleChange: (title: string) => void;
|
||||
onSiteDescriptionChange: (description: string) => void;
|
||||
onValidationChange?: (isValid: boolean) => void;
|
||||
/**
|
||||
* Open the list of names this gateway is holding for whoever signs in.
|
||||
*
|
||||
* Passed in rather than opened here: recognising one name is usually not the
|
||||
* whole of what somebody has waiting, and the dialog that hands them all back
|
||||
* belongs above this field rather than inside it.
|
||||
*/
|
||||
onTakeBackSites?: () => void;
|
||||
}
|
||||
|
||||
/** What the field is currently saying about the name in it. */
|
||||
type NameState =
|
||||
| { kind: 'empty' }
|
||||
| { kind: 'mine' }
|
||||
| { kind: 'waiting' }
|
||||
| { kind: 'checking' }
|
||||
| { kind: 'free' }
|
||||
| { kind: 'unavailable'; message: string };
|
||||
@@ -40,6 +50,11 @@ function describe(availability: NameAvailability, domain: string): NameState {
|
||||
// there rather than taking anything.
|
||||
if (availability.reason === 'mine') return { kind: 'mine' };
|
||||
|
||||
// Theirs from before the gateway, and still held for them. Not somewhere
|
||||
// they can deploy until they take it back, which is a thing they can do
|
||||
// from here rather than a wall.
|
||||
if (availability.reason === 'waiting') return { kind: 'waiting' };
|
||||
|
||||
if (availability.available) return { kind: 'free' };
|
||||
|
||||
if (availability.reason === 'taken') {
|
||||
@@ -61,6 +76,7 @@ export function NpanelDeployForm({
|
||||
onSiteTitleChange,
|
||||
onSiteDescriptionChange,
|
||||
onValidationChange,
|
||||
onTakeBackSites,
|
||||
}: NpanelDeployFormProps) {
|
||||
const { user } = useCurrentUser();
|
||||
const [subdomain, setSubdomain] = useState(savedSubdomain || projectId);
|
||||
@@ -134,7 +150,11 @@ export function NpanelDeployForm({
|
||||
// A name still being checked stays deployable: the gateway decides for real
|
||||
// when the deploy runs, and blocking the button on an in-flight request would
|
||||
// make the form feel stuck on a slow connection.
|
||||
const isValid = subdomain.trim() !== '' && nameState.kind !== 'unavailable';
|
||||
// A name still waiting is not one to deploy to: the gateway would refuse,
|
||||
// because taking it back is what turns it into somewhere this user can
|
||||
// publish. The field says so and offers the step rather than the refusal.
|
||||
const isValid =
|
||||
subdomain.trim() !== '' && nameState.kind !== 'unavailable' && nameState.kind !== 'waiting';
|
||||
|
||||
useEffect(() => {
|
||||
onValidationChange?.(isValid);
|
||||
@@ -194,6 +214,24 @@ export function NpanelDeployForm({
|
||||
</p>
|
||||
)}
|
||||
|
||||
{nameState.kind === 'waiting' && (
|
||||
<div className="rounded-md border border-dashed p-3 space-y-2">
|
||||
<p className="text-sm">
|
||||
<span className="font-mono">{subdomain.trim()}.{domain}</span> is being held for you.
|
||||
</p>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
You published it before {domain} moved to this gateway. It is being served from an
|
||||
archive until you take it back, which publishes your own copy and points the name at
|
||||
it.
|
||||
</p>
|
||||
{onTakeBackSites && (
|
||||
<Button type="button" variant="outline" size="sm" onClick={onTakeBackSites}>
|
||||
Take back your sites
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{nameState.kind === 'unavailable' && (
|
||||
<div className="flex items-start gap-2 text-sm text-destructive">
|
||||
<AlertCircle className="h-4 w-4 mt-0.5 flex-shrink-0" />
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { useState } from 'react';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { useNostr } from '@nostrify/react';
|
||||
import { AlertCircle, Check, ExternalLink, Loader2, Rocket, Trash2 } from 'lucide-react';
|
||||
import type { NostrEvent } from '@nostrify/nostrify';
|
||||
import { AlertCircle, Check, ExternalLink, Eye, Loader2, Rocket, Tag, Trash2 } from 'lucide-react';
|
||||
import type { LucideIcon } from 'lucide-react';
|
||||
import {
|
||||
Dialog,
|
||||
DialogContent,
|
||||
@@ -10,14 +12,30 @@ import {
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from '@/components/ui/dialog';
|
||||
import {
|
||||
AlertDialog,
|
||||
AlertDialogAction,
|
||||
AlertDialogCancel,
|
||||
AlertDialogContent,
|
||||
AlertDialogDescription,
|
||||
AlertDialogFooter,
|
||||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
} from '@/components/ui/alert-dialog';
|
||||
import { Alert, AlertDescription } from '@/components/ui/alert';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Skeleton } from '@/components/ui/skeleton';
|
||||
import { useCurrentUser } from '@/hooks/useCurrentUser';
|
||||
import { useNpanelClaims, type NpanelClaimPlan, type NpanelTakenSite } from '@/hooks/useNpanelClaims';
|
||||
import type { NpanelProvider } from '@/contexts/DeploySettingsContext';
|
||||
import { claimNpanelHostname } from '@/lib/deploy/npanelApi';
|
||||
import { NAMED_SITE_KIND, republishTags, retitleTags } from '@/lib/deploy/npanelMigration';
|
||||
import { claimNpanelHostname, deleteNpanelClaim } from '@/lib/deploy/npanelApi';
|
||||
import {
|
||||
NAMED_SITE_KIND,
|
||||
nsitePreviewUrl,
|
||||
republishTags,
|
||||
retitleTags,
|
||||
sitePreviewUrl,
|
||||
} from '@/lib/deploy/npanelMigration';
|
||||
import { checkRelayCoverage, forwardMissing, host, publishToRelays } from '@/lib/deploy/publishToRelays';
|
||||
|
||||
/** Where a single name has got to. */
|
||||
@@ -25,9 +43,18 @@ type RowStatus =
|
||||
| { kind: 'waiting' }
|
||||
| { kind: 'publishing' }
|
||||
| { kind: 'claiming' }
|
||||
| { kind: 'deleting' }
|
||||
| { kind: 'deleted'; note?: string }
|
||||
| { kind: 'done'; partial?: string }
|
||||
| { kind: 'failed'; error: string };
|
||||
|
||||
/** A name a person has asked to delete, and has not confirmed yet. */
|
||||
interface PendingDeletion {
|
||||
hostname: string;
|
||||
/** Whether a copy of the site is published under their own key. */
|
||||
published: boolean;
|
||||
}
|
||||
|
||||
/** What the last coverage run found, as a sentence per relay. */
|
||||
interface CoverageReport {
|
||||
lines: string[];
|
||||
@@ -52,6 +79,11 @@ function describeStep(claim: NpanelClaimPlan): string {
|
||||
}
|
||||
}
|
||||
|
||||
/** The `d` tag of an event, which for a named site is the site's identifier. */
|
||||
function eventIdentifier(event: NostrEvent): string {
|
||||
return event.tags.find(([name]) => name === 'd')?.[1] ?? '';
|
||||
}
|
||||
|
||||
/** "took 3 of 5 relays", where that is worth saying. */
|
||||
function coverageNote(accepted: string[], rejected: { url: string; reason: string }[]): string | undefined {
|
||||
if (!rejected.length) return undefined;
|
||||
@@ -66,8 +98,11 @@ export function NpanelMigrationDialog({ open, onOpenChange, provider }: NpanelMi
|
||||
const { data, isLoading, error } = useNpanelClaims(open ? provider : undefined);
|
||||
|
||||
const [statuses, setStatuses] = useState<Record<string, RowStatus>>({});
|
||||
const [running, setRunning] = useState<null | 'migrate' | 'titles' | 'coverage'>(null);
|
||||
const [running, setRunning] = useState<null | 'migrate' | 'titles' | 'coverage' | 'row'>(null);
|
||||
const [coverage, setCoverage] = useState<CoverageReport | null>(null);
|
||||
const [confirming, setConfirming] = useState<PendingDeletion | null>(null);
|
||||
/** Whether anything has happened that the cached lists do not know about. */
|
||||
const [dirty, setDirty] = useState(false);
|
||||
|
||||
const claims = data?.waiting ?? [];
|
||||
const actionable = claims.filter((claim) => claim.step.kind !== 'blocked');
|
||||
@@ -77,12 +112,19 @@ export function NpanelMigrationDialog({ open, onOpenChange, provider }: NpanelMi
|
||||
const strays = (data?.taken ?? []).filter((site) => site.stray);
|
||||
|
||||
const done = Object.values(statuses).filter((status) => status.kind === 'done').length;
|
||||
const deleted = Object.values(statuses).filter((status) => status.kind === 'deleted').length;
|
||||
const failed = Object.values(statuses).filter((status) => status.kind === 'failed').length;
|
||||
|
||||
const setStatus = (hostname: string, status: RowStatus) => {
|
||||
setStatuses((previous) => ({ ...previous, [hostname]: status }));
|
||||
};
|
||||
|
||||
/** Whether a row has already reached a state no further action applies to. */
|
||||
const settled = (hostname: string): boolean => {
|
||||
const kind = statuses[hostname]?.kind;
|
||||
return kind === 'done' || kind === 'deleted';
|
||||
};
|
||||
|
||||
/**
|
||||
* Take back one name.
|
||||
*
|
||||
@@ -145,33 +187,54 @@ export function NpanelMigrationDialog({ open, onOpenChange, provider }: NpanelMi
|
||||
});
|
||||
};
|
||||
|
||||
/** Ask a relay to forget a manifest that was published for an unusable name. */
|
||||
/**
|
||||
* Give a name up rather than take it back.
|
||||
*
|
||||
* Only npanel forgets anything. The archive's manifest stays on relays under
|
||||
* the archive's key, and a copy published under the user's own key stays
|
||||
* theirs — what ends is this gateway serving the name and holding it for
|
||||
* them. Saying otherwise in the confirmation would be a promise nothing here
|
||||
* can keep.
|
||||
*/
|
||||
const removeClaim = async (hostname: string): Promise<void> => {
|
||||
if (!user) return;
|
||||
|
||||
setStatus(hostname, { kind: 'deleting' });
|
||||
await deleteNpanelClaim(provider.dashboardHost, user.signer, hostname);
|
||||
setStatus(hostname, { kind: 'deleted' });
|
||||
};
|
||||
|
||||
/**
|
||||
* Undo a manifest published for a name that can never load.
|
||||
*
|
||||
* Both halves, because there is no useful middle state: a relay is asked to
|
||||
* forget the event, and the gateway to forget the name. Keeping the record
|
||||
* for a hostname whose TLS handshake has always failed and always will would
|
||||
* leave a row in this list forever with nothing to do about it.
|
||||
*
|
||||
* The gateway going second is deliberate — it is the recoverable half. A
|
||||
* deletion request cannot be taken back, so it is the one that has to be
|
||||
* worth making on its own.
|
||||
*/
|
||||
const removeStray = async (site: NpanelTakenSite): Promise<void> => {
|
||||
if (!user) return;
|
||||
|
||||
setStatus(site.hostname, { kind: 'publishing' });
|
||||
|
||||
try {
|
||||
const identifier = site.event.tags.find(([name]) => name === 'd')?.[1] ?? '';
|
||||
const deletion = await user.signer.signEvent({
|
||||
kind: 5,
|
||||
content: 'Published for a hostname no certificate can cover.',
|
||||
created_at: Math.floor(Date.now() / 1000),
|
||||
tags: [
|
||||
['e', site.event.id],
|
||||
['a', `${site.event.kind}:${user.pubkey}:${identifier}`],
|
||||
['k', String(site.event.kind)],
|
||||
],
|
||||
});
|
||||
const deletion = await user.signer.signEvent({
|
||||
kind: 5,
|
||||
content: 'Published for a hostname no certificate can cover.',
|
||||
created_at: Math.floor(Date.now() / 1000),
|
||||
tags: [
|
||||
['e', site.event.id],
|
||||
['a', `${site.event.kind}:${user.pubkey}:${eventIdentifier(site.event)}`],
|
||||
['k', String(site.event.kind)],
|
||||
],
|
||||
});
|
||||
|
||||
await publishToRelays(nostr, deletion, provider.relayUrls);
|
||||
setStatus(site.hostname, { kind: 'done' });
|
||||
} catch (err) {
|
||||
setStatus(site.hostname, {
|
||||
kind: 'failed',
|
||||
error: err instanceof Error ? err.message : 'Failed',
|
||||
});
|
||||
}
|
||||
await publishToRelays(nostr, deletion, provider.relayUrls);
|
||||
await removeClaim(site.hostname);
|
||||
setStatus(site.hostname, { kind: 'deleted', note: 'Retracted, and taken off the gateway.' });
|
||||
};
|
||||
|
||||
/** Run `action` over `rows`, one at a time, recording failures per row. */
|
||||
@@ -181,7 +244,7 @@ export function NpanelMigrationDialog({ open, onOpenChange, provider }: NpanelMi
|
||||
action: (row: T) => Promise<void>,
|
||||
): Promise<void> => {
|
||||
for (const row of rows) {
|
||||
if (statuses[key(row)]?.kind === 'done') continue;
|
||||
if (settled(key(row))) continue;
|
||||
|
||||
try {
|
||||
await action(row);
|
||||
@@ -194,6 +257,30 @@ export function NpanelMigrationDialog({ open, onOpenChange, provider }: NpanelMi
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* One row's action, on its own.
|
||||
*
|
||||
* Still holds the whole dialog while it runs. A signer answers one request at
|
||||
* a time whatever the UI allows, and two buttons that look live but queue
|
||||
* behind each other read as a hang.
|
||||
*/
|
||||
const runRow = async (hostname: string, action: () => Promise<void>): Promise<void> => {
|
||||
setRunning('row');
|
||||
|
||||
try {
|
||||
await action();
|
||||
// Deliberately not refetched here. Somebody clearing out twenty sites
|
||||
// clicks twenty times, and re-reading the list after each one would cost
|
||||
// a signature and a relay round trip to learn what the row already says.
|
||||
// The list is caught up when the dialog closes.
|
||||
setDirty(true);
|
||||
} catch (err) {
|
||||
setStatus(hostname, { kind: 'failed', error: err instanceof Error ? err.message : 'Failed' });
|
||||
}
|
||||
|
||||
setRunning(null);
|
||||
};
|
||||
|
||||
const migrateAll = async () => {
|
||||
setRunning('migrate');
|
||||
// One at a time: a remote signer answers one request at a time anyway, and
|
||||
@@ -201,6 +288,7 @@ export function NpanelMigrationDialog({ open, onOpenChange, provider }: NpanelMi
|
||||
// than a hundred simultaneous errors.
|
||||
await runEach(actionable, (claim) => claim.hostname, migrate);
|
||||
setRunning(null);
|
||||
setDirty(true);
|
||||
// Whatever succeeded is no longer waiting, and whatever failed still is.
|
||||
queryClient.invalidateQueries({ queryKey: ['npanel-claims'] });
|
||||
};
|
||||
@@ -209,6 +297,7 @@ export function NpanelMigrationDialog({ open, onOpenChange, provider }: NpanelMi
|
||||
setRunning('titles');
|
||||
await runEach(retitlable, (site) => site.hostname, retitle);
|
||||
setRunning(null);
|
||||
setDirty(true);
|
||||
queryClient.invalidateQueries({ queryKey: ['npanel-claims'] });
|
||||
};
|
||||
|
||||
@@ -268,6 +357,19 @@ export function NpanelMigrationDialog({ open, onOpenChange, provider }: NpanelMi
|
||||
<Loader2 className="h-3 w-3 animate-spin" /> Claiming…
|
||||
</span>
|
||||
);
|
||||
case 'deleting':
|
||||
return (
|
||||
<span className="flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||
<Loader2 className="h-3 w-3 animate-spin" /> Deleting…
|
||||
</span>
|
||||
);
|
||||
case 'deleted':
|
||||
return (
|
||||
<span className="flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||
<Check className="h-3 w-3 shrink-0" />
|
||||
{status.note ?? `Deleted from ${provider.domain}.`}
|
||||
</span>
|
||||
);
|
||||
case 'done':
|
||||
return (
|
||||
<span className="flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||
@@ -295,191 +397,349 @@ export function NpanelMigrationDialog({ open, onOpenChange, provider }: NpanelMi
|
||||
|
||||
const busy = running !== null;
|
||||
|
||||
/** Names still worth running the bulk button over. */
|
||||
const remaining = actionable.filter((claim) => !settled(claim.hostname)).length;
|
||||
|
||||
/**
|
||||
* Where this sitting has got to, said once.
|
||||
*
|
||||
* Deleting is reported alongside taking names back rather than folded into
|
||||
* it, because they are opposite decisions and somebody who has just made
|
||||
* thirty of them should be able to see that they did.
|
||||
*/
|
||||
const summary = (() => {
|
||||
const parts: string[] = [];
|
||||
if (done) parts.push(`${done} done`);
|
||||
if (deleted) parts.push(`${deleted} deleted`);
|
||||
if (failed) parts.push(`${failed} failed`);
|
||||
|
||||
if (failed) return `${parts.join(', ')} — try the failed ones again.`;
|
||||
if (parts.length) {
|
||||
return `${parts.join(', ')}. A republished site takes the gateway about a minute to pick up.`;
|
||||
}
|
||||
return `${remaining} to migrate.`;
|
||||
})();
|
||||
|
||||
/**
|
||||
* Close, and let the lists catch up.
|
||||
*
|
||||
* Marked stale rather than refetched: the query is disabled while the dialog
|
||||
* is shut, so nothing is asked until somebody opens it again — and asking
|
||||
* costs a signature, which on a remote signer costs a round trip.
|
||||
*/
|
||||
const close = () => {
|
||||
if (dirty) {
|
||||
queryClient.invalidateQueries({ queryKey: ['npanel-claims'] });
|
||||
queryClient.invalidateQueries({ queryKey: ['npanel-claim-count'] });
|
||||
}
|
||||
onOpenChange(false);
|
||||
};
|
||||
|
||||
/**
|
||||
* What can be done about one name, minus whatever does not apply to it.
|
||||
*
|
||||
* Every row gets its own controls rather than only the bulk button, because
|
||||
* the list is not a queue of decisions already made. Somebody with forty
|
||||
* names on file wants three of them back and the rest gone, and until now the
|
||||
* only thing the dialog would do was hand them all forty.
|
||||
*/
|
||||
const renderActions = (
|
||||
hostname: string,
|
||||
options: {
|
||||
/** Where the site can be looked at, when anywhere can show it. */
|
||||
preview?: string;
|
||||
/** The one thing this row's section does to a name that is staying. */
|
||||
act?: { label: string; icon: LucideIcon; run: () => Promise<void> };
|
||||
/** Present when the name can be given up. `published` decides what the confirmation promises. */
|
||||
deletable?: { published: boolean };
|
||||
},
|
||||
) => {
|
||||
const gone = settled(hostname);
|
||||
const ActionIcon = options.act?.icon;
|
||||
|
||||
return (
|
||||
<div className="shrink-0 flex items-center gap-1">
|
||||
{options.preview && (
|
||||
<Button size="sm" variant="ghost" className="h-8 px-2 text-muted-foreground" asChild>
|
||||
<a href={options.preview} target="_blank" rel="noreferrer">
|
||||
<Eye className="h-4 w-4 sm:mr-1.5" />
|
||||
<span className="hidden sm:inline">Show</span>
|
||||
</a>
|
||||
</Button>
|
||||
)}
|
||||
|
||||
{options.act && ActionIcon && !gone && (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
className="h-8 px-2"
|
||||
disabled={busy}
|
||||
onClick={() => runRow(hostname, options.act!.run)}
|
||||
>
|
||||
<ActionIcon className="h-4 w-4 sm:mr-1.5" />
|
||||
<span className="hidden sm:inline">{options.act.label}</span>
|
||||
</Button>
|
||||
)}
|
||||
|
||||
{options.deletable && !gone && (
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
className="h-8 px-2 text-muted-foreground hover:text-destructive"
|
||||
disabled={busy}
|
||||
aria-label={`Delete ${hostname}`}
|
||||
onClick={() => setConfirming({ hostname, published: options.deletable!.published })}
|
||||
>
|
||||
<Trash2 className="h-4 w-4" />
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={busy ? undefined : onOpenChange}>
|
||||
<DialogContent className="max-w-2xl max-h-[85vh] flex flex-col">
|
||||
<DialogHeader className="shrink-0">
|
||||
<DialogTitle>Take back your sites</DialogTitle>
|
||||
<DialogDescription>
|
||||
These names on {provider.domain} were yours before this gateway took the domain over.
|
||||
They are being served from an archive key until you publish your own copy.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<>
|
||||
<Dialog open={open} onOpenChange={busy ? undefined : (next) => (next ? onOpenChange(true) : close())}>
|
||||
<DialogContent className="max-w-2xl max-h-[85vh] flex flex-col">
|
||||
<DialogHeader className="shrink-0">
|
||||
<DialogTitle>Take back your sites</DialogTitle>
|
||||
<DialogDescription>
|
||||
These names on {provider.domain} were yours before this gateway took the domain over.
|
||||
They are being served from an archive key until you publish your own copy.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
<div className="flex-1 overflow-y-auto space-y-6 py-2">
|
||||
{isLoading && (
|
||||
<div className="space-y-2">
|
||||
<Skeleton className="h-12 w-full" />
|
||||
<Skeleton className="h-12 w-full" />
|
||||
<Skeleton className="h-12 w-full" />
|
||||
</div>
|
||||
)}
|
||||
|
||||
{error && (
|
||||
<Alert variant="destructive">
|
||||
<AlertCircle className="h-4 w-4" />
|
||||
<AlertDescription>{error.message}</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
{data && !claims.length && !data.taken.length && (
|
||||
<p className="text-sm text-muted-foreground py-8 text-center">
|
||||
Nothing is waiting for you here.
|
||||
</p>
|
||||
)}
|
||||
|
||||
{actionable.length > 0 && (
|
||||
<div className="space-y-2">
|
||||
<h4 className="text-sm font-medium">Waiting for you</h4>
|
||||
<div className="rounded-md border divide-y">
|
||||
{actionable.map((claim) => (
|
||||
<div key={claim.hostname} className="flex items-center justify-between gap-4 p-3">
|
||||
<div className="min-w-0">
|
||||
<div className="font-mono text-sm truncate">{claim.hostname}</div>
|
||||
<div className="truncate">{renderStatus(claim.hostname, describeStep(claim))}</div>
|
||||
</div>
|
||||
<span className="shrink-0 text-xs rounded-full px-2 py-0.5 border text-muted-foreground">
|
||||
{claim.step.kind === 'republish' ? 'republish' : 'claim'}
|
||||
</span>
|
||||
</div>
|
||||
))}
|
||||
<div className="flex-1 overflow-y-auto space-y-6 py-2">
|
||||
{isLoading && (
|
||||
<div className="space-y-2">
|
||||
<Skeleton className="h-12 w-full" />
|
||||
<Skeleton className="h-12 w-full" />
|
||||
<Skeleton className="h-12 w-full" />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
)}
|
||||
|
||||
{retitlable.length > 0 && (
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-end justify-between gap-4">
|
||||
<div>
|
||||
<h4 className="text-sm font-medium">Titled after their address</h4>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
The archive could only call a site by its hostname. These say what they are
|
||||
actually called, so the name they publish under can too.
|
||||
</p>
|
||||
</div>
|
||||
<Button size="sm" variant="outline" onClick={fixTitles} disabled={busy}>
|
||||
{running === 'titles' ? <Loader2 className="h-4 w-4 animate-spin" /> : 'Fix titles'}
|
||||
</Button>
|
||||
</div>
|
||||
<div className="rounded-md border divide-y">
|
||||
{retitlable.map((site) => (
|
||||
<div key={site.hostname} className="flex items-center justify-between gap-4 p-3">
|
||||
<div className="min-w-0">
|
||||
<div className="font-mono text-sm truncate">{site.hostname}</div>
|
||||
<div className="truncate">
|
||||
{renderStatus(
|
||||
site.hostname,
|
||||
site.suggestedTitle ? `Will be titled "${site.suggestedTitle}".` : 'The title will be removed.',
|
||||
)}
|
||||
{error && (
|
||||
<Alert variant="destructive">
|
||||
<AlertCircle className="h-4 w-4" />
|
||||
<AlertDescription>{error.message}</AlertDescription>
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
{data && !claims.length && !data.taken.length && (
|
||||
<p className="text-sm text-muted-foreground py-8 text-center">
|
||||
Nothing is waiting for you here.
|
||||
</p>
|
||||
)}
|
||||
|
||||
{actionable.length > 0 && (
|
||||
<div className="space-y-2">
|
||||
<h4 className="text-sm font-medium">Waiting for you</h4>
|
||||
<div className="rounded-md border divide-y">
|
||||
{actionable.map((claim) => (
|
||||
<div key={claim.hostname} className="flex items-center justify-between gap-3 p-3">
|
||||
<div className="min-w-0">
|
||||
<div className="font-mono text-sm truncate">{claim.hostname}</div>
|
||||
<div className="truncate">{renderStatus(claim.hostname, describeStep(claim))}</div>
|
||||
</div>
|
||||
{renderActions(claim.hostname, {
|
||||
preview: sitePreviewUrl(claim.address, claim.hostname, provider.domain),
|
||||
// The word the button uses is the work it does. A name
|
||||
// whose site is already on this key publishes nothing.
|
||||
act: {
|
||||
label: claim.step.kind === 'republish' ? 'Publish' : 'Claim',
|
||||
icon: Rocket,
|
||||
run: () => migrate(claim),
|
||||
},
|
||||
// A `claim` step, either reason, means a copy of the site
|
||||
// is already published under this key and survives the
|
||||
// name going away. A `republish` step means it is not.
|
||||
deletable: { published: claim.step.kind === 'claim' },
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{(data?.events.length ?? 0) > 0 && (
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-end justify-between gap-4">
|
||||
<div>
|
||||
<h4 className="text-sm font-medium">Relay coverage</h4>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
A site is only as findable as the relays holding its manifest. This sends the
|
||||
events you already published to the relays that do not have them — same events,
|
||||
no signing.
|
||||
</p>
|
||||
</div>
|
||||
<Button size="sm" variant="outline" onClick={fixCoverage} disabled={busy}>
|
||||
{running === 'coverage' ? <Loader2 className="h-4 w-4 animate-spin" /> : 'Check relays'}
|
||||
</Button>
|
||||
</div>
|
||||
{coverage && (
|
||||
<div className="rounded-md border bg-muted/30 p-3 space-y-1">
|
||||
{coverage.lines.map((line) => (
|
||||
<p key={line} className="text-xs font-mono text-muted-foreground break-words">
|
||||
{line}
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{strays.length > 0 && (
|
||||
<div className="space-y-2">
|
||||
<h4 className="text-sm font-medium">Published for a name that cannot load</h4>
|
||||
<div className="rounded-md border border-dashed divide-y">
|
||||
{strays.map((site) => (
|
||||
<div key={site.hostname} className="flex items-center justify-between gap-4 p-3">
|
||||
<div className="min-w-0 space-y-0.5">
|
||||
<div className="font-mono text-sm truncate">{site.hostname}</div>
|
||||
<div className="truncate">
|
||||
{renderStatus(
|
||||
site.hostname,
|
||||
`No certificate covers a name this deep under ${provider.domain}.`,
|
||||
)}
|
||||
{retitlable.length > 0 && (
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-end justify-between gap-4">
|
||||
<div>
|
||||
<h4 className="text-sm font-medium">Titled after their address</h4>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
The archive could only call a site by its hostname. These say what they are
|
||||
actually called, so the name they publish under can too.
|
||||
</p>
|
||||
</div>
|
||||
<Button size="sm" variant="outline" onClick={fixTitles} disabled={busy}>
|
||||
{running === 'titles' ? <Loader2 className="h-4 w-4 animate-spin" /> : 'Fix titles'}
|
||||
</Button>
|
||||
</div>
|
||||
<div className="rounded-md border divide-y">
|
||||
{retitlable.map((site) => (
|
||||
<div key={site.hostname} className="flex items-center justify-between gap-3 p-3">
|
||||
<div className="min-w-0">
|
||||
<div className="font-mono text-sm truncate">{site.hostname}</div>
|
||||
<div className="truncate">
|
||||
{renderStatus(
|
||||
site.hostname,
|
||||
site.suggestedTitle ? `Will be titled "${site.suggestedTitle}".` : 'The title will be removed.',
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{renderActions(site.hostname, {
|
||||
preview: sitePreviewUrl(
|
||||
`${site.event.kind}:${site.event.pubkey}:${eventIdentifier(site.event)}`,
|
||||
site.hostname,
|
||||
provider.domain,
|
||||
),
|
||||
act: { label: 'Retitle', icon: Tag, run: () => retitle(site) },
|
||||
deletable: { published: true },
|
||||
})}
|
||||
</div>
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
className="shrink-0"
|
||||
onClick={() => removeStray(site)}
|
||||
disabled={busy}
|
||||
>
|
||||
<Trash2 className="h-4 w-4 mr-1.5" />
|
||||
Retract
|
||||
</Button>
|
||||
</div>
|
||||
))}
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
)}
|
||||
|
||||
{blocked.length > 0 && (
|
||||
<div className="space-y-2">
|
||||
<h4 className="text-sm font-medium">Needs a decision</h4>
|
||||
<div className="rounded-md border border-dashed divide-y">
|
||||
{blocked.map((claim) => (
|
||||
<div key={claim.hostname} className="p-3 space-y-0.5">
|
||||
<div className="font-mono text-sm truncate">{claim.hostname}</div>
|
||||
<p className="text-xs text-muted-foreground">{describeStep(claim)}</p>
|
||||
{(data?.events.length ?? 0) > 0 && (
|
||||
<div className="space-y-2">
|
||||
<div className="flex items-end justify-between gap-4">
|
||||
<div>
|
||||
<h4 className="text-sm font-medium">Relay coverage</h4>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
A site is only as findable as the relays holding its manifest. This sends the
|
||||
events you already published to the relays that do not have them — same events,
|
||||
no signing.
|
||||
</p>
|
||||
</div>
|
||||
))}
|
||||
<Button size="sm" variant="outline" onClick={fixCoverage} disabled={busy}>
|
||||
{running === 'coverage' ? <Loader2 className="h-4 w-4 animate-spin" /> : 'Check relays'}
|
||||
</Button>
|
||||
</div>
|
||||
{coverage && (
|
||||
<div className="rounded-md border bg-muted/30 p-3 space-y-1">
|
||||
{coverage.lines.map((line) => (
|
||||
<p key={line} className="text-xs font-mono text-muted-foreground break-words">
|
||||
{line}
|
||||
</p>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
<DialogFooter className="shrink-0 gap-2 sm:justify-between items-center">
|
||||
<span className="text-xs text-muted-foreground">
|
||||
{failed > 0
|
||||
? `${done} done, ${failed} failed — run it again to retry.`
|
||||
: done > 0
|
||||
? `${done} done. A republished site takes the gateway about a minute to pick up.`
|
||||
: `${actionable.length} to migrate.`}
|
||||
</span>
|
||||
<div className="flex gap-2">
|
||||
<Button variant="outline" onClick={() => onOpenChange(false)} disabled={busy}>
|
||||
Close
|
||||
</Button>
|
||||
<Button onClick={migrateAll} disabled={busy || actionable.length === 0}>
|
||||
{running === 'migrate' ? (
|
||||
<>
|
||||
<Loader2 className="h-4 w-4 mr-2 animate-spin" />
|
||||
Migrating…
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Rocket className="h-4 w-4 mr-2" />
|
||||
{failed > 0 ? 'Retry' : `Migrate all (${actionable.length})`}
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
{strays.length > 0 && (
|
||||
<div className="space-y-2">
|
||||
<h4 className="text-sm font-medium">Published for a name that cannot load</h4>
|
||||
<div className="rounded-md border border-dashed divide-y">
|
||||
{strays.map((site) => (
|
||||
<div key={site.hostname} className="flex items-center justify-between gap-3 p-3">
|
||||
<div className="min-w-0 space-y-0.5">
|
||||
<div className="font-mono text-sm truncate">{site.hostname}</div>
|
||||
<div className="truncate">
|
||||
{renderStatus(
|
||||
site.hostname,
|
||||
`No certificate covers a name this deep under ${provider.domain}.`,
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{/*
|
||||
One button, not two. What is wrong with these is that
|
||||
they exist at all, so there is no version of retracting
|
||||
the manifest that leaves the gateway's record worth
|
||||
keeping — the name has never loaded for anyone and never
|
||||
will. The hostname is unservable, so the preview can only
|
||||
come from the address.
|
||||
*/}
|
||||
{renderActions(site.hostname, {
|
||||
preview: nsitePreviewUrl(
|
||||
`${site.event.kind}:${site.event.pubkey}:${eventIdentifier(site.event)}`,
|
||||
),
|
||||
act: { label: 'Retract', icon: Trash2, run: () => removeStray(site) },
|
||||
})}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{blocked.length > 0 && (
|
||||
<div className="space-y-2">
|
||||
<h4 className="text-sm font-medium">Needs a decision</h4>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Nothing here can be taken back safely without you choosing something first. Deleting
|
||||
is a decision too, and for most of these it is the right one.
|
||||
</p>
|
||||
<div className="rounded-md border border-dashed divide-y">
|
||||
{blocked.map((claim) => (
|
||||
<div key={claim.hostname} className="flex items-center justify-between gap-3 p-3">
|
||||
<div className="min-w-0 space-y-0.5">
|
||||
<div className="font-mono text-sm truncate">{claim.hostname}</div>
|
||||
<div className="truncate">{renderStatus(claim.hostname, describeStep(claim))}</div>
|
||||
</div>
|
||||
{renderActions(claim.hostname, {
|
||||
preview: sitePreviewUrl(claim.address, claim.hostname, provider.domain),
|
||||
deletable: { published: claim.mine },
|
||||
})}
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
<DialogFooter className="shrink-0 gap-2 sm:justify-between items-center">
|
||||
<span className="text-xs text-muted-foreground">{summary}</span>
|
||||
<div className="flex gap-2">
|
||||
<Button variant="outline" onClick={() => close()} disabled={busy}>
|
||||
Close
|
||||
</Button>
|
||||
<Button onClick={migrateAll} disabled={busy || remaining === 0}>
|
||||
{running === 'migrate' ? (
|
||||
<>
|
||||
<Loader2 className="h-4 w-4 mr-2 animate-spin" />
|
||||
Migrating…
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Rocket className="h-4 w-4 mr-2" />
|
||||
{failed > 0 ? 'Retry' : `Migrate all (${remaining})`}
|
||||
</>
|
||||
)}
|
||||
</Button>
|
||||
</div>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
<AlertDialog open={confirming !== null} onOpenChange={(next) => !next && setConfirming(null)}>
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>Delete {confirming?.hostname}?</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
{provider.name} stops serving this name and stops holding it for you, and it goes back
|
||||
to being anybody's to take. This cannot be undone.{' '}
|
||||
{confirming?.published
|
||||
? 'The site itself stays published under your key, and can still be reached by its address.'
|
||||
: 'The archived copy stays on Nostr under the key that published it — this only ends the gateway serving it.'}
|
||||
</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||
<AlertDialogAction
|
||||
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
|
||||
onClick={() => {
|
||||
const hostname = confirming?.hostname;
|
||||
setConfirming(null);
|
||||
if (hostname) void runRow(hostname, () => removeClaim(hostname));
|
||||
}}
|
||||
>
|
||||
Delete
|
||||
</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -3,7 +3,12 @@ import { useNostr } from '@nostrify/react';
|
||||
import type { NostrEvent } from '@nostrify/nostrify';
|
||||
import { useCurrentUser } from '@/hooks/useCurrentUser';
|
||||
import type { NpanelProvider } from '@/contexts/DeploySettingsContext';
|
||||
import { fetchNpanelClaims, type NpanelClaim } from '@/lib/deploy/npanelApi';
|
||||
import {
|
||||
fetchNpanelClaimCount,
|
||||
fetchNpanelClaims,
|
||||
type NpanelClaim,
|
||||
type NpanelClaimCount,
|
||||
} from '@/lib/deploy/npanelApi';
|
||||
import {
|
||||
NAMED_SITE_KIND,
|
||||
hasArchiveTitle,
|
||||
@@ -156,3 +161,32 @@ export function useNpanelClaims(provider: NpanelProvider | undefined) {
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* How many names a gateway is holding for the logged-in user.
|
||||
*
|
||||
* Separate from {@link useNpanelClaims} because it is asked at a different
|
||||
* moment and must cost a different amount. That one runs when somebody opens
|
||||
* the dialog and has already decided to look; it reads every claimed deploy on
|
||||
* the gateway and queries relays for this user's own events. This one runs
|
||||
* because a settings page was opened, so it is one signature and two counted
|
||||
* rows, and a gateway that cannot answer it says nothing rather than failing.
|
||||
*/
|
||||
export function useNpanelClaimCount(provider: NpanelProvider | undefined) {
|
||||
const { user } = useCurrentUser();
|
||||
|
||||
return useQuery<NpanelClaimCount>({
|
||||
queryKey: ['npanel-claim-count', provider?.dashboardHost, user?.pubkey],
|
||||
enabled: Boolean(provider && user),
|
||||
// Nobody's list of waiting names changes on its own, and every refetch
|
||||
// costs a signature — which on a remote signer costs a round trip. Long
|
||||
// enough that opening settings twice in a sitting asks once.
|
||||
staleTime: 30 * 60 * 1000,
|
||||
refetchOnWindowFocus: false,
|
||||
retry: false,
|
||||
queryFn: async ({ signal }) => {
|
||||
if (!provider || !user) return { waiting: 0, taken: 0 };
|
||||
return await fetchNpanelClaimCount(provider.dashboardHost, user.signer, signal);
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -271,3 +271,32 @@ describe('checkNameAvailable', () => {
|
||||
).resolves.toMatchObject({ available: false, reason: 'taken' });
|
||||
});
|
||||
});
|
||||
|
||||
describe('checkNameAvailable, for a name held for its previous owner', () => {
|
||||
it('reports waiting rather than taken', async () => {
|
||||
// The state almost every unclaimed name is in: an archive serving it, so
|
||||
// the public answer is taken and the useful answer is that it is theirs.
|
||||
fetchMock
|
||||
.mockResolvedValueOnce(
|
||||
new Response(JSON.stringify({ hostname: `x.${DOMAIN}`, available: false, reason: 'taken' })),
|
||||
)
|
||||
.mockResolvedValueOnce(
|
||||
new Response(JSON.stringify({ hostname: `x.${DOMAIN}`, available: false, reason: 'waiting' })),
|
||||
);
|
||||
|
||||
await expect(
|
||||
checkNameAvailable(DASHBOARD_HOST, `x.${DOMAIN}`, undefined, signer),
|
||||
).resolves.toMatchObject({ available: false, reason: 'waiting' });
|
||||
});
|
||||
|
||||
it('says nothing more to somebody who did not sign', async () => {
|
||||
fetchMock.mockResolvedValue(
|
||||
new Response(JSON.stringify({ hostname: `x.${DOMAIN}`, available: false, reason: 'taken' })),
|
||||
);
|
||||
|
||||
await expect(checkNameAvailable(DASHBOARD_HOST, `x.${DOMAIN}`)).resolves.toMatchObject({
|
||||
reason: 'taken',
|
||||
});
|
||||
expect(fetchMock).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
@@ -12,11 +12,16 @@ export interface NameAvailability {
|
||||
available: boolean;
|
||||
/**
|
||||
* Why it is not free, or — with `available` — that it is not free of somebody
|
||||
* else. `mine` comes only from a signed request, and only from a gateway new
|
||||
* enough to answer one; an older one says `taken` and is not wrong, just less
|
||||
* use to the person who owns the name.
|
||||
* else.
|
||||
*
|
||||
* `mine` is a name this signer can already point somewhere. `waiting` is one
|
||||
* the gateway is holding for them from before it took the domain over: not
|
||||
* free, not theirs to deploy to yet, and one claim away from both. Both come
|
||||
* only from a signed request, and only from a gateway new enough to answer
|
||||
* one; an older one says `taken`, which is not wrong, just of no use to the
|
||||
* person the name belongs to.
|
||||
*/
|
||||
reason?: 'taken' | 'invalid' | 'mine';
|
||||
reason?: 'taken' | 'invalid' | 'mine' | 'waiting';
|
||||
/** Present when `reason` is `invalid`; written to be shown to whoever typed it. */
|
||||
error?: string;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
||||
import { getPublicKey, generateSecretKey } from 'nostr-tools';
|
||||
import type { NostrSigner } from '@nostrify/nostrify';
|
||||
import { fetchNpanelClaimCount } from './npanelApi';
|
||||
|
||||
const DASHBOARD_HOST = 'npanel.example.test';
|
||||
|
||||
const pubkey = getPublicKey(generateSecretKey());
|
||||
|
||||
/**
|
||||
* A signer that fills in the fields a real one would, without signing.
|
||||
*
|
||||
* Signing for real is not available here: jsdom's TextEncoder returns a
|
||||
* Uint8Array from its own realm, which fails the `instanceof` check inside
|
||||
* @noble/hashes, so nostr-tools cannot hash an event under this environment.
|
||||
* Nothing here verifies a signature — what matters is which request goes out
|
||||
* and what is made of the answer.
|
||||
*/
|
||||
const signer: NostrSigner = {
|
||||
getPublicKey: async () => pubkey,
|
||||
signEvent: async (template) => ({
|
||||
...template,
|
||||
id: 'f'.repeat(64),
|
||||
pubkey,
|
||||
sig: '0'.repeat(128),
|
||||
}),
|
||||
} as NostrSigner;
|
||||
|
||||
let fetchMock: ReturnType<typeof vi.fn>;
|
||||
|
||||
beforeEach(() => {
|
||||
fetchMock = vi.fn();
|
||||
vi.stubGlobal('fetch', fetchMock);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.unstubAllGlobals();
|
||||
});
|
||||
|
||||
describe('fetchNpanelClaimCount', () => {
|
||||
it('asks the gateway only for the count', async () => {
|
||||
fetchMock.mockResolvedValue(new Response(JSON.stringify({ waiting: 3, taken: 1 })));
|
||||
|
||||
await expect(fetchNpanelClaimCount(DASHBOARD_HOST, signer)).resolves.toEqual({
|
||||
waiting: 3,
|
||||
taken: 1,
|
||||
});
|
||||
|
||||
const request = fetchMock.mock.calls[0][0] as Request;
|
||||
expect(request.url).toBe(`https://${DASHBOARD_HOST}/api/claims?summary=1`);
|
||||
expect(request.headers.get('Authorization')).toMatch(/^Nostr /);
|
||||
});
|
||||
|
||||
it('reports nothing waiting when the gateway answers with the list instead', async () => {
|
||||
// An older gateway ignores the parameter and returns every claim, which is
|
||||
// a different shape rather than a bigger number — counting it would be
|
||||
// inventing one.
|
||||
fetchMock.mockResolvedValue(
|
||||
new Response(JSON.stringify({ claims: [{ hostname: `a.example.test` }] })),
|
||||
);
|
||||
|
||||
await expect(fetchNpanelClaimCount(DASHBOARD_HOST, signer)).resolves.toEqual({
|
||||
waiting: 0,
|
||||
taken: 0,
|
||||
});
|
||||
});
|
||||
|
||||
it('reports nothing waiting when the gateway cannot be reached', async () => {
|
||||
// This runs because somebody opened a settings page. A number that failed
|
||||
// to arrive is not an error worth showing them.
|
||||
fetchMock.mockRejectedValue(new Error('offline'));
|
||||
|
||||
await expect(fetchNpanelClaimCount(DASHBOARD_HOST, signer)).resolves.toEqual({
|
||||
waiting: 0,
|
||||
taken: 0,
|
||||
});
|
||||
});
|
||||
|
||||
it('reports nothing waiting when the gateway refuses', async () => {
|
||||
fetchMock.mockResolvedValue(new Response('nope', { status: 403 }));
|
||||
|
||||
await expect(fetchNpanelClaimCount(DASHBOARD_HOST, signer)).resolves.toEqual({
|
||||
waiting: 0,
|
||||
taken: 0,
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -114,6 +114,50 @@ export async function fetchNpanelClaims(
|
||||
return claims;
|
||||
}
|
||||
|
||||
/** How many names a gateway is holding for somebody, and how many they took. */
|
||||
export interface NpanelClaimCount {
|
||||
waiting: number;
|
||||
taken: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* The count alone, without working out what to do about any of them.
|
||||
*
|
||||
* {@link fetchNpanelClaims} reads every file of every claimed deploy and returns
|
||||
* a manifest each, which is the right price for the dialog that hands the names
|
||||
* back and much too high for the sentence that gets somebody to open it. A
|
||||
* gateway too old to know the parameter answers with the list instead, so the
|
||||
* shape is checked rather than assumed — and a gateway that fails outright
|
||||
* reports nothing waiting, since a number nobody can fetch should not become an
|
||||
* error on a settings page.
|
||||
*/
|
||||
export async function fetchNpanelClaimCount(
|
||||
dashboardHost: string,
|
||||
signer: NostrSigner,
|
||||
signal?: AbortSignal,
|
||||
): Promise<NpanelClaimCount> {
|
||||
const none: NpanelClaimCount = { waiting: 0, taken: 0 };
|
||||
|
||||
try {
|
||||
const response = await npanelRequest(
|
||||
dashboardHost,
|
||||
signer,
|
||||
'GET',
|
||||
'/api/claims?summary=1',
|
||||
undefined,
|
||||
signal,
|
||||
);
|
||||
if (!response.ok) return none;
|
||||
|
||||
const body = (await response.json()) as Partial<NpanelClaimCount>;
|
||||
if (typeof body.waiting !== 'number' || typeof body.taken !== 'number') return none;
|
||||
|
||||
return { waiting: body.waiting, taken: body.taken };
|
||||
} catch {
|
||||
return none;
|
||||
}
|
||||
}
|
||||
|
||||
/** Point a name waiting for this signer at a site they published. */
|
||||
export async function claimNpanelHostname(
|
||||
dashboardHost: string,
|
||||
@@ -135,3 +179,32 @@ export async function claimNpanelHostname(
|
||||
throw await npanelError(response, `Could not take back ${hostname}`);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Give a name up rather than take it back.
|
||||
*
|
||||
* The gateway forgets the hostname entirely: it stops serving the archived
|
||||
* site, stops holding the name, and the name goes back to being anybody's. What
|
||||
* this cannot touch is the network — the archive's manifest is its own event
|
||||
* under its own key, and a copy the user published is theirs to retract — so
|
||||
* this is a request to one server and nothing more.
|
||||
*/
|
||||
export async function deleteNpanelClaim(
|
||||
dashboardHost: string,
|
||||
signer: NostrSigner,
|
||||
hostname: string,
|
||||
signal?: AbortSignal,
|
||||
): Promise<void> {
|
||||
const response = await npanelRequest(
|
||||
dashboardHost,
|
||||
signer,
|
||||
'DELETE',
|
||||
`/api/claims/${encodeURIComponent(hostname)}`,
|
||||
undefined,
|
||||
signal,
|
||||
);
|
||||
|
||||
if (!response.ok) {
|
||||
throw await npanelError(response, `Could not delete ${hostname}`);
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,14 @@ import type { NostrEvent } from '@nostrify/nostrify';
|
||||
import type { NpanelClaim } from './npanelApi';
|
||||
import {
|
||||
NAMED_SITE_KIND,
|
||||
ROOT_SITE_KIND,
|
||||
hasArchiveTitle,
|
||||
isServableHostname,
|
||||
nsitePreviewUrl,
|
||||
planClaim,
|
||||
republishTags,
|
||||
retitleTags,
|
||||
sitePreviewUrl,
|
||||
} from './npanelMigration';
|
||||
|
||||
const PUBKEY = 'a'.repeat(64);
|
||||
@@ -95,6 +98,54 @@ describe('isServableHostname', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('nsitePreviewUrl', () => {
|
||||
it('addresses a named site by its base36 pubkey and identifier', () => {
|
||||
expect(nsitePreviewUrl(`${NAMED_SITE_KIND}:${ARCHIVE}:mysite`)).toMatch(/^https:\/\/[0-9a-z]{50}mysite\.nsite\.lol$/);
|
||||
});
|
||||
|
||||
it('addresses a root site by its npub', () => {
|
||||
expect(nsitePreviewUrl(`${ROOT_SITE_KIND}:${ARCHIVE}:`)).toMatch(/^https:\/\/npub1[0-9a-z]+\.nsite\.lol$/);
|
||||
});
|
||||
|
||||
it('has nowhere to send an identifier that will not fit a DNS label', () => {
|
||||
// About a quarter of what this migration carries: the host it came from
|
||||
// named sites after projects and never had to fit one in a subdomain.
|
||||
expect(nsitePreviewUrl(`${NAMED_SITE_KIND}:${ARCHIVE}:nostr-pro-file-manager`)).toBeUndefined();
|
||||
// Uppercase resolves as a DNS label and then matches no `d` tag, which is
|
||||
// worse than no link at all.
|
||||
expect(nsitePreviewUrl(`${NAMED_SITE_KIND}:${ARCHIVE}:ErrorTime`)).toBeUndefined();
|
||||
});
|
||||
|
||||
it('says nothing about an address it cannot read', () => {
|
||||
expect(nsitePreviewUrl(null)).toBeUndefined();
|
||||
expect(nsitePreviewUrl(undefined)).toBeUndefined();
|
||||
expect(nsitePreviewUrl(`${NAMED_SITE_KIND}:not-a-pubkey:mysite`)).toBeUndefined();
|
||||
expect(nsitePreviewUrl(`${NAMED_SITE_KIND}:${ARCHIVE}:`)).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('sitePreviewUrl', () => {
|
||||
it('prefers the address, which outlives both the name and its certificate', () => {
|
||||
expect(sitePreviewUrl(`${NAMED_SITE_KIND}:${ARCHIVE}:mysite`, 'mysite.shakespeare.wtf', DOMAIN)).toMatch(
|
||||
/\.nsite\.lol$/,
|
||||
);
|
||||
});
|
||||
|
||||
it('falls back to the hostname when no gateway label can hold the identifier', () => {
|
||||
expect(
|
||||
sitePreviewUrl(`${NAMED_SITE_KIND}:${ARCHIVE}:nostr-pro-file-manager`, 'long.shakespeare.wtf', DOMAIN),
|
||||
).toBe('https://long.shakespeare.wtf');
|
||||
});
|
||||
|
||||
it('offers nothing for a name that is neither servable nor addressable', () => {
|
||||
// A link to a certificate error is worse than no button.
|
||||
expect(sitePreviewUrl(null, 'a.b.shakespeare.wtf', DOMAIN)).toBeUndefined();
|
||||
expect(
|
||||
sitePreviewUrl(`${NAMED_SITE_KIND}:${ARCHIVE}:nostr-pro-file-manager`, 'a.b.shakespeare.wtf', DOMAIN),
|
||||
).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('republishTags', () => {
|
||||
it('keeps the files and where to fetch them, and takes the archive’s words', () => {
|
||||
const manifest = claim().manifest;
|
||||
|
||||
@@ -1,9 +1,26 @@
|
||||
import { nip19 } from 'nostr-tools';
|
||||
import type { NostrEvent } from '@nostrify/nostrify';
|
||||
import { buildNsiteUrl, isValidDTag } from '@/lib/utils/nsite';
|
||||
import type { NpanelClaim, NpanelClaimManifest } from './npanelApi';
|
||||
|
||||
/** nsite named-site kind. Everything a gateway archived is one of these. */
|
||||
export const NAMED_SITE_KIND = 35128;
|
||||
|
||||
/** nsite root-site kind. One per key, which is why one is never republished. */
|
||||
export const ROOT_SITE_KIND = 15128;
|
||||
|
||||
/**
|
||||
* A gateway that serves any nsite from its address alone.
|
||||
*
|
||||
* Not this gateway, deliberately. Everything in this list is a decision about a
|
||||
* site somebody has not looked at in a year, and the honest way to show them one
|
||||
* is from an address rather than from the name that is in question — a name
|
||||
* about to be deleted, or one that no certificate covers and that has therefore
|
||||
* never loaded for anyone. It reads the same relays this provider publishes to,
|
||||
* so the archive's copy is as findable there as anywhere.
|
||||
*/
|
||||
const PREVIEW_GATEWAY = 'nsite.lol';
|
||||
|
||||
/**
|
||||
* Tags the archive wrote about itself, which are not the site's to carry.
|
||||
*
|
||||
@@ -60,6 +77,59 @@ export function isServableHostname(hostname: string, domain: string): boolean {
|
||||
return label.length > 0 && !label.includes('.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Somewhere the site at an address can actually be looked at.
|
||||
*
|
||||
* Preferred over the hostname because a preview is worth most for the names the
|
||||
* hostname cannot show: one too deep for a wildcard certificate, which answers a
|
||||
* TLS error and always has, and one about to be deleted, which will stop
|
||||
* answering at all. An address survives both.
|
||||
*
|
||||
* Undefined when the identifier is longer than a DNS label leaves room for —
|
||||
* about a quarter of what this migration carries, because the host it came from
|
||||
* named sites after projects and never had to fit one in a subdomain. There is
|
||||
* no address-based URL for those on any gateway, so callers fall back to the
|
||||
* hostname where the hostname works.
|
||||
*/
|
||||
export function nsitePreviewUrl(address: string | null | undefined): string | undefined {
|
||||
if (!address) return undefined;
|
||||
|
||||
const [kind, pubkey, ...rest] = address.split(':');
|
||||
const identifier = rest.join(':');
|
||||
|
||||
if (!/^[0-9a-f]{64}$/i.test(pubkey ?? '')) return undefined;
|
||||
|
||||
if (Number(kind) === ROOT_SITE_KIND && !identifier) {
|
||||
return buildNsiteUrl({ pubkeyHex: pubkey, npub: nip19.npubEncode(pubkey), gateway: PREVIEW_GATEWAY });
|
||||
}
|
||||
|
||||
if (Number(kind) === NAMED_SITE_KIND && isValidDTag(identifier)) {
|
||||
return buildNsiteUrl({
|
||||
pubkeyHex: pubkey,
|
||||
npub: nip19.npubEncode(pubkey),
|
||||
gateway: PREVIEW_GATEWAY,
|
||||
siteIdentifier: identifier,
|
||||
});
|
||||
}
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Where to send somebody who wants to see a site before deciding about it.
|
||||
*
|
||||
* {@link nsitePreviewUrl} first, the hostname second, and nothing at all for a
|
||||
* name that is both unservable and unaddressable — which is a real combination
|
||||
* here, and better shown as no button than as a link to a certificate error.
|
||||
*/
|
||||
export function sitePreviewUrl(
|
||||
address: string | null | undefined,
|
||||
hostname: string,
|
||||
domain: string,
|
||||
): string | undefined {
|
||||
return nsitePreviewUrl(address) ?? (isServableHostname(hostname, domain) ? `https://${hostname}` : undefined);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decide how a single waiting name gets back to its owner.
|
||||
*
|
||||
|
||||
@@ -15,6 +15,7 @@ import { ProviderConfigDialog } from '@/components/ProviderConfigDialog';
|
||||
import { AddDeployProviderDialog } from '@/components/AddDeployProviderDialog';
|
||||
import { AddCustomProviderDialog } from '@/components/AddCustomProviderDialog';
|
||||
import { NpanelMigrationDialog } from '@/components/deploy/NpanelMigrationDialog';
|
||||
import { useNpanelClaimCount } from '@/hooks/useNpanelClaims';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
DndContext,
|
||||
@@ -344,27 +345,13 @@ export function DeploySettings() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Sites held for their previous owner on a gateway that took over a
|
||||
domain. Shown without asking the gateway first: finding out costs
|
||||
a signature, and a signing prompt nobody asked for is worse than a
|
||||
button that sometimes opens an empty list. */}
|
||||
{user && settings.providers.map((provider) => (
|
||||
provider.type === 'npanel' ? (
|
||||
<div
|
||||
<HeldSites
|
||||
key={`migrate-${provider.id}`}
|
||||
className="rounded-lg border border-dashed p-4 flex flex-wrap items-center justify-between gap-3"
|
||||
>
|
||||
<div className="space-y-1">
|
||||
<h4 className="text-sm font-medium">Sites from before {provider.name}</h4>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Names you published on {provider.domain} under the old host are being served
|
||||
from an archive until you take them back.
|
||||
</p>
|
||||
</div>
|
||||
<Button variant="outline" onClick={() => setMigratingProvider(provider)}>
|
||||
Take back sites
|
||||
</Button>
|
||||
</div>
|
||||
provider={provider}
|
||||
onOpen={() => setMigratingProvider(provider)}
|
||||
/>
|
||||
) : null
|
||||
))}
|
||||
|
||||
@@ -440,4 +427,45 @@ export function DeploySettings() {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sites held for their previous owner on a gateway that took over a domain.
|
||||
*
|
||||
* The count is asked for on load, rather than the card standing there saying
|
||||
* "you may have sites waiting" to everyone forever. Almost nobody does, and a
|
||||
* card that cannot tell them apart is one most people learn to ignore before
|
||||
* it ever applies to them — while the person it does apply to has a few names
|
||||
* being served from an archive under a key that is not theirs, which is worth
|
||||
* one signature to say out loud.
|
||||
*
|
||||
* It is only the count: {@link useNpanelClaimCount} is two counted rows, not
|
||||
* the deploy-by-deploy read the dialog does when somebody opens it.
|
||||
*/
|
||||
function HeldSites({ provider, onOpen }: { provider: NpanelProvider; onOpen: () => void }) {
|
||||
const { data } = useNpanelClaimCount(provider);
|
||||
|
||||
// Nothing to say until the gateway says there is something, so a gateway with
|
||||
// no migration behind it — every gateway but the one — shows nothing at all.
|
||||
if (!data?.waiting) return null;
|
||||
|
||||
return (
|
||||
<div className="rounded-lg border border-dashed p-4 flex flex-wrap items-center justify-between gap-3">
|
||||
<div className="space-y-1">
|
||||
<h4 className="text-sm font-medium">
|
||||
{data.waiting === 1
|
||||
? `One name is waiting for you on ${provider.domain}`
|
||||
: `${data.waiting} names are waiting for you on ${provider.domain}`}
|
||||
</h4>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
You published {data.waiting === 1 ? 'it' : 'them'} before {provider.domain} moved to{' '}
|
||||
{provider.name}. {data.waiting === 1 ? 'It is' : 'They are'} being served from an archive
|
||||
until you take {data.waiting === 1 ? 'it' : 'them'} back.
|
||||
</p>
|
||||
</div>
|
||||
<Button variant="outline" onClick={onOpen}>
|
||||
Take back sites
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default DeploySettings;
|
||||
Reference in new issue
Block a user