# Changelog

## 0.10.1-lfm-import — 6 December 2026

Matched to a live LFMVM 2.x database (Jet Speed Mailer): table structure and counts only, no member data was read.

### Added
- `"preset": "lfmvm"` and `"preset": "lfmte"` in the import mapping: LFMVM maps `credits` to mail credits, LFMTE to traffic credits; both map `bannerimps`/`textimps` to banner and text-ad impressions, `upgend` to the upgrade end date, `status`, and `commission`. LFMTE also imports `oto_msites`.
- Membership levels created automatically from `oto_membertypes` for any old level not mapped by hand: name, active flag, commission % (`comm`), surf timer (`surftimer`), mailing size (`maillimit`) and mailings per day (from `mailhours`). Code `lfm-<id>-<name>`, no expiry. Old surf ratios are listed for you to set, because LFM and AdNova count them differently. Levels in `free_ids` (default `1`) go to Free.
- `"password_format": "auto"` (new default): bcrypt and Argon2 hashes are kept as they are, so members sign in with their old password straight away; MD5 and SHA-1 hashes keep working as before; empty or unknown ones need **Forgot password**.
- Members with status `Unverified` are imported unverified and asked to confirm their email.
- `import:inspect` now also shows password formats (counts only), statuses, members per old level, which levels will be created, and unpaid commissions on the old site.
- The import report adds password outcomes, unverified members, upgrades that had already ended, created levels, and unpaid commissions (not imported).

### Fixed
- An imported bcrypt password shorter than 12 characters could not be used to sign in, because the sign-in upgrade applied the new-password length rule. Sign-in now only re-hashes the password the member typed.

## 0.10.0-release-tools — 5 December 2026

### Added
- LFMTE/LFMVM import tool (`import:inspect`, `import:lfm` with `--dry-run` and `--limit`): members, names, join dates, suspended status, membership levels (mapped), credit balances (audited ledger entries), referral links and member sites; configurable column mapping; re-runnable without duplicates; existing emails linked, not changed.
- Old LFM passwords (MD5/SHA-1) keep working: checked once on first sign-in, then replaced with bcrypt and deleted; ignored after any password change.
- Browser installer at `/install`, protected by `INSTALL_TOKEN` in `.env`, with server checks; closed once installed.
- System & updates page: pending database updates with one-click apply, maintenance mode (owner keeps access; webhooks are asked to retry), server checks, audited actions.
- Backups: create, list, download (owner only, never web-served), delete; `backup:restore` into an empty database rebuilds the schema and reloads every row, refusing damaged or incomplete files.
- Themes: folder-based themes in `public/themes/` (Midnight, Emerald, Sunset included), owner switching, refusal of themes containing code.
- Addons: folder-based addons in `addons/` with their own pages, navigation links, dashboard cards and migrations; owner enable/disable with password; broken addons are skipped without taking the site down. Sample "Announcements" addon included.
- Console: `maintenance:on/off`, `backup:create/list/restore`, `import:inspect`, `import:lfm`.
- Migrations 039–040. Migrations 001–038 are unchanged.

## 0.9.0-referrals — 5 December 2026

### Added
- Permanent referral link per member with a signed, first-click-wins cookie, sign-up attribution and an "invited by" notice; visits counted per day.
- Sales commissions at the referrer's membership commission rate on every fulfilled order (manual or online), per currency, held for a configurable period.
- Payout requests with encrypted payout details; owner records sent payments (with reference) or declines them; owner can cancel unpaid commissions. All decisions need the owner password and are audited.
- Qualified-referral bonus credits once a referral surfs a set number of pages; a configurable share of referrals' surf and mail-reading credits paid to the referrer with exact carry-over.
- Member referral page (link, stats, rates, rewards, balances, payouts, referrals list without email addresses, monthly leaderboard) and owner referral administration with settings.
- Migrations 033–038. Migrations 001–032 are unchanged.

### Changed
- Surf page payments now update site statistics before wallet balances, so they lock rows in the same order as credit assignment (avoids rare database deadlocks).

## 0.8.0-payments — 5 December 2026

### Added
- Online payments for orders: Stripe Checkout, PayPal (Orders v2) and NOWPayments crypto invoices, each enabled by keys in `.env` and offered only for currencies it supports.
- Automatic, all-or-nothing order completion after the provider confirms payment, through a server-checked return (Stripe session lookup, PayPal capture) or a verified webhook (Stripe HMAC-SHA256, PayPal verify-webhook-signature, NOWPayments HMAC-SHA512).
- Each payment applied once; provider events stored so replays are ignored; PayPal approvals without a return are captured by webhook.
- Payment review list for confirmed payments that cannot be applied (amount/currency mismatch, second payment, cancelled order, suspended member, partly paid crypto, unknown order), with owner resolution notes.
- Member confirmation before paying for a level that replaces their current one.
- Provider status and webhook addresses on the Products page; checkout attempts on the owner's order page.
- Migrations 031–032. Migrations 001–030 are unchanged.

## 0.7.0-mailer — 5 December 2026

### Added
- Viral mailer: plain-text member mailings with preview, rule-based spam score and blocking, and https destination pages (blocked domains apply).
- Free mailings from each membership level (mailings per day, recipients per mailing) and credit mailings that hold one mail credit per recipient and return every credit not used by a verified click.
- Random recipient selection among active, verified members who receive mailings; sender never included; members can turn mailings off.
- Email delivery through the existing SMTP account in cron batches, with single-use click links (hashes only stored), signed unsubscribe links, one-click `List-Unsubscribe` headers, owner footer and no exposure of member email addresses.
- On-site mail inbox, so mailings also work without email delivery.
- Click page with timer and symbol check; readers earn mail credits and reward points once per mailing.
- Sender statistics, stop mailing, automatic closing after the click window, administrator cancellation with a reason, and owner mailer settings.
- `mail:campaigns` command; `cron:run` now also sends member mailings and closes ended ones.
- Migrations 027–030. Migrations 001–026 are unchanged.

### Changed
- Forms up to 64 KB are accepted (was 16 KB) so long mailings in any language fit.

## 0.6.0-traffic — 5 December 2026

### Added
- Traffic exchange engine: member sites, review queue, surfing with server-checked timers, single-use page tokens and a four-symbol check, without any JavaScript.
- Credits reserved per page and returned on wrong answers, skips, reports, expiry and abandoned pages; one open page per surfer; reloading cannot skip the timer.
- Earnings from each membership level's timer and ratio, with exact carry-over of fractional credits.
- Daily surf goals, lucky bonuses, reward points per page, today's top-surfer leaderboard and 14-day surf history.
- Wrong-answer lockout, optional daily page limit, repeat interval per site, sandboxed frame that blocks frame-breaking.
- Advertiser controls: assign/withdraw credits, daily view limit, pause/resume, edit (address changes are re-reviewed), remove with refund, 7-day view history.
- Surfer reports (once per member per site) and a Reported queue for administrators; owner-managed blocked domains.
- Owner traffic settings page with today's totals; settings now support numbers, goal tiers and domain lists, saved together in one audited operation.
- Wallet activity: high-volume automatic earnings are stored as daily totals per source and included in `wallet:check`.
- `cron:run` returns credits from unanswered pages and prunes page records older than 30 days; new `surf:maintain` command.
- Migrations 020–026. Migrations 001–019 are unchanged.

## 0.5.0-commerce — 5 December 2026

### Added
- Product catalog for membership upgrades and advertising-credit packs, with exact integer prices in seven currencies, per-member purchase limits (one-time offers), display order and hide/show.
- Member store, order placement with saved terms, order history, payment instructions and self-cancellation of unpaid orders (maximum 5 unpaid).
- Owner order queue with status totals, order review, membership-effect preview, manual payment recording and cancellation.
- Atomic fulfilment: payment record, every credit type, membership and order status commit together or not at all.
- Membership renewals add time to the current expiry; replacing a different active level requires explicit owner confirmation.
- One-time payment references per payment method; amount must match the order total exactly.
- Owner-editable manual payment instructions (new settings store).
- Dashboard now shows membership, traffic/mail credits and unpaid orders.
- Migrations 015–019. Migrations 001–014 are unchanged.

### Fixed
- The installed owner was left with an unverified email, which blocked the dashboard, membership and wallet pages until SMTP was working. New installs verify the owner; migration 015 verifies the existing owner.
- Insecure (HTTP) requests in production were always redirected to the sign-in page; they now redirect to the same page over HTTPS. `HTTPS=1` server flags are recognised.
- Session files in `storage/sessions` were never removed on hosts that disable PHP session garbage collection. `cron:run` now deletes session files older than 12 hours.
- Opening `/admin/plan` without an `id` returned an error instead of the create form.
- Version numbers in the layout and console were hard-coded; they now come from one place.

## 0.4.0-core — 26 October 2026

- Added configurable levels with duration, surf ratio/timer, mailing allowances and referral commission settings.
- Added timed/lifetime member assignments, saved benefit snapshots and immediate expiry fallback to the configurable default level.
- Added five integer advertising-credit balances, owner adjustments and paginated member transaction history.
- Added owner-only core writes with current-password checks, reasons, idempotency references, stale-state protection and transactionally linked before/after audit details.
- Added a read-only `wallet:check` reconciliation command.
- Added migrations 008–014 while preserving migrations 001–007 and existing credentials.
- Added 89 database/concurrency/HTTP checks and passed 175 existing regressions, plus upgrade and ledger reconciliation checks.
- Removed an undeclared ctype-extension dependency from existing member-ID validation.
- Added manual upgrade and membership/credit documentation.
- Products, billing, cash withdrawal, earning/spending engines and live payment processing remain pending. Configured surf/mail/referral benefits do not run those engines yet.

## 0.3.0-accounts — 27 September 2026

- Added member search by name/email/ID, status and role filters, and 25-account pagination.
- Added self-service display-name editing, password changes and sign out everywhere.
- Added administrator controls for member names, suspension, reactivation and session revocation.
- Added owner-only administrator grants/removals; owner accounts and administrator peers are protected.
- Access changes revoke sessions and outstanding account links. Administrator promotion requires an active, verified member.
- Required current administrator password and a recorded reason for administrative changes.
- Added stale-form conflicts and atomic before/after audit details through migration 007, preserving existing migrations.
- Added database and HTTP regression coverage for authorization, rollback, profile forgery and multi-session revocation.
- Email-address changes, owner transfer, memberships, wallets, TE and marketing mail remain pending.

## 0.2.0-accounts — 27 September 2026

- Added email verification and password recovery with expiring, single-use links.
- Password reset now revokes existing sessions and outstanding links atomically.
- Added an encrypted account-email queue, authenticated SMTP/TLS delivery, bounded retries and local capture mode.
- Added verification/resend/recovery screens and administration queue counts.
- Registration can be enabled after SMTP setup; unverified members cannot enter the workspace.
- Added migrations 005–006 without changing existing migrations or user passwords.
- Included PHPMailer 7.1.1 and updated installation/upgrade instructions.
- Real provider delivery still requires testing on the target host; marketing mail and payments remain unimplemented.

## 0.1.0-foundation — 27 September 2026

First standalone PHP/MySQL milestone, separate from the hosted TypeScript prototype.

### Added

- PHP application bootstrap, strict environment parsing and Composer PSR-4 autoloading.
- Native PDO prepared statements and InnoDB schema migrations with version checksums.
- CLI installer, explicit first-owner creation and persistent installation locking.
- Independent password authentication and local member registration.
- CSRF protection, secure production sessions, session rotation and expiry.
- Active-account and role enforcement, with session revocation through account status/auth version.
- Transactional registration and account audit records.
- Per-email and per-IP authentication limits with cron cleanup.
- Member overview/account pages and an administrator member/audit overview.
- DirectAdmin/cPanel setup instructions and repeatable test scripts.

### Scope

The package contains no TE engine, mail delivery, wallet, billing or live payment integration. Production registration is closed pending verification and recovery. No existing site database or hosted prototype was modified by this milestone.
