stat: Highlight deprecated versions of elwig

This commit is contained in:
2026-04-23 14:26:46 +02:00
parent aa3564284f
commit fbb0ac86d5
2 changed files with 14 additions and 1 deletions
+7
View File
@@ -82,6 +82,10 @@
justify-content: space-between; justify-content: space-between;
} }
.device:not(.inactive) .versions .elwig.deprecated {
color: #C00000;
}
img { img {
width: 1em; width: 1em;
height: 1em; height: 1em;
@@ -115,4 +119,7 @@ img {
.device.online .date { .device.online .date {
color: #00A000; color: #00A000;
} }
.device:not(.inactive) .versions .elwig.deprecated {
color: #E00000;
}
} }
+7 -1
View File
@@ -5,6 +5,10 @@ include ".php/devices.inc";
authenticate(['stat']); authenticate(['stat']);
$fileNames = array_filter(scandir('files/'), function($e) { return str_starts_with($e, 'Elwig-'); });
usort($fileNames, 'version_compare');
$latestVersion = sizeof($fileNames) > 0 ? substr(substr($fileNames[sizeof($fileNames) - 1], 6), 0, -4) : null;
$osVersions = [ $osVersions = [
'Microsoft Windows NT 10.0.10240.0' => 'Windows 10 (1507)', 'Microsoft Windows NT 10.0.10240.0' => 'Windows 10 (1507)',
'Microsoft Windows NT 10.0.10586.0' => 'Windows 10 (1511)', 'Microsoft Windows NT 10.0.10586.0' => 'Windows 10 (1511)',
@@ -238,7 +242,9 @@ EOF);
$active = $timestamp + 36 * 60 * 60 > time() ? 'online' : ($timestamp + 28 * 24 * 60 * 60 > time() ? 'offline' : 'inactive'); $active = $timestamp + 36 * 60 * 60 > time() ? 'online' : ($timestamp + 28 * 24 * 60 * 60 > time() ? 'offline' : 'inactive');
echo "<div class='device $active'>"; echo "<div class='device $active'>";
echo "<div class='versions'><span><img src='/favicon.ico' width='16' height='16'/> $d[0]</span>"; 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>";
if (isset($osVersions[$d[2]])) { 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>"; echo "<span class='os'>" . str_replace('Windows', "<img src='/res/windows.png' width='16' height='16'/> ", $osVersions[$d[2]]) . "</span>";
} else { } else {