← back to Pattern Vault

wpb-uploaders/README.md

41 lines

# WPB Marketplace Uploaders

Per-platform design uploaders for the Wallpaper's Back marketplace operation, one module
each (the "every vendor its own uploader" rule). Spoonflower/Fernwick keeps its own dedicated
pipeline at `../whimsical-compare/daily/` — it is **not** here.

## Platforms

| Platform | Brand | Type | Status |
|----------|-------|------|--------|
| Etsy | Wallpaper's Back (SteveAbramsStudios) | API (`createDraftListing`) | DISARMED — needs OAuth |
| Creative Market | Wallpaper's Back | web (Playwright) | DISARMED — needs session + DOM calibration |
| Redbubble | Wallpaper's Back | web (Playwright) | DISARMED — AI-hostile, anti-bot critical |
| Society6 | Wallpaper's Back | web (Playwright) | DISARMED — account pending |
| Patternbank | Designer Wallcoverings (exception) | web (Playwright) | DISARMED — account pending |

## Hard safety (baked into `lib/base.js`)

- **DISARMED by default.** A live upload only fires if `platforms/<key>.ARMED` exists.
  Absent → dry-run (no live action). **Arming any platform is Steve-gated.**
- **Anti-bot cadence:** ≤ 4 designs/run (hard cap), human-typed fields (`lib/human.js`),
  sporadic 30–90s gaps between uploads.
- **Fail-loud:** a design counts as uploaded ONLY if its `uploadFn` returns a real `{id}`.
  No id → `failed[]` with the reason. Never a false-green (the exact bug that plagued Spoonflower).

## Run

```sh
node run.js list                              # show platforms + armed state
node run.js creativemarket <manifest.json>    # dry-run (DISARMED) — no live action
```

## Arming a platform (Steve-gated, per platform)

1. Capture a login session → `sessions/<key>-state.json` (or set `ETSY_OAUTH_TOKEN` for Etsy).
2. Calibrate the platform's `uploadFn` against the live DOM (the stub refuses to false-green until then).
3. `touch platforms/<key>.ARMED` — ONLY on Steve's explicit go.

Each platform's `uploadFn` is a DISARMED stub today: it navigates to the known upload URL and
returns a fail-loud "not yet calibrated" reason rather than pretending to upload.