feat: recorded import grants, unclaimed creators and claiming (#15)
Co-authored-by: dhkatz <[email protected]>
This commit was merged in pull request #15.
This commit is contained in:
1 parent
e6a97be894
commit
8f6dacba10
18 files changed
+5222
-26
No files matched your search
@@ -3,24 +3,13 @@
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { api, ApiError, unwrap } from "@/lib/api";
|
||||
import { attempt, field, type ActionState } from "@/lib/actions";
|
||||
import { productIDs } from "@/lib/imvu";
|
||||
|
||||
const done = () => {
|
||||
revalidatePath("/imports");
|
||||
revalidatePath("/library");
|
||||
};
|
||||
|
||||
/** IMVU product IDs in what someone typed or pasted: numbers, or shop links (`products_id=123`, `product-123`). */
|
||||
function productIDs(text: string): number[] | undefined {
|
||||
const out = new Set<number>();
|
||||
for (const part of text.split(/[\s,]+/).filter(Boolean)) {
|
||||
const m = part.match(/(?:products_id=|product-)(\d+)/) ?? part.match(/^(\d+)$/);
|
||||
const n = m ? Number(m[1]) : NaN;
|
||||
if (!Number.isSafeInteger(n) || n <= 0) return undefined;
|
||||
out.add(n);
|
||||
}
|
||||
return [...out];
|
||||
}
|
||||
|
||||
const answers = {
|
||||
added: "It's in your library.",
|
||||
queued: "Its creator lets T5DE have it: it'll be in your library once the catalog imports it.",
|
||||
|
||||
Reference in new issue
Block a user