Read Supabase's wrapped lists, create free projects directly, open Supabase in a new tab, keep installs clean
- list_organizations and list_projects reply {organizations: [...]} and {projects: [...]}: read both
- A $0 project is created without a cost confirmation, as Supabase's tool asks
- Connect Supabase opens Supabase in its own tab; broke's tab updates when the sign-in finishes
- Installs use npm ci, and npm run update puts back an npm-rewritten package-lock.json
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0e1a05801c
commit
5893af22c1
5 files changed
+47
-11
No files matched your search
@@ -182,9 +182,17 @@ export function ConnectSupabaseButton({ onDone, onFail }: { onDone: () => void;
|
||||
onClick={async () => {
|
||||
setBusy(true);
|
||||
setMsg("");
|
||||
// Supabase opens in its own tab, so broke stays put. Opened now, while the click still counts, or it's blocked.
|
||||
const tab = window.open("", "_blank");
|
||||
const res = await fetch("/api/setup/supabase/connect", { method: "POST" });
|
||||
const body = await res.json().catch(() => ({}));
|
||||
if (body.url) return void (window.location.href = body.url);
|
||||
if (body.url) {
|
||||
if (tab) tab.location.href = body.url;
|
||||
else window.location.href = body.url; // pop-ups blocked: this tab, as before
|
||||
setMsg("Approve broke in the Supabase tab. This page updates when you're done.");
|
||||
return;
|
||||
}
|
||||
tab?.close();
|
||||
setBusy(false);
|
||||
if (!res.ok) {
|
||||
setMsg(body.error ?? "Couldn't start the Supabase sign-in.");
|
||||
|
||||
@@ -61,6 +61,20 @@ export function SetupChecklist({ signedIn }: { signedIn: boolean }) {
|
||||
}
|
||||
setChecking(false);
|
||||
}, []);
|
||||
// Connect Supabase opens Supabase in its own tab. Back from Supabase, that tab passes the result here and closes itself.
|
||||
useEffect(() => {
|
||||
const db = new URLSearchParams(window.location.search).get("db");
|
||||
if (db && window.opener) {
|
||||
try { localStorage.setItem("broke.supabase", `${db}|${Date.now()}`); } catch { /* private window: this tab just stays open */ }
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
const onStorage = (e: StorageEvent) => {
|
||||
if (e.key === "broke.supabase" && e.newValue) window.location.href = `/setup?db=${encodeURIComponent(e.newValue.split("|")[0])}`;
|
||||
};
|
||||
addEventListener("storage", onStorage);
|
||||
return () => removeEventListener("storage", onStorage);
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
load();
|
||||
}, [load]);
|
||||
|
||||
Reference in new issue
Block a user