Add auto-update system with Forgejo integration and enhance configuration management

This commit is contained in:
claudi 2026-01-28 12:05:07 +01:00
parent 1c1ec95139
commit 90dc09eb4d

View file

@ -575,9 +575,101 @@ pip install pyinstaller
---
## Phase 4: Professional Features (Weeks 9-12)
## Phase 4: Professional Features & Auto-Update (Weeks 9-12)
### 4.1 Enhanced Logging & Monitoring
### 4.1 Auto-Update System with Forgejo Integration
**Forgejo Configuration:**
```
Host: https://git.him-tools.de
Organization: HIM-public
Repository: webdrop-bridge
API Endpoint: https://git.him-tools.de/api/v1/repos/HIM-public/webdrop-bridge
```
**Tasks:**
#### 4.1.1 Update Manager (`src/webdrop_bridge/core/updater.py`)
```python
class UpdateManager:
"""Manages auto-updates via Forgejo releases."""
def __init__(self, config: Config):
self.forgejo_url = "https://git.him-tools.de"
self.repo = "HIM-public/webdrop-bridge"
self.current_version = config.app_version
async def check_for_updates(self) -> Optional[Release]:
"""Query Forgejo API for latest release.
Returns:
Release info if newer version available, None otherwise
"""
# GET https://git.him-tools.de/api/v1/repos/HIM-public/webdrop-bridge/releases/latest
# Compare version semantic versioning
async def download_update(self, release: Release) -> Path:
"""Download MSI/DMG from Forgejo release artifacts.
Args:
release: Release information from API
Returns:
Path to downloaded installer file
"""
# Download from release assets
# Verify checksums
def install_update(self, installer_path: Path) -> bool:
"""Launch installer and schedule restart.
Args:
installer_path: Path to MSI or DMG file
Returns:
True if installation scheduled, False otherwise
"""
```
**Configuration** (`.env`):
```env
# Auto-Update Settings
FORGEJO_URL=https://git.him-tools.de
FORGEJO_REPO=HIM-public/webdrop-bridge
AUTO_UPDATE_CHECK=true
AUTO_UPDATE_INTERVAL=86400 # 24 hours in seconds
AUTO_UPDATE_NOTIFY=true
```
**Features:**
- Check on startup (with 24h cache)
- Manual "Check for Updates" menu option
- Background download (non-blocking)
- User notification with changelog
- Automatic restart capability
- Rollback to previous version (optional)
- Security: HTTPS-only, checksum verification
**Deliverables:**
- [ ] `src/webdrop_bridge/core/updater.py` - Update manager
- [ ] Menu item for manual update check
- [ ] Update notification dialog
- [ ] Unit tests for update checking and downloading
- [ ] Integration with Forgejo API
**Acceptance Criteria:**
- Can query Forgejo releases API
- Detects new versions correctly
- Downloads and verifies checksums
- Prompts user for restart
- Manual check works from menu
- Gracefully handles network errors
- Version comparison uses semantic versioning
---
### 4.2 Enhanced Logging & Monitoring
**Deliverables:**
- [ ] Structured logging (JSON format option)
@ -587,7 +679,7 @@ pip install pyinstaller
---
### 4.2 Advanced Configuration
### 4.3 Advanced Configuration
**Deliverables:**
- [ ] UI settings dialog
@ -597,7 +689,7 @@ pip install pyinstaller
---
### 4.3 User Documentation
### 4.4 User Documentation
**Deliverables:**
- [ ] User manual (PDF, HTML)
@ -609,26 +701,16 @@ pip install pyinstaller
## Phase 5: Post-Release (Months 2-3)
### 5.1 Auto-Update System
### 5.1 Analytics & Monitoring
**Requirements:**
- Check for updates on startup
- Download in background
- Staged rollout support
- Rollback capability
---
### 5.2 Analytics & Monitoring
**Metrics:**
- App usage statistics
- Error/crash reporting
- Feature usage tracking
---
### 5.3 Community Support
### 5.2 Community Support
**Channels:**
- GitHub Issues
@ -665,6 +747,8 @@ pip install pyinstaller
- PyInstaller (building)
- Sphinx (documentation)
- pytest (testing)
- aiohttp (auto-update downloads)
- packaging (version comparison)
---
@ -681,6 +765,7 @@ webdrop-bridge/
│ │ ├── __init__.py
│ │ ├── validator.py ← Path validation
│ │ ├── drag_interceptor.py ← Drag handling
│ │ ├── updater.py ← Auto-update system (Phase 4)
│ │ └── errors.py ← Custom exceptions
│ ├── ui/
│ │ ├── __init__.py