diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml new file mode 100644 index 0000000..b8be3e7 --- /dev/null +++ b/.github/workflows/docker-publish.yml @@ -0,0 +1,39 @@ +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/.github/workflows/release.yml b/.github/workflows/release.yml index 6e93026..3fc3001 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -65,45 +65,21 @@ 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 ! grep -Fxq "$required" /tmp/zip-inhalt.txt; then + if ! unzip -l "dist/${{ steps.meta.outputs.name }}.zip" | grep -q "$required"; then echo "Fehlt im Paket: $required" >&2 exit 1 fi done - - # 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)." + echo "Paket vollständig." - name: Als Build-Artefakt sichern uses: actions/upload-artifact@v3 @@ -136,16 +112,9 @@ 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 - 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 + OLD_ID="$(curl -sf -H "$AUTH" "${API}/releases/tags/${TAG}" \ + | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2 || true)" 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 @@ -164,19 +133,12 @@ jobs: BODY="${BODY}- oder gleich den eingebauten Updater unter Administration, System-Update verwenden.\n\n" BODY="${BODY}Pruefsumme: siehe beigelegte .sha256-Datei." - # ohne -f, damit bei einem Fehler die Antwort der API im Log landet - curl -s -X POST -H "$AUTH" -H 'Content-Type: application/json' \ + RELEASE_ID="$(curl -sf -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" -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 + "${API}/releases" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)" if [ -z "${RELEASE_ID:-}" ]; then - echo "Release konnte nicht angelegt werden:" >&2 - cat /tmp/neues-release.json >&2 || true + echo "Release konnte nicht angelegt werden." >&2 exit 1 fi diff --git a/Readme.md b/Readme.md index 9e655ae..1eb3d8e 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) -[![CI](https://git.loheide.cloud/friloo/Unifi-Voucher-Tool/badges/workflows/ci.yml/badge.svg)](https://git.loheide.cloud/friloo/Unifi-Voucher-Tool/actions) +![Tests](https://img.shields.io/badge/Tests-PHPUnit%20%2B%20PHPStan-brightgreen) [![Repository](https://img.shields.io/badge/Code-git.loheide.cloud-4b3ec4)](https://git.loheide.cloud/friloo/Unifi-Voucher-Tool) @@ -660,10 +660,9 @@ 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. -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. +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). ### Mitwirken @@ -677,10 +676,10 @@ tea issues ls # offene Tickets ansehen ``` > Die Workflows unter `.github/workflows/` werden von Forgejo Actions -> 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**). +> 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. Der **Auto-Updater** ist davon unabhängig: er zieht seine Pakete über `update.loheide.eu` (Channels `stable` und `development`) und nicht direkt aus @@ -712,11 +711,6 @@ 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 2d75b79..74a3bd3 100644 --- a/admin/integrations.php +++ b/admin/integrations.php @@ -203,64 +203,6 @@ $adminBase = ''; -
-

-

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

-

-
- - - - - - - - - - - - - - - - - -
- - - - - - - -
-
-
- diff --git a/assets/global.css b/assets/global.css index e255c86..bef64c9 100644 --- a/assets/global.css +++ b/assets/global.css @@ -1445,35 +1445,6 @@ 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 5cb0260..0c0d5b4 100644 --- a/includes/Ui.php +++ b/includes/Ui.php @@ -230,35 +230,6 @@ 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 464be78..18f705f 100644 --- a/lang/de.php +++ b/lang/de.php @@ -333,20 +333,6 @@ 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 3063b10..35229b1 100644 --- a/lang/en.php +++ b/lang/en.php @@ -333,20 +333,6 @@ 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 9944b17..8d55513 100644 --- a/tests/UiTest.php +++ b/tests/UiTest.php @@ -90,42 +90,4 @@ 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')); - } }