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
45
app/Support/Update/Changelog.php
Normal file
45
app/Support/Update/Changelog.php
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace App\Support\Update;
|
||||
|
||||
use League\CommonMark\GithubFlavoredMarkdownConverter;
|
||||
|
||||
/**
|
||||
* Zerlegt CHANGELOG.md an „## <version>“-Abschnitten und rendert Markdown
|
||||
* sicher (kein Roh-HTML, keine unsicheren Links).
|
||||
*/
|
||||
class Changelog
|
||||
{
|
||||
/**
|
||||
* @return list<array{version: string, heading: string, html: string}>
|
||||
*/
|
||||
public function sections(?string $markdown = null): array
|
||||
{
|
||||
$markdown ??= (string) @file_get_contents(base_path('CHANGELOG.md'));
|
||||
$parts = preg_split('/^## +/m', $markdown) ?: [];
|
||||
array_shift($parts); // Einleitung vor dem ersten Abschnitt
|
||||
|
||||
return array_values(array_map(function (string $part) {
|
||||
[$heading, $body] = array_pad(explode("\n", $part, 2), 2, '');
|
||||
$heading = trim($heading);
|
||||
preg_match('/\d+\.\d+\.\d+(?:[-+][\w.]+)?/', $heading, $m);
|
||||
|
||||
return [
|
||||
'version' => $m[0] ?? $heading,
|
||||
'heading' => $heading,
|
||||
'html' => $this->toHtml(trim($body)),
|
||||
];
|
||||
}, $parts));
|
||||
}
|
||||
|
||||
public function toHtml(string $markdown): string
|
||||
{
|
||||
$converter = new GithubFlavoredMarkdownConverter([
|
||||
'html_input' => 'strip',
|
||||
'allow_unsafe_links' => false,
|
||||
'max_nesting_level' => 20,
|
||||
]);
|
||||
|
||||
return (string) $converter->convert($markdown);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue