Merge pull request 'Über-Karte in der Administration, docker-publish entfernt' (#13) from feature/about-card into main
All checks were successful
CI / PHP Lint (push) Successful in 38s
CI / PHP Lint-1 (push) Successful in 48s
Release-Paket / ZIP bauen und veröffentlichen (push) Successful in 11s
CI / Unit Tests & Static Analysis (push) Successful in 46s

This commit is contained in:
Friederich Loheide 2026-09-24 19:22:00 +00:00
commit 12f831eccd
9 changed files with 241 additions and 54 deletions

View file

@ -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 }}

View file

@ -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

View file

@ -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)
</div>
@ -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

View file

@ -203,6 +203,64 @@ $adminBase = '';
<button class="btn btn-primary" type="submit" name="save"><?= __('btn_save') ?></button>
</form>
<div class="card about-card">
<h2><?= __('about_title') ?></h2>
<p class="muted"><?= __('about_hint') ?></p>
<dl class="about-list">
<dt><?= __('about_app') ?></dt>
<dd>UniFi Voucher Management System</dd>
<dt><?= __('about_version') ?></dt>
<dd><?= Ui::version() !== '' ? htmlspecialchars(Ui::version()) : '–' ?></dd>
<dt><?= __('about_php') ?></dt>
<dd><?= htmlspecialchars(PHP_VERSION) ?></dd>
<dt><?= __('about_license') ?></dt>
<dd><?= Ui::LICENSE ?> –
<a href="<?= Ui::LICENSE_URL ?>" target="_blank" rel="noopener"><?= __('about_license_view') ?></a>
</dd>
<dt><?= __('about_developer') ?></dt>
<dd><a href="<?= Ui::CREDIT_URL ?>" target="_blank" rel="noopener"><?= Ui::CREDIT_NAME ?></a></dd>
<dt><?= __('about_repository') ?></dt>
<dd><a href="<?= Ui::REPOSITORY_URL ?>" target="_blank" rel="noopener">git.loheide.cloud</a></dd>
</dl>
<h3><?= __('about_third_party') ?></h3>
<p class="muted"><?= __('about_third_party_hint') ?></p>
<div class="table-container">
<table class="table table-stack">
<thead>
<tr>
<th><?= __('about_component') ?></th>
<th><?= __('about_version') ?></th>
<th><?= __('about_license') ?></th>
</tr>
</thead>
<tbody>
<?php foreach (Ui::thirdParty() as $component): ?>
<tr>
<td data-label="<?= __('about_component') ?>">
<a href="<?= htmlspecialchars($component['url']) ?>" target="_blank" rel="noopener">
<?= htmlspecialchars($component['name']) ?>
</a>
</td>
<td data-label="<?= __('about_version') ?>"><?= htmlspecialchars($component['version']) ?></td>
<td data-label="<?= __('about_license') ?>">
<a href="<?= htmlspecialchars('../' . $component['license_file']) ?>" target="_blank" rel="noopener">
<?= htmlspecialchars($component['license']) ?>
</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</main>
<script src="../assets/global.js"></script>
</body>

View file

@ -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);

View file

@ -230,6 +230,35 @@ class Ui
. self::CREDIT_NAME . '</a></p>';
}
/** 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<int, array{name: string, version: string, license: string, license_file: string, url: string}>
*/
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.

View file

@ -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.',

View file

@ -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.',

View file

@ -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'));
}
}