Skip to content

Commit 4b2dcf2

Browse files
committed
feat: remove references to legacy domain
1 parent 060c1e6 commit 4b2dcf2

File tree

9 files changed

+19
-416
lines changed

9 files changed

+19
-416
lines changed

apps/web/.env.example

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ KV_REST_API_TOKEN="local_token"
1818
SUPABASE_OAUTH_SECRET="<supabase-oauth-secret>"
1919
SUPABASE_SERVICE_ROLE_KEY="<supabase-service-role-key>"
2020

21-
NEXT_PUBLIC_LEGACY_DOMAIN=https://postgres.new
22-
NEXT_PUBLIC_CURRENT_DOMAIN=https://database.build
23-
REDIRECT_LEGACY_DOMAIN=false
24-
2521
# Optional
2622
#LOGFLARE_SOURCE="<logflare-source>"
2723
#LOGFLARE_API_KEY="<logflare-api-key>"

apps/web/app/export/page.tsx

Lines changed: 8 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ import { chunk } from 'lodash'
55
import Link from 'next/link'
66
import { useState } from 'react'
77
import { useApp } from '~/components/app-provider'
8-
import {
9-
Accordion,
10-
AccordionContent,
11-
AccordionItem,
12-
AccordionTrigger,
13-
} from '~/components/ui/accordion'
148
import { Button } from '~/components/ui/button'
159
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '~/components/ui/dialog'
1610
import { Progress } from '~/components/ui/progress'
@@ -23,12 +17,7 @@ import {
2317
readableStreamFromIterable,
2418
transformStreamFromFn,
2519
} from '~/lib/streams'
26-
import {
27-
currentDomainHostname,
28-
currentDomainUrl,
29-
downloadFile,
30-
legacyDomainHostname,
31-
} from '~/lib/util'
20+
import { downloadFile } from '~/lib/util'
3221

3322
export default function Page() {
3423
const { dbManager } = useApp()
@@ -42,61 +31,15 @@ export default function Page() {
4231
<DialogTitle>Export your databases</DialogTitle>
4332
<div className="py-2 border-b" />
4433
</DialogHeader>
34+
<p>All databases live locally within your browser&apos;s local IndexedDB storage.</p>
4535
<p>
46-
{legacyDomainHostname} is renaming to {currentDomainHostname}, which means you need to
47-
transfer your databases if you wish to continue using them.
36+
You can backup and restore your databases in order to transfer them between browsers or
37+
devices.
4838
</p>
4939

50-
<Accordion type="single" collapsible>
51-
<AccordionItem value="item-1" className="border rounded-md">
52-
<AccordionTrigger className="p-0 gap-2 px-3 py-2">
53-
<div className="flex gap-2 items-center font-normal text-lighter text-sm">
54-
<span>
55-
Why is {legacyDomainHostname} renaming to {currentDomainHostname}?
56-
</span>
57-
</div>
58-
</AccordionTrigger>
59-
<AccordionContent className="p-3 prose prose-sm">
60-
This project is not an official Postgres project and we don&apos;t want to mislead
61-
anyone! We&apos;re renaming to{' '}
62-
<Link href={currentDomainUrl} className="underline">
63-
{currentDomainHostname}
64-
</Link>{' '}
65-
because, well, that&apos;s what this does. This will still be 100% Postgres-focused,
66-
just with a different URL.
67-
</AccordionContent>
68-
</AccordionItem>
69-
</Accordion>
70-
<Accordion type="single" collapsible>
71-
<AccordionItem value="item-1" className="border rounded-md">
72-
<AccordionTrigger className="p-0 gap-2 px-3 py-2">
73-
<div className="flex gap-2 items-center font-normal text-lighter text-sm">
74-
<span>Why do I need to export my databases?</span>
75-
</div>
76-
</AccordionTrigger>
77-
<AccordionContent className="p-3 prose prose-sm">
78-
<p>
79-
Since PGlite databases are stored in your browser&apos;s IndexedDB storage, other
80-
domains like{' '}
81-
<Link href={currentDomainUrl} className="underline">
82-
{currentDomainHostname}
83-
</Link>{' '}
84-
cannot access them directly (this is a security restriction built into every
85-
browser).
86-
</p>
87-
<p>
88-
If you&apos;d like to continue using your previous databases and conversations:
89-
<ol>
90-
<li>Export them from {legacyDomainHostname}</li>
91-
<li>Import them to {currentDomainHostname}</li>
92-
</ol>
93-
</p>
94-
</AccordionContent>
95-
</AccordionItem>
96-
</Accordion>
9740
<div className="my-2 border-b" />
9841
<div className="prose">
99-
<h4 className="mb-4">How to transfer your databases to {currentDomainHostname}</h4>
42+
<h4 className="mb-4">How to export and import your databases</h4>
10043
<ol>
10144
<li>
10245
Click <strong>Export</strong> to download all of your databases into a single
@@ -158,12 +101,11 @@ export default function Page() {
158101
)}
159102
<br />
160103
This tarball will contain every PGlite database&apos;s <code>pgdata</code> dump
161-
along with any files you imported or exported from {legacyDomainHostname}.
104+
along with any files that you imported or exported in your chats.
162105
</li>
163106
<li>
164-
Navigate to{' '}
165-
<Link href={`${currentDomainUrl}/import`}>{currentDomainHostname}/import</Link> and
166-
click <strong>Import</strong>.
107+
Navigate to <Link href="/import">{window.location.origin}/import</Link> and click{' '}
108+
<strong>Import</strong>.
167109
</li>
168110
</ol>
169111
</div>

apps/web/app/import/page.tsx

Lines changed: 7 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
import { UntarStream } from '@std/tar/untar-stream'
44
import { useState } from 'react'
55
import { useApp } from '~/components/app-provider'
6-
import {
7-
Accordion,
8-
AccordionContent,
9-
AccordionItem,
10-
AccordionTrigger,
11-
} from '~/components/ui/accordion'
126
import { Button } from '~/components/ui/button'
137
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '~/components/ui/dialog'
148
import { Progress } from '~/components/ui/progress'
@@ -21,14 +15,7 @@ import { getDatabasesQueryKey } from '~/data/databases/databases-query'
2115
import { DbManager } from '~/lib/db'
2216
import { hasFile, saveFile } from '~/lib/files'
2317
import { tarStreamEntryToFile, waitForChunk } from '~/lib/streams'
24-
import {
25-
currentDomainHostname,
26-
currentDomainUrl,
27-
legacyDomainHostname,
28-
legacyDomainUrl,
29-
requestFileUpload,
30-
stripSuffix,
31-
} from '~/lib/util'
18+
import { requestFileUpload, stripSuffix } from '~/lib/util'
3219

3320
export default function Page() {
3421
const { dbManager } = useApp()
@@ -47,66 +34,19 @@ export default function Page() {
4734
<DialogTitle>Import your databases</DialogTitle>
4835
<div className="py-2 border-b" />
4936
</DialogHeader>
37+
<p>All databases live locally within your browser&apos;s local IndexedDB storage.</p>
5038
<p>
51-
{legacyDomainHostname} is renaming to {currentDomainHostname}, which means you need to
52-
transfer your databases if you wish to continue using them.
39+
You can backup and restore your databases in order to transfer them between browsers or
40+
devices.
5341
</p>
5442

55-
<Accordion type="single" collapsible>
56-
<AccordionItem value="item-1" className="border rounded-md">
57-
<AccordionTrigger className="p-0 gap-2 px-3 py-2">
58-
<div className="flex gap-2 items-center font-normal text-lighter text-sm">
59-
<span>
60-
Why is {legacyDomainHostname} renaming to {currentDomainHostname}?
61-
</span>
62-
</div>
63-
</AccordionTrigger>
64-
<AccordionContent className="p-3 prose prose-sm">
65-
This project is not an official Postgres project and we don&apos;t want to mislead
66-
anyone! We&apos;re renaming to{' '}
67-
<Link href={currentDomainUrl} className="underline">
68-
{currentDomainHostname}
69-
</Link>{' '}
70-
because, well, that&apos;s what this does. This will still be 100% Postgres-focused,
71-
just with a different URL.
72-
</AccordionContent>
73-
</AccordionItem>
74-
</Accordion>
75-
<Accordion type="single" collapsible>
76-
<AccordionItem value="item-1" className="border rounded-md">
77-
<AccordionTrigger className="p-0 gap-2 px-3 py-2">
78-
<div className="flex gap-2 items-center font-normal text-lighter text-sm">
79-
<span>Why do I need to import my databases?</span>
80-
</div>
81-
</AccordionTrigger>
82-
<AccordionContent className="p-3 prose prose-sm">
83-
<p>
84-
Since PGlite databases are stored in your browser&apos;s IndexedDB storage,{' '}
85-
<Link href={currentDomainUrl} className="underline">
86-
{currentDomainHostname}
87-
</Link>{' '}
88-
cannot access them directly (this is a security restriction built into every
89-
browser).
90-
</p>
91-
<p>
92-
If you&apos;d like to continue using your previous databases and conversations:
93-
<ol>
94-
<li>Export them from {legacyDomainHostname}</li>
95-
<li>Import them to {currentDomainHostname}</li>
96-
</ol>
97-
</p>
98-
</AccordionContent>
99-
</AccordionItem>
100-
</Accordion>
10143
<div className="my-2 border-b" />
10244
<div className="prose">
103-
<h4 className="mb-4">How to transfer your databases to {currentDomainHostname}</h4>
45+
<h4 className="mb-4">How to export and import your databases</h4>
10446
<ol>
10547
<li>
106-
Navigate to{' '}
107-
<Link href={`${legacyDomainUrl}/export`}>{legacyDomainHostname}/export</Link> and
108-
click <strong>Export</strong> to download all of your databases into a single
109-
tarball.
48+
Navigate to <Link href={'/export'}>{window.location.origin}/export</Link> and click{' '}
49+
<strong>Export</strong> to download all of your databases into a single tarball.
11050
</li>
11151
<li>
11252
Click <strong>Import</strong> and select the previously exported tarball.

apps/web/components/app-provider.tsx

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import {
2929
parseReadyForQuery,
3030
parseStartupMessage,
3131
} from '~/lib/pg-wire-util'
32-
import { legacyDomainHostname } from '~/lib/util'
3332
import { parse, serialize } from '~/lib/websocket-protocol'
3433
import { createClient } from '~/utils/supabase/client'
3534
import { useModelProvider } from './model-provider/use-model-provider'
@@ -43,7 +42,6 @@ export default function AppProvider({ children }: AppProps) {
4342
const [isLoadingUser, setIsLoadingUser] = useState(true)
4443
const [user, setUser] = useState<User>()
4544
const [isSignInDialogOpen, setIsSignInDialogOpen] = useState(false)
46-
const [isRenameDialogOpen, setIsRenameDialogOpen] = useState(false)
4745
const [isRateLimited, setIsRateLimited] = useState(false)
4846
const [showSidebar, setShowSidebar] = useState(false)
4947

@@ -259,23 +257,10 @@ export default function AppProvider({ children }: AppProps) {
259257
clientIp: connectedClientIp,
260258
isLiveSharing: Boolean(liveSharedDatabaseId),
261259
}
262-
const [isLegacyDomain, setIsLegacyDomain] = useState(false)
263-
const [isLegacyDomainRedirect, setIsLegacyDomainRedirect] = useState(false)
264260

265261
const [modelProviderError, setModelProviderError] = useState<string>()
266262
const [isModelProviderDialogOpen, setIsModelProviderDialogOpen] = useState(false)
267263

268-
useEffect(() => {
269-
const isLegacyDomain = window.location.hostname === legacyDomainHostname
270-
const urlParams = new URLSearchParams(window.location.search)
271-
const isLegacyDomainRedirect = urlParams.get('from') === legacyDomainHostname
272-
273-
// Set via useEffect() to prevent SSR hydration issues
274-
setIsLegacyDomain(isLegacyDomain)
275-
setIsLegacyDomainRedirect(isLegacyDomainRedirect)
276-
setIsRenameDialogOpen(isLegacyDomain || isLegacyDomainRedirect)
277-
}, [])
278-
279264
const modelProvider = useModelProvider()
280265

281266
return (
@@ -291,8 +276,6 @@ export default function AppProvider({ children }: AppProps) {
291276
signOut,
292277
isSignInDialogOpen,
293278
setIsSignInDialogOpen,
294-
isRenameDialogOpen,
295-
setIsRenameDialogOpen,
296279
isRateLimited,
297280
setIsRateLimited,
298281
isModelProviderDialogOpen,
@@ -301,8 +284,6 @@ export default function AppProvider({ children }: AppProps) {
301284
dbManager,
302285
pgliteVersion,
303286
pgVersion,
304-
isLegacyDomain,
305-
isLegacyDomainRedirect,
306287
showSidebar,
307288
setShowSidebar,
308289
}}
@@ -323,8 +304,6 @@ export type AppContextValues = {
323304
signOut: () => Promise<void>
324305
isSignInDialogOpen: boolean
325306
setIsSignInDialogOpen: (open: boolean) => void
326-
isRenameDialogOpen: boolean
327-
setIsRenameDialogOpen: (open: boolean) => void
328307
isRateLimited: boolean
329308
setIsRateLimited: (limited: boolean) => void
330309
isModelProviderDialogOpen: boolean
@@ -343,8 +322,6 @@ export type AppContextValues = {
343322
modelProvider: ReturnType<typeof useModelProvider>
344323
modelProviderError?: string
345324
setModelProviderError: (error: string | undefined) => void
346-
isLegacyDomain: boolean
347-
isLegacyDomainRedirect: boolean
348325
showSidebar: boolean
349326
setShowSidebar: (show: boolean) => void
350327
}

0 commit comments

Comments
 (0)