@protobase/ui 0.63.2 → 0.63.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth/auth-gate.js +4 -1
- package/dist/auth/auth-provider.js +4 -1
- package/dist/auth/first-run-page.js +49 -40
- package/dist/auth/messages.js +4 -0
- package/dist/package.js +1 -1
- package/dist/shell/assets/{app-DqOuQJpX.js → app-Bm6h0l5D.js} +8 -8
- package/dist/shell/assets/{calls-BjMBacTA.js → calls-CEW8hdPi.js} +2 -2
- package/dist/shell/assets/{index-DYpysp6_.js → index-D7O0sMwH.js} +2 -2
- package/dist/shell/assets/{records-map-BZPeBvM4.js → records-map-BIDl1ull.js} +2 -2
- package/dist/shell/assets/{shared-protobase-ui-ByA8um6R.js → shared-protobase-ui-F5elmh4N.js} +2 -2
- package/dist/shell/index.html +3 -3
- package/dist/shell/protobase.shell.json +2 -2
- package/dist/shell/protobase.sw.js +2 -2
- package/dist/shell-source-maps/assets/app-Bm6h0l5D.js.map +1 -0
- package/dist/shell-source-maps/assets/{calls-BjMBacTA.js.map → calls-CEW8hdPi.js.map} +1 -1
- package/dist/shell-source-maps/assets/{index-DYpysp6_.js.map → index-D7O0sMwH.js.map} +1 -1
- package/dist/shell-source-maps/assets/{records-map-BZPeBvM4.js.map → records-map-BIDl1ull.js.map} +1 -1
- package/dist/shell-source-maps/assets/{shared-protobase-ui-ByA8um6R.js.map → shared-protobase-ui-F5elmh4N.js.map} +1 -1
- package/package.json +4 -4
- package/dist/shell-source-maps/assets/app-DqOuQJpX.js.map +0 -1
package/dist/auth/auth-gate.js
CHANGED
|
@@ -148,7 +148,10 @@ const useAuthPage = (workspace, children) => {
|
|
|
148
148
|
children: text("tryAgain")
|
|
149
149
|
})]
|
|
150
150
|
});
|
|
151
|
-
case "needs-admin": return /* @__PURE__ */ jsx(FirstRunPage, {
|
|
151
|
+
case "needs-admin": return /* @__PURE__ */ jsx(FirstRunPage, {
|
|
152
|
+
firstAdminUrl: state.firstAdminUrl,
|
|
153
|
+
onCheckAgain: recheck
|
|
154
|
+
});
|
|
152
155
|
}
|
|
153
156
|
if (state.kind === "signed-in" && address) return /* @__PURE__ */ jsx(Redirect, { to: next ?? "/" });
|
|
154
157
|
if (page.kind === "reset-password") return /* @__PURE__ */ jsx(ResetPasswordPage, {
|
|
@@ -125,7 +125,10 @@ const AuthProvider = ({ session: given, origin, nativeBridge, children }) => {
|
|
|
125
125
|
setAnonymous(Boolean(status.anonymous));
|
|
126
126
|
setBeforeSignIn(status.plugins ?? []);
|
|
127
127
|
setLocale(status.locale);
|
|
128
|
-
if (status.needsAdmin) return setState({
|
|
128
|
+
if (status.needsAdmin) return setState({
|
|
129
|
+
kind: "needs-admin",
|
|
130
|
+
...status.firstAdminUrl && { firstAdminUrl: status.firstAdminUrl }
|
|
131
|
+
});
|
|
129
132
|
const user = await session.session();
|
|
130
133
|
return user ? enter(user) : setState({ kind: status.anonymous ? "visitor" : "signed-out" });
|
|
131
134
|
}).catch((error) => setState({
|
|
@@ -1,52 +1,61 @@
|
|
|
1
1
|
import { text } from "./messages.js";
|
|
2
|
-
import {
|
|
2
|
+
import { cn } from "../lib/cn.js";
|
|
3
|
+
import { Button, buttonClass } from "../primitives/button.js";
|
|
3
4
|
import { AuthLayout } from "./auth-layout.js";
|
|
4
5
|
import { useState } from "react";
|
|
5
|
-
import { Check, Copy } from "lucide-react";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Check, Copy, ExternalLink } from "lucide-react";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
//#region src/auth/first-run-page.tsx
|
|
8
9
|
const createAdminCommand = "protobase users create you@example.com";
|
|
9
10
|
/**
|
|
10
11
|
* Shown while the admin store has no user. Accounts are not created over the web (a fresh URL must not be claimable
|
|
11
|
-
* by whoever reaches it first), so this says how to create the first admin on the host
|
|
12
|
+
* by whoever reaches it first), so this says how to create the first admin on the host, or, with `firstAdminUrl`,
|
|
13
|
+
* links to the platform's page where it is added, since nobody hosted there can run the command.
|
|
12
14
|
*/
|
|
13
|
-
const FirstRunPage = ({ command = createAdminCommand, onCheckAgain, busy }) => {
|
|
15
|
+
const FirstRunPage = ({ command = createAdminCommand, firstAdminUrl, onCheckAgain, busy }) => /* @__PURE__ */ jsxs(AuthLayout, {
|
|
16
|
+
title: text("noAdminTitle"),
|
|
17
|
+
description: text("noAdminDescription"),
|
|
18
|
+
children: [firstAdminUrl ? /* @__PURE__ */ jsx(ConsoleLink, { url: firstAdminUrl }) : /* @__PURE__ */ jsx(CommandBox, { command }), /* @__PURE__ */ jsx(Button, {
|
|
19
|
+
variant: firstAdminUrl ? "secondary" : "primary",
|
|
20
|
+
className: "mt-4 min-h-10 w-full",
|
|
21
|
+
loading: busy,
|
|
22
|
+
onClick: onCheckAgain,
|
|
23
|
+
children: text("reload")
|
|
24
|
+
})]
|
|
25
|
+
});
|
|
26
|
+
const ConsoleLink = ({ url }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("p", {
|
|
27
|
+
className: "text-muted-foreground",
|
|
28
|
+
children: text("firstAdminExplanation")
|
|
29
|
+
}), /* @__PURE__ */ jsxs("a", {
|
|
30
|
+
href: url,
|
|
31
|
+
target: "_blank",
|
|
32
|
+
rel: "noopener noreferrer",
|
|
33
|
+
className: cn(buttonClass({ variant: "primary" }), "mt-4 min-h-10 w-full"),
|
|
34
|
+
children: [text("firstAdminLink"), /* @__PURE__ */ jsx(ExternalLink, { className: "size-4" })]
|
|
35
|
+
})] });
|
|
36
|
+
const CommandBox = ({ command }) => {
|
|
14
37
|
const [copied, setCopied] = useState(false);
|
|
15
|
-
return /* @__PURE__ */ jsxs(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
className: "inline-flex size-8 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted pointer-coarse:size-11",
|
|
38
|
-
children: copied ? /* @__PURE__ */ jsx(Check, { className: "size-4 text-success" }) : /* @__PURE__ */ jsx(Copy, { className: "size-4" })
|
|
39
|
-
})]
|
|
40
|
-
}),
|
|
41
|
-
/* @__PURE__ */ jsx(Button, {
|
|
42
|
-
variant: "primary",
|
|
43
|
-
className: "mt-4 min-h-10 w-full",
|
|
44
|
-
loading: busy,
|
|
45
|
-
onClick: onCheckAgain,
|
|
46
|
-
children: text("reload")
|
|
47
|
-
})
|
|
48
|
-
]
|
|
49
|
-
});
|
|
38
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("p", {
|
|
39
|
+
className: "text-muted-foreground",
|
|
40
|
+
children: text("noAdminExplanation")
|
|
41
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
42
|
+
className: "mt-4 flex items-center gap-2 rounded-md border bg-surface py-1.5 pl-3 pr-1.5",
|
|
43
|
+
children: [/* @__PURE__ */ jsx("code", {
|
|
44
|
+
className: "min-w-0 flex-1 break-all font-mono text-xs",
|
|
45
|
+
children: command
|
|
46
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
47
|
+
type: "button",
|
|
48
|
+
"aria-label": text("copyCommand"),
|
|
49
|
+
onClick: () => {
|
|
50
|
+
navigator.clipboard.writeText(command).then(() => {
|
|
51
|
+
setCopied(true);
|
|
52
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
className: "inline-flex size-8 shrink-0 items-center justify-center rounded text-muted-foreground hover:bg-muted pointer-coarse:size-11",
|
|
56
|
+
children: copied ? /* @__PURE__ */ jsx(Check, { className: "size-4 text-success" }) : /* @__PURE__ */ jsx(Copy, { className: "size-4" })
|
|
57
|
+
})]
|
|
58
|
+
})] });
|
|
50
59
|
};
|
|
51
60
|
//#endregion
|
|
52
61
|
export { FirstRunPage, createAdminCommand };
|
package/dist/auth/messages.js
CHANGED
|
@@ -29,6 +29,8 @@ const text = defineMessages({
|
|
|
29
29
|
noAdminDescription: "This Protobase has no users to sign in with.",
|
|
30
30
|
noAdminExplanation: "Run this in the terminal where Protobase runs, then reload. The first admin is created on the server, not in the browser, so nobody else can claim a fresh URL.",
|
|
31
31
|
copyCommand: "Copy command",
|
|
32
|
+
firstAdminExplanation: "The first user is added in the Protobase Cloud console, not in the browser, so nobody else can claim a fresh URL. Add yourself there, then reload.",
|
|
33
|
+
firstAdminLink: "Add your first user in the Protobase Cloud console",
|
|
32
34
|
reload: "Reload",
|
|
33
35
|
tooManyRequests: "Too many requests. Wait a minute and try again.",
|
|
34
36
|
tooManyAttempts: "Too many attempts. Wait a minute and try again.",
|
|
@@ -127,6 +129,8 @@ const text = defineMessages({
|
|
|
127
129
|
noAdminDescription: "Deze Protobase heeft geen gebruikers om mee in te loggen.",
|
|
128
130
|
noAdminExplanation: "Voer dit uit in de terminal waar Protobase draait en laad de pagina daarna opnieuw. De eerste beheerder wordt op de server gemaakt, niet in de browser, zodat niemand anders een nieuwe URL kan opeisen.",
|
|
129
131
|
copyCommand: "Opdracht kopiëren",
|
|
132
|
+
firstAdminExplanation: "De eerste gebruiker wordt in de Protobase Cloud-console toegevoegd, niet in de browser, zodat niemand anders een nieuwe URL kan opeisen. Voeg jezelf daar toe en laad de pagina daarna opnieuw.",
|
|
133
|
+
firstAdminLink: "Voeg je eerste gebruiker toe in de Protobase Cloud-console",
|
|
130
134
|
reload: "Opnieuw laden",
|
|
131
135
|
tooManyRequests: "Te veel verzoeken. Wacht een minuut en probeer het opnieuw.",
|
|
132
136
|
tooManyAttempts: "Te veel pogingen. Wacht een minuut en probeer het opnieuw.",
|
package/dist/package.js
CHANGED