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>
45 lines
1.5 KiB
PHP
45 lines
1.5 KiB
PHP
<?php
|
||
|
||
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;
|
||
|
||
class AppServiceProvider extends ServiceProvider
|
||
{
|
||
public function register(): void
|
||
{
|
||
$this->app->singleton(Settings::class);
|
||
$this->app->singleton(Branding::class);
|
||
$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
|
||
{
|
||
// 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());
|
||
}
|
||
}
|