# Hub — install guide (≈10 minutes, file manager only)

## What you're installing
* `hub/` — dashboard + single sign-on. Admin lives at `https://YOURSITE/hub/`.
* A tiny `module.json` in each existing app folder → each app appears on the dashboard automatically.
* A tiny `_sso.php` in the apps that have their own login (pizza, progresspad, signmydoc, cloud, otterlink) → one click from the dashboard signs you in. Their own code is untouched.
* Nothing existing is overwritten. Public pages keep the exact same URLs.

## Steps
1. **Back up** your site (file manager → compress the web root, or at least the app folders).
2. Upload `site/` **contents** into your web root (the folder that contains `pizza/`, `cloud/`, etc.), merging folders. Result: `hub/` sits next to `pizza/`.
3. Open `https://YOURSITE/hub/`. Enter the one-time **setup code** (also in `hub/data/setup_code.php`), choose a username and a 12+ character password. The code file deletes itself.
4. You land on the dashboard with every app listed. Click **Open admin** on each to confirm the bridge works.
5. Cloud: `cloud/_sso.php` signs in as My Cloud user `webadmin`. If your account name differs, edit `$CLOUD_USER` at the top of that file.

## Then apply the security patches (strongly recommended)
`optional-patches/` has modified copies of a few files. Each differs from your original by 1–3 lines (listed below). Copy each over the matching file **after** step 4 works. They are made from the zip you sent; if you've edited those files since, re-apply the listed change by hand instead.

| File | Change | Why |
|---|---|---|
| `announce/admin.php`, `announce/api.php` | require hub sign-in | **Currently no login at all** — anyone could edit rosters/scripts |
| `pizza/admin.php` | removes hard-coded `mchislett` / `admin` login; logout returns to hub | password was guessable |
| `progresspad/mchislett/authenticate.php`, `login.php`, `logout.php` | removes hard-coded password; sign-in via hub | same |
| `progresspad/demo/*.php` (7 files) | gives the demo its own session name | today the **demo/demo login also opens pizza admin and your real ProgressPad** (shared PHP session) |
| `chislettu/otterlink/index.php` | blocks password login for the `admin` role (students unaffected) | admin is still `adminpassword` |

Already included in `site/` (no action): `announce/data/.htaccess` (hockey.db was downloadable) and `chislettu/otterlink/.htaccess` (blocks `data.json` and the 366 MB `files.zip`, both previously downloadable by URL).

## Also do these yourself
* **Rotate the SMTP password** in `signmydoc/settings.php` — it was in the zip you shared with me.
* Keep `chislettu/otterlink/files.zip` out of the web root (it's a 366 MB backup).
* On **nginx** hosts `.htaccess` is ignored: block `/hub/data/`, `*/data/`, `otterlink/data.json` in server config.

## Known limits (be aware)
* Hub **Sign out** ends sessions in bridged apps automatically (best effort). The five legacy apps still have their own login pages; once patched, those can't be used with the old passwords.
* Hub cookie is valid 12 h. "Sign out everywhere" in Settings invalidates all of them instantly.
* Meetpoll (scheduler) has per-poll admin links by design — no hub admin side, so it's public-only on the dashboard.
* Single admin user. Same domain only (all apps share one cookie).

## Adding apps later
Generate with the AI prompt in `module-kit/AI-PROMPT.md`, upload the folder, refresh the hub. That's it.
