Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/android-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
version="1.0.${GITHUB_RUN_NUMBER}"
notes="Handy-App für Cinemood, Version ${version}. Installation: docs/android-app.md. Installierte Apps finden diese Version von selbst (Update-Prüfung beim Start)."
notes="Handy-App für Cinemood, Version ${version}. Installation: docs/de/android-app.md (English: docs/en/android-app.md). Installierte Apps finden diese Version von selbst (Update-Prüfung beim Start)."
printf '{"versionCode": %s, "versionName": "%s", "apk": "https://github.com/%s/releases/download/handy-app/cinemood-handy.apk"}\n' \
"$GITHUB_RUN_NUMBER" "$version" "$GITHUB_REPOSITORY" > version.json
if gh release view handy-app >/dev/null 2>&1; then
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/android-tv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
version="1.0.${GITHUB_RUN_NUMBER}"
notes="Android-TV-App für Cinemood, Version ${version}. Installation: docs/android-tv.md. Installierte Apps finden diese Version von selbst (Update-Prüfung beim Start)."
notes="Android-TV-App für Cinemood, Version ${version}. Installation: docs/de/android-tv.md (English: docs/en/android-tv.md). Installierte Apps finden diese Version von selbst (Update-Prüfung beim Start)."
printf '{"versionCode": %s, "versionName": "%s", "apk": "https://github.com/%s/releases/download/tv-app/cinemood-tv.apk"}\n' \
"$GITHUB_RUN_NUMBER" "$version" "$GITHUB_REPOSITORY" > version.json
if gh release view tv-app >/dev/null 2>&1; then
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Cinemood zum Selbst-Hosten. Standard: SQLite in einer Datei unter /data, ohne Mail-Login.
# Bauen: docker build -t cinemood .
# Starten: siehe docker-compose.yml oder docs/self-hosting.md
# Starten: siehe docker-compose.yml oder docs/de/self-hosting.md (English: docs/en/self-hosting.md)

# Volles Image zum Installieren: better-sqlite3 wird dabei übersetzt (braucht python3, make, g++)
FROM node:22-bookworm AS deps
Expand Down
78 changes: 78 additions & 0 deletions README.de.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
[English](README.en.md) · **Deutsch**

# Cinemood

Gemeinsam schnell einen Film finden: Der Host erstellt eine Runde und wählt die Streaming-Anbieter,
alle joinen per QR-Code, wählen Genres und swipen Filme. Am Ende gewinnt der Film, den alle
(oder die meisten) sehen wollen. Filme, die die Crew schon gesehen hat, landen im **Abspann**
und werden nicht mehr vorgeschlagen.

Die Oberfläche gibt es auf Deutsch und Englisch (Sprachauswahl oben auf jeder Seite, Standard nach Browsersprache).

## Sprachen

- Texte: `src/lib/i18n/de.tsx` und `src/lib/i18n/en.tsx` (TypeScript prüft, dass keine Übersetzung fehlt).
- Fehlermeldungen der API kommen deutsch vom Server und werden im Browser übersetzt (`src/lib/i18n/errors.ts`).
- Die Adressen haben kein Sprachkürzel: `src/proxy.ts` schreibt intern auf `/de/...` bzw. `/en/...` um
(gespeicherte Wahl im Cookie `lang`, sonst Browsersprache, sonst Englisch).
- Filmtitel und Beschreibungen werden beim Start einer Runde auf Deutsch und Englisch gespeichert,
Genres und Tags beim Ausliefern übersetzt.

## Technik

- Next.js 16 (App Router) + Tailwind CSS 4
- Datenbank wählbar: Supabase (Standard, mit Mail-Login), MariaDB/MySQL oder SQLite (Self-Hosting, ohne Login).
Alle Zugriffe laufen über [Kysely](https://kysely.dev), derselbe Code für alle Datenbanken (`src/lib/server/db.ts`).
- Live-Stand per regelmäßigem Nachfragen (kein Realtime nötig)
- TMDB für Filmdaten, Poster und Streaming-Anbieter

## Datenbank wählen

| `DATABASE` | Wofür | Login (Google / Mail) | Tabellen anlegen |
| --- | --- | --- | --- |
| `supabase` (Standard) | Vercel | ja | SQL aus `supabase/` im Supabase SQL Editor |
| `mariadb` / `mysql` | eigener Server | nein | macht die App selbst |
| `sqlite` | kleiner Self-Host (eine Datei) | nein | macht die App selbst |
| `postgres` | eigener Postgres-Server | nein | `supabase/setup-alles.sql` einmal ausführen |

Verbindung über `DATABASE_URL` (bei SQLite stattdessen `SQLITE_FILE`). Selbst hosten mit Docker:
siehe [docs/de/self-hosting.md](docs/de/self-hosting.md).

## Apps

- Handy (Android): [docs/de/android-app.md](docs/de/android-app.md), Download unter `/handy-app`
- Fernseher (Android TV / Fire TV): [docs/de/android-tv.md](docs/de/android-tv.md), Download unter `/tv-app`
- Login mit Google oder Mail einrichten: [docs/de/login-einrichten.md](docs/de/login-einrichten.md)

## Sicherheitsmodell (Kurzfassung)

- Browser sprechen nie direkt mit der Datenbank. Alles läuft über die Next.js-API, die
Zugangsdaten zur Datenbank liegen nur auf dem Server.
- RLS ist auf allen Tabellen aktiv, ohne Policies für Client-Rollen.
- Teilnehmer, Hosts und Crews werden über zufällige 256-Bit-Tokens in httpOnly-Cookies
erkannt. In der DB liegt nur der HMAC.
- Raum-Codes sind 10 Zeichen aus 31 Zeichen (~49 Bit) und werden mit Rate Limiting geschützt.
- Externe TMDB-Daten werden mit zod validiert, bevor sie gespeichert oder angezeigt werden.

## Lokal starten

```bash
npm install
cp .env.example .env.local # Werte eintragen
npm run dev
```

Datenbank: Am einfachsten lokal `DATABASE=sqlite` in `.env.local`, dann legt die App alles selbst an.
Mit Supabase: Migrationen in `supabase/migrations/` im Supabase-Dashboard (SQL Editor) ausführen
oder mit `npx supabase db push`.

## Checks

```bash
npm test # Unit-Tests
npm run typecheck
npm run lint
npm run e2e # Ende-zu-Ende: Host + 2 Gäste spielen eine Runde (braucht laufenden Dev-Server)
```

Für lokale Tests ohne TMDB-Zugang `TMDB_MOCK=1` in `.env.local` setzen (wirkt nie in Produktion).
78 changes: 78 additions & 0 deletions README.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
**English** · [Deutsch](README.de.md)

# Cinemood

Find a movie together, fast: the host creates a round and picks the streaming services,
everyone joins by QR code, chooses genres and swipes movies. The movie everyone (or most people)
wants to watch wins. Movies the crew has already seen go into the **credits**
and won't be suggested again.

The interface is available in English and German (language switch at the top of every page, default based on browser language).

## Languages

- Texts: `src/lib/i18n/de.tsx` and `src/lib/i18n/en.tsx` (TypeScript checks that no translation is missing).
- API error messages come from the server in German and are translated in the browser (`src/lib/i18n/errors.ts`).
- URLs have no language prefix: `src/proxy.ts` rewrites internally to `/de/...` or `/en/...`
(saved choice in the `lang` cookie, otherwise browser language, otherwise English).
- Movie titles and descriptions are stored in German and English when a round starts;
genres and tags are translated when they are served.

## Tech

- Next.js 16 (App Router) + Tailwind CSS 4
- Database of your choice: Supabase (default, with email sign-in), MariaDB/MySQL or SQLite (self-hosting, without sign-in).
All queries go through [Kysely](https://kysely.dev), the same code for every database (`src/lib/server/db.ts`).
- Live updates by regular polling (no realtime needed)
- TMDB for movie data, posters and streaming services

## Choosing a database

| `DATABASE` | For | Sign-in (Google / email) | Creating tables |
| --- | --- | --- | --- |
| `supabase` (default) | Vercel | yes | SQL from `supabase/` in the Supabase SQL Editor |
| `mariadb` / `mysql` | your own server | no | the app does it itself |
| `sqlite` | small self-host (one file) | no | the app does it itself |
| `postgres` | your own Postgres server | no | run `supabase/setup-alles.sql` once |

Connection via `DATABASE_URL` (for SQLite use `SQLITE_FILE` instead). Self-hosting with Docker:
see [docs/en/self-hosting.md](docs/en/self-hosting.md).

## Apps

- Phone (Android): [docs/en/android-app.md](docs/en/android-app.md), download at `/handy-app`
- TV (Android TV / Fire TV): [docs/en/android-tv.md](docs/en/android-tv.md), download at `/tv-app`
- Setting up sign-in with Google or email: [docs/en/login-setup.md](docs/en/login-setup.md)

## Security model (short version)

- Browsers never talk to the database directly. Everything goes through the Next.js API;
database credentials live only on the server.
- RLS is enabled on all tables, with no policies for client roles.
- Participants, hosts and crews are identified by random 256-bit tokens in httpOnly cookies.
The database only stores their HMAC.
- Room codes are 10 characters from a 31-character alphabet (~49 bits) and are protected by rate limiting.
- External TMDB data is validated with zod before it is stored or displayed.

## Running locally

```bash
npm install
cp .env.example .env.local # fill in the values
npm run dev
```

Database: the easiest option locally is `DATABASE=sqlite` in `.env.local`; the app then creates everything itself.
With Supabase: run the migrations in `supabase/migrations/` in the Supabase dashboard (SQL Editor)
or with `npx supabase db push`.

## Checks

```bash
npm test # unit tests
npm run typecheck
npm run lint
npm run e2e # end-to-end: host + 2 guests play a round (needs a running dev server)
```

For local tests without TMDB access, set `TMDB_MOCK=1` in `.env.local` (never takes effect in production).
83 changes: 14 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,76 +1,21 @@
# Cinemood

Gemeinsam schnell einen Film finden: Der Host erstellt eine Runde und wählt die Streaming-Anbieter,
alle joinen per QR-Code, wählen Genres und swipen Filme. Am Ende gewinnt der Film, den alle
(oder die meisten) sehen wollen. Filme, die die Crew schon gesehen hat, landen im **Abspann**
und werden nicht mehr vorgeschlagen.
Find a movie together, fast. Everyone joins by QR code, picks genres and swipes movies.
The movie most people want to watch wins.

Die Oberfläche gibt es auf Deutsch und Englisch (Sprachauswahl oben auf jeder Seite, Standard nach Browsersprache).
Gemeinsam schnell einen Film finden. Alle joinen per QR-Code, wählen Genres und swipen Filme.
Der Film, den die meisten sehen wollen, gewinnt.

## Sprachen
**Choose your language / Sprache wählen:**

- Texte: `src/lib/i18n/de.tsx` und `src/lib/i18n/en.tsx` (TypeScript prüft, dass keine Übersetzung fehlt).
- Fehlermeldungen der API kommen deutsch vom Server und werden im Browser übersetzt (`src/lib/i18n/errors.ts`).
- Die Adressen haben kein Sprachkürzel: `src/proxy.ts` schreibt intern auf `/de/...` bzw. `/en/...` um
(gespeicherte Wahl im Cookie `lang`, sonst Browsersprache, sonst Englisch).
- Filmtitel und Beschreibungen werden beim Start einer Runde auf Deutsch und Englisch gespeichert,
Genres und Tags beim Ausliefern übersetzt.
- 🇬🇧 [English](README.en.md)
- 🇩🇪 [Deutsch](README.de.md)

## Technik
## Docs / Anleitungen

- Next.js 16 (App Router) + Tailwind CSS 4
- Datenbank wählbar: Supabase (Standard, mit Mail-Login), MariaDB/MySQL oder SQLite (Self-Hosting, ohne Login).
Alle Zugriffe laufen über [Kysely](https://kysely.dev), derselbe Code für alle Datenbanken (`src/lib/server/db.ts`).
- Live-Stand per regelmäßigem Nachfragen (kein Realtime nötig)
- TMDB für Filmdaten, Poster und Streaming-Anbieter

## Datenbank wählen

| `DATABASE` | Wofür | Login (Google / Mail) | Tabellen anlegen |
| --- | --- | --- | --- |
| `supabase` (Standard) | Vercel | ja | SQL aus `supabase/` im Supabase SQL Editor |
| `mariadb` / `mysql` | eigener Server | nein | macht die App selbst |
| `sqlite` | kleiner Self-Host (eine Datei) | nein | macht die App selbst |
| `postgres` | eigener Postgres-Server | nein | `supabase/setup-alles.sql` einmal ausführen |

Verbindung über `DATABASE_URL` (bei SQLite stattdessen `SQLITE_FILE`). Selbst hosten mit Docker:
siehe [docs/self-hosting.md](docs/self-hosting.md).

## Apps

- Handy (Android): [docs/android-app.md](docs/android-app.md), Download unter `/handy-app`
- Fernseher (Android TV / Fire TV): [docs/android-tv.md](docs/android-tv.md), Download unter `/tv-app`
- Login mit Google oder Mail einrichten: [docs/login-einrichten.md](docs/login-einrichten.md)

## Sicherheitsmodell (Kurzfassung)

- Browser sprechen nie direkt mit der Datenbank. Alles läuft über die Next.js-API, die
Zugangsdaten zur Datenbank liegen nur auf dem Server.
- RLS ist auf allen Tabellen aktiv, ohne Policies für Client-Rollen.
- Teilnehmer, Hosts und Crews werden über zufällige 256-Bit-Tokens in httpOnly-Cookies
erkannt. In der DB liegt nur der HMAC.
- Raum-Codes sind 10 Zeichen aus 31 Zeichen (~49 Bit) und werden mit Rate Limiting geschützt.
- Externe TMDB-Daten werden mit zod validiert, bevor sie gespeichert oder angezeigt werden.

## Lokal starten

```bash
npm install
cp .env.example .env.local # Werte eintragen
npm run dev
```

Datenbank: Am einfachsten lokal `DATABASE=sqlite` in `.env.local`, dann legt die App alles selbst an.
Mit Supabase: Migrationen in `supabase/migrations/` im Supabase-Dashboard (SQL Editor) ausführen
oder mit `npx supabase db push`.

## Checks

```bash
npm test # Unit-Tests
npm run typecheck
npm run lint
npm run e2e # Ende-zu-Ende: Host + 2 Gäste spielen eine Runde (braucht laufenden Dev-Server)
```

Für lokale Tests ohne TMDB-Zugang `TMDB_MOCK=1` in `.env.local` setzen (wirkt nie in Produktion).
| | English | Deutsch |
| --- | --- | --- |
| Self-hosting | [docs/en/self-hosting.md](docs/en/self-hosting.md) | [docs/de/self-hosting.md](docs/de/self-hosting.md) |
| Android phone app / Handy-App | [docs/en/android-app.md](docs/en/android-app.md) | [docs/de/android-app.md](docs/de/android-app.md) |
| Android TV app / Fernseher-App | [docs/en/android-tv.md](docs/en/android-tv.md) | [docs/de/android-tv.md](docs/de/android-tv.md) |
| Sign-in setup / Login einrichten | [docs/en/login-setup.md](docs/en/login-setup.md) | [docs/de/login-einrichten.md](docs/de/login-einrichten.md) |
2 changes: 1 addition & 1 deletion android-app/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Cinemood Handy-App (Android)

Android-App für Handy und Tablet: Runden erstellen, per QR-Code beitreten und abstimmen, mit Anmeldung über Google.
Die App zeigt die Web-App von Cinemood in einer WebView. Installation und Einrichtung: [docs/android-app.md](../docs/android-app.md).
Die App zeigt die Web-App von Cinemood in einer WebView. Installation und Einrichtung: [Deutsch](../docs/de/android-app.md) · [English](../docs/en/android-app.md).

- Code: `app/src/main/java/app/cinemood/handy/`
- `MainActivity`: WebView, Google-Anmeldung im Custom Tab, Rücksprung über `cinemood://anmelden`, QR-Links (`/r/…`)
Expand Down
2 changes: 1 addition & 1 deletion android-tv/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Cinemood TV (Android TV / Google TV)

Kleine Android-App, die die Fernseher-Seite `/tv` von Cinemood im Vollbild in einer WebView öffnet.
Installation und Bedienung: [docs/android-tv.md](../docs/android-tv.md).
Installation und Bedienung: [Deutsch](../docs/de/android-tv.md) · [English](../docs/en/android-tv.md).

- Code: `app/src/main/java/app/cinemood/tv/` (eine Activity für die Seite, eine für die Server-Adresse)
- Bauen: `./gradlew assembleRelease` (braucht JDK 17 und das Android SDK), Ergebnis unter
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Cinemood selbst hosten: `docker compose up -d`, danach http://<IP-des-Rechners>:3000 öffnen.
# Vorher eine Datei .env anlegen (siehe .env.example): TMDB_READ_TOKEN und APP_SECRET reichen.
# Anleitung: docs/self-hosting.md
# Anleitung / Guide: docs/de/self-hosting.md · docs/en/self-hosting.md

services:
cinemood:
Expand Down
2 changes: 2 additions & 0 deletions docs/android-app.md → docs/de/android-app.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[English](../en/android-app.md) · **Deutsch**

# Cinemood als App fürs Handy (Android, z. B. Samsung Galaxy)

Die App **Cinemood** fürs Handy und Tablet kann alles, was die Webseite kann: Runde erstellen, Freunde per
Expand Down
2 changes: 2 additions & 0 deletions docs/android-tv.md → docs/de/android-tv.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[English](../en/android-tv.md) · **Deutsch**

# Cinemood auf dem Android-Fernseher

Die App **Cinemood TV** öffnet die Fernseher-Seite (`/tv`) im Vollbild. Am Fernseher musst du nichts
Expand Down
2 changes: 2 additions & 0 deletions docs/login-einrichten.md → docs/de/login-einrichten.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[English](../en/login-setup.md) · **Deutsch**

# Login einrichten: Google und Magic-Link (Supabase)

Das Konto ist freiwillig und nur für Hosts gedacht. Gäste treten weiterhin nur mit ihrem Namen bei.
Expand Down
2 changes: 2 additions & 0 deletions docs/self-hosting.md → docs/de/self-hosting.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[English](../en/self-hosting.md) · **Deutsch**

# Cinemood selbst hosten

Cinemood läuft auch ohne Supabase und Vercel auf einem eigenen Rechner (Raspberry Pi, NAS, Server).
Expand Down
52 changes: 52 additions & 0 deletions docs/en/android-app.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
**English** · [Deutsch](../de/android-app.md)

# Cinemood as a phone app (Android, e.g. Samsung Galaxy)

The **Cinemood** app for phones and tablets can do everything the website can: create a round, invite friends
by QR code, pick genres and vote. On top of that there is **sign-in with Google**: tap once,
choose your Google account, done. Your crews, the credits and your favorite services are tied to this account
and are there on every device where you sign in with the same Google account.

Guests need neither the app nor an account. They scan the QR code and join in the browser.

## Download and install

1. On your phone, open `cinemood.yugusaa.de/handy-app` in the browser. This downloads the current APK
(`https://github.com/pinguDevelopment/cinemood/releases/download/handy-app/cinemood-handy.apk`).
2. Tap the downloaded file. The first time, Android asks whether the browser (Samsung Internet
or Chrome) may install apps: **Settings → Allow**, then go back and tap **Install**.
3. Google Play Protect may warn about an "unknown app" because it doesn't come from the Play Store:
**More details → Install anyway**.
4. Open Cinemood. Under **Account**, tap **Sign in with Google**.

The app checks for new versions on its own at startup and asks whether to install the update.
For that, allow Cinemood to install apps once (the app takes you there).

## Opening QR codes directly in the app

If someone with the app installed scans an invite QR code, Android opens the round directly in the app.
If that doesn't work and the browser opens instead: turn on **Settings → Apps → Cinemood → Set as default →
Open supported links**.

## Settings

**Press and hold** the Cinemood icon on the home screen **→ Settings**: a different server address (your own server),
reload page, check for updates.

## How Google sign-in works in the app

Google doesn't allow signing in inside an in-app view (WebView). So the app briefly opens the sign-in
in the browser (it looks like a window of the app), and then jumps back into the app automatically.
Only a short-lived, signed ticket travels back, and it is valid only together with a secret that
only the app knows. This way the actual sign-in ends up in the app and not in the browser.

Requirement: Google is set up in Supabase, see [login-setup.md](login-setup.md#setting-up-google-sign-in).
Without that setup, the app (and the website) simply shows no Google button.

## Your own server or your own signing key

- Different start address at build time: on GitHub under **Actions → Handy-App → Run workflow**, enter an address.
- The app is signed with the same sideload key as the TV app. If you use your own key via the GitHub secret
`CINEMOOD_KEYSTORE_B64`, enter its SHA-256 fingerprint in Vercel as
`ANDROID_CERT_SHA256`, otherwise QR codes open in the browser instead of the app
(`keytool -list -v -keystore your-own.jks` shows the fingerprint).
Loading
Loading