docs: update README to reflect project name change and enhance setup instructions

This commit is contained in:
2026-02-28 00:12:54 +01:00
parent 287506f8bb
commit b83d814c7c

View File

@@ -1,33 +1,61 @@
**Project**
- **Name:**: Simple WebUntis → PocketBase sync
- **Description:**: A small Node.js script that fetches your WebUntis timetable and synchronizes classes into a PocketBase collection.
# Moodle Timetable Server **Files**
- **Main script:**: [index.js](index.js)
- **Package metadata:**: [package.json](package.json)
- **Dockerfile:**: [dockerfile](dockerfile)
A Node.js server that fetches timetable data from WebUntis. **Requirements**
- **Node.js:**: v14+ recommended
- **Environment:**: A PocketBase instance reachable from the script (the URL is currently set inside `index.js`).
## Setup **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:
1. Install dependencies:
```bash
npm install express dotenv luxon webuntis
``` ```
2. Create a `.env` file with:
```env
PORT=3000
WEBUNTIS_SCHOOL=your_school WEBUNTIS_SCHOOL=your_school
WEBUNTIS_USER=your_username WEBUNTIS_USER=your_username
WEBUNTIS_PASS=your_password WEBUNTIS_PASS=your_password
WEBUNTIS_URL=your_webuntis_url WEBUNTIS_URL=your_webuntis_url
``` ```
## API Endpoints - **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.
- `GET /` - Health check **Install**
- `GET /timetable` - Fetch timetable for next 4 weeks
## Running
```bash ```bash
node server.js npm install
``` ```
Server runs on `http://localhost:3000` by default. **Run**
```bash
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.