feat: IMVU imports on the hub: grants, requests and the importer's job queue
Pull request / title (pull_request) Successful in 1s
CI / test (pull_request) Successful in 1m15s
CI / image (apps/api/Dockerfile, t5de-hub-api) (pull_request) Skipped
CI / image (apps/web/Dockerfile, t5de-hub-web) (pull_request) Skipped

Creators grant a catalog leave to import their IMVU products (whole shop less
exclusions, or listed products) from a linked IMVU account, agreeing to a versioned
consent text; the catalog's team accepts or declines. Requests queue covered
products (or add them to the library when imported already), suggest, or count.
Importers claim jobs with the catalog's importer key, get t5de-import tokens, and
the catalog registers imported revisions as published products owned by the creator.
Narrowing or withdrawing a grant withdraws products; unlinking suspends grants;
an hourly batch rechecks imported products with IMVU daily. Website: /imports and
the console's catalog imports page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
dhkatzandClaude Opus 5.5 committed 2026-11-05 19:46:10 -08:00
1 parent eca1884918
commit 7d708aebdb
24 files changed
+6521 -153

No files matched your search

+23 -82
View File
@@ -9,13 +9,7 @@ import { ErrorText } from "@/components/forms";
import { Tag } from "@/components/status";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Button } from "@/components/ui/button";
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { authClient } from "@/lib/auth-client";
@@ -25,13 +19,7 @@ type Stage =
| { kind: "setup"; uri: string; codes: string[] }
| { kind: "codes"; codes: string[] };
export function TwoFactorCard({
enabled,
neededFor,
}: {
enabled: boolean;
neededFor: string[];
}) {
export function TwoFactorCard({ enabled, neededFor }: { enabled: boolean; neededFor: string[] }) {
const router = useRouter();
const [stage, setStage] = useState<Stage>({ kind: "idle" });
const [error, setError] = useState("");
@@ -45,10 +33,7 @@ export function TwoFactorCard({
setPending(false);
}
async function withPassword(
then: "enable" | "codes" | "disable",
password: string,
) {
async function withPassword(then: "enable" | "codes" | "disable", password: string) {
if (then === "enable") {
const { data, error } = await authClient.twoFactor.enable({ password });
if (error || !data || !("totpURI" in data) || !data.totpURI)
@@ -62,8 +47,7 @@ export function TwoFactorCard({
const { data, error } = await authClient.twoFactor.generateBackupCodes({
password,
});
if (error || !data)
return error?.message ?? "That didn't work. Try again.";
if (error || !data) return error?.message ?? "That didn't work. Try again.";
setStage({ kind: "codes", codes: data.backupCodes });
} else {
const { error } = await authClient.twoFactor.disable({ password });
@@ -82,13 +66,11 @@ export function TwoFactorCard({
router.refresh();
}
const submitTo =
(fn: (form: FormData) => Promise<string | void>) =>
(e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
const form = new FormData(e.currentTarget);
void run(() => fn(form));
};
const submitTo = (fn: (form: FormData) => Promise<string | void>) => (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
const form = new FormData(e.currentTarget);
void run(() => fn(form));
};
return (
<Card>
@@ -97,8 +79,7 @@ export function TwoFactorCard({
Two-Factor Sign-In {enabled && <Tag tone="strong">on</Tag>}
</CardTitle>
<CardDescription>
Signing in asks for a code from an authenticator app on your phone as
well as your password.
Signing in asks for a code from an authenticator app on your phone as well as your password.
</CardDescription>
</CardHeader>
<CardContent className="space-y-4">
@@ -123,34 +104,19 @@ export function TwoFactorCard({
{stage.kind === "idle" &&
(enabled ? (
<div className="flex flex-wrap gap-2">
<Button
variant="outline"
onClick={() => setStage({ kind: "password", then: "codes" })}
>
<Button variant="outline" onClick={() => setStage({ kind: "password", then: "codes" })}>
New backup codes
</Button>
<Button
variant="outline"
onClick={() => setStage({ kind: "password", then: "disable" })}
>
<Button variant="outline" onClick={() => setStage({ kind: "password", then: "disable" })}>
Turn off
</Button>
</div>
) : (
<Button
onClick={() => setStage({ kind: "password", then: "enable" })}
>
Turn on
</Button>
<Button onClick={() => setStage({ kind: "password", then: "enable" })}>Turn on</Button>
))}
{stage.kind === "password" && (
<form
onSubmit={submitTo((f) =>
withPassword(stage.then, String(f.get("password"))),
)}
className="space-y-3"
>
<form onSubmit={submitTo((f) => withPassword(stage.then, String(f.get("password"))))} className="space-y-3">
<p className="text-sm">
{stage.then === "disable"
? neededFor.length > 0
@@ -170,22 +136,10 @@ export function TwoFactorCard({
aria-label="Password"
className="max-w-xs"
/>
<Button
type="submit"
variant={stage.then === "disable" ? "destructive" : "default"}
disabled={pending}
>
{pending
? "Checking…"
: stage.then === "disable"
? "Turn off"
: "Continue"}
<Button type="submit" variant={stage.then === "disable" ? "destructive" : "default"} disabled={pending}>
{pending ? "Checking…" : stage.then === "disable" ? "Turn off" : "Continue"}
</Button>
<Button
type="button"
variant="ghost"
onClick={() => setStage({ kind: "idle" })}
>
<Button type="button" variant="ghost" onClick={() => setStage({ kind: "idle" })}>
Cancel
</Button>
</div>
@@ -197,8 +151,8 @@ export function TwoFactorCard({
<ol className="list-decimal space-y-4 pl-5 text-sm">
<li className="space-y-2">
<p>
Scan this with an authenticator app (such as Google
Authenticator, Microsoft Authenticator or 1Password).
Scan this with an authenticator app (such as Google Authenticator, Microsoft Authenticator or
1Password).
</p>
<div
className="w-44 rounded-md bg-white p-2 [&>svg]:h-auto [&>svg]:w-full"
@@ -216,10 +170,7 @@ export function TwoFactorCard({
</p>
</li>
<li className="space-y-2">
<p>
Keep these backup codes somewhere safe. Each signs you in once
if you lose your phone.
</p>
<p>Keep these backup codes somewhere safe. Each signs you in once if you lose your phone.</p>
<BackupCodes codes={stage.codes} />
</li>
<li className="space-y-2">
@@ -242,11 +193,7 @@ export function TwoFactorCard({
<Button type="submit" disabled={pending}>
{pending ? "Checking…" : "Turn on"}
</Button>
<Button
type="button"
variant="ghost"
onClick={() => setStage({ kind: "idle" })}
>
<Button type="button" variant="ghost" onClick={() => setStage({ kind: "idle" })}>
Cancel
</Button>
</form>
@@ -257,15 +204,9 @@ export function TwoFactorCard({
{stage.kind === "codes" && (
<div className="space-y-2 text-sm">
<p>
Your new backup codes. Keep them somewhere safe: they won&apos;t
be shown again.
</p>
<p>Your new backup codes. Keep them somewhere safe: they won&apos;t be shown again.</p>
<BackupCodes codes={stage.codes} />
<Button
variant="outline"
onClick={() => setStage({ kind: "idle" })}
>
<Button variant="outline" onClick={() => setStage({ kind: "idle" })}>
Done
</Button>
</div>