Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Infoscreen

The screen in Prodeko's guild room. A Vite + React + Tailwind page that runs full screen in Chrome on a Raspberry Pi.

What it shows

The main area rotates through these slides:

Slide Source Notes
Lunch menus (TUAS, A Bloc, T-talo) with opening hours Kanttiinit Flags a restaurant that closes within 30 minutes. Shown from 07:00 to 18:00
Slides from prodeko.org prodeko.org/fi/infoscreen.json Edited at prodeko.org/admin → Infoscreen. A slide with a "show until" date disappears after that day. Hidden when there are none
Event sign-ups: open now and opening soon Ilmo Read on the server by server/ilmoSignups.ts, see the comment there. Hidden when there are none
The open election: application count and the newest applications vaalit.prodeko.org Shown only while an election is open
Countdown to the next big event prodeko.org/fi/infoscreen-countdowns.json Edited at prodeko.org/admin → Infoscreen → Laskurit. Hidden when none is ahead
The newest post on Prodeko's Telegram announcement channel The channel's public web page, t.me/s/prodekotiedotus Read on the server by server/telegram.ts; no bot or key. Shows the Finnish part of a bilingual post. Hidden when the newest post is over two weeks old
Weekly bulletin (viikkotiedote) viikkotiedote API on old.prodeko.org (the old Django site) Hidden when there is nothing to show
This week's events from the guild's Google calendars (Tapahtumat, Yleiset, Excut, Fuksit, PoRa) Public iCalendar feeds Calendars are listed in src/calendarApi.ts. Hidden when the week has no events
Namukilke: this week's most bought products and the most liked open wishes namu2's /api/infoscreen Needs NAMU_INFOSCREEN_KEY, the same value as namu2's INFOSCREEN_API_KEY. Hidden without it
Biliskilke: this season's and the all-time top 10, and the latest games Bilis-2's /api/infoscreen (bilis2.prodeko.org) Public like the app itself. Hidden until the endpoint exists
The most-voted active PTER ideas pter.prodeko.org/api/top-ideas Hidden when there are none
HSL departures and disruptions: Aalto metro, Innopolis, Tietotie (bus 52), Maari (tram 15) Digitransit Needs HSL_SUBSCRIPTION_KEY. Each group shows the walk from TUAS; departures one could not walk to in time are left out. Free city bikes at the four nearest stations (citybik.es) next to the disruption notices, hidden off-season
Rain radar for the capital region FMI open data over OpenStreetMap tiles No keys. The map is greyed so the rain stands out
Stock prices: S&P 500 (through the SPY ETF) and the Magnificent 7 Twelve Data Needs TWELVE_DATA_API_KEY (free plan: 8 symbols/min, 800/day, no indices). Refreshes every 15 minutes. Hidden without data
McKinsey logo public/ Sponsor

The sidebar shows the date and time (with today's flag day, if any, from src/flagDays.ts), the weather in Otaniemi (Open-Meteo), the next HSL departures, the two coffee pots from kahvikilke, what the guild room's Spotify is playing (only while something plays, see below), and whether someone is watching Kiltiskamera.

Slides that lead somewhere (sign-ups, elections, bulletin, calendar, PTER, and prodeko.org slides with a link) show a QR code to that page in the bottom right corner (src/QrLink.tsx).

When a source stops answering, its slide or box shows a grey note with the time of its last successful update (src/StaleNote.tsx). From 22:00 to 07:00 the whole screen switches to dark (src/useNightMode.ts).

Running it locally

Node 22 or newer.

npm install
cp .env.example .env
npm run dev

and open http://localhost:5173. Without the HSL key and the Kiltiskamera password in .env those two parts stay empty; everything else works.

The slides come from prodeko.org. To try slides before they are published, run the site from a checkout of Prodeko/prodeko-org, edit site/data/infoscreen.yaml there, and point the screen at it:

cd ../prodeko-org/site && hugo server     # serves /fi/infoscreen.json

with SLIDES_ORIGIN=http://localhost:1313 in .env.

The screen is 1920×1080; size the browser window to match.

To work on one slide, add ?slide=N to the address (counting from 0) and the rotation stays on that slide.

Checks

npx @biomejs/biome check .
npm run build

The keys and passwords in .env are read by the proxy in vite.config.ts when the server starts, not at build time, so npm run build needs none of them and none of them are in the built page.

Spotify ("Nyt soi")

The sidebar card shows what the guild room's Spotify account is playing. It needs a Spotify app and one sign-in by that account; until then the card stays hidden.

  1. At https://developer.spotify.com/dashboard, signed in with the guild room account, create an app. Choose Web API, and add the redirect URI http://127.0.0.1:8888/callback exactly.
  2. Put the app's client ID and secret in .env as SPOTIFY_CLIENT_ID and SPOTIFY_CLIENT_SECRET, on any computer with a browser.
  3. Run npm run spotify-login, open the link it prints, sign in with the guild room account and allow access. It prints SPOTIFY_REFRESH_TOKEN=….
  4. Put all three lines in the Pi's .env and restart the service.

The tokens and the secret stay on the Pi (server/spotify.ts); the page only sees the song. If the card stops showing while music plays, the refresh token has probably been revoked: run step 3 again.

Building and deploying

SSH into the Raspberry Pi (who has access, and how, is kept in the board's own documents, not in this public repo), pull the new contents of the repo and run:

npm ci
npm run build

Use npm ci, not npm install: on the Pi, npm install rewrites package-lock.json, and the next git pull then refuses to run. If that has happened, git checkout -- package-lock.json undoes it.

Create a .env file in the project root first:

KILTISKAMERA_ON_AIR_PASSWORD=secretpassword
HSL_SUBSCRIPTION_KEY=your_hsl_subscription_key
TWELVE_DATA_API_KEY=your_twelve_data_key
NAMU_INFOSCREEN_KEY=same_as_namu2_INFOSCREEN_API_KEY

The older VITE_KILTISKAMERA_ON_AIR_PASSWORD and VITE_HSL_SUBSCRIPTION_KEY names still work, but rename them when you next touch the file. Restart the service after changing .env: the proxy reads it on start.

secretpassword value can be looked up from the Azure environment values for kiltiskamera app.

There is a systemd service in /etc/systemd/system/infoscreen.service which runs the preview server. Chrome is started on boot in kiosk mode and the configuration is in ~/.config/autostart/infoscreen.desktop.

The screen reloads itself within five minutes of a new build: npm run build writes dist/version.json, and the page reloads when the build id there changes. vite preview serves the new files without a restart. Restart the service only after changing .env or vite.config.ts, which are read when it starts.

The Pi updates itself every hour: scripts/update-pi.sh pulls master and, if there is anything new, installs dependencies, builds, and restarts the service when vite.config.ts, server/ or the dependencies changed. It runs from the pi user's crontab (crontab -e):

0 * * * * /home/pi/infoscreen/scripts/update-pi.sh >> /home/pi/infoscreen-update.log 2>&1

Run the script by hand to update right away.

The API proxies in vite.config.ts are what make the data sources reachable, so the screen has to be served by vite preview (or vite), not as plain static files.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages