stat: Highlight deprecated Windows versions

This commit is contained in:
2026-05-04 20:19:35 +02:00
parent a7658c33b1
commit 028c16be3d
2 changed files with 15 additions and 7 deletions
+2 -2
View File
@@ -82,7 +82,7 @@
justify-content: space-between;
}
.device:not(.inactive) .versions .elwig.deprecated {
.device:not(.inactive) .versions .deprecated {
color: #C00000;
}
@@ -119,7 +119,7 @@ img {
.device.online .date {
color: #00A000;
}
.device:not(.inactive) .versions .elwig.deprecated {
.device:not(.inactive) .versions .deprecated {
color: #E00000;
}
}
+13 -5
View File
@@ -31,6 +31,11 @@ $osVersions = [
'Microsoft Windows NT 10.0.26200.0' => 'Windows 11 (25H2)',
];
$latestOsVersions = [];
foreach ($osVersions as $id => $name) {
$latestOsVersions[substr($name, 0, 10)] = $name;
}
$DEVICES ??= [];
if ($_SERVER['PATH_INFO'] === '/log') {
@@ -45,7 +50,7 @@ cat files/.log.csv \
EOF);
} else {
passthru(<<<EOF
cat files/.log.csv | grep -E '\|json\|$|\|Elwig/' | grep -v "PICARD|ENTERPRISE|GEORGIOU|78A16E85-410A-4" \
cat files/.log.csv | grep -E '\|json\|$|\|Elwig/' | grep -v "WGX|PICARD|ENTERPRISE|GEORGIOU|78A16E85-410A-4" \
| awk -F'|' -vOFS='|' '{\$1 = strftime("%F %T", $1); print $0}' \
| sed 's:|:</td><td>:g;s:^:<tr><td>:g;s:$:</td></tr>:g'
EOF);
@@ -60,7 +65,7 @@ EOF);
$line = explode('|', $line);
if (sizeof($line) < 6) continue;
if (!str_starts_with($line[5], 'Elwig/')) continue;
if (str_contains($line[5], "PICARD") || str_contains($line[5], "ENTERPRISE") || str_contains($line[5], "GEORGIOU") || str_contains($line[5], "78A16E85-410A-4")) continue;
if (str_contains($line[5], "WGX") || str_contains($line[5], "PICARD") || str_contains($line[5], "ENTERPRISE") || str_contains($line[5], "GEORGIOU") || str_contains($line[5], "78A16E85-410A-4")) continue;
$timestamp = intval($line[0]);
$version = substr(explode(' ', $line[5], 2)[0], 6);
$comment = preg_match("/\((.*?), *(.*?), *(.*?), *(.*?)\)/", $line[5], $m);
@@ -243,10 +248,13 @@ EOF);
echo "<div class='device $active'>";
echo "<div class='versions'>";
$stat = $latestVersion === null ? '' : ($d[0] === $latestVersion ? 'latest' : 'deprecated');
echo "<span class='elwig $stat'><img src='/favicon.ico' width='16' height='16'/> $d[0]</span>";
$elwigVers = $latestVersion === null ? '' : ($d[0] === $latestVersion ? 'latest' : 'deprecated');
echo "<span class='elwig $elwigVers'><img src='/favicon.ico' width='16' height='16'/> $d[0]</span>";
if (isset($osVersions[$d[2]])) {
echo "<span class='os'>" . str_replace('Windows', "<img src='/res/windows.png' width='16' height='16'/> ", $osVersions[$d[2]]) . "</span>";
$v = $osVersions[$d[2]];
$l = $latestOsVersions[substr($v, 0, 10)] ?? null;
$osVers = $l === null ? '' : ($l === $v ? 'latest' : 'deprecated');
echo "<span class='os $osVers'>" . str_replace('Windows', "<img src='/res/windows.png' width='16' height='16'/> ", $v) . "</span>";
} else {
echo "<span class='os'>$d[2]</span>";
}