# PBX Launchpad v4: SQL credentials, token-free installer, direct wget links

## Browser upgrade from v3

1. Back up the entire site, SQL database and private `.env`. Do not overwrite `.installed.lock`.
2. Upload/extract v4 over existing v3 files, preserving `.env` and `.installed.lock`.
3. Log in as admin and visit `https://YOURDOMAIN/upgrade.php`.
4. Click the upgrade button. The upgrade creates the `app_secrets` table and the `download_links` table. Existing third-party secrets from `.env` are AES-256-GCM encrypted and migrated to SQL; SMTP host/user/port, sender and OpenAI model become normal SQL settings. The old service values are removed from `.env` once the SQL writes finish. Keep `APP_KEY` and `DB_*` in private `.env`.
5. In Admin verify OpenAI, Stripe and SMTP statuses. Confirm prices and open registration. Run test Stripe checkout and webhook, API edit and contact delivery.
6. Under Orders, view automatically generated download links for newly paid bundles or generate a link for an existing paid order. Links expire after 7 days and 25 downloads; revoke or rotate on demand.
7. Delete the website installer and upgrade script after verifying the migration. Retire old plaintext backups securely according to your retention policy.

## No setup token

For a **new installation only**, `public/install.php` no longer requires `setup-token.txt`. This removes the ownership check. Keep first-run installation behind your own IP allowlist or host panel authentication, and delete the installer afterward. Old installed sites retain `.installed.lock` and must use `upgrade.php`, not the first-run installer.

## SQL credential management

Admin includes fields to rotate or clear Stripe secret API key, Stripe webhook signing secret, OpenAI API key, and SMTP password. Blank leaves existing value unchanged. Nonsecret OpenAI model and SMTP details also live in SQL. `APP_KEY` is a separate encryption secret not stored in SQL. Store a secure backup. If you lose it, existing encrypted provider secrets cannot be recovered.

## Wget

The signed-in Orders page displays each paid order's direct URL and ready-to-paste wget command. An HTTPS bearer link downloads the immutable order snapshot without a browser login, once its Stripe webhook has confirmed payment. Link renewal is free; a revised project snapshot requires a new purchase. Refunds, revoked links, expiry, suspended account, and 25-download limit block retrieval. Do not publish URLs.

Run downloaded `install.sh --dry-run` on your own FreePBX host. This does not automate manual IVR or SIP trunk changes.
