diff options
Diffstat (limited to 'pages/computers.inc')
-rw-r--r-- | pages/computers.inc | 114 |
1 files changed, 91 insertions, 23 deletions
diff --git a/pages/computers.inc b/pages/computers.inc index fb88296..d2b9cbd 100644 --- a/pages/computers.inc +++ b/pages/computers.inc @@ -69,7 +69,7 @@ if (str_ends_with($computer["os"], "unknown")) { <?php if ($computer["luna_version"] === "1.0.0"): ?> <div class="alert alert-danger"> <p><b>We are unable to give you access to this computer.</b></p> - <p>This computer is running Luna version 1.0.0. This version of Luna is considered malware because of inconspicuous behavior and is therefore not usable anymore and has been disabled. This means you cannot access this computer at the moment.</p> + <p>This computer is running xsion 1.0.0. This version of Luna is considered malware because of inconspicuous behavior and is therefore not usable anymore and has been disabled. This means you cannot access this computer at the moment.</p> Update this computer to run Luna 1.1.0 or newer and try again. </div> <?php else: ?> @@ -93,7 +93,23 @@ if (str_ends_with($computer["os"], "unknown")) { </style> <div style="display: grid; grid-template-columns: 256px 1fr; grid-column-gap: 30px;" id="g-0"> <div style="display: flex; align-items: center;"> - <img style="width: 256px;" src="https://ponies.equestria.horse/api/data?f=computers/screens/<?= $id . "-" . $computer["screens"][0]["id"] ?>.jpg"> + <img style="width: 256px;" src="<?php + + if (isset($computer["dsb"])) { + switch ($computer["dsb"]["platform"]) { + case "chrome": + echo("https://upload.wikimedia.org/wikipedia/en/3/3e/ChromeOS_screenshot.png"); + break; + + default: + echo("https://ponies.equestria.horse/api/data?f=computers/screens/" . $id . "-" . $computer["screens"][0]["id"] . ".jpg"); + break; + } + } else { + echo("https://ponies.equestria.horse/api/data?f=computers/screens/" . $id . "-" . $computer["screens"][0]["id"] . ".jpg"); + } + + ?>"> </div> <div style="display: flex; align-items: center;"> <table> @@ -104,7 +120,26 @@ if (str_ends_with($computer["os"], "unknown")) { </tr> <tr> <td style="padding-right: 10px; text-align: right;"><b>Luna version:</b></td> - <td><?= $computer["luna_version"] ?></td> + <td><?= $computer["luna_version"] ?><?php if (isset($computer["dsb"])): ?> (<?php switch ($computer["dsb"]["platform"]) { + case "chrome": + echo("Chrome "); + break; + + case "desktop": + echo("Desktop "); + break; + + case "android": + echo("Android "); + break; + + case "server": + echo("server "); + break; + + default: + break; + } ?> DSB <?= $computer["dsb"]["version"] ?? 0 ?>)<?php endif; ?></td> </tr> <tr> <td style="padding-right: 10px; text-align: right;"><b>System:</b></td> @@ -123,7 +158,7 @@ if (str_ends_with($computer["os"], "unknown")) { <?php if (timeAgo($computer["date"]) === "now"): ?> <td>Online</td> <?php else: ?> - <td>Offline since <?= timeAgo($computer["date"]) ?>, <?= date('j M, g:ia (T)', strtotime($computer["date"])) ?></td> + <td>Offline since <?= timeAgo($computer["date"]) ?>: <?= date('j M, g:ia (T)', strtotime($computer["date"])) ?></td> <?php endif; ?> </tr> </tbody> @@ -142,14 +177,15 @@ if (str_ends_with($computer["os"], "unknown")) { <tr> <td style="padding-right: 10px; text-align: right;"><b>Processor threading:</b></td> <td> - <?= $computer["cpu"]["processors"] ?> processor<?= $computer["cpu"]["processors"] > 1 ? "s" : "" ?>, - <?= $computer["cpu"]["physicalCores"] ?> core<?= $computer["cpu"]["physicalCores"] > 1 ? "s" : "" ?><?= isset($computer["cpu"]["efficiencyCores"]) ? " (" . $computer["cpu"]["efficiencyCores"] . " efficiency, " . $computer["cpu"]["performanceCores"] . " performance)" : "" ?>, - <?= $computer["cpu"]["cores"] ?> thread<?= $computer["cpu"]["cores"] > 1 ? "s" : "" ?></td> + <?php if ($computer["cpu"]["processors"] > 1): ?><?= $computer["cpu"]["processors"] ?> processor<?= $computer["cpu"]["processors"] > 1 ? "s" : "" ?>, + <?php endif; ?><?= $computer["cpu"]["physicalCores"] ?> core<?= $computer["cpu"]["physicalCores"] > 1 ? "s" : "" ?><?= isset($computer["cpu"]["efficiencyCores"]) && isset($computer["cpu"]["performanceCores"]) && $computer["cpu"]["efficiencyCores"] !== 0 && $computer["cpu"]["performanceCores"] !== 0 ? " (" . $computer["cpu"]["efficiencyCores"] . " efficiency, " . $computer["cpu"]["performanceCores"] . " performance)" : "" ?><?php if ($computer["cpu"]["cores"] !== $computer["cpu"]["physicalCores"]): ?>, + <?= $computer["cpu"]["cores"] ?> thread<?= $computer["cpu"]["cores"] > 1 ? "s" : "" ?><?php endif; ?></td> </tr> <tr> <td style="padding-right: 10px; text-align: right;"><b>Hardware virtualization:</b></td> - <td><?= $computer["cpu"]["virtualization"] ? "Capable" : "Disabled" ?></td> + <td><?= isset($computer["cpu"]["virtualization"]) ? ($computer["cpu"]["virtualization"] ? "Capable" : "Disabled") : "Unknown" ?></td> </tr> + <?php if (isset($computer["cpu"]["cache"])): ?> <tr> <td style="padding-right: 10px; text-align: right;"><b>Level 1 cache:</b></td> <td><?= round($computer["cpu"]["cache"]["l1i"] / 1024, 2) ?> KiB (instruction), <?= round($computer["cpu"]["cache"]["l1d"] / 1024, 2) ?> KiB (data)</td> @@ -162,7 +198,9 @@ if (str_ends_with($computer["os"], "unknown")) { <td style="padding-right: 10px; text-align: right;"><b>Level 3 cache:</b></td> <td><?= isset($computer["cpu"]["cache"]["l3"]) ? round($computer["cpu"]["cache"]["l3"] / 1024**2, 2) . " MiB" : "Not supported" ?></td> </tr> - <tr> + <?php endif; ?> + <?php if (isset($computer["gpu"])): ?> + <?php if (isset($computer["gpu"]["controllers"]) && isset($computer["gpu"]["controllers"][0])): ?><tr> <td style="padding-right: 10px; text-align: right;"><b>Graphics processor<?= count($computer["gpu"]["controllers"]) > 1 ? "s" : "" ?>:</b></td> <td> <?php $index = 0; foreach ($computer["gpu"]["controllers"] as $controller): ?> @@ -170,7 +208,7 @@ if (str_ends_with($computer["os"], "unknown")) { <?= $index < count($computer["gpu"]["controllers"]) - 1 ? "<br>" : "" ?> <?php $index++; endforeach; ?> </td> - </tr> + </tr><?php endif; ?> <tr> <td style="padding-right: 10px; text-align: right;"><b>Display<?= count($computer["gpu"]["displays"]) > 1 ? "s" : "" ?>:</b></td> <td> @@ -180,6 +218,7 @@ if (str_ends_with($computer["os"], "unknown")) { <?php $index++; endforeach; ?> </td> </tr> + <?php endif; ?> <tr> <td colspan="2"><h4 style="margin-top: 20px;margin-bottom: 10px;">System memory</h4></td> @@ -188,15 +227,15 @@ if (str_ends_with($computer["os"], "unknown")) { <td style="padding-right: 10px; text-align: right;"><b>Physical memory:</b></td> <td><?= round($computer["ram"]["total"] / 1024**3, 2) ?> GiB (<?= round($computer["ram"]["used"] / 1024**2, 2) ?> MiB used, <?= round($computer["ram"]["free"] / 1024**2, 2) ?> MiB free)</td> </tr> - <tr> + <?php if (isset($computer["ram"]["active"]) && isset($computer["ram"]["available"]) && isset($computer["ram"]["buffcache"])): ?><tr> <td style="padding-right: 10px; text-align: right;"><b>Memory usage:</b></td> <td><?= round($computer["ram"]["active"] / 1024**2, 2) ?> MiB active, <?= round($computer["ram"]["available"] / 1024**2, 2) ?> MiB available, <?= round($computer["ram"]["buffcache"] / 1024**2, 2) ?> MiB cache</td> - </tr> - <tr> + </tr><?php endif; ?> + <?php if (isset($computer["ram"]["swaptotal"]) && isset($computer["ram"]["swapused"])): ?><tr> <td style="padding-right: 10px; text-align: right;"><b>Swap memory:</b></td> <td><?= round($computer["ram"]["swaptotal"] / 1024**3, 2) ?> GiB (<?= round($computer["ram"]["swapused"] / 1024**2, 2) ?> MiB used, <?= round($computer["ram"]["swapfree"] / 1024**2, 2) ?> MiB free)</td> - </tr> - <tr> + </tr><?php endif; ?> + <?php if (isset($computer["ram_chips"])): ?><tr> <td style="padding-right: 10px; text-align: right;"><b>RAM chips:</b></td> <td> <?php $index = 0; foreach ($computer["ram_chips"] as $chip): ?> @@ -204,11 +243,12 @@ if (str_ends_with($computer["os"], "unknown")) { <?= $index < count($computer["ram_chips"]) - 1 ? "<br>" : "" ?> <?php $index++; endforeach; ?> </td> - </tr> + </tr><?php endif; ?> <tr> <td colspan="2"><h4 style="margin-top: 20px;margin-bottom: 10px;">Battery</h4></td> </tr> + <?php if (isset($computer["battery"])): ?> <?php if ($computer["battery"]["hasBattery"]): ?> <tr> <td style="padding-right: 10px; text-align: right;"><b>Battery model:</b></td> @@ -226,7 +266,7 @@ if (str_ends_with($computer["os"], "unknown")) { <td style="padding-right: 10px; text-align: right;"><b>Remaining capacity:</b></td> <td><?= $computer["battery"]["currentCapacity"] ?>/<?= $computer["battery"]["maxCapacity"] ?> <?= $computer["battery"]["capacityUnit"] ?> (designed for <?= $computer["battery"]["designedCapacity"] ?> <?= $computer["battery"]["capacityUnit"] ?><?php if ($computer["battery"]["designedCapacity"] > 0): ?>, <?= round(($computer["battery"]["maxCapacity"] / $computer["battery"]["designedCapacity"]) * 100, 2) ?>% left<?php endif; ?>)</td> </tr> - <?php else: ?><tr><td colspan="2">This computer does not contain a battery.</td></tr><?php endif; ?> + <?php else: ?><tr><td colspan="2">This computer does not contain a battery.</td></tr><?php endif; ?><?php else: ?><tr><td colspan="2">This operating system does not support reporting battery info.</td></tr><?php endif; ?> <tr> <td colspan="2"><h4 style="margin-top: 20px;margin-bottom: 10px;">Operating system</h4></td> @@ -243,10 +283,12 @@ if (str_ends_with($computer["os"], "unknown")) { <td style="padding-right: 10px; text-align: right;"><b>Kernel version:</b></td> <td><?= $computer["os_info"]["kernel"] ?></td> </tr> + <?php if ($computer["os_info"]["codepage"]): ?> <tr> <td style="padding-right: 10px; text-align: right;"><b>Code page:</b></td> <td><?= $computer["os_info"]["codepage"] ?></td> </tr> + <?php endif; ?> <tr> <td style="padding-right: 10px; text-align: right;"><b>Build number:</b></td> <td><?= $computer["os_info"]["build"] === "rolling" ? "Rolling release" : $computer["os_info"]["build"] ?></td> @@ -255,10 +297,12 @@ if (str_ends_with($computer["os"], "unknown")) { <td style="padding-right: 10px; text-align: right;"><b>Serial number:</b></td> <td><?= $computer["os_info"]["serial"] ?></td> </tr> + <?php if (isset($computer["os_info"]["uefi"])): ?> <tr> <td style="padding-right: 10px; text-align: right;"><b>Startup interface:</b></td> <td><?= $computer["os_info"]["uefi"] ? "UEFI" : "BIOS (legacy)" ?></td> </tr> + <?php endif; ?> <tr> <td colspan="2"><h4 style="margin-top: 20px;margin-bottom: 10px;">Software versions</h4></td> @@ -305,12 +349,15 @@ if (str_ends_with($computer["os"], "unknown")) { </tbody> </table> + <?php if (!isset($computer["remote_control"]) || $computer["remote_control"] === true): ?> <h4 style="margin-top: 20px;margin-bottom: 10px;" id="screens">Remote control</h4> <p id="page-content"> You can remotely control this computer. <a href="./<?= $id ?>/control">Open remote control.</a><br> <small class="text-muted">Note: The user of this computer will need to approve your connection request before you can see and control their screen.</small> </p> + <?php endif; ?> + <?php if (count($computer["users"]) > 0): ?> <h4 style="margin-top: 20px;margin-bottom: 10px;">Sessions</h4> <table class="table"> <thead> @@ -334,7 +381,9 @@ if (str_ends_with($computer["os"], "unknown")) { <?php endforeach; ?> </tbody> </table> + <?php endif; ?> + <?php if (count($computer["filesystems"]) > 0): ?> <h4 style="margin-top: 20px;margin-bottom: 10px;">Filesystems</h4> <table class="table"> <thead> @@ -366,7 +415,9 @@ if (str_ends_with($computer["os"], "unknown")) { <?php endforeach; ?> </tbody> </table> + <?php endif; ?> + <?php if (isset($computer["audio"])): ?> <h4 style="margin-top: 20px;margin-bottom: 10px;">Audio devices</h4> <table class="table"> <thead> @@ -390,7 +441,9 @@ if (str_ends_with($computer["os"], "unknown")) { <?php endforeach; ?> </tbody> </table> + <?php endif; ?> + <?php if (isset($computer["network"])): ?> <h4 style="margin-top: 20px;margin-bottom: 10px;">Network cards</h4> <table class="table"> <thead> @@ -437,7 +490,9 @@ if (str_ends_with($computer["os"], "unknown")) { <?php endforeach; ?> </tbody> </table> + <?php endif; ?> + <?php if (isset($computer["connections"])): ?> <h4 style="margin-top: 20px;margin-bottom: 10px;">Network connections</h4> <table class="table"> <thead> @@ -499,6 +554,7 @@ if (str_ends_with($computer["os"], "unknown")) { <?php endforeach; ?> </tbody> </table> + <?php endif; ?> <h4 style="margin-top: 20px;margin-bottom: 10px;">Processes</h4> <table class="table"> @@ -520,7 +576,7 @@ if (str_ends_with($computer["os"], "unknown")) { <td><?= round($process["cpu"], 2) ?>%</td> <td><?= round($process["ram"], 2) ?>%</td> <td><?= $process["user"] ?></td> - <td><?= timeAgo($process["date"]) ?></td> + <td><?= isset($process["date"]) ? timeAgo($process["date"]) : "" ?></td> </tr> <?php endforeach; ?> </tbody> @@ -823,7 +879,23 @@ if (str_ends_with($computer["os"], "unknown")) { ?> <a href="/-/computers/<?= $id ?>" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: 100px 1fr; grid-column-gap: 10px;"> <div style="display: flex; align-items: center;"> - <img style="width: 100px;" src="https://ponies.equestria.horse/api/data?f=computers/screens/<?= $id . "-" . $computer["screens"][0]["id"] ?>.jpg"> + <img style="width: 100px;" src="<?php + + if (isset($computer["dsb"])) { + switch ($computer["dsb"]["platform"]) { + case "chrome": + echo("https://upload.wikimedia.org/wikipedia/en/3/3e/ChromeOS_screenshot.png"); + break; + + default: + echo("https://ponies.equestria.horse/api/data?f=computers/screens/" . $id . "-" . $computer["screens"][0]["id"] . ".jpg"); + break; + } + } else { + echo("https://ponies.equestria.horse/api/data?f=computers/screens/" . $id . "-" . $computer["screens"][0]["id"] . ".jpg"); + } + + ?>"> </div> <div style="display: flex; align-items: center;"> <div> @@ -835,10 +907,6 @@ if (str_ends_with($computer["os"], "unknown")) { </a> <?php endforeach; ?> </ul> - - <div id="page-content" style="margin-top: 10px;"> - <a href="https://static.equestria.horse/luna-cros.crx">Install Chrome OS extension</a> - </div> </div> <?php endif; ?> </div> |