# Next session starting point

We are continuing development of the reolink-viewer project.

The project is at `/home/matt/gitrepos/reolink-viewer` and is published
at https://github.com/matthewhelmke/reolink-viewer.

Read `AGENTS.md` first for full context, then audit `src/index.ts`,
`public/index.html`, `public/app.js`, and `README.md` before proposing anything.


## Where we are

Basic mode is complete and deployed via Docker Compose on monster (ubuntu:25.04,
FFmpeg 7.1.1 via apt). The app is serving family on the LAN at port 3000.

All prior features are working:
- Hub device info in sidebar, Sign out button
- Per-camera snapshot thumbnails with 30 s refresh and timestamps
- Camera reorder (▲▼) with localStorage persistence
- Focus model: one camera card fills the viewport
- Live tab: Low quality (MJPEG) and High quality (RTSP via FFmpeg)
- Recordings tab: search by date/time range, playback via frag MP4 streaming
- Web app auth: viewer/admin roles, HMAC-signed 1-year cookies


## Next session focus: Admin mode

Admin mode features require ONVIF to be enabled on the Reolink Hub Pro.

**Before starting:** confirm ONVIF is enabled in the hub's Advanced Network
Settings > Server Settings > Basic Service. Matthew needs to do this in the
Reolink app. **Matthew confirms this is turned on.**

Key decisions to discuss at the start of the session:
- What specific admin features to build first (device management? camera config?
  firmware info? PTZ if any cameras support it?)
- Whether admin UI lives in a separate page/route or as a conditional panel
  within the existing layout
- Which ONVIF operations the hub actually supports (needs testing)

Idea for later:
Matthew just noticed in the Android app in the Hub there is an option in the 
Hub config to view **Event history** which is a reverse-chronological list of
all events across all cameras. This is overkill for basic mode, but once we get
admin mode working with the necessary stuff, let's implement something similar!
- Clicking to open starts with a list of the most recent 14 events (not sure why
  that number) with a timestamp and thumbnail, similar to what we use in the sidebar
- The user is able to configure:
  - Start **date** and end **date** (not timestamp) for what is displayed in the list
  - Event types to show (and there are more than Matthew realized are possible); some
    of these events are not available from the camera-specific recordings list, so
    let's explore and figure out what's going on here
  - Which cameras (called "channels" here, but let's stick with a term we already use)
    to include in the history list


## Architecture reminder

- Server: Express + TypeScript (`src/index.ts`)
- Auth: stateless signed cookies — `admin` role is already wired; admin-only
  routes just need a role check (`res.locals['role'] === 'admin'`)
- Docker: `docker compose up --build -d` on monster to deploy changes
- Git: commit on a feature branch, PR to main, merge in GitHub UI
