feat(setup): center onboarding and add secure token help
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
export const SETUP_TOKEN_COMMAND = "python -m app.container_bootstrap setup-token";
|
||||
|
||||
type ClipboardWriter = Pick<Clipboard, "writeText">;
|
||||
type CommandField = Pick<HTMLTextAreaElement, "focus" | "select">;
|
||||
|
||||
export async function copySetupTokenCommand(
|
||||
clipboard: ClipboardWriter | undefined,
|
||||
commandField: CommandField | null,
|
||||
): Promise<"copied" | "selected" | "manual"> {
|
||||
try {
|
||||
if (clipboard?.writeText) {
|
||||
await clipboard.writeText(SETUP_TOKEN_COMMAND);
|
||||
return "copied";
|
||||
}
|
||||
} catch {
|
||||
// Clipboard access may be unavailable on LAN HTTP or denied by the browser.
|
||||
}
|
||||
if (commandField) {
|
||||
commandField.focus();
|
||||
commandField.select();
|
||||
return "selected";
|
||||
}
|
||||
return "manual";
|
||||
}
|
||||
Reference in New Issue
Block a user