- Rückmeldungen an den Hersteller (docs/specs/feedback.md): Fehlerbericht und
Funktionswunsch, nur freigeschaltete Wege, Idempotency-Key je Meldung,
Warteschlange mit höchstens fünf Versuchen, 422 am Feld, 429 mit Wartezeit,
404 blendet den Weg aus, Referenznummer und „Meine Rückmeldungen“,
sichtbare technische Angaben und Datenschutzhinweis über dem Absendeknopf
- Hintergrundaufgaben ohne Dauerprozess: Cron, Web-Cron (/cron/{token}) oder
Pseudo-Cron nach dem Seitenaufruf; Queue in kurzen Häppchen
- Seite „Systemzustand“ mit Voraussetzungen, Grenzen, Betrieb, Sicherheit und
Anleitung für den Cronjob
- Web-Installer (Systemprüfung → Datenbank → Administrator), legt .env und
Anwendungsschlüssel selbst an, arbeitet vor der Einrichtung ohne Datenbank
- Datenbank-Benachrichtigungen im Admin-Bereich
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
58 lines
1.8 KiB
PHP
58 lines
1.8 KiB
PHP
<?php
|
||
|
||
namespace App\Support\Feedback;
|
||
|
||
use App\Models\VendorFeedback;
|
||
use App\Support\Settings;
|
||
use Illuminate\Support\Facades\Cache;
|
||
use Illuminate\Support\Facades\Http;
|
||
use Throwable;
|
||
|
||
/**
|
||
* Welche Meldewege für dieses Programm freigeschaltet sind – einmal täglich über
|
||
* GET /v1/software ermittelt. Ein 404 beim Senden blendet den Weg dauerhaft aus.
|
||
*/
|
||
class FeedbackChannels
|
||
{
|
||
public function __construct(private readonly Settings $settings) {}
|
||
|
||
/**
|
||
* @return array<string, string> Schlüssel => Bezeichnung
|
||
*/
|
||
public function available(): array
|
||
{
|
||
$enabled = Cache::remember('feedback.endpoints', now()->addDay(), fn () => $this->fetch());
|
||
$disabled = (array) $this->settings->get('feedback.disabled', []);
|
||
|
||
return collect(VendorFeedback::TYPES)
|
||
->only($enabled ?? array_keys(VendorFeedback::TYPES))
|
||
->except($disabled)
|
||
->all();
|
||
}
|
||
|
||
public function disable(string $type): void
|
||
{
|
||
$disabled = (array) $this->settings->get('feedback.disabled', []);
|
||
$this->settings->set('feedback.disabled', array_values(array_unique([...$disabled, $type])));
|
||
}
|
||
|
||
/**
|
||
* @return list<string>|null null = unbekannt (Server nicht erreichbar) – dann alle anbieten
|
||
*/
|
||
private function fetch(): ?array
|
||
{
|
||
try {
|
||
$software = Http::timeout(5)->acceptJson()->get(rtrim(config('updater.api_url'), '/').'/software')->json('software');
|
||
|
||
foreach ((array) $software as $entry) {
|
||
if (($entry['slug'] ?? null) === config('updater.software')) {
|
||
return array_values(array_filter((array) ($entry['endpoints'] ?? []), 'is_string'));
|
||
}
|
||
}
|
||
|
||
return [];
|
||
} catch (Throwable) {
|
||
return null;
|
||
}
|
||
}
|
||
}
|