Files
moodle/readme.md

2.0 KiB

Project

  • Name:: Simple WebUntis → PocketBase sync
  • Description:: A small Node.js script that fetches your WebUntis timetable and synchronizes classes into a PocketBase collection.

Files

Requirements

  • Node.js:: v14+ recommended
  • Environment:: A PocketBase instance reachable from the script (the URL is currently set inside index.js).

Dependencies

  • webuntis: fetches timetable data
  • pocketbase: PocketBase client
  • luxon: date handling
  • dotenv: load environment variables

Configuration

  • Environment variables:: Create a .env in the project root with at least:
WEBUNTIS_SCHOOL=your_school
WEBUNTIS_USER=your_username
WEBUNTIS_PASS=your_password
WEBUNTIS_URL=your_webuntis_url
  • PocketBase URL:: The script currently instantiates PocketBase with a hard-coded URL (https://fsae41.de). Edit index.js to change this or make it configurable via an env var.

Install

npm install

Run

node index.js

The script runs an initial sync and then repeats every 30 minutes (see setInterval near the end of index.js).

Behavior

  • Merging lessons:: The script sorts and merges adjacent lessons that end and start at the same time on the same day.
  • PocketBase collection:: Records are created/updated in the classes collection. Existing records are compared and updated if changes are detected.

Docker

  • A dockerfile is present; you can containerize the app. Ensure environment variables and PocketBase URL are provided to the container.

Notes & Next steps

  • Consider moving the PocketBase URL into .env for easier configuration.
  • Add error handling and logging for production use.

License

  • No license specified. Add one if you plan to publish.

Contact

  • Questions or improvements: edit index.js and open an issue or PR in your repo.