Files
t5de-hub/docs/imports.md
T
dhkatz efc7d6b808
Release / release (push) Successful in 4s
CI / test (push) Successful in 1m35s
CI / image (apps/api/Dockerfile, t5de-hub-api) (push) Successful in 6s
CI / image (apps/web/Dockerfile, t5de-hub-web) (push) Successful in 14s
feat: whole shops listed on IMVU, and GET /imports/available (#16)
Co-authored-by: dhkatz <[email protected]>
2026-11-08 00:51:00 +00:00

273 lines
22 KiB
Markdown

# Imported IMVU products
Creators who sell on IMVU can let T5DE users wear their IMVU products for free: a catalog imports the products from
IMVU, hosts them as ordinary T5 products, and serves them to its members. Decided 2026-11-04 (the user's
discussion). The contract with catalogs and proxies is in `products.md`; permissions and the console are in
`console.md`.
## Why the catalog imports
- **Responsibility stays with catalogs**, as for uploads: the catalog that imports a product stores and serves its
files, and its takedown contact answers for them. End users only download from catalogs, as for any T5 product.
- **Nothing changes for proxies**: an imported product is a hub product with revisions. No aliasing of IMVU IDs, no
re-signed IMVU requests.
- **Only consenting creators**: nothing is imported without a grant from the creator (or one an admin records on
their behalf, with evidence).
## Words
- **Grant**: a creator's consent for one catalog to import their products: the whole shop, or listed products.
- **Importer** (`t5de-importer`): a program that fetches products from IMVU and uploads them to its catalog. Run by
the catalog's operator beside an ordinary `t5de-catalog`. T5DE runs one for its own import catalog; any catalog
may enable imports.
- **Import job**: one product to import or re-check, queued at the hub.
- **Request**: someone asking for a creator's product, or whole shop, to be on T5DE.
- **Unclaimed creator**: a placeholder creator for IMVU creators without a hub account, whose consent an admin
recorded. Claimed when they join and link that IMVU account.
## What's imported
- **The product's own files**: its CFL's entries, with the 16x16 placeholder textures replaced by the full-size
originals its `_contents.json` lists (fetched from IMVU's CDN beside the CFL), and without `_contents.json` (packs
don't use it). Its `index.xml` keeps its `__DATAIMPORT` of the parent.
- **The parent stays on IMVU** (**Decided**, for now): the revision's `parent` is the IMVU product it derives from,
as for uploaded products, and the client loads it from IMVU as it does for anyone's outfit. Option B
(**Decided**): any product the creator made may be imported, whatever it derives from; deriving from a derivable
product is what IMVU's derive permission allows. If keeping the parent on IMVU becomes a problem, imports can be
flattened later (the whole chain in one product, parent 0).
- **Info**: name and rating from IMVU's public API (`api.imvu.com/product/product-<id>`: `product_name`, `rating`,
`creator_cid`), the higher of IMVU's rating and the files' `ProductRating`; a description saying it's imported
with the creator's permission, linking its IMVU page. Creators edit it afterwards like any product.
- **Revisions**: each IMVU revision imported becomes a hub revision ("Imported from IMVU revision 12"). Revision
history and staying on a revision work as for any product.
- One hub product per IMVU product (`product.imvu_product`, unique). Two catalogs importing the same product mirror
the same revisions.
## Grants
```
import_grant(id, catalog, creator person, imvu_id, scope ("shop" | "products"), products bigint[], exclude bigint[],
listed, consent_version, consented_at, consent_kind ("verified" | "recorded"), evidence, recorded_by,
proof_checked_at, accepted_at, accepted_by, withdrawn_at, status ("pending" | "active" | "suspended" | "withdrawn"))
```
- **Made by the creator**: on the hub website, "Bring my IMVU shop": choose one of their linked IMVU accounts, a
catalog with imports on, the scope (whole shop with exclusions, or listed products), listed or unlisted, and agree
to the consent text. The text is versioned; the version and time are stored.
- **Accepted by the catalog**: the catalog's team (`import:accept`) accepts or declines it, so nobody pushes imports
onto a catalog without its operator agreeing. Until then it's `pending`.
- **Recorded by an admin** (`import:grant-on-behalf`, hub-wide; for creators who won't make an account): the IMVU
creator (ID or name), scope, catalog, and **evidence** (required: how they agreed, e.g. "Discord DM, 2026-11-04",
optionally a screenshot). Optional **proof without an account**: the console gives a code to send the creator;
they put it in their IMVU tagline, and the hub checks it as for linking. Shown as "consent verified" or "consent
recorded by admin". The products belong to an unclaimed creator.
- **Scope "shop"**: any product whose `creator_cid` is the grant's IMVU account, including new ones, except
exclusions. **Scope "products"**: only those listed; the creator can add more (requests show as suggestions).
- **Changes**: the creator (or an admin, for recorded grants) changes the scope, list and exclusions any time.
Removing a product from a grant withdraws it (below).
- **Ending**: the creator withdraws the grant, or the catalog's team ends it, or the IMVU account's link moves to
another person (the grant is `suspended` until the new owner consents again), or the account is unlinked
(`suspended`). Admins can withdraw any grant.
### Unclaimed creators and claiming
An unclaimed creator is a hub person without credentials (can't sign in), named after the IMVU account ("Bar, on
IMVU"), marked unclaimed. When someone links that IMVU account, the hub offers them the claim: the products, grants,
requests and stats move to them, and the placeholder is deleted. Until then, withdrawal goes through admins
(contacting T5DE, or the catalog's takedown contact).
Built (2026-11-07): `user.unclaimed_imvu_id` marks the placeholder (username `imvu_<IMVU ID>`, a prefix nobody can
sign up with; display name the IMVU name; an `.invalid` email and no password). Admins with `import:grant-on-behalf`
(two-factor sign-in) record grants on the console's Imports page (evidence required; not for IMVU accounts linked to
someone, who grant themselves), make a tagline code and check it (`import_grant.proof_code`, `proof_checked_at`:
"proven"), and change or withdraw them until claimed. The catalog's team accepts them as any grant. Linking or
unlinking the IMVU account doesn't suspend an unclaimed creator's grants (they stand on the recorded consent). Whoever
links the account sees the claim on their account page; claiming moves the products (and their revisions' uploader)
and grants to them and deletes the placeholder. Requests aren't the creator's (they're keyed by IMVU account), so
nothing moves for them. Not built: a screenshot with the evidence.
## Requests
```
import_request(person, imvu_creator, imvu_product (0: the whole shop), created_at) -- unique per person and target
```
- Anyone signed in can request a product (by IMVU ID or from its shop page in the client) or a creator's whole shop.
At most 50 a day per person; one per person and target, so counts can't be inflated.
- The hub looks up the product's creator (public API, cached in `imvu_product_info`).
- **Covered by an active grant**: queued for import at once; the person gets the product in their library when it's
done (pending until then; nothing on screen waits for it).
- **Not covered, grant by products**: a suggestion for the creator ("12 people asked for X"), added with one click.
- **No grant**: counted. The creator sees the demand when they bring their shop; the hub's creator page for a shop
that hasn't joined can show "requested by 47 people". The hub never contacts creators through IMVU.
- Admins see request counts per IMVU creator in the console (whom it's worth asking).
## Import jobs
```
import_job(id, catalog, grant, imvu_product, kind ("import" | "recheck"), status ("queued" | "claimed" | "done" | "failed"),
imvu_revision, reason, attempts, claimed_at, next_at, created_at, updated_at)
```
- **Queued by the hub**: a request covered by a grant, a product added to a grant, a "shop" grant accepted (the
products people requested so far, and the shop's products as IMVU lists them: "Whole shops" below), and a daily
**recheck** of each imported product.
- **The hub checks IMVU's public API** before queuing and at each recheck (rate-limited, as for parents): the
product exists, its creator is the grant's account, its rating. Gone from IMVU: withdrawn. Rating changed to AP:
adult at once. Retired (`is_purchasable` false): kept unless the creator excludes it.
- **The importer claims jobs**, fetches, converts, uploads with a `t5de-import` token (products.md), and reports the
outcome. Rechecks probe IMVU's CDN for revisions after the last imported one; a new one is imported.
- Failures retry with backoff (1 min, 10 min, 1 h, then daily; failed for good after 5); the reason is shown in the
console. The catalog's team can retry or re-import one product, and pause the importer (`import:pause`): the hub
hands out no jobs while paused.
## Whole shops
IMVU lists a shop's products to the signed out (`api.imvu.com/product?creator=<username>`, general-rated only: no
Access Pass products). The hub lists a "shop" grant's shop when the grant is accepted (or becomes a whole shop), then
daily (a few shops an hour, oldest listing first), and when the catalog's team (`import:run`) or the creator asks
("List the shop again", at most 3 times an hour). Each listing looks the IMVU account up by ID first (listing goes
by its current username), keeps every listed product's info (`imvu_product_info`, as a lookup would; so their
rechecks need no lookup for a day), records when and how many (`import_grant.shop_listed_at`, `shop_listed`), and
queues imports for the creator's known products not imported in that catalog yet, less exclusions. A product that
disappears from the listing isn't withdrawn for it: it may have become Access Pass; rechecks decide.
IMVU's paging is unreliable: in pages of 100 (or its default 50) pages overlap and products are missed (2026-11-07:
580 different products of 639), but one page of up to 1000 returns them all. So the hub asks for pages of 1000,
follows `next` (on IMVU's API only), drops repeats, and stops at 10 pages.
## Withdrawal
A withdrawn imported product (grant withdrawn or narrowed, gone from IMVU, account link moved) is removed as
moderation removes products: it leaves libraries, outfits and rooms; its page says it was withdrawn; the catalog
deletes its files (the catalog changes feed, products.md). Unlike deleting an uploaded product, people who had it
don't keep it: the consent is gone.
## `t5de-importer`
A Go program (its own repository) beside a `t5de-catalog`; it stores nothing lasting but its working files, its key
pair and the IMVU accounts' passwords.
- Everything is set from the console (the catalog's Imports page) except what it needs to reach the hub:
`HUB_URL`, `CATALOG_ID`, `IMPORTER_KEY` (from turning imports on), `IMPORTER_DATA` (its folder). The rest
(requests a second to IMVU, jobs at a time, the IMVU accounts and their order) comes from
`GET /api/v1/importer/config`, polled every minute.
- Revisions: without an IMVU account, the CDN is probed (`HEAD productdata/<id>/<n>`) once per product; afterwards a
recheck tries the next few numbers. With one, `authorizeProducts` gives exact revisions.
- Reads CFLs with t5de-api's `cfl` package; the conversion follows `@imvu/chkn` (dhkatz/imvu.js) as a reference.
- Validates with t5de-api's `pack` rules before uploading; a product breaking them fails with the reason. (The spike
checks whether typical IMVU products fit; imports may need their own limits.)
### IMVU accounts
Signed out, IMVU shows no info for Access Pass products (see "Built"), so an importer needs an IMVU account with
Access Pass to import them, and accounts give exact revisions. The catalog's team adds them on the console; their
passwords never reach the hub readable, and are kept only by the importer.
- On first start the importer makes an RSA key pair (3072-bit, RSA-OAEP with SHA-256) in `IMPORTER_DATA` and sends
the public key with `POST /api/v1/importer/hello {version, publicKey}`. The console shows its fingerprint and
version and when it was last heard from.
- Adding an account (`import:run`): the console looks the username up on IMVU (public info: avatar, ID, Access
Pass, age verified) and asks to confirm it in a dialog showing that, with a warning if it has no Access Pass
and the importer key's fingerprint. The password is encrypted in the browser (WebCrypto) with the importer's
public key; the hub stores only that sealed blob, hands it to the importer in its config, and deletes it once the
importer confirms it has it (or after 7 days).
- Several accounts, in an order the team sets: the importer uses the first that signs in and moves to the next when
one fails. It reports each account's state (`ok`, `sign_in_failed`, `needs_password`, plus whether IMVU shows it
Access Pass) with `POST /api/v1/importer/accounts/:id`, shown on the console. Before that an account is `waiting`
(sealed, not yet with the importer) or `received`. At most 10 accounts.
- If the importer's key pair changes (a new install), passwords sealed for the old key can't be read: those
accounts show "needs password" until re-entered.
- Removing an account tells the importer to forget it. Adding, new passwords and removing are audited
(`catalog.importer_account`), as are settings (`catalog.importer_settings`) and a new importer key pair
(`catalog.importer_hello`).
- Built (2026-11-07): all of the above on the hub and the console, except the importer's report of AP products' info
(with the importer).
- What the importer sees with an account (creator, name, rating of AP products) it reports to the hub with the job
(`POST /api/v1/importer/jobs/:id {product: {creatorId, name, rating}}`), trusted from that catalog's importer
only, for products IMVU hides from the hub.
## Hub routes
| | |
| --- | --- |
| `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; for an unclaimed creator, `import:grant-on-behalf`) `{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/grants/:id/list` | (its creator, or `import:run` at the catalog) → `{grant, listed, queued}`: an active whole-shop grant's shop listed on IMVU now. 409 `not_shop`; 429 after 3 an hour. |
| `GET /api/v1/imports/available?products=&creators=` | (anyone) up to 100 IMVU product IDs and 100 IMVU account IDs, comma-separated → `{products: [{imvuProduct, status, product, requested?}], shops: [{imvuCreator, shop, products}]}`. `status`: `imported` (`product` is the hub product), `adult` (imported, but the person can't see adult products), `queued`, `covered` (a grant covers it: asking queues it) or `none` (asking counts it). `requested` (signed in): they asked for it. `shop`: an active whole-shop grant; `products`: how many of the shop's are on T5DE. From what the hub knows only (it asks IMVU nothing), for the proxy's "Get on T5DE". |
| `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 |
| `GET /api/v1/console/imports` | (`import:grant-on-behalf`) `{grants: [grant + {evidence, recordedBy, proofCode, proofCheckedAt, claimed}], creators: [{imvuCreator, name, people, products}], catalogs, consent}`: recorded grants, and the most asked-for IMVU creators |
| `POST /api/v1/console/imports/grants` | (`import:grant-on-behalf`) `{catalog, imvu (username or ID), scope, products?, exclude?, listed?, evidence}` → 201 `{grant}` (pending, `consentKind: "recorded"`). 409 `linked` if someone linked that IMVU account, 409 `exists` as for creators' grants. |
| `POST /api/v1/console/imports/grants/:id/proof` | (`import:grant-on-behalf`) → `{code}`: for the creator's IMVU tagline (made once) |
| `POST /api/v1/console/imports/grants/:id/proof/check` | (`import:grant-on-behalf`) → `{grant}` with `consentProven`; 409 `not_found` if the tagline lacks the code |
| `GET /api/v1/account` | also `claims: [{imvuId, username, products, grants}]`: unclaimed creators for the person's linked IMVU accounts |
| `POST /api/v1/account/claims/:imvu` | → `{products, grants}`: claimed (the IMVU account must be linked to them) |
| `GET /api/v1/catalogs/:id/importer/imvu-account?username=` | (`import:run`) `{imvuId, username, picture, accessPass, ageVerified}`: IMVU's public info, for the confirmation dialog |
| `POST /api/v1/catalogs/:id/importer/accounts` | (`import:run`) `{imvuId, sealed, fingerprint}` → 201 `{account}`. `fingerprint` must be the importer's key's (409 `importer_key_changed`; 409 `no_importer` before it has said hello); one per IMVU account (409 `exists`), at most 10. |
| `PUT /api/v1/catalogs/:id/importer/accounts/:account/password` | (`import:run`) `{sealed, fingerprint}`: a new password |
| `POST /api/v1/catalogs/:id/importer/accounts/:account/move` | (`import:run`) `{direction: "up" \| "down"}` |
| `DELETE /api/v1/catalogs/:id/importer/accounts/:account` | (`import:run`) |
| `POST /api/v1/catalogs/:id/importer/settings` | (`import:run`) `{rate (0.2-10 requests a second to IMVU), concurrency (1-8 jobs at once)}` |
Grants also carry `shopListedAt` (null: not listed yet) and `shopListed` (how many products IMVU listed).
`GET /api/v1/catalogs/:id/importer` also has `program: {version, seenAt, fingerprint, publicKey}` (`publicKey` only
with `import:run`), `settings`, and `accounts: [{id, imvuId, username, state, stateMessage, stateAt, accessPass,
ageVerified}]` (state: `waiting` for the importer, `received`, `ok`, `sign_in_failed`, `needs_password`). Never a
password, sealed or not.
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) reports the product info to the
hub ("IMVU accounts" above). Also signed out: `client-dynamic.imvu.com/api/shop/product.php` and
`api.imvu.com/creator/creator-<id>` need an account, and search refuses AP (`ap_search_denied`, with
`product_rating` other than `0,5`), but `api.imvu.com/product?creator=<username>` lists a shop's general-rated
products ("Whole shops").
Built (2026-11-07): whole shops listed on IMVU ("Whole shops" above), and `GET /imports/available`.
t5de-catalog takes `t5de-import` tokens on uploads (its PR #2). Still to do: the spike and `t5de-importer` (and
its report of Access Pass products' info).
## 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
client wear it as a T5 product, with the parent loading from IMVU? (Never committed: it's IMVU's files.)
2. Do typical IMVU products fit the `pack` limits?
3. How many HEAD requests does probing take for real shops; does the CDN limit them?
4. ~~Is there a public way to list a creator's products?~~ Yes, general-rated ones ("Whole shops").
## Later
- Flattened imports (parent included), if keeping the parent on IMVU causes problems.
- A dry run: preview an import (and anything over the pack limits) before it's published.
- "Get on T5DE" on IMVU's shop and product pages in the client (a t5de patch, using
`/api/v1/imports/available`).
- Creators who don't want their products as parents of imports (an opt-out hiding imports that derive from theirs).