satellitenhimmel gefixt

This commit is contained in:
Eskimue
2026-04-05 15:11:37 +02:00
parent 5dfc805915
commit 11bd9ac840
2 changed files with 213 additions and 27 deletions
+143
View File
@@ -477,3 +477,146 @@
[Sun Apr 5 14:40:50 2026] 127.0.0.1:54921 [200]: POST /sternbedeckungen.php
[Sun Apr 5 14:40:50 2026] 127.0.0.1:54921 Closing
[Sun Apr 5 14:40:50 2026] 127.0.0.1:61192 Accepted
[Sun Apr 5 14:42:23 2026] 127.0.0.1:61192 Closed without sending a request; it was probably just an unused speculative preconnection
[Sun Apr 5 14:42:23 2026] 127.0.0.1:61192 Closing
[Sun Apr 5 14:42:23 2026] 127.0.0.1:57095 Accepted
[Sun Apr 5 14:42:26 2026] 127.0.0.1:57095 [200]: POST /sternbedeckungen.php
[Sun Apr 5 14:42:26 2026] 127.0.0.1:57095 Closing
[Sun Apr 5 14:42:26 2026] 127.0.0.1:63938 Accepted
[Sun Apr 5 14:42:38 2026] 127.0.0.1:63938 [200]: GET /my_favorites.php
[Sun Apr 5 14:42:38 2026] 127.0.0.1:63938 Closing
[Sun Apr 5 14:42:38 2026] 127.0.0.1:63331 Accepted
[Sun Apr 5 14:42:38 2026] 127.0.0.1:63331 [200]: GET /css/style.css
[Sun Apr 5 14:42:38 2026] 127.0.0.1:63331 Closing
[Sun Apr 5 14:42:39 2026] 127.0.0.1:60816 Accepted
[Sun Apr 5 14:42:39 2026] 127.0.0.1:60816 [200]: GET /images/star16x16.png
[Sun Apr 5 14:42:39 2026] 127.0.0.1:60816 Closing
[Sun Apr 5 14:42:39 2026] 127.0.0.1:55102 Accepted
[Sun Apr 5 14:42:39 2026] 127.0.0.1:56422 Accepted
[Sun Apr 5 14:42:39 2026] 127.0.0.1:55102 [200]: GET /images/star16x16_rays.png
[Sun Apr 5 14:42:39 2026] 127.0.0.1:55102 Closing
[Sun Apr 5 14:42:40 2026] 127.0.0.1:56422 [200]: GET /favicon.ico
[Sun Apr 5 14:42:40 2026] 127.0.0.1:56422 Closing
[Sun Apr 5 14:46:54 2026] 127.0.0.1:49905 Accepted
[Sun Apr 5 14:46:54 2026] 127.0.0.1:49905 [200]: GET /my_favorites.php
[Sun Apr 5 14:46:54 2026] 127.0.0.1:49905 Closing
[Sun Apr 5 14:46:54 2026] 127.0.0.1:53000 Accepted
[Sun Apr 5 14:46:54 2026] 127.0.0.1:53000 [200]: GET /css/style.css
[Sun Apr 5 14:46:54 2026] 127.0.0.1:53000 Closing
[Sun Apr 5 14:46:54 2026] 127.0.0.1:64715 Accepted
[Sun Apr 5 14:46:54 2026] 127.0.0.1:51812 Accepted
[Sun Apr 5 14:46:54 2026] 127.0.0.1:64715 [200]: GET /images/star16x16.png
[Sun Apr 5 14:46:54 2026] 127.0.0.1:51812 [200]: GET /images/star16x16_rays.png
[Sun Apr 5 14:46:54 2026] 127.0.0.1:64715 Closing
[Sun Apr 5 14:46:54 2026] 127.0.0.1:51812 Closing
[Sun Apr 5 14:46:54 2026] 127.0.0.1:51021 Accepted
[Sun Apr 5 14:46:56 2026] 127.0.0.1:51021 [200]: GET /favicon.ico
[Sun Apr 5 14:46:56 2026] 127.0.0.1:51021 Closing
[Sun Apr 5 14:46:56 2026] 127.0.0.1:65334 Accepted
[Sun Apr 5 14:49:28 2026] 127.0.0.1:65334 Closed without sending a request; it was probably just an unused speculative preconnection
[Sun Apr 5 14:49:28 2026] 127.0.0.1:65334 Closing
[Sun Apr 5 14:55:24 2026] 127.0.0.1:63672 Accepted
[Sun Apr 5 14:55:25 2026] 127.0.0.1:63672 [200]: GET /my_favorites.php
[Sun Apr 5 14:55:25 2026] 127.0.0.1:63672 Closing
[Sun Apr 5 14:55:25 2026] 127.0.0.1:53252 Accepted
[Sun Apr 5 14:55:25 2026] 127.0.0.1:53252 [200]: GET /css/style.css
[Sun Apr 5 14:55:25 2026] 127.0.0.1:53252 Closing
[Sun Apr 5 14:55:25 2026] 127.0.0.1:54091 Accepted
[Sun Apr 5 14:55:25 2026] 127.0.0.1:53828 Accepted
[Sun Apr 5 14:55:25 2026] 127.0.0.1:54091 [200]: GET /images/star16x16.png
[Sun Apr 5 14:55:25 2026] 127.0.0.1:53828 [200]: GET /images/star16x16_rays.png
[Sun Apr 5 14:55:25 2026] 127.0.0.1:54091 Closing
[Sun Apr 5 14:55:25 2026] 127.0.0.1:53828 Closing
[Sun Apr 5 14:55:25 2026] 127.0.0.1:49905 Accepted
[Sun Apr 5 14:55:27 2026] 127.0.0.1:49905 [200]: GET /favicon.ico
[Sun Apr 5 14:55:27 2026] 127.0.0.1:49905 Closing
[Sun Apr 5 14:55:27 2026] 127.0.0.1:50160 Accepted
[Sun Apr 5 14:55:46 2026] 127.0.0.1:50160 [200]: POST /my_favorites.php
[Sun Apr 5 14:55:46 2026] 127.0.0.1:50160 Closing
[Sun Apr 5 14:55:46 2026] 127.0.0.1:59416 Accepted
[Sun Apr 5 14:55:46 2026] 127.0.0.1:59416 [200]: GET /css/style.css
[Sun Apr 5 14:55:46 2026] 127.0.0.1:59416 Closing
[Sun Apr 5 14:55:46 2026] 127.0.0.1:60379 Accepted
[Sun Apr 5 14:55:46 2026] 127.0.0.1:60379 [200]: GET /images/star16x16.png
[Sun Apr 5 14:55:46 2026] 127.0.0.1:60379 Closing
[Sun Apr 5 14:55:46 2026] 127.0.0.1:50779 Accepted
[Sun Apr 5 14:55:46 2026] 127.0.0.1:56329 Accepted
[Sun Apr 5 14:55:46 2026] 127.0.0.1:50779 [200]: GET /images/star16x16_rays.png
[Sun Apr 5 14:55:46 2026] 127.0.0.1:50779 Closing
[Sun Apr 5 14:55:48 2026] 127.0.0.1:56329 [200]: GET /favicon.ico
[Sun Apr 5 14:55:48 2026] 127.0.0.1:56329 Closing
[Sun Apr 5 14:56:26 2026] 127.0.0.1:62168 Accepted
[Sun Apr 5 14:56:26 2026] 127.0.0.1:62168 [200]: POST /my_favorites.php
[Sun Apr 5 14:56:26 2026] 127.0.0.1:62168 Closing
[Sun Apr 5 14:56:26 2026] 127.0.0.1:64930 Accepted
[Sun Apr 5 14:56:26 2026] 127.0.0.1:64930 [200]: GET /css/style.css
[Sun Apr 5 14:56:26 2026] 127.0.0.1:64930 Closing
[Sun Apr 5 14:56:26 2026] 127.0.0.1:52648 Accepted
[Sun Apr 5 14:56:26 2026] 127.0.0.1:50928 Accepted
[Sun Apr 5 14:56:26 2026] 127.0.0.1:52648 [200]: GET /images/star16x16.png
[Sun Apr 5 14:56:26 2026] 127.0.0.1:50928 [200]: GET /images/star16x16_rays.png
[Sun Apr 5 14:56:26 2026] 127.0.0.1:52648 Closing
[Sun Apr 5 14:56:26 2026] 127.0.0.1:50928 Closing
[Sun Apr 5 14:56:26 2026] 127.0.0.1:63184 Accepted
[Sun Apr 5 14:56:28 2026] 127.0.0.1:63184 [200]: GET /favicon.ico
[Sun Apr 5 14:56:28 2026] 127.0.0.1:63184 Closing
[Sun Apr 5 14:56:28 2026] 127.0.0.1:58923 Accepted
[Sun Apr 5 14:56:45 2026] 127.0.0.1:58923 [200]: POST /my_favorites.php
[Sun Apr 5 14:56:45 2026] 127.0.0.1:58923 Closing
[Sun Apr 5 14:56:46 2026] 127.0.0.1:54324 Accepted
[Sun Apr 5 14:56:46 2026] 127.0.0.1:54324 [200]: GET /css/style.css
[Sun Apr 5 14:56:46 2026] 127.0.0.1:54324 Closing
[Sun Apr 5 14:56:46 2026] 127.0.0.1:52727 Accepted
[Sun Apr 5 14:56:46 2026] 127.0.0.1:52727 [200]: GET /images/star16x16.png
[Sun Apr 5 14:56:46 2026] 127.0.0.1:52727 Closing
[Sun Apr 5 14:56:46 2026] 127.0.0.1:52008 Accepted
[Sun Apr 5 14:56:46 2026] 127.0.0.1:53146 Accepted
[Sun Apr 5 14:56:46 2026] 127.0.0.1:52008 [200]: GET /images/star16x16_rays.png
[Sun Apr 5 14:56:46 2026] 127.0.0.1:52008 Closing
[Sun Apr 5 14:56:47 2026] 127.0.0.1:53146 [200]: GET /favicon.ico
[Sun Apr 5 14:56:47 2026] 127.0.0.1:53146 Closing
[Sun Apr 5 14:58:28 2026] 127.0.0.1:54578 Accepted
[Sun Apr 5 14:58:28 2026] 127.0.0.1:54578 [200]: GET /my_favorites.php
[Sun Apr 5 14:58:28 2026] 127.0.0.1:54578 Closing
[Sun Apr 5 14:58:28 2026] 127.0.0.1:52348 Accepted
[Sun Apr 5 14:58:28 2026] 127.0.0.1:52348 [200]: GET /css/style.css
[Sun Apr 5 14:58:28 2026] 127.0.0.1:52348 Closing
[Sun Apr 5 14:58:28 2026] 127.0.0.1:53537 Accepted
[Sun Apr 5 14:58:28 2026] 127.0.0.1:53537 [200]: GET /images/star16x16.png
[Sun Apr 5 14:58:28 2026] 127.0.0.1:53537 Closing
[Sun Apr 5 14:58:28 2026] 127.0.0.1:59817 Accepted
[Sun Apr 5 14:58:28 2026] 127.0.0.1:49662 Accepted
[Sun Apr 5 14:58:28 2026] 127.0.0.1:59817 [200]: GET /images/star16x16_rays.png
[Sun Apr 5 14:58:28 2026] 127.0.0.1:59817 Closing
[Sun Apr 5 14:58:30 2026] 127.0.0.1:49662 [200]: GET /favicon.ico
[Sun Apr 5 14:58:30 2026] 127.0.0.1:49662 Closing
[Sun Apr 5 15:02:05 2026] 127.0.0.1:51374 Accepted
[Sun Apr 5 15:02:06 2026] 127.0.0.1:51374 [200]: GET /my_favorites.php
[Sun Apr 5 15:02:06 2026] 127.0.0.1:51374 Closing
[Sun Apr 5 15:02:06 2026] 127.0.0.1:63617 Accepted
[Sun Apr 5 15:02:06 2026] 127.0.0.1:63617 [200]: GET /css/style.css
[Sun Apr 5 15:02:06 2026] 127.0.0.1:63617 Closing
[Sun Apr 5 15:02:06 2026] 127.0.0.1:51057 Accepted
[Sun Apr 5 15:02:06 2026] 127.0.0.1:52314 Accepted
[Sun Apr 5 15:02:06 2026] 127.0.0.1:51057 [200]: GET /images/star16x16.png
[Sun Apr 5 15:02:06 2026] 127.0.0.1:52314 [200]: GET /images/star16x16_rays.png
[Sun Apr 5 15:02:06 2026] 127.0.0.1:51057 Closing
[Sun Apr 5 15:02:06 2026] 127.0.0.1:52314 Closing
[Sun Apr 5 15:02:06 2026] 127.0.0.1:58087 Accepted
[Sun Apr 5 15:02:08 2026] 127.0.0.1:58087 [200]: GET /favicon.ico
[Sun Apr 5 15:02:08 2026] 127.0.0.1:58087 Closing
[Sun Apr 5 15:02:08 2026] 127.0.0.1:63986 Accepted
[Sun Apr 5 15:02:48 2026] 127.0.0.1:63986 [200]: GET /satellitenhimmel.php
[Sun Apr 5 15:02:48 2026] 127.0.0.1:63986 Closing
[Sun Apr 5 15:02:49 2026] 127.0.0.1:56431 Accepted
[Sun Apr 5 15:02:49 2026] 127.0.0.1:56431 [200]: GET /css/style.css
[Sun Apr 5 15:02:49 2026] 127.0.0.1:56431 Closing
[Sun Apr 5 15:02:49 2026] 127.0.0.1:65407 Accepted
[Sun Apr 5 15:02:49 2026] 127.0.0.1:65407 [200]: GET /images/star16x16.png
[Sun Apr 5 15:02:49 2026] 127.0.0.1:65407 Closing
[Sun Apr 5 15:02:49 2026] 127.0.0.1:60622 Accepted
[Sun Apr 5 15:02:49 2026] 127.0.0.1:62270 Accepted
[Sun Apr 5 15:02:49 2026] 127.0.0.1:60622 [200]: GET /images/star16x16_rays.png
[Sun Apr 5 15:02:49 2026] 127.0.0.1:60622 Closing
[Sun Apr 5 15:02:50 2026] 127.0.0.1:62270 [200]: GET /favicon.ico
[Sun Apr 5 15:02:50 2026] 127.0.0.1:62270 Closing
+70 -27
View File
@@ -39,6 +39,54 @@ function h(?string $value): string
return htmlspecialchars((string)$value, ENT_QUOTES, 'UTF-8');
}
function getPythonCandidates(): array
{
if (PHP_OS_FAMILY === 'Windows') {
return ['python', 'py'];
}
return ['/usr/bin/python3', '/usr/bin/python', 'python3', 'python'];
}
function runPythonCommand(string $scriptPath, array $args): array
{
putenv('PYTHONUTF8=1');
putenv('PYTHONIOENCODING=utf-8');
$escapedArguments = array_map('escapeshellarg', array_merge([$scriptPath], $args));
$lastError = 'Python konnte nicht gestartet werden.';
foreach (getPythonCandidates() as $pythonBinary) {
$command = $pythonBinary . ' ' . implode(' ', $escapedArguments) . ' 2>&1';
$output = [];
$resultCode = 0;
exec($command, $output, $resultCode);
$joined = trim(implode("\n", $output));
$decoded = json_decode($joined, true);
if (is_array($decoded)) {
return [
'ok' => (bool) ($decoded['ok'] ?? false),
'data' => $decoded,
'raw' => $joined,
'command' => $command,
];
}
if ($joined !== '') {
$lastError = $joined;
} elseif ($resultCode !== 0) {
$lastError = 'Fehlercode ' . $resultCode . ' bei ' . $pythonBinary;
}
}
return [
'ok' => false,
'error' => $lastError,
];
}
// ── Satelliten aus DB laden ──────────────────────────────────────────────────
function tleChecksum(string $line): int
@@ -291,34 +339,29 @@ if (!empty($satellitePayload) && !empty($defaultLocation['latitude'])) {
$windowStart = $dayStart->setTimezone(new DateTimeZone('UTC'))->format(DateTime::ATOM);
$windowEnd = $dayEnd->setTimezone(new DateTimeZone('UTC'))->format(DateTime::ATOM);
$scriptPath = realpath(__DIR__ . '/py/api.py');
$satellitesJson = json_encode($satellitePayload, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
$args = [
'/usr/bin/python',
escapeshellarg($scriptPath),
escapeshellarg('satellite_passes'),
escapeshellarg((string)$lat),
escapeshellarg((string)$lon),
escapeshellarg((string)$elev),
escapeshellarg($tz),
escapeshellarg($windowStart),
escapeshellarg($windowEnd),
escapeshellarg($satellitesJson),
];
$command = implode(' ', $args) . ' 2>&1';
$output = [];
$code = 0;
exec($command, $output, $code);
$joined = implode('', $output);
$decoded = json_decode($joined, true);
if (is_array($decoded) && ($decoded['ok'] ?? false)) {
$pythonResult = $decoded;
$scriptPath = realpath(__DIR__ . '/py/api.py');
if ($scriptPath === false) {
$pythonError = 'Das Python-Skript für den Satellitenhimmel wurde nicht gefunden.';
} else {
$pythonError = $joined ?: 'Leere Antwort von Python.';
$satellitesJson = json_encode($satellitePayload, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
$satellitesPayload = base64_encode((string)$satellitesJson);
$pythonCall = runPythonCommand($scriptPath, [
'satellite_passes',
(string)$lat,
(string)$lon,
(string)$elev,
$tz,
$windowStart,
$windowEnd,
$satellitesPayload,
]);
if ($pythonCall['ok'] ?? false) {
$pythonResult = $pythonCall['data'];
} else {
$pythonError = $pythonCall['raw'] ?? $pythonCall['error'] ?? 'Leere Antwort von Python.';
}
}
}
?>