From f5081a4b11922e7c297a905d6a1d4cc3c7e54ddc Mon Sep 17 00:00:00 2001 From: Friederich Loheide Date: Thu, 24 Sep 2026 19:06:15 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=C3=9Cber-Karte=20in=20der=20Administration?= =?UTF-8?q?,=20docker-publish=20entfernt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Die Lizenzhinweise standen bisher nur in den Dateien. Unter Integration & Wartung gibt es jetzt eine Karte "Über diese Installation" mit Version, PHP-Version, Lizenz, Entwickler und Quellcode sowie einer Tabelle der mitgelieferten Komponenten Dritter, die direkt auf die ausgelieferten Lizenztexte verlinkt. Die Liste kommt aus Ui::thirdParty(), damit Oberfläche und THIRD-PARTY-NOTICES.md nicht auseinanderlaufen; drei Tests prüfen, dass jede gelistete Komponente ihren Lizenztext wirklich mitliefert, in den Notices auftaucht und LICENSE vorhanden ist. Außerdem: - docker-publish.yml entfernt – der Workflow veröffentlichte nach ghcr.io und stammte noch aus der GitHub-Zeit - Readme: der Actions-Runner läuft jetzt, entsprechende Hinweise angepasst; Test-Badge durch das echte CI-Badge der Forgejo-Instanz ersetzt Co-Authored-By: Claude Opus 5 --- .github/workflows/docker-publish.yml | 39 ------------------- Readme.md | 22 +++++++---- admin/integrations.php | 58 ++++++++++++++++++++++++++++ assets/global.css | 29 ++++++++++++++ includes/Ui.php | 29 ++++++++++++++ lang/de.php | 14 +++++++ lang/en.php | 14 +++++++ tests/UiTest.php | 38 ++++++++++++++++++ 8 files changed, 196 insertions(+), 47 deletions(-) delete mode 100644 .github/workflows/docker-publish.yml diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml deleted file mode 100644 index b8be3e7..0000000 --- a/.github/workflows/docker-publish.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Docker Publish - -on: - push: - tags: [ "v*" ] - workflow_dispatch: - -jobs: - build-push: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@v4 - - - name: Log in to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: ghcr.io/${{ github.repository }} - tags: | - type=ref,event=tag - type=raw,value=latest - - - name: Build and push - uses: docker/build-push-action@v6 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/Readme.md b/Readme.md index 1eb3d8e..9e655ae 100644 --- a/Readme.md +++ b/Readme.md @@ -11,7 +11,7 @@ Entwickelt von **[Loheide.eu](https://loheide.eu)** ![UniFi OS](https://img.shields.io/badge/UniFi%20OS-7.0%2B-0559C9?logo=ubiquiti&logoColor=white) ![License](https://img.shields.io/badge/Lizenz-MIT-green) ![Version](https://img.shields.io/badge/Version-2.9.0-blueviolet) -![Tests](https://img.shields.io/badge/Tests-PHPUnit%20%2B%20PHPStan-brightgreen) +[![CI](https://git.loheide.cloud/friloo/Unifi-Voucher-Tool/badges/workflows/ci.yml/badge.svg)](https://git.loheide.cloud/friloo/Unifi-Voucher-Tool/actions) [![Repository](https://img.shields.io/badge/Code-git.loheide.cloud-4b3ec4)](https://git.loheide.cloud/friloo/Unifi-Voucher-Tool) @@ -660,9 +660,10 @@ entsteht daraus ein reguläres Release mit derselben Mechanik. > `updater/storage/` nicht überschreiben – oder gleich den eingebauten Updater > verwenden, der genau diese Pfade schützt. -Voraussetzung ist ein registrierter **Forgejo-Actions-Runner**; ohne Runner -bleiben die Workflows in der Warteschlange stehen. Compose-Datei und Anleitung -dafür liegen in [`tools/runner/`](tools/runner/README.md). +Gebaut wird das von einem **Forgejo-Actions-Runner**, der auf dem Server läuft. +Compose-Datei und Einrichtungsanleitung liegen in +[`tools/runner/`](tools/runner/README.md) – nötig für eine Neuinstallation oder +wenn der Runner ersetzt wird. ### Mitwirken @@ -676,10 +677,10 @@ tea issues ls # offene Tickets ansehen ``` > Die Workflows unter `.github/workflows/` werden von Forgejo Actions -> mitgelesen; das Badge oben ist bewusst statisch, solange kein Runner -> registriert ist. `docker-publish.yml` veröffentlicht nach `ghcr.io` und -> stammt noch aus der GitHub-Zeit – für den Forgejo-Betrieb entweder auf die -> eigene Registry umstellen oder entfernen. +> mitgelesen – geblieben sind `ci.yml` (Lint, Tests, statische Analyse) und +> `release.yml` (Release-ZIP). Das frühere `docker-publish.yml` veröffentlichte +> nach `ghcr.io` und stammte noch aus der GitHub-Zeit; es ist entfernt. Das +> Image wird stattdessen lokal gebaut (siehe Abschnitt **Docker**). Der **Auto-Updater** ist davon unabhängig: er zieht seine Pakete über `update.loheide.eu` (Channels `stable` und `development`) und nicht direkt aus @@ -711,6 +712,11 @@ Lizenztexte liegen jeweils im zugehörigen Ordner unter `assets/vendor/`: Teil jedes Release-ZIPs – wer die Anwendung weitergibt, gibt die Hinweise also automatisch mit. +Dieselbe Übersicht steht in der laufenden Installation unter +**Administration → Integration & Wartung → Über diese Installation**, dort +zusammen mit Version und PHP-Version und mit Links auf die ausgelieferten +Lizenztexte. + --- ## 🗺️ Roadmap diff --git a/admin/integrations.php b/admin/integrations.php index 74a3bd3..2d75b79 100644 --- a/admin/integrations.php +++ b/admin/integrations.php @@ -203,6 +203,64 @@ $adminBase = ''; +
+

+

+ +
+
+
UniFi Voucher Management System
+ +
+
+ +
+
+ +
+
– + +
+ +
+
+ +
+
git.loheide.cloud
+
+ +

+

+
+ + + + + + + + + + + + + + + + + +
+ + + + + + + +
+
+
+ diff --git a/assets/global.css b/assets/global.css index bef64c9..e255c86 100644 --- a/assets/global.css +++ b/assets/global.css @@ -1445,6 +1445,35 @@ input.search-bar, .site-selector .search-bar { min-width: 240px; width: auto; fl .badge-secondary { background: var(--bg-hover); color: var(--text-secondary); border-color: var(--border-color); } .placeholder-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; } +/* Ueber-Karte: Kennwerte als zweispaltige Liste, auf schmalen Geraeten untereinander. */ +.about-card h3 { + margin: 26px 0 4px; + font-size: 15px; + font-weight: 650; + color: var(--text-primary); +} +.about-list { + display: grid; + grid-template-columns: max-content 1fr; + gap: 8px 22px; + margin: 16px 0 0; +} +.about-list dt { + color: var(--text-muted); + font-size: 13px; + font-weight: 600; +} +.about-list dd { + margin: 0; + color: var(--text-primary); + font-size: 13.5px; +} +.about-card .table-container { margin-top: 12px; } +@media (max-width: 560px) { + .about-list { grid-template-columns: 1fr; gap: 2px; } + .about-list dd { margin-bottom: 10px; } +} + /* Einstellungen: Tabs */ .tab-container { background: var(--bg-card); diff --git a/includes/Ui.php b/includes/Ui.php index 0c0d5b4..5cb0260 100644 --- a/includes/Ui.php +++ b/includes/Ui.php @@ -230,6 +230,35 @@ class Ui . self::CREDIT_NAME . '

'; } + /** Lizenz der Anwendung selbst (siehe LICENSE im Wurzelverzeichnis). */ + public const LICENSE = 'MIT'; + public const REPOSITORY_URL = 'https://git.loheide.cloud/friloo/Unifi-Voucher-Tool'; + public const LICENSE_URL = self::REPOSITORY_URL . '/src/branch/main/LICENSE'; + + /** + * Mitgelieferte Komponenten Dritter – dieselbe Liste wie in + * THIRD-PARTY-NOTICES.md, nur maschinenlesbar fuer die Uebersicht in der + * Administration. 'license_file' zeigt auf den ausgelieferten Lizenztext; + * ein Test stellt sicher, dass die Dateien wirklich vorhanden sind. + * + * @return array + */ + public static function thirdParty(): array + { + return [ + ['name' => 'Inter', 'version' => '4.0', 'license' => 'SIL OFL 1.1', + 'license_file' => 'assets/vendor/inter/LICENSE.txt', 'url' => 'https://github.com/rsms/inter'], + ['name' => 'Font Awesome Free', 'version' => '6.4.0', 'license' => 'CC BY 4.0 / SIL OFL 1.1 / MIT', + 'license_file' => 'assets/vendor/fontawesome/LICENSE.txt', 'url' => 'https://fontawesome.com'], + ['name' => 'Chart.js', 'version' => '4.4.0', 'license' => 'MIT', + 'license_file' => 'assets/vendor/chartjs/LICENSE.txt', 'url' => 'https://www.chartjs.org'], + ['name' => 'qrcodejs', 'version' => '1.0.0', 'license' => 'MIT', + 'license_file' => 'assets/vendor/qrcodejs/LICENSE.txt', 'url' => 'https://github.com/davidshimjs/qrcodejs'], + ['name' => 'TinyMCE', 'version' => '6.8.3', 'license' => 'MIT', + 'license_file' => 'assets/vendor/tinymce/license.txt', 'url' => 'https://www.tiny.cloud'], + ]; + } + /** * Standard-Druckvorlage (wird nur verwendet, solange keine eigene * Vorlage gespeichert ist). {QR_CODE} fuellt der Browser. diff --git a/lang/de.php b/lang/de.php index 18f705f..464be78 100644 --- a/lang/de.php +++ b/lang/de.php @@ -333,6 +333,20 @@ return [ 'int_cleanup_expired' => 'Abgelaufene Voucher', 'int_cleanup_audit' => 'Audit-Log', 'int_cleanup_logins' => 'Login-Versuche', + + // Ueber-Karte (Integration & Wartung) + 'about_title' => 'Über diese Installation', + 'about_hint' => 'Version, Lizenz und die mitgelieferten Komponenten Dritter.', + 'about_app' => 'Anwendung', + 'about_version' => 'Version', + 'about_php' => 'PHP-Version', + 'about_license' => 'Lizenz', + 'about_license_view' => 'Lizenztext ansehen', + 'about_developer' => 'Entwickelt von', + 'about_repository' => 'Quellcode', + 'about_third_party' => 'Komponenten Dritter', + 'about_third_party_hint' => 'Diese Bibliotheken werden lokal ausgeliefert und behalten ihre eigene Lizenz. Die vollständigen Texte liegen unter assets/vendor/, eine Übersicht in THIRD-PARTY-NOTICES.md.', + 'about_component' => 'Komponente', 'int_saved' => 'Einstellungen gespeichert.', 'int_webhook_sent' => 'Test-Webhook gesendet.', 'int_webhook_failed' => 'Test-Webhook fehlgeschlagen.', diff --git a/lang/en.php b/lang/en.php index 35229b1..3063b10 100644 --- a/lang/en.php +++ b/lang/en.php @@ -333,6 +333,20 @@ return [ 'int_cleanup_expired' => 'Expired vouchers', 'int_cleanup_audit' => 'Audit log', 'int_cleanup_logins' => 'Login attempts', + + // Ueber-Karte (Integration & Wartung) + 'about_title' => 'About this installation', + 'about_hint' => 'Version, license and the bundled third-party components.', + 'about_app' => 'Application', + 'about_version' => 'Version', + 'about_php' => 'PHP version', + 'about_license' => 'License', + 'about_license_view' => 'View license text', + 'about_developer' => 'Developed by', + 'about_repository' => 'Source code', + 'about_third_party' => 'Third-party components', + 'about_third_party_hint' => 'These libraries are served locally and keep their own license. The full texts are in assets/vendor/, an overview is in THIRD-PARTY-NOTICES.md.', + 'about_component' => 'Component', 'int_saved' => 'Settings saved.', 'int_webhook_sent' => 'Test webhook sent.', 'int_webhook_failed' => 'Test webhook failed.', diff --git a/tests/UiTest.php b/tests/UiTest.php index 8d55513..9944b17 100644 --- a/tests/UiTest.php +++ b/tests/UiTest.php @@ -90,4 +90,42 @@ class UiTest extends TestCase { $this->assertSame('../uploads/logo.png', \Ui::mediaUrl('uploads/logo.png', '../')); } + + /** + * Die Uebersicht in der Administration und THIRD-PARTY-NOTICES.md duerfen + * nicht auseinanderlaufen: jede gelistete Komponente muss ihren + * Lizenztext wirklich mitliefern. + */ + public function testEveryThirdPartyComponentShipsItsLicence(): void + { + $root = dirname(__DIR__); + + foreach (\Ui::thirdParty() as $component) { + $this->assertFileExists( + $root . '/' . $component['license_file'], + 'Lizenztext fehlt fuer ' . $component['name'] + ); + $this->assertNotSame('', trim($component['license']), 'Lizenz fehlt fuer ' . $component['name']); + $this->assertNotSame('', trim($component['version']), 'Version fehlt fuer ' . $component['name']); + } + } + + public function testThirdPartyComponentsAreListedInTheNotices(): void + { + $notices = (string)file_get_contents(dirname(__DIR__) . '/THIRD-PARTY-NOTICES.md'); + + foreach (\Ui::thirdParty() as $component) { + $this->assertStringContainsString( + $component['name'], + $notices, + $component['name'] . ' fehlt in THIRD-PARTY-NOTICES.md' + ); + } + } + + public function testProjectLicenceFileExists(): void + { + $this->assertFileExists(dirname(__DIR__) . '/LICENSE'); + $this->assertStringContainsString('MIT License', (string)file_get_contents(dirname(__DIR__) . '/LICENSE')); + } } From d2407c57c158ed8b2309d04c3176fd64ffb4ef11 Mon Sep 17 00:00:00 2001 From: Friederich Loheide Date: Thu, 24 Sep 2026 19:19:11 +0000 Subject: [PATCH 2/2] =?UTF-8?q?Release-Workflow:=20Paketpr=C3=BCfung=20und?= =?UTF-8?q?=20Release-Anlage=20gegen=20SIGPIPE=20absichern?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Der erste Lauf auf dem neuen Runner scheiterte an der eigenen Prüfung: "Fehlt im Paket: assets/global.css", obwohl die Datei im ZIP liegt. Ursache ist "unzip -l | grep -q" je Datei. grep beendet sich beim ersten Treffer, unzip stirbt an SIGPIPE, und weil der Runner die Schritte mit pipefail ausführt, gilt die Prüfung als fehlgeschlagen – aber nur für Dateien, die früh in der Liste stehen. index.php und install.php liegen am Ende und kamen deshalb durch. Jetzt wird die Dateiliste einmal erzeugt und danach nur noch in der Datei gesucht. Zusätzlich wird geprüft, dass LICENSE und THIRD-PARTY-NOTICES.md enthalten sind und tests/, tools/, docs/ sowie .github/ eben nicht. Dieselbe Falle steckte in der Release-Anlage ("curl | grep | head -1"): umgestellt auf Antwort in eine Datei und "grep -m1". Schlägt das Anlegen fehl, steht die Antwort der API jetzt im Log. Co-Authored-By: Claude Opus 5 --- .github/workflows/release.yml | 52 ++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3fc3001..6e93026 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -65,21 +65,45 @@ jobs: - name: Inhalt kurz prüfen run: | set -eu + # Die Dateiliste einmal erzeugen und danach nur noch darin suchen. + # Frueher lief hier "unzip -l | grep -q" je Datei: grep beendet sich + # beim ersten Treffer, unzip stirbt an SIGPIPE, und mit pipefail galt + # die Pruefung als fehlgeschlagen - aber nur fuer Dateien, die frueh + # in der Liste stehen. + unzip -Z1 "dist/${{ steps.meta.outputs.name }}.zip" > /tmp/zip-inhalt.txt + # Ein paar Dateien muessen enthalten sein, sonst ist das Paket kaputt. for required in \ unifi-voucher-tool/index.php \ unifi-voucher-tool/install.php \ unifi-voucher-tool/database.sql \ + unifi-voucher-tool/LICENSE \ + unifi-voucher-tool/THIRD-PARTY-NOTICES.md \ unifi-voucher-tool/assets/global.css \ unifi-voucher-tool/assets/vendor/inter/inter.css \ + unifi-voucher-tool/assets/vendor/inter/LICENSE.txt \ unifi-voucher-tool/includes/Ui.php do - if ! unzip -l "dist/${{ steps.meta.outputs.name }}.zip" | grep -q "$required"; then + if ! grep -Fxq "$required" /tmp/zip-inhalt.txt; then echo "Fehlt im Paket: $required" >&2 exit 1 fi done - echo "Paket vollständig." + + # Und umgekehrt: Entwicklungsdateien haben im Paket nichts verloren. + for forbidden in \ + unifi-voucher-tool/tests/ \ + unifi-voucher-tool/tools/ \ + unifi-voucher-tool/docs/ \ + unifi-voucher-tool/.github/ + do + if grep -Fq "$forbidden" /tmp/zip-inhalt.txt; then + echo "Gehoert nicht ins Paket: $forbidden" >&2 + exit 1 + fi + done + + echo "Paket vollständig ($(wc -l < /tmp/zip-inhalt.txt) Dateien)." - name: Als Build-Artefakt sichern uses: actions/upload-artifact@v3 @@ -112,9 +136,16 @@ jobs: # Rollendes Vorab-Release durch ein frisches ersetzen, damit der # Download-Link stabil bleibt und auf den aktuellen Stand zeigt. + # Hinweis: Pipelines hier bewusst ohne "head -1" hinter curl/grep. + # Beendet sich das letzte Glied frueher, stirbt das erste an SIGPIPE + # und der Schritt bricht ab (pipefail). "grep -m1" auf einer Datei + # hat das Problem nicht. if [ "$TAG" = "latest-main" ]; then - OLD_ID="$(curl -sf -H "$AUTH" "${API}/releases/tags/${TAG}" \ - | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2 || true)" + curl -sf -H "$AUTH" "${API}/releases/tags/${TAG}" -o /tmp/altes-release.json || true + OLD_ID="" + if [ -s /tmp/altes-release.json ]; then + OLD_ID="$(grep -m1 -o '"id":[0-9]*' /tmp/altes-release.json | cut -d: -f2 || true)" + fi if [ -n "${OLD_ID:-}" ]; then curl -sf -X DELETE -H "$AUTH" "${API}/releases/${OLD_ID}" || true curl -sf -X DELETE -H "$AUTH" "${API}/tags/${TAG}" || true @@ -133,12 +164,19 @@ jobs: BODY="${BODY}- oder gleich den eingebauten Updater unter Administration, System-Update verwenden.\n\n" BODY="${BODY}Pruefsumme: siehe beigelegte .sha256-Datei." - RELEASE_ID="$(curl -sf -X POST -H "$AUTH" -H 'Content-Type: application/json' \ + # ohne -f, damit bei einem Fehler die Antwort der API im Log landet + curl -s -X POST -H "$AUTH" -H 'Content-Type: application/json' \ -d "{\"tag_name\":\"${TAG}\",\"target_commitish\":\"${GITHUB_SHA}\",\"name\":\"${TITLE}\",\"body\":\"${BODY}\",\"draft\":false,\"prerelease\":${PRERELEASE}}" \ - "${API}/releases" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)" + "${API}/releases" -o /tmp/neues-release.json || true + + RELEASE_ID="" + if [ -s /tmp/neues-release.json ]; then + RELEASE_ID="$(grep -m1 -o '"id":[0-9]*' /tmp/neues-release.json | cut -d: -f2 || true)" + fi if [ -z "${RELEASE_ID:-}" ]; then - echo "Release konnte nicht angelegt werden." >&2 + echo "Release konnte nicht angelegt werden:" >&2 + cat /tmp/neues-release.json >&2 || true exit 1 fi