← Back to Poker Night Ledger

How it works

A one-page app for recording each poker night: who played, the top three, and the Chip Bitch (first one out), plus a photo of the winner. Each night can be downloaded as a one-page PDF summary.

Page: https://science-connects.com/fun-apps/poker/


Using it

  1. Open the page and enter your password. Each device remembers it after the first time. To remove it from a device, use Sign out on this device at the bottom of the page.
  2. Players. Add each person in the group once. Tap names to mark who is playing tonight, or use Everyone's playing.
  3. Tonight's result. Set the date and host, then pick 1st, 2nd, 3rd and the Chip Bitch. One person can't fill two spots, and the Chip Bitch can't also be in the top three.
  4. Winner photo. Tap Upload photo. The photo is shrunk automatically before it's saved.
  5. Save night & make PDF. This saves the night and downloads the PDF.
  6. Past nights. Every saved night is listed here. Use PDF to download it again, or Share then Send PDF to send the file straight to Mail, Messages or another app. Send the PDF file itself, not a link: a blob: link only works in the tab that made it. The admin also sees Edit to fix a night and ✕ to delete it.

The list is shared. Anyone with a password sees the same players and nights on any phone or computer. An open page checks for changes every 20 seconds and whenever you switch back to it.

Two passwords

Group password (share with players) Admin password (keep to yourself)
See players and past nights Yes Yes
Download PDFs Yes Yes
Add players and record new nights Yes Yes
Edit or delete a saved night No Yes
Remove players No Yes

The bottom of the page shows which password the device is signed in with. If someone records a night with a mistake, the admin can fix it with Edit. The server checks every change, so these limits can't be bypassed from the page.

What's on the PDF

The date and host, the winner photo, the champion's name, 1st, 2nd and 3rd place, the Chip Bitch, the list of players, and any notes.


How it works

Part Where it lives on the server What it does
Web page /var/www/html/fun-apps/poker/index.html The app itself. It makes the PDF in your browser.
Save service /opt/poker-ledger/poker_server.py A small Python program that stores the shared list. It's reachable only through Nginx.
Service settings /etc/systemd/system/poker-ledger.service Starts the save service automatically and restarts it if it stops.
Passwords /etc/poker-ledger.env Holds POKER_PASSWORD (group) and POKER_ADMIN_PASSWORD (admin). Readable only by root. They are never stored in the web folder.
Nginx link /etc/nginx/snippets/poker-ledger.conf Sends /fun-apps/poker/api/ to the save service. It's loaded by one include line in /etc/nginx/sites-enabled/default, in the 443 server block.
Saved data /var/lib/private/poker-ledger/ ledger.json holds players and nights. photos/ holds one file per winner photo.

Maintenance

All commands are run on the droplet after logging in with ssh root@YOUR_DROPLET_IP.

Check that it's running

systemctl status poker-ledger
curl -s http://127.0.0.1:8765/api/ping        # should print {"ok": true}

See recent activity or errors

journalctl -u poker-ledger -n 30

Change a password

nano /etc/poker-ledger.env        # edit POKER_PASSWORD=... (group) or POKER_ADMIN_PASSWORD=... (admin)
systemctl restart poker-ledger

Anyone using the old password will be asked for the new one the next time they open the page. Keep the two passwords different.

Back up the data (worth doing after each game night)

tar czf ~/poker-backup-$(date +%F).tgz -C /var/lib/private poker-ledger

To copy a backup to your Mac, run this on the Mac: scp root@YOUR_DROPLET_IP:~/poker-backup-*.tgz ~/Downloads/

Restore a backup

systemctl stop poker-ledger
tar xzf ~/poker-backup-YYYY-MM-DD.tgz -C /var/lib/private
systemctl start poker-ledger

Update the web page (run on your Mac, from the folder holding the new file)

scp index.html root@YOUR_DROPLET_IP:/var/www/html/fun-apps/poker/index.html

Updating the page doesn't touch saved players or nights.


Troubleshooting

What you see What to do
"Can't reach the server" Check the service with systemctl status poker-ledger, then restart it with systemctl restart poker-ledger.
"That password didn't work" The password was changed or mistyped. Check /etc/poker-ledger.env.
No Edit or ✕ buttons on past nights The device is signed in with the group password. Tap Sign out on this device, then sign in with the admin password.
"Only the admin can change…" That change needs the admin password.
A new device shows no players Make sure it's on the same page address and that the right password was entered.
The page looks old after an update Hard-refresh: Cmd+Shift+R on a Mac, or close and reopen the tab on a phone.
Nginx won't reload after an edit Run nginx -t to see the error. The original config was backed up to /root/nginx-default.backup.

← Back to Poker Night Ledger