feat: IMVU imports on the hub: grants, requests and the importer's job queue (#13)
Phase 4a (docs/imports.md): the hub's side of IMVU imports. **Grants** - A creator picks one of their linked IMVU accounts and a catalog with imports on. They choose the whole shop (with exclusions) or listed products, listed or unlisted, and agree to a versioned consent text (`imports.ts` `consent`). - The catalog's team (`import:accept`) accepts or declines, and the creator is notified. Accepting queues what people already asked for, plus a grant's listed products. - The creator can change what's covered or withdraw it; the team (`import:withdraw`, which moderators also have) can end it. - Withdrawn products are removed the way moderation removes products: their hosting is dropped and their files go in the catalogs' changes feed. If another catalog's active grant still covers a product, it's only delisted from this catalog. - Unlinking an IMVU account, or someone else linking it, suspends its grants. **Requests** - Anyone signed in can ask for an IMVU product (an ID or a shop link). The answer is one of: - `added`: already imported, and now in their library - `queued`: delivered to their library once imported - `suggested`: the creator grants by listed products, and will see the request - `counted`: no grant covers it yet - Creators see request counts for their accounts, and moderators see the most-requested creators. - At most 50 requests a day per person. **Importer** - Importers sign in with `Authorization: Importer <catalog>:<key>`; turning imports on returns the key once. The catalog's importer can be paused (`import:pause`). - Importers claim jobs, get `t5de-import` tokens for a revision, and report outcomes. - Claims time out after 30 minutes. Failures retry after 1 min, 10 min, 1 h, then daily, and fail for good after 5 attempts. - `POST /catalog/revisions` takes `importToken` instead of `uploadToken`. The result is a published product owned by the creator (`product.imvu_product`, `product_revision.imvu_revision`). If another catalog already imported the same IMVU revision, this catalog hosts it too. - Every hour, the API rechecks a batch of imported products with IMVU (each at most once a day). A product gone from IMVU, or now another creator's, is withdrawn. One rated AP becomes adult. If it's still covered, a recheck job looks for new revisions. **Website** - `/imports`: ask for a product; bring your products; change or withdraw a grant; what people asked for. It's linked from the account page. - The console's catalog page has an Imports card leading to `/console/catalogs/:id/imports`: - importer on, off, pause and resume, and a new key - pending grants to accept or decline - grants to end - the queue, filtered by status, with retry - Notification text for the two new notification types. **Checks** - **Tests:** `test/imports.test.ts` covers the whole flow, from grant to withdrawal. All 58 API tests pass, and type checks pass. - **Scratch hub:** through the console forms, I turned imports on (the key was shown once), paused and resumed. I checked that importer claims accept the key and refuse a wrong one, that `/imports` renders, and that a request while IMVU is unreachable says "IMVU didn't answer." - **IMVU fields not checked live:** `api.imvu.com` times out from the dev machine. The product fields (`product_name`, `creator_cid`, `creator_name`, `rating`, `is_purchasable`) are what the design recorded; the spike will check them. **Formatting** - `two-factor-card.tsx`, `signin-form.tsx` and `console-nav.tsx` are only reformatted. I'd run Prettier on them at its default 80 columns in #12, but the repo is wrapped at about 120. **Still to do (4b and later)** - admin-recorded grants, proofs and unclaimed creators (and claiming them) - `GET /imports/available` for the proxy's shop button - t5de-catalog accepting `t5de-import` tokens on uploads - the spike, then `t5de-importer` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Phase 4a (docs/imports.md): the hub's side of IMVU imports. **Grants** - A creator picks one of their linked IMVU accounts and a catalog with imports on. They choose the whole shop (with exclusions) or listed products, listed or unlisted, and agree to a versioned consent text (`imports.ts` `consent`). - The catalog's team (`import:accept`) accepts or declines, and the creator is notified. Accepting queues what people already asked for, plus a grant's listed products. - The creator can change what's covered or withdraw it; the team (`import:withdraw`, which moderators also have) can end it. - Withdrawn products are removed the way moderation removes products: their hosting is dropped and their files go in the catalogs' changes feed. If another catalog's active grant still covers a product, it's only delisted from this catalog. - Unlinking an IMVU account, or someone else linking it, suspends its grants. **Requests** - Anyone signed in can ask for an IMVU product (an ID or a shop link). The answer is one of: - `added`: already imported, and now in their library - `queued`: delivered to their library once imported - `suggested`: the creator grants by listed products, and will see the request - `counted`: no grant covers it yet - Creators see request counts for their accounts, and moderators see the most-requested creators. - At most 50 requests a day per person. **Importer** - Importers sign in with `Authorization: Importer <catalog>:<key>`; turning imports on returns the key once. The catalog's importer can be paused (`import:pause`). - Importers claim jobs, get `t5de-import` tokens for a revision, and report outcomes. - Claims time out after 30 minutes. Failures retry after 1 min, 10 min, 1 h, then daily, and fail for good after 5 attempts. - `POST /catalog/revisions` takes `importToken` instead of `uploadToken`. The result is a published product owned by the creator (`product.imvu_product`, `product_revision.imvu_revision`). If another catalog already imported the same IMVU revision, this catalog hosts it too. - Every hour, the API rechecks a batch of imported products with IMVU (each at most once a day). A product gone from IMVU, or now another creator's, is withdrawn. One rated AP becomes adult. If it's still covered, a recheck job looks for new revisions. **Website** - `/imports`: ask for a product; bring your products; change or withdraw a grant; what people asked for. It's linked from the account page. - The console's catalog page has an Imports card leading to `/console/catalogs/:id/imports`: - importer on, off, pause and resume, and a new key - pending grants to accept or decline - grants to end - the queue, filtered by status, with retry - Notification text for the two new notification types. **Checks** - **Tests:** `test/imports.test.ts` covers the whole flow, from grant to withdrawal. All 58 API tests pass, and type checks pass. - **Scratch hub:** through the console forms, I turned imports on (the key was shown once), paused and resumed. I checked that importer claims accept the key and refuse a wrong one, that `/imports` renders, and that a request while IMVU is unreachable says "IMVU didn't answer." - **IMVU fields not checked live:** `api.imvu.com` times out from the dev machine. The product fields (`product_name`, `creator_cid`, `creator_name`, `rating`, `is_purchasable`) are what the design recorded; the spike will check them. **Formatting** - `two-factor-card.tsx`, `signin-form.tsx` and `console-nav.tsx` are only reformatted. I'd run Prettier on them at its default 80 columns in #12, but the repo is wrapped at about 120. **Still to do (4b and later)** - admin-recorded grants, proofs and unclaimed creators (and claiming them) - `GET /imports/available` for the proxy's shop button - t5de-catalog accepting `t5de-import` tokens on uploads - the spike, then `t5de-importer` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: dhkatz <[email protected]>
This commit was merged in pull request #13.
This commit is contained in:
1 parent
eca1884918
commit
7ece681eef
24 files changed
+6565
-158
No files matched your search
+35
-12
@@ -135,21 +135,44 @@ A Go program (its own repository) beside a `t5de-catalog`; it stores nothing las
|
||||
|
||||
| | |
|
||||
| --- | --- |
|
||||
| `GET /api/v1/imports/catalogs` | approved catalogs with imports on, accepting grants |
|
||||
| `POST /api/v1/imports/grants` | `{catalog, imvuId, scope, products?, exclude?, listed, consentVersion}` → 201 `{grant}` (pending). With `onBehalf: {imvuId, evidence, proof?}` instead of a linked `imvuId`: an admin-recorded grant. |
|
||||
| `GET /api/v1/imports/grants` | the person's grants; with `catalog=`, a catalog's (its team) |
|
||||
| `PATCH /api/v1/imports/grants/:id` | `{scope?, products?, exclude?, listed?}` |
|
||||
| `POST /api/v1/imports/grants/:id/accept`, `.../decline` | the catalog's team |
|
||||
| `DELETE /api/v1/imports/grants/:id` | withdraw |
|
||||
| `POST /api/v1/imports/proofs` | (admins) `{imvuId}` → `{proof, code}`; `POST .../proofs/:id/check` |
|
||||
| `POST /api/v1/imports/requests` | `{imvuProduct}` or `{imvuCreator}` → `{status: "queued" \| "suggested" \| "counted", product?}` |
|
||||
| `GET /api/v1/imports/requests?imvuCreator=` | counts (the creator, admins) |
|
||||
| `GET /api/v1/imports/available?imvuProducts=a,b` | for the proxy's shop button: which can the person get (and the hub product ID), already have, or request |
|
||||
| `GET /api/v1/imports/jobs?catalog=&status=` | the catalog's team: the queue; `POST .../jobs/:id/retry` |
|
||||
| `POST /api/v1/imports/claim` | `{imvuId}`: claim an unclaimed creator's products for a linked account |
|
||||
| `GET /api/v1/imports/catalogs` | (anyone) `{catalogs: [{id, name, url, contact, maxRating}], consent: {version, text}}`: approved catalogs with imports on |
|
||||
| `POST /api/v1/imports/grants` | `{catalog, imvuId, scope ("shop" \| "products"), products?, exclude?, listed?, consentVersion}` → 201 `{grant}` (pending). The IMVU account must be the person's linked one (403 `not_linked`); an older consent version is 409 `consent_changed`; one open grant per catalog and account (409 `exists`). |
|
||||
| `GET /api/v1/imports/grants` | the person's grants (as their creator) |
|
||||
| `PATCH /api/v1/imports/grants/:id` | (its creator) `{products?, exclude?, listed?}` → `{grant, withdrawn}`: products no longer covered are withdrawn; newly covered ones people asked for are queued |
|
||||
| `POST /api/v1/imports/grants/:id/accept`, `.../decline` | (`import:accept` at the catalog) `{reason?}` → `{grant, queued}`. The creator is notified. |
|
||||
| `DELETE /api/v1/imports/grants/:id` | (its creator, or `import:withdraw` at the catalog) `{reason?}` → `{grant, withdrawn}` |
|
||||
| `POST /api/v1/imports/requests` | `{imvuProduct}` or `{imvuCreator}` → `{status: "added" \| "queued" \| "suggested" \| "counted", product?}` (`added`: imported already, now in their library). At most 50 a day. |
|
||||
| `GET /api/v1/imports/requests?imvuCreator=` | `{requests: [{imvuProduct (0: the whole shop), name, requests}]}` for a linked account of theirs (moderators: any); without `imvuCreator`, moderators get `{creators}`: the most asked-for IMVU creators |
|
||||
| `GET /api/v1/catalogs/:id/importer` | (`import:accept` or `import:pause`) `{importer, grants, jobs, counts, permissions}`; `?status=` filters jobs |
|
||||
| `POST /api/v1/catalogs/:id/importer` | `{enabled?}` (`import:run`; turning on returns the importer `key`, shown once) and `{paused?}` (`import:pause`) |
|
||||
| `POST /api/v1/catalogs/:id/importer/key` | (`import:run`) → `{key}`: a new importer key |
|
||||
| `POST /api/v1/catalogs/:id/importer/jobs/:job/retry` | (`import:run`) a failed or done job queued again |
|
||||
|
||||
For importers (`Authorization: Importer <catalog ID>:<key>`) in products.md.
|
||||
|
||||
Built (phase 4a, 2026-11-05): grants made by creators, accepting and declining, changing and withdrawing (withdrawn
|
||||
products are removed as moderation removes, their hosting dropped and their files in the catalogs' changes feed;
|
||||
only delisted from one catalog if another catalog's active grant still covers them), requests with library
|
||||
delivery, the job queue (claims time out after 30 minutes; failures back off 1 min, 10 min, 1 h, daily, then fail
|
||||
after 5), import tokens and registering imported revisions (`product.imvu_product`, `product_revision.imvu_revision`;
|
||||
a revision another catalog imported already is hosted here too, same files only), grants suspended when their IMVU
|
||||
account is unlinked or linked to someone else, an hourly batch of daily rechecks (`imvu_product_info` caches IMVU's
|
||||
answers a day), notifications (`import_grant_decided`, `import_grant_ended`), the website's `/imports` page (ask
|
||||
for a product; bring products; change or withdraw; what people asked for) and the console's
|
||||
`/console/catalogs/:id/imports` (importer on, off, paused, key; accept and decline; the queue with retries).
|
||||
IMVU's product fields (`product_name`, `creator_cid`, `creator_name`, `rating`, `is_purchasable`) were checked
|
||||
against the live API (2026-11-06). Anonymous callers get 401 (`AUTHENTICATION-005`) alike for Access Pass products,
|
||||
deleted ones and IDs that never existed (404 only for a few very old IDs), so the hub keeps what it last saw on a
|
||||
401 rather than withdraw a product that became AP, and can't import AP products it never saw. The CDN
|
||||
(`userimages-akm.imvu.com/productdata/<id>/<n>/`) serves AP and even deleted products' files without signing in
|
||||
(made-up IDs 404), but they carry no creator, name or rating, which a grant needs to cover a product. The shop page
|
||||
(`www.imvu.com/shop/product.php?products_id=`) tells them apart: an AP product redirects to sign-in, a deleted one
|
||||
says "Not Found". For AP products, the importer's IMVU account (with Access Pass) would report the product info to
|
||||
the hub: decide with the spike.
|
||||
|
||||
Still to do: admin-recorded grants, proofs and unclaimed creators (and claiming); `GET /imports/available` for the
|
||||
proxy's shop button; t5de-catalog accepting `t5de-import` tokens on uploads; the spike and `t5de-importer`.
|
||||
|
||||
## Spike (before building the importer)
|
||||
|
||||
1. Import one product by hand as a local pack (full-size textures, no `_contents.json`, parent kept). Does the
|
||||
|
||||
Reference in new issue
Block a user