Commit Graph
10 Commits
Author SHA1 Message Date
isaaccladandClaude 9ead4573d6 qr: downscale uploaded images before storing them
Uploads were written to the qr disk byte-for-byte. A bookshop cover arrived as a
9000x6600 print-resolution JPEG — 18MB — and was then served in full to every
visitor of a public bio page. During a launch that one file accounted for roughly
1.6GB of 1.9GB of image traffic, and because these assets are proxied through the
app rather than served statically, PHP streamed every byte of it and held a worker
for the duration.

Nothing the QR/bio pages display needs more than a couple of thousand pixels, so
UploadedImageOptimizer caps the long edge at 2000px and re-encodes on the way in.
The incident file becomes ~350KB. Configurable via qr.image.*.

Deliberately conservative, because a broken upload is worse than a large one:

- Format is preserved. A PNG stays a PNG so transparency survives; converting to
  JPEG would put black boxes behind logos.
- GIF is excluded — GD would silently drop animation frames.
- SVG and any file GD cannot read is stored untouched.
- Small files are passed through rather than lossily re-encoded for no gain.
- Output is discarded if it came out larger than the original.
- Any failure logs and falls back to storing the original.

Applied to the seven image paths only. Books (PDF/EPUB) and documents keep the
plain store — the optimiser would have fallen through for them anyway, but routing
non-images through something called an image optimiser invites the wrong change
later.

This is the source-level counterpart to the nginx cache: caching stops the bytes
being regenerated, this stops them existing.

Tests: 6 new, including the real 9000x6600 shape, PNG alpha survival, format
preservation and non-image passthrough. Pre-existing suite failures unchanged at 8.

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-25 12:23:08 +00:00
isaacclad 5bab0fedaf Use Host-header loopback for billing force_ip.
Deploy Ladill QR Plus / deploy (push) Successful in 1m45s
CURLOPT_RESOLVE was not reliably faster; rewrite the billing base URL to the
forced IP and send the original Host header instead.
2026-07-16 21:28:06 +00:00
isaacclad 02e6778ccf Speed up QR create/update by cutting billing round-trips.
Deploy Ladill QR Plus / deploy (push) Successful in 2m2s
Create was making three sequential public HTTPS billing calls (~400ms each)
while holding a DB transaction open for image generation. Use loopback DNS
forcing, cache balances briefly, return balance from debit, regenerate images
only when style changes, and keep remote work outside the DB transaction.
2026-07-16 21:25:16 +00:00
isaacclad d83a314bee Add Portfolio and Bookshop QR types with tailored landing pages.
Deploy Ladill QR Plus / deploy (push) Successful in 58s
Portfolio showcases freelancer work projects; Bookshop lists author titles with multi-platform purchase links. Includes create/edit forms, public assets, and tests.
2026-07-16 20:56:52 +00:00
isaacclad 95d73d1367 Add Campaigns module for grouping QR codes.
Deploy Ladill QR Plus / deploy (push) Successful in 1m6s
Let accounts organise codes by promo or launch, attach or detach codes, and view combined scan totals from the sidebar.
2026-07-16 20:43:02 +00:00
isaaccladandClaude Opus 4.8 b7adb69245 Point in-app wallet top-up at the billing API (key the app already holds)
Deploy Ladill QR Plus / deploy (push) Successful in 33s
qr-plus authenticates to the monolith with a billing service key, not an
identity key, so the modal's top-up now goes through BillingClient::topup ->
POST /api/billing/topup. Drops the unused IdentityClient::walletTopup.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 06:23:03 +00:00
isaaccladandClaude Opus 4.8 73faa20fff Two-step add-funds modal instead of wallet redirect on insufficient balance
Deploy Ladill QR Plus / deploy (push) Successful in 40s
When a user hits an action they can't afford (e.g. creating a QR code with
0/low balance), open an in-app two-step modal instead of bouncing them to the
central wallet page. Step 1 explains pay-as-you-go billing + shows the action
cost and current balance; step 2 takes an amount and starts a Paystack checkout
via the central identity wallet-topup API, returning the user where they were.

- service-topup-modal: rebuilt as two-step (billing explainer -> amount/pay)
- IdentityClient::walletTopup + WalletTopupController + POST /wallet/topup
- balanceGate.openTopup / qrCustomizer.redirectTopup now prefer the modal,
  falling back to the wallet page only when no modal is wired
- qr-codes index + create render the modal and open it on insufficient balance

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-25 23:25:06 +00:00
isaaccladandCursor 03fffa04be Add account-level Analytics page to QR Plus.
Deploy Ladill QR Plus / deploy (push) Successful in 39s
Aggregates scan metrics across all codes with charts, breakdowns, and a sidebar nav item.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-19 00:57:08 +00:00
isaaccladandCursor 9ddda21ea3 Add Afia AI assistant to the QR Plus header.
Deploy Ladill QR Plus / deploy (push) Successful in 1m33s
Wire in-app chat scoped to QR codes, billing, and scans so users get product-specific help without leaving qrplus.ladill.com.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-07 08:56:29 +00:00
isaaccladandCursor cd6571f199 Extract Ladill QR Plus as standalone app at qr.ladill.com.
Deploy Ladill QR Plus / deploy (push) Failing after 1s
Utility QR types only (URL, WiFi, link list, business, app download) with
SSO, Billing API integration, public /q resolver, and qr-plus:import for
platform migration. vCard and commerce types stay on the platform.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-06 21:31:24 +00:00