All checks were successful
Deploy netdiag / deploy (push) Successful in 14s
PDF-Zweig netdiagPdfSip()
- Eigener Zweig, weil die Aussage sonst untergeht: in einer flachen
Schluessel/Wert-Liste sieht "401 Unauthorized" wie ein Fehler aus, ist aber
der Beweis fuer eine erreichbare Instanz, die nur Zugangsdaten will. Erst
Befund im Klartext, dann eine Zeile je Transportweg.
- Der Grenzhinweis steht mit im Dokument: gemessen ist die Erreichbarkeit,
NICHT die Sprachqualitaet.
- Feldnamen-Falle wieder aufgetreten: 'port' gehoert in beiden Feldtabellen
laengst dem SNMP-Werkzeug ("Switch-Port"). Im Kunden-PDF haette gestanden
"Switch-Port: 5060" - deshalb 'zielPort'.
WLAN-Kanalanalyse: Warnungen nicht mehr abschneiden
- dol_trunc(..., 160) kappte genau die Begruendung ("... In dicht besiedelter
Umgebung meist ein Fehle..."). Eine Warnung ohne ihren Grund ist im
Kundendokument wertlos; MultiCell bricht ohnehin um.
Token in der Adresszeile
- netdiag_api_read_token() nimmt ?jwt= nur noch an, wenn der Endpunkt es
ausdruecklich erlaubt. Einzige Stelle: update.php?download=1.
- Grund: ein Token in der URL steht in jedem Zugriffs- und Proxy-Log und gilt
sieben Tage fuer die GESAMTE Kunden-API.
- Warum die Ausnahme bleibt: die App-Fassungen im Feld bauen die
Download-Adresse mit dem Token darin. Sofort schliessen hiesse, genau die
Geraete vom Update auszusperren, die die neue APK brauchen. Zu entfernen,
sobald Eddy den Rollout bestaetigt (Hinweis steht im Code).
- pdf.php nimmt ab sofort ausschliesslich den Authorization-Header.
Gegen die Testinstanz gemessen: ?jwt= liefert bei orders/customers/protocols/
pdf/update-Version jetzt 401, mit Bearer weiterhin 200.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
71 lines
2.3 KiB
PHP
71 lines
2.3 KiB
PHP
<?php
|
|
/* Copyright (C) 2026 Eduard Wisch <data@data-it-solution.de>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
/**
|
|
* \file netdiag/api/pdf.php
|
|
* \ingroup netdiag
|
|
* \brief API-Endpunkt: Protokoll-PDF streamen (GET ?id=).
|
|
*
|
|
* Authentifizierung ausschliesslich per `Authorization: Bearer`-Header. Ein
|
|
* Token in der Adresszeile stuende in jedem Zugriffs- und Proxy-Log; der
|
|
* Aufrufer holt das PDF deshalb per fetch und verarbeitet es als Blob.
|
|
*/
|
|
|
|
require_once __DIR__.'/netdiag_api.lib.php';
|
|
|
|
netdiag_api_bootstrap();
|
|
|
|
/**
|
|
* @var DoliDB $db
|
|
* @var Translate $langs
|
|
*/
|
|
|
|
$user = netdiag_api_authenticate($db);
|
|
|
|
require_once __DIR__.'/../class/netdiagprotocol.class.php';
|
|
require_once __DIR__.'/../lib/netdiag.lib.php';
|
|
require_once __DIR__.'/../lib/netdiag_pdf.lib.php';
|
|
|
|
$id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
|
|
if ($id <= 0) {
|
|
netdiag_api_error('Parameter id fehlt', 400);
|
|
}
|
|
|
|
$protocol = new NetDiagProtocol($db);
|
|
if ($protocol->fetch($id) <= 0) {
|
|
netdiag_api_error('Protokoll nicht gefunden', 404);
|
|
}
|
|
|
|
$file = netdiagGetOutputDir().'/'.dol_sanitizeFileName($protocol->ref).'/'.dol_sanitizeFileName($protocol->ref).'.pdf';
|
|
|
|
// PDF erzeugen, wenn noch nicht vorhanden oder Neuerzeugung verlangt
|
|
if (!dol_is_file($file) || !empty($_GET['regenerate'])) {
|
|
if (netdiagGeneratePdf($db, $protocol, $langs) <= 0) {
|
|
netdiag_api_error('PDF-Erzeugung fehlgeschlagen', 500);
|
|
}
|
|
}
|
|
if (!dol_is_file($file)) {
|
|
netdiag_api_error('PDF nicht gefunden', 404);
|
|
}
|
|
|
|
// PDF ausliefern
|
|
header('Content-Type: application/pdf');
|
|
header('Content-Disposition: inline; filename="'.dol_sanitizeFileName($protocol->ref).'.pdf"');
|
|
header('Content-Length: '.dol_filesize($file));
|
|
header('Cache-Control: private, max-age=0');
|
|
readfile($file);
|
|
exit;
|