Sito web statico per visualizzare gli orari delle lezioni e creare specchietti personalizzati
  • JavaScript 72.7%
  • SCSS 25.5%
  • HTML 1.7%
  • Dockerfile 0.1%
Find a file
2026-09-22 15:28:04 +02:00
public feat: dynamic semester data loading and automated daily update setup 2026-09-02 22:45:39 +02:00
src fix(systemd): ensure 0644 file permissions and document root execution for docker volumes 2026-09-22 15:28:04 +02:00
systemd fix(systemd): ensure 0644 file permissions and document root execution for docker volumes 2026-09-22 15:28:04 +02:00
tests feat: dynamic semester data loading and automated daily update setup 2026-09-02 22:45:39 +02:00
.drone.yml drone: now it actually works 2023-02-27 00:41:17 +01:00
.gitignore chore: added new calendars 2023-01-23 23:28:59 +01:00
.prettierrc cmd: prettier -w src/ 2024-02-25 16:43:59 +01:00
bun.lockb chore: fix old typo 2026-01-24 16:36:12 +01:00
Dockerfile Refactor delle view-modes, readme and better dockerfile 2022-09-11 16:18:45 +02:00
index.html fix: aggiunta finalmente un'icona 2023-01-24 17:27:03 +01:00
package.json feat: dynamic semester data loading and automated daily update setup 2026-09-02 22:45:39 +02:00
pnpm-lock.yaml first brutal rework and first prototype 2023-08-19 03:57:46 +02:00
README.md feat: dynamic semester data loading and automated daily update setup 2026-09-02 22:45:39 +02:00
vite.config.js Prima release 2022-09-09 18:46:36 +02:00

Orario

Sito per visualizzare l'orario delle lezioni per i vari anni di corso.

Usage

You need to have installed node and npm (or pnpm). To setup the project just run npm install.

Development

To start the development server run npm run dev.

Editor

È meglio se prima di fare commit il codice sia formattato con Prettier, nel caso di VSCode c'è un'estensione omonima e le opzioni da aggiungere al proprio JSON di impostazioni sono

...
"prettier.printWidth": 100,
"prettier.singleQuote": true,
"prettier.quoteProps": "consistent",
"prettier.tabWidth": 4,
"prettier.semi": false,
"prettier.arrowParens": "avoid",
"editor.formatOnSave": true,
...

Production

To build the ViteJS project run npm run build, for deployment a .env file can be used to set the BASE_URL variable.

Semester Timetable Data & Automated Updates

The timetable IDs and semester dates are stored in semester-data.json. The client application loads semester-data.json with a Stale-While-Revalidate / Fallback pattern:

  • The bundled src/semester-data.json is used as an immediate fallback (ensuring instant render and offline availability).
  • On startup, the client dynamically fetches /semester-data.json (hourly cache-busted). If new IDs or dates are published, the UI updates automatically without needing to rebuild or redeploy the frontend bundle.

Updating Semester Data

To manually check and update semester data:

# Update both src/semester-data.json and public/semester-data.json
npm run update-data

# Or run directly with custom output path(s)
node src/scripts/update-semester-data.js --output /var/www/orario/semester-data.json

# Check without modifying files (exits with code 1 if updates found, 0 if up to date)
node src/scripts/update-semester-data.js --check

Automated Daily Host Updates

To ensure the production site always has up-to-date timetable IDs each semester without manual commits, set up a daily check on the server hosting /var/www/orario.

  1. Copy the systemd unit files to /etc/systemd/system/:
    sudo cp systemd/orario-update.service /etc/systemd/system/
    sudo cp systemd/orario-update.timer /etc/systemd/system/
    
  2. In /etc/systemd/system/orario-update.service, ensure the ExecStart path points to your repository's update script and your webroot target, for example:
    ExecStart=/usr/bin/node /home/fra/tech/phc/orario/src/scripts/update-semester-data.js --output /var/www/orario/semester-data.json --quiet
    
  3. Enable and start the timer:
    sudo systemctl daemon-reload
    sudo systemctl enable --now orario-update.timer
    
  4. Verify status:
    systemctl list-timers | grep orario
    

Option 2: Standard Cron (crontab -e)

Add a daily cron entry to the caddy (or deployment) user's crontab:

crontab -e

Add the following line (runs daily at 04:30 AM):

30 4 * * * /usr/bin/node /home/fra/tech/phc/orario/src/scripts/update-semester-data.js --output /var/www/orario/semester-data.json --quiet >> /var/log/orario-update.log 2>&1