chore: cleanup project structure, update docs, include dist
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,6 +1,4 @@
|
|||||||
node_modules/
|
node_modules/
|
||||||
dist/
|
|
||||||
.env
|
.env
|
||||||
|
.DS_Store
|
||||||
*.log
|
*.log
|
||||||
data/*.json
|
|
||||||
!data/.gitkeep
|
|
||||||
|
|||||||
114
README.md
114
README.md
@@ -1,89 +1,47 @@
|
|||||||
# Bessa Knapp-Kantine Menu Scraper
|
# Kantine Wrapper Bookmarklet (v1.7.0)
|
||||||
|
|
||||||
Automatischer Menü-Scraper für die Knapp-Kantine basierend auf https://web.bessa.app/knapp-kantine.
|
Ein intelligentes Bookmarklet für die Mitarbeiter-Kantine der Bessa App. Dieses Skript erweitert die Standardansicht um eine **Wochenübersicht**, Kostenkontrolle und verbesserte Usability.
|
||||||
|
|
||||||
## Setup
|
## 🚀 Features
|
||||||
|
|
||||||
1. **Dependencies installieren**:
|
* **Wochenübersicht:** Zeigt alle Tage der aktuellen Woche auf einen Blick.
|
||||||
```bash
|
* **Bestellstatus:** Farbige Indikatoren für bestellte Menüs.
|
||||||
npm install
|
* **Kostenkontrolle:** Summiert automatisch den Gesamtpreis der Woche.
|
||||||
```
|
* **Session Reuse:** Nutzt automatisch eine bestehende Login-Session (Loggt dich automatisch ein).
|
||||||
|
* **Bestellhistorie:** Zeigt zuverlässig alle aktiven und abgeschlossenen Bestellungen an (über `/user/orders/`).
|
||||||
|
* **Lokaler Cache:** Lädt Menüdaten blitzschnell aus dem Browser-Speicher.
|
||||||
|
* **Scroll-Fix:** Garantiert Scrollbarkeit auch auf restriktiven Seiten.
|
||||||
|
|
||||||
2. **Credentials konfigurieren**:
|
## 📦 Installation
|
||||||
```bash
|
|
||||||
cp .env.example .env
|
|
||||||
# Dann .env bearbeiten und echte Zugangsdaten eintragen
|
|
||||||
```
|
|
||||||
|
|
||||||
3. **TypeScript kompilieren**:
|
1. Öffne die Datei `dist/install.html` in deinem Browser.
|
||||||
```bash
|
2. Ziehe den blauen Button **"Kantine Wrapper"** in deine Lesezeichen-Leiste.
|
||||||
npm run build
|
3. Fertig!
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
## usage
|
||||||
|
|
||||||
### Menüs scrapen
|
1. Navigiere zu [https://web.bessa.app/knapp-kantine](https://web.bessa.app/knapp-kantine).
|
||||||
|
2. Klicke auf das **"Kantine Wrapper"** Lesezeichen.
|
||||||
|
3. Die Seite wird neu geladen und zeigt das erweiterte Menü. (Bei vorhandenem Login entfällt die Anmeldung).
|
||||||
|
|
||||||
|
## 🛠️ Entwicklung
|
||||||
|
|
||||||
|
### Voraussetzungen
|
||||||
|
* Node.js (optional, nur für Build-Scripts)
|
||||||
|
* Bash (für `build-bookmarklet.sh`)
|
||||||
|
|
||||||
|
### Projektstruktur
|
||||||
|
* `kantine.js`: Der Haupt-Quellcode des Bookmarklets.
|
||||||
|
* `public/style.css`: Das Design (CSS).
|
||||||
|
* `build-bookmarklet.sh`: Skript zum Erstellen der `dist/` Dateien.
|
||||||
|
* `dist/`: Enthält die kompilierten Dateien (`bookmarklet.txt`, `install.html`).
|
||||||
|
|
||||||
|
### Build
|
||||||
|
Um Änderungen an `kantine.js` oder `style.css` wirksam zu machen, führe den Build aus:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Development mode (mit TypeScript direkt)
|
./build-bookmarklet.sh
|
||||||
npm run dev
|
|
||||||
|
|
||||||
# Production mode (kompiliertes JavaScript)
|
|
||||||
npm run build
|
|
||||||
npm run scrape
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Scraper-Ablauf
|
## 📝 Lizenz
|
||||||
|
Internes Tool.
|
||||||
1. Öffnet Browser (Puppeteer)
|
|
||||||
2. Akzeptiert Cookies
|
|
||||||
3. Klickt "Pre-order menu"
|
|
||||||
4. Loggt sich ein (mit Credentials aus `.env`)
|
|
||||||
5. Navigiert durch Kalenderwochenansicht
|
|
||||||
6. Extrahiert Menüdaten für jeden Tag
|
|
||||||
7. Speichert alles in `data/menus.json`
|
|
||||||
|
|
||||||
## Output
|
|
||||||
|
|
||||||
Die gescrapten Daten werden in `data/menus.json` gespeichert:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"lastUpdated": "2026-02-02T10:00:00.000Z",
|
|
||||||
"weeks": [
|
|
||||||
{
|
|
||||||
"year": 2026,
|
|
||||||
"weekNumber": 6,
|
|
||||||
"days": [
|
|
||||||
{
|
|
||||||
"date": "2026-02-03",
|
|
||||||
"weekday": "Monday",
|
|
||||||
"items": [
|
|
||||||
{
|
|
||||||
"id": "2026-02-03_M1_Herzhaftes",
|
|
||||||
"name": "M1 Herzhaftes",
|
|
||||||
"description": "Rindsuppe mit Backerbsen / Puten Tikka Masala...",
|
|
||||||
"price": 5.5,
|
|
||||||
"available": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Development
|
|
||||||
|
|
||||||
- `npm run dev` - Run scraper in development mode with tsx
|
|
||||||
- `npm run build` - Compile TypeScript to JavaScript
|
|
||||||
- `npm run type-check` - Check TypeScript types without building
|
|
||||||
|
|
||||||
## Debugging
|
|
||||||
|
|
||||||
Setze `PUPPETEER_HEADLESS=false` in `.env` um den Browser sichtbar zu machen.
|
|
||||||
|
|
||||||
## Sicherheit
|
|
||||||
|
|
||||||
⚠️ **WICHTIG**: Die `.env`-Datei enthält Zugangsdaten und darf niemals ins Git committed werden!
|
|
||||||
|
|||||||
9
dist/bookmarklet-payload.js
vendored
Executable file
9
dist/bookmarklet-payload.js
vendored
Executable file
File diff suppressed because one or more lines are too long
1
dist/bookmarklet.txt
vendored
Executable file
1
dist/bookmarklet.txt
vendored
Executable file
File diff suppressed because one or more lines are too long
34
dist/install.html
vendored
Executable file
34
dist/install.html
vendored
Executable file
File diff suppressed because one or more lines are too long
2311
dist/kantine-standalone.html
vendored
Executable file
2311
dist/kantine-standalone.html
vendored
Executable file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user