No description
  • TypeScript 99%
  • JavaScript 1%
Find a file
2026-08-06 02:30:21 +06:00
src feat: ddcais mock server (auth, license, pricing, ai stubs) 2026-08-06 02:30:21 +06:00
.gitignore feat: ddcais mock server (auth, license, pricing, ai stubs) 2026-08-06 02:30:21 +06:00
AGENTS.md feat: ddcais mock server (auth, license, pricing, ai stubs) 2026-08-06 02:30:21 +06:00
eslint.config.js feat: ddcais mock server (auth, license, pricing, ai stubs) 2026-08-06 02:30:21 +06:00
package.json feat: ddcais mock server (auth, license, pricing, ai stubs) 2026-08-06 02:30:21 +06:00
pnpm-lock.yaml feat: ddcais mock server (auth, license, pricing, ai stubs) 2026-08-06 02:30:21 +06:00
pnpm-workspace.yaml feat: ddcais mock server (auth, license, pricing, ai stubs) 2026-08-06 02:30:21 +06:00
README.md feat: ddcais mock server (auth, license, pricing, ai stubs) 2026-08-06 02:30:21 +06:00
tsconfig.json feat: ddcais mock server (auth, license, pricing, ai stubs) 2026-08-06 02:30:21 +06:00

ddcais

Local mock backend for a node-based GPU motion-design editor. Speaks the editor's server protocol: passwordless auth, license validation, pricing, and token-metered AI endpoints — everything the desktop app needs to consider itself licensed, without contacting the real upstream.

How it works

The editor reads its backend URL from an environment variable at startup. Point that variable at ddcais and every request the app makes lands here:

  • Auth — magic-link flow is auto-approved. Submitting any email immediately authorizes the nonce, so the next poll (the app polls every 3 s) receives a license key. Keys are deterministic: a UUID-shaped slice of sha256(email), so the same email always yields the same key.
  • License/license/check answers valid: true (type: "perpetual", canExport: true, tokenBalance: 0) for any key this process issued. Unknown keys get license_not_found, same as upstream.
  • Pricing — returns mock variants whose checkout URLs route back to the mock itself (a stub HTML page, no real purchase).
  • AI — the model catalog is served so the AI UI populates, but every generation endpoint returns 402 insufficient_tokens. BYOK mode in the app bypasses this server entirely (direct provider calls) and is unaffected.

The app caches a successful license check locally with a 7-day offline grace, so once licensed it keeps working even after the mock is stopped.

Quickstart

pnpm install
pnpm dev

The server prints the exact PowerShell command to launch the editor against it:

$env:<TARGET_ENV_VAR> = "http://localhost:8787"   # real name printed at startup
& "<path-to-editor.exe>"

Then enter any email in the app's license dialog — it activates within seconds.

Endpoints

Method Path Behavior
POST /auth/request-magic-link { ok, beta: true }, auto-approves nonce
GET /auth/poll?email&nonce { ready: true, licenseKey } once approved
POST /license/check valid: true for issued keys
GET /pricing mock license + token-pack variants
GET /ai/models real model catalog
GET /ai/video/models empty list
POST /ai/generate 402 insufficient_tokens
POST /ai/shader 402 insufficient_tokens
POST /ai/video/upload-url 402 insufficient_tokens
POST /ai/video/submit 402 insufficient_tokens
POST /ai/video/status 402 insufficient_tokens

Config

Env var Default Purpose
PORT 8787 listen port

Notes

  • State is in-memory: restart the mock and the app must re-authenticate (instant, since approval is automatic).
  • Editor-specific strings (env var name, binary path) are stored reversed-base64'd in src/obfuscated.ts and decoded only at runtime.
  • Lint with pnpm lint.