Self-Updater und Lizenzprüfung

Umsetzung von docs/specs/self-updater.md für Laravel:
- Installierter Stand als SHA in storage/.version, Fortschritt in storage/.update-progress,
  selbstheilender Wartungsmodus in storage/.maintenance
- Update-Client je Kanal (stable/development), nur HTTPS, begrenzte Redirects,
  ZIP-Download per Stream mit PK- und SHA-256-Prüfung
- Entpacken mit zweistufigem ZIP-Slip-Schutz, Übernahme mit geschützten Pfaden
  (atomar je Datei, nie löschen), Migrationen, Cache- und OPcache-Reset
- Lizenzspeicher außerhalb der DB, Geräte-ID als Zufallszahl, rotierendes Gerätetoken
  wird bei jeder Antwort (auch Fehler und Downloads) sofort gespeichert
- Lizenzfehler mit verständlichen Meldungen – sie sperren nie das Portal
- Seite „Aktualisierung“ mit Kanal, Suche, Changelog-Vorschau, Fortschritt,
  Migrationen, Änderungsprotokoll, Lizenz und Datenschutzhinweis
- Wartungs-Middleware (503 + Retry-After) und Auto-Migration per Fingerabdruck
- Audit-Log für Updates, Kanalwechsel und Lizenzänderungen
- Version 0.2.0

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-26 06:02:19 +00:00
parent a36752e09a
commit 43244d751a
41 changed files with 3184 additions and 3 deletions

View file

@ -2,12 +2,18 @@
namespace App\Providers;
use App\Models\User;
use App\Support\Avatars;
use App\Support\Branding;
use App\Support\License\LicenseStore;
use App\Support\Navigation;
use App\Support\QuickLinks;
use App\Support\Settings;
use App\Support\Update\InstalledVersion;
use App\Support\Update\MaintenanceFlag;
use App\Support\Update\UpdateProgress;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\ServiceProvider;
use Illuminate\Validation\Rules\Password;
@ -20,6 +26,10 @@ class AppServiceProvider extends ServiceProvider
$this->app->singleton(Avatars::class);
$this->app->singleton(Navigation::class);
$this->app->singleton(QuickLinks::class);
$this->app->singleton(LicenseStore::class);
$this->app->singleton(InstalledVersion::class);
$this->app->singleton(UpdateProgress::class);
$this->app->singleton(MaintenanceFlag::class);
}
public function boot(): void
@ -27,6 +37,9 @@ class AppServiceProvider extends ServiceProvider
// N+1-Abfragen in Entwicklung und Tests sofort sichtbar machen (docs/PLAN.md, Performance).
Model::preventLazyLoading(! $this->app->isProduction());
// Vorläufig: Administratoren über is_admin – wird in Phase 2 durch Rollen ersetzt.
Gate::define('admin', fn (User $user) => $user->is_admin && $user->is_active);
Password::defaults(fn () => Password::min(10)->letters()->numbers());
}
}