# Offline mode

No internet at the venue? The room runs on your own computer.
Phones join it over the room's Wi-Fi. They need no internet at all.

What the room says stays on your computer.
When you are online again, it goes to your account.

> Offline mode is an app for your computer: **{{name}} Offline**, for Mac.
> A Windows version builds the same way, but is not tested on Windows yet.
> Until it is published, build it from the project folder with
> `npm run desktop`. The command line does the same steps, at the end of
> this guide.

---

## Do I need it?

| The room | Do this |
| --- | --- |
| The internet works | Nothing. Present as always. |
| There is Wi-Fi, but its internet is slow or gone | **Offline mode, on the venue's Wi-Fi.** This guide. |
| No usable Wi-Fi at all | Offline mode on your own network, from a travel router. Coming soon. |

On the venue's Wi-Fi, we change nothing about it.
Whatever internet it gives people stays as it is.

---

## Before the event, online

Open **{{name}} Offline**.

1. Press **Link this computer**. You do this once per computer.
2. Your browser opens a page with a code. Sign in if it asks.
   Check the code matches the one in the app. Press **Allow**.
3. Tick the decks for your event. Press **Copy**.

Changed a deck since? Press **Change the decks**, then **Copy** again.
Only what changed is fetched.
No internet where you are? Your own phone's hotspot is enough for this.

---

## At the venue

Join the venue's Wi-Fi with your computer. Then:

1. Press **Start the room**. {{name}} opens in its own window, signed in.
2. **The first time on a Mac**, it asks whether {{name}} Offline may
   accept incoming network connections. Click **Allow**.
   Phones cannot join without it.
3. Open your deck. Press **Present**. Everything works as always.
   The stage goes to the projector by itself, full screen.
4. The join code and QR on the screen point at your computer.
   Phones on the same Wi-Fi scan it and join.

While the room runs, your computer does not go to sleep.
Keep it plugged in.

**Test it before people arrive.** Put your own phone on the same Wi-Fi
the audience will use, and scan the QR.
If the join page opens, the room is ready.
If it does not, see the end of this guide.

Closed the {{name}} window? Press **Open {{name}}** in the app.

---

## Afterwards

Press **Stop the room**, or quit the app.

- **Online?** The rooms go to your account at once.
- **Still offline?** They wait on your computer. When you are online,
  press **Send rooms to your account**.

The results are where they always are: the deck, **...**,
**What the room said**.

A room you ended is removed from your computer once it is in your account.
A room you did not end stays, so you can carry on another day.

---

## What works offline

Everything you present with:

- Every question, live results, quizzes, Q&A, photos, reactions.
- The stage, the console, your notes, the clock.
- Your phone as the clicker, and a second screen on another device:
  **More** in the console, as always. They must be on the same Wi-Fi.
- Room safety: the word filter, hiding, removing, pause, close.
- Coded decks, and the videos and pictures you uploaded.

Not yet:

- **Voice notes.** Phones only record on a secure connection, and this
  room's network is not one yet. The console shows **No voice notes here**.
- Your AI.
- Web pages, videos and fonts from the internet inside slides.

---

## What phones can reach

Only the join page and the room. That is all.

Not the app. Not your decks. Not anything else on your computer.
Everything else answers "Not here."

Your phone as the clicker gets in only with the one-time code your
console shows, and a second screen only with its own view-only link.
Your sign in never works from the Wi-Fi, so nobody can borrow it.

---

## This computer's key

Pressing **Allow** gives this computer a key of its own.
It shows under **Your AI** as **Offline:** and the computer's name.

It can copy your decks and bring your rooms back. Nothing else.
It cannot edit, present or delete anything.

Lost the laptop? Remove that key under **Your AI**. It stops at once.
To unlink from the computer itself, press **Unlink** at the bottom of
the app. The app keeps the key in a file encrypted by your computer's
keychain, so a copy of that file is no use on any other computer.

---

## Where it is kept

The app keeps your decks, files and rooms in its own folder:
**Library**, **Application Support**, **{{name}} Offline** on a Mac.
Only your own account on this computer can open it.
Delete that folder to forget it all.

---

## When something goes wrong

**Phones cannot open the join link.**
They must be on the same Wi-Fi as your computer.
On a Mac, check **System Settings**, **Network**, **Firewall**:
"node" must be allowed, and "Block all incoming connections" off.
Some guest Wi-Fi keeps devices from seeing each other.
Then you need your own network (coming soon).

**The terminal says the computer is on no network.**
Join the Wi-Fi first, then run `npm run offline` again.

**The address on the screen changed.**
Your computer got a new address on the Wi-Fi. That is fine:
present again and the QR shows the new one. It is the same room.

**"The door for phones could not open."** Another app uses its port,
8080. Quit that app, or use the command line below with another port.

**"This computer was unlinked."** Its key was removed.
Press **Link this computer** and **Allow** again.
Your rooms are still on the computer.

---

## The command line

The same steps, from a terminal in the project folder.
It keeps its own copy, in the `.offline` folder there.

| Command | Does |
| --- | --- |
| `npm run offline -- prepare` | Link this computer (the first time), then copy decks. |
| `npm run offline` | Start the room. **O** opens the app again, **Ctrl + C** stops it. |
| `npm run offline -- sync` | Bring the rooms back to your account. |
| `npm run offline -- status` | What this computer holds. |
| `npm run offline -- unlink` | This computer's key stops working. |

Another port for phones: `OFFLINE_DOOR_PORT=8081 npm run offline`.
The first time, the Mac asks about "node" accepting connections: **Allow**.
