feat: automatisches Update-System

- VERSION-Konstante in app.py (aktuell: 1.0.0)
- version.txt als zentraler Versions-Vergleichspunkt
- Background-Thread prüft alle 6 Stunden auf Updates
- /api/update/status – aktueller Update-Status
- /api/update/check  – manueller Check auslösen
- /api/update/install – Download + Syntax-Check + Neustart
- Topbar-Badge zeigt "↑ v1.x.x verfügbar" wenn Update bereit
- One-Click-Install mit Bestätigungsdialog + Auto-Reload
- README: Update-Anleitung (Web-Interface, SSH, One-Liner)
- README: Release-Prozess für Maintainer dokumentiert

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-09 02:03:50 +02:00
parent e3339933ba
commit 2c02ed4df3
3 changed files with 204 additions and 3 deletions

View File

@@ -171,6 +171,24 @@ Der Hotspot startet automatisch beim Boot wenn das konfigurierte WLAN nicht verf
## Update
### Automatische Update-Benachrichtigung
PiCopy prüft alle **6 Stunden** automatisch ob eine neue Version verfügbar ist. Sobald ein Update bereitsteht, erscheint in der Topbar des Web-Interfaces ein gelbes Badge:
```
↑ v1.1.0 verfügbar
```
Ein Klick auf das Badge → Bestätigungsdialog → PiCopy lädt die neue Version herunter, verifiziert sie und startet sich selbst neu. Das Interface ist dabei ca. 10 Sekunden nicht erreichbar.
### Manuelles Update
**Option A über das Web-Interface:**
Topbar-Badge klicken (falls Update verfügbar) oder direkt:
`http://<pi-ip>:8080` → Badge erscheint automatisch
**Option B per SSH:**
```bash
cd PiCopy
git pull
@@ -178,6 +196,13 @@ sudo cp app.py /opt/picopy/app.py
sudo systemctl restart picopy
```
**Option C One-Liner:**
```bash
curl -sSL https://git.leuschner.dev/Tobias/PiCopy/raw/branch/main/app.py \
| sudo tee /opt/picopy/app.py > /dev/null && sudo systemctl restart picopy
```
---
## Deinstallation
@@ -245,6 +270,40 @@ sudo systemctl stop picopy
---
## Neue Version veröffentlichen (für Maintainer)
So wird ein neues Release erstellt, das alle Nutzer automatisch als Update angezeigt bekommen:
**1. Versionen erhöhen**
In `app.py`:
```python
VERSION = '1.1.0' # ← neue Versionsnummer
```
In `version.txt`:
```
1.1.0
```
**2. Committen & pushen**
```bash
git add app.py version.txt
git commit -m "Release v1.1.0"
git push
```
**3. Release/Tag in Gitea erstellen** *(optional, aber empfohlen)*
Unter [git.leuschner.dev/Tobias/PiCopy/releases](https://git.leuschner.dev/Tobias/PiCopy/releases) → *Neues Release* → Tag `v1.1.0` setzen.
**Das war's.** Alle laufenden PiCopy-Instanzen erkennen das Update innerhalb von 6 Stunden automatisch und zeigen das Badge im Web-Interface an.
> **Hinweis:** `version.txt` und `app.py` müssen immer dieselbe Versionsnummer haben. Die `version.txt` ist der einzige Vergleichspunkt der Inhalt der `app.py` wird erst beim tatsächlichen Update-Install heruntergeladen.
---
## Lizenz
MIT License siehe [LICENSE](LICENSE)