An open-source, faster Devin alternative
TypeScript
web: remove sandbox leftovers (custom domain settings, concurrency copy, sandbox org fields)
Mohamed Habib via Computerb1167af6087c
diff --git a/web/src/api/client.ts b/web/src/api/client.tsindex 8c9c7f21..d8307831 100644--- a/web/src/api/client.ts+++ b/web/src/api/client.ts@@ -232,19 +232,6 @@ export const updateNavigationPreferences = (S.MeResponseSchema,)-export const setCustomDomain = (domain: string) =>- apiFetch(- '/org/custom-domain',- { method: 'PUT', body: JSON.stringify({ domain }) },- S.OrgSchema,- )--export const deleteCustomDomain = () =>- apiFetch('/org/custom-domain', { method: 'DELETE' }, S.OrgSchema)--export const refreshCustomDomain = () =>- apiFetch('/org/custom-domain/refresh', { method: 'POST' }, S.OrgSchema)-// Organization membersexport const getOrgMembers = () =>apiFetch('/org/members', {}, z.array(S.OrgMemberSchema))@@ -316,12 +303,6 @@ export const autumnTopup = (credits: number) =>body: JSON.stringify({ credits }),})-export const autumnSubscribeConcurrency = (plan: string) =>- apiFetch<{ url: string | null }>('/billing/autumn/concurrency', {- method: 'POST',- body: JSON.stringify({ plan }),- })-// Where a checkout was opened from; the edge records it on// billing.checkout_opened.export type CheckoutFrom = 'paywall' | 'warning' | 'billing_page' | 'signup'diff --git a/web/src/api/mock.ts b/web/src/api/mock.tsindex ba3a6846..2d280e62 100644--- a/web/src/api/mock.ts+++ b/web/src/api/mock.ts@@ -168,7 +168,6 @@ function autumnMock() {},concurrencyPlan: 'base',usagePlan: 'trial' as string,- maxConcurrentSandboxes: 5,autoTopup: { enabled: false, threshold: 5, quantity: 10, budget: 100 },hasToppedUp: false,hasPaidSubscription: false,@@ -228,7 +227,6 @@ function autumnMock() {const billing = {plan: 'free',billingProvider: 'autumn',- maxConcurrentSandboxes: 5,freeCreditsRemainingCents: 0,stripeCreditCents: 0,hasPaymentMethod: false,@@ -239,17 +237,8 @@ const org = {name: 'Digger',slug: 'digger',plan: 'pro',- maxConcurrentSandboxes: 25,- maxSandboxTimeoutSec: 3600,createdAt: at(120),updatedAt: at(2),- customDomain: 'acme.dev',- domainVerificationStatus: 'pending_validation',- domainSslStatus: 'pending',- verificationTxtName: '_oc-verify.acme.dev',- verificationTxtValue: 'oc-verify=abc123def456',- sslTxtName: '_acme-challenge.acme.dev',- sslTxtValue: 'xyz789uvw012',isPersonal: false,creditBalanceCents: 4210,}@@ -909,7 +898,6 @@ const ROUTES: Array<[RegExp, Handler]> = [[/^\/billing$/, () => billing],[/^\/org\/members$/, () => orgMembers],[/^\/org\/invitations$/, () => orgInvitations],- [/^\/org\/custom-domain$/, () => ({})],[/^\/org$/, () => org],]diff --git a/web/src/api/schemas.ts b/web/src/api/schemas.tsindex 7dffe0ae..0ccebc23 100644--- a/web/src/api/schemas.ts+++ b/web/src/api/schemas.ts@@ -40,18 +40,8 @@ export const OrgSchema = z.object({name: z.string(),slug: z.string(),plan: z.string(),- maxConcurrentSandboxes: z.number(),- maxSandboxTimeoutSec: z.number(),createdAt: z.string(),updatedAt: z.string(),- customDomain: z.string().optional(),- cfHostnameId: z.string().optional(),- domainVerificationStatus: z.string(),- domainSslStatus: z.string(),- verificationTxtName: z.string().optional(),- verificationTxtValue: z.string().optional(),- sslTxtName: z.string().optional(),- sslTxtValue: z.string().optional(),workosOrgId: z.string().optional(),isPersonal: z.boolean(),creditBalanceCents: z.number(),@@ -104,7 +94,6 @@ export const CreditsSchema = z.object({export const BillingStateSchema = z.object({plan: z.string(),stripeCreditCents: z.number(),- maxConcurrentSandboxes: z.number(),hasPaymentMethod: z.boolean(),freeCreditsRemainingCents: z.number(),billingProvider: z.string().optional(),@@ -136,7 +125,6 @@ export const AutumnBillingSchema = z.object({otherRemainingCents: z.number(),planResetsAt: z.string().nullable(),}),- maxConcurrentSandboxes: z.number(),concurrencyPlan: z.string(),// `trial` is the 3-day trial; `base` is the pre-trial free tier, kept until// every free org is migrated (serverless-agents-ws 086).diff --git a/web/src/pages/Billing.tsx b/web/src/pages/Billing.tsxindex d65ba6b4..5b808839 100644--- a/web/src/pages/Billing.tsx+++ b/web/src/pages/Billing.tsx@@ -171,8 +171,7 @@ function PlanTab() {</p>)}<p className="text-muted-foreground text-sm">- Upgrade to Pro for an additional $30 free credit and larger- machine sizes.+ Upgrade to Pro for an additional $30 free credit.</p><ButtononClick={() => setupMutation.mutate()}@@ -189,18 +188,6 @@ function PlanTab() {Payment method on file — billed monthly via Stripe</p>) : null}-- <p className="text-muted-foreground mt-3 text-xs">- Need more concurrency?{' '}- <a- href="https://cal.com/team/digger/opencomputer-founder-chat"- target="_blank"- rel="noreferrer"- className="text-foreground font-medium underline underline-offset-4"- >- Talk to us- </a>- </p></Panel>{isPro || billing?.hasPaymentMethod ? (diff --git a/web/src/pages/Settings.tsx b/web/src/pages/Settings.tsxindex 174ccf41..89be6816 100644--- a/web/src/pages/Settings.tsx+++ b/web/src/pages/Settings.tsx@@ -5,17 +5,14 @@ import { useTransientFlag } from '@/lib/use-transient-flag'import { ME_QUERY_KEY, useAuth } from '@/hooks/useAuth'import { organizationPlanLabel } from '@/lib/plan-label'import {- deleteCustomDomain,getAutumnBilling,getBilling,getInvitations,getOrg,getOrgMembers,- refreshCustomDomain,removeMember,revokeInvitation,sendInvitation,- setCustomDomain,updateOrg,updateNavigationPreferences,type NavigationPreferenceUpdate,@@ -32,7 +29,6 @@ import {import { Button } from '@/components/ui/button'import { Skeleton } from '@/components/ui/skeleton'import { Field, Input, Label } from '@/components/form'-import { StatusBadge } from '@/components/status-badge'import { ConfirmDialog } from '@/components/confirm-dialog'import { Switch } from '@/components/ui/switch'import {@@ -57,27 +53,6 @@ function ReadOnlyField({ label, value }: { label: string; value: ReactNode }) {)}-// Domain verification / SSL statuses → a lifecycle tone + clean label.-function DomainStatus({ status }: { status: string }) {- const tone =- status === 'active'- ? 'running'- : !status || status === 'none'- ? 'stopped'- : 'pending'- const label =- !status || status === 'none' ? 'Not set' : status.replace(/_/g, ' ')- return <StatusBadge status={tone} label={label} />-}--function CodeBlock({ children }: { children: ReactNode }) {- return (- <div className="bg-panel-2 text-muted-foreground rounded-md border p-3 font-mono text-xs leading-relaxed break-all">- {children}- </div>- )-}-export default function Settings() {const queryClient = useQueryClient()const { user } = useAuth()@@ -109,8 +84,6 @@ export default function Settings() {// effect to sync the field with the query).const [draftName, setDraftName] = useState<string | null>(null)const [saved, markSaved] = useTransientFlag(2000)- const [domainInput, setDomainInput] = useState('')- const [confirmRemoveDomain, setConfirmRemoveDomain] = useState(false)const [showRuntimeProfileInfo, setShowRuntimeProfileInfo] = useState(false)const name = draftName ?? org?.name ?? ''@@ -131,27 +104,6 @@ export default function Settings() {onError: (e) => notifyError("Couldn't save navigation settings.", e),})- const setDomainMutation = useMutation({- mutationFn: (domain: string) => setCustomDomain(domain),- onSuccess: () => {- void queryClient.invalidateQueries({ queryKey: ['org'] })- setDomainInput('')- },- onError: (e) => notifyError("Couldn't set the custom domain.", e),- })-- const deleteDomainMutation = useMutation({- mutationFn: () => deleteCustomDomain(),- onError: (e) => notifyError("Couldn't remove the custom domain.", e),- onSettled: () => queryClient.invalidateQueries({ queryKey: ['org'] }),- })-- const refreshDomainMutation = useMutation({- mutationFn: () => refreshCustomDomain(),- onError: (e) => notifyError("Couldn't refresh domain status.", e),- onSettled: () => queryClient.invalidateQueries({ queryKey: ['org'] }),- })-if (isLoading || isBillingLoading || (usesAutumnBilling && isAutumnLoading)) {return (<div>@@ -165,7 +117,6 @@ export default function Settings() {}const unchanged = name === (org?.name ?? '')- const hasDomain = !!org?.customDomain && org.customDomain !== ''const plan = organizationPlanLabel(org, billing, autumn)return (@@ -263,137 +214,6 @@ export default function Settings() {</div></Panel>- {/* Custom domain */}- <Panel className="p-6">- <div className="mb-5">- <PanelTitle>Custom domain</PanelTitle>- <PanelDescription className="mt-1">- Serve sandbox preview URLs from your own domain.- </PanelDescription>- </div>-- {hasDomain ? (- <div className="space-y-4">- <ReadOnlyField label="Domain" value={`*.${org.customDomain}`} />-- <div className="grid grid-cols-1 gap-4 sm:grid-cols-2">- <div className="space-y-1.5">- <Label>Verification</Label>- <div>- <DomainStatus status={org.domainVerificationStatus} />- </div>- </div>- <div className="space-y-1.5">- <Label>SSL</Label>- <div>- <DomainStatus status={org.domainSslStatus} />- </div>- </div>- </div>-- {org.verificationTxtName || org.sslTxtName ? (- <div className="space-y-1.5">- <Label>Required DNS TXT records</Label>- <CodeBlock>- {org.verificationTxtName ? (- <div className={org.sslTxtName ? 'mb-3' : ''}>- <div className="text-foreground font-semibold">- Domain verification- </div>- <div>Name: {org.verificationTxtName}</div>- <div>Value: {org.verificationTxtValue}</div>- </div>- ) : null}- {org.sslTxtName ? (- <div>- <div className="text-foreground font-semibold">- SSL validation- </div>- <div>Name: {org.sslTxtName}</div>- <div>Value: {org.sslTxtValue}</div>- </div>- ) : null}- </CodeBlock>- </div>- ) : null}-- {org.domainVerificationStatus === 'active' ? (- <div className="space-y-1.5">- <Label>Preview URL setup</Label>- <CodeBlock>- <div className="text-foreground mb-1.5 font-semibold">- Add a wildcard CNAME record for preview URLs:- </div>- <div>- Type: <span className="text-foreground">CNAME</span>- </div>- <div>- Name:{' '}- <span className="text-foreground">- *.{org.customDomain}- </span>- </div>- <div>- Target:{' '}- <span className="text-foreground">- fallback-origin.opencomputer.dev- </span>- </div>- </CodeBlock>- </div>- ) : null}-- <div className="flex gap-2">- <Button- variant="outline"- onClick={() => refreshDomainMutation.mutate()}- disabled={refreshDomainMutation.isPending}- >- {refreshDomainMutation.isPending- ? 'Refreshing…'- : 'Refresh status'}- </Button>- <Button- variant="ghost"- className="text-status-error hover:bg-status-error-bg hover:text-status-error"- onClick={() => setConfirmRemoveDomain(true)}- disabled={deleteDomainMutation.isPending}- >- Remove domain- </Button>- </div>- </div>- ) : (- <form- onSubmit={(e) => {- e.preventDefault()- if (domainInput.trim())- setDomainMutation.mutate(domainInput.trim())- }}- >- <Field label="Domain" htmlFor="domain">- <div className="flex gap-2">- <Input- id="domain"- value={domainInput}- onChange={(e) => setDomainInput(e.target.value)}- placeholder="acme.dev"- className="flex-1"- />- <Button- type="submit"- disabled={- setDomainMutation.isPending || !domainInput.trim()- }- >- {setDomainMutation.isPending ? 'Setting up…' : 'Set domain'}- </Button>- </div>- </Field>- </form>- )}- </Panel>-{user?.capabilities?.manageMembers !== false ? (<><div className="lg:col-span-2">@@ -406,21 +226,6 @@ export default function Settings() {) : null}</div>- <ConfirmDialog- open={confirmRemoveDomain}- onOpenChange={setConfirmRemoveDomain}- title="Remove custom domain?"- description="Sandbox preview URLs will revert to the default domain."- confirmLabel="Remove domain"- destructive- pending={deleteDomainMutation.isPending}- onConfirm={() =>- deleteDomainMutation.mutate(undefined, {- onSuccess: () => setConfirmRemoveDomain(false),- })- }- />-<Dialogopen={showRuntimeProfileInfo}onOpenChange={setShowRuntimeProfileInfo}