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:
parent
a36752e09a
commit
43244d751a
41 changed files with 3184 additions and 3 deletions
38
app/Support/License/ServerError.php
Normal file
38
app/Support/License/ServerError.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
namespace App\Support\License;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Fehlerantwort eines Hersteller-Servers (Update-Proxy oder API) mit stabilem `code`.
|
||||
* Ausgewertet wird immer der Code, nie der Meldungstext.
|
||||
*/
|
||||
class ServerError extends RuntimeException
|
||||
{
|
||||
/**
|
||||
* @param array<string, mixed> $payload
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly string $errorCode,
|
||||
public readonly int $status,
|
||||
string $message,
|
||||
public readonly array $payload = [],
|
||||
public readonly ?int $retryAfter = null,
|
||||
) {
|
||||
parent::__construct($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Lizenzfehler, bei denen die Eingabemaske die richtige Reaktion ist.
|
||||
*/
|
||||
public function needsLicenseInput(): bool
|
||||
{
|
||||
return in_array($this->errorCode, ['license_required', 'invalid_key', 'email_mismatch'], true);
|
||||
}
|
||||
|
||||
public function isTemporary(): bool
|
||||
{
|
||||
return in_array($this->errorCode, ['mirror_pending', 'not_released', 'rate_limited', 'maintenance', 'upstream_unavailable', 'unreachable'], true);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue