summaryrefslogtreecommitdiff
path: root/pages/computers.inc
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-03-12 19:16:53 +0100
committerRaindropsSys <contact@minteck.org>2023-03-12 19:16:53 +0100
commiteb89b15c0f044673c1206a418a21d0baba1a675e (patch)
tree39ac31a576d8b8392cbd9baf8d67621bf2cefa86 /pages/computers.inc
parent5385f0ed8fbb4325203a222a75e6700ffb519349 (diff)
downloadpluralconnect-eb89b15c0f044673c1206a418a21d0baba1a675e.tar.gz
pluralconnect-eb89b15c0f044673c1206a418a21d0baba1a675e.tar.bz2
pluralconnect-eb89b15c0f044673c1206a418a21d0baba1a675e.zip
Updated 104 files, added 3 files, deleted 4 files and renamed 36 files (automated)
Diffstat (limited to 'pages/computers.inc')
-rw-r--r--pages/computers.inc48
1 files changed, 30 insertions, 18 deletions
diff --git a/pages/computers.inc b/pages/computers.inc
index 56a1b5d..fb88296 100644
--- a/pages/computers.inc
+++ b/pages/computers.inc
@@ -1,6 +1,6 @@
<?php
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $pagename; global $_USER;
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $pagename; global $_USER; global $_PROFILE;
$computer = [];
$parts = explode("/", $pagename);
@@ -26,7 +26,7 @@ if (isset($parts[2]) && $parts[2] !== "control") {
die();
}
-require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
+require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc';
$parts = array_values(array_filter($parts, function ($i) {
return $i !== "-";
@@ -36,6 +36,10 @@ if (count($parts) === 2 || count($parts) === 3) {
array_unshift($parts, null);
}
+if (str_ends_with($computer["os"], "unknown")) {
+ $computer["os"] = trim(substr($computer["os"], 0, -7));
+}
+
?>
<script>
@@ -112,11 +116,15 @@ if (count($parts) === 2 || count($parts) === 3) {
</tr>
<tr>
<td style="padding-right: 10px; text-align: right;"><b>Serial:</b></td>
- <td><?= $computer["serial"] ?> (<?= $computer["serial_source"] === "hardware" ? "logic board" : "OS" ?>)</td>
+ <?php if (trim($computer["serial"]) !== ""): ?><td><?= $computer["serial"] ?> (<?= $computer["serial_source"] === "hardware" ? "logic board" : "OS" ?>)</td><?php else: ?><td>-</td><?php endif; ?>
</tr>
<tr>
- <td style="padding-right: 10px; text-align: right;"><b>Last seen:</b></td>
- <td><?= date('j M, g:ia (T)', strtotime($computer["date"])) ?>, <?= timeAgo($computer["date"]) ?></td>
+ <td style="padding-right: 10px; text-align: right;"><b>Status:</b></td>
+ <?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>
+ <?php endif; ?>
</tr>
</tbody>
</table>
@@ -225,7 +233,7 @@ if (count($parts) === 2 || count($parts) === 3) {
</tr>
<tr>
<td style="padding-right: 10px; text-align: right;"><b>System:</b></td>
- <td><?= $computer["os_info"]["distro"] ?> <?= $computer["os_info"]["release"] ?></td>
+ <td><?= $computer["os_info"]["distro"] ?> <?= $computer["os_info"]["release"] === "unknown" ? "" : $computer["os_info"]["release"] ?></td>
</tr>
<tr>
<td style="padding-right: 10px; text-align: right;"><b>CPU architecture:</b></td>
@@ -241,7 +249,7 @@ if (count($parts) === 2 || count($parts) === 3) {
</tr>
<tr>
<td style="padding-right: 10px; text-align: right;"><b>Build number:</b></td>
- <td><?= $computer["os_info"]["build"] ?></td>
+ <td><?= $computer["os_info"]["build"] === "rolling" ? "Rolling release" : $computer["os_info"]["build"] ?></td>
</tr>
<tr>
<td style="padding-right: 10px; text-align: right;"><b>Serial number:</b></td>
@@ -449,9 +457,8 @@ if (count($parts) === 2 || count($parts) === 3) {
"LISTEN" => "Listening",
"CLOSING" => "Terminating",
"UNKNOWN" => "?",
- "LAST_ACK", "FIN_WAIT2" => "Waiting",
- "TIME_WAIT" => "Waiting",
- "FIN_WAIT1" => "Closing",
+ "LAST_ACK", "FIN_WAIT2", "TIME_WAIT" => "Waiting",
+ "FIN_WAIT1", "CLOSE_WAIT" => "Closing",
"SYN_RECV" => "Received",
"SYN_SENT" => "Attempting",
default => $connection["state"],
@@ -598,7 +605,6 @@ if (count($parts) === 2 || count($parts) === 3) {
}
}
- document.getElementById("title-bar-action-1").style.display = "none";
window.controlling = false;
window.commandRunInterval = null;
@@ -792,14 +798,10 @@ if (count($parts) === 2 || count($parts) === 3) {
}
function enableControl() {
- document.getElementById("title-bar-action-1").style.display = "inline-block";
- document.getElementById("title-bar-action-0").style.display = "none";
window.controlling = true;
}
function disableControl() {
- document.getElementById("title-bar-action-1").style.display = "none";
- document.getElementById("title-bar-action-0").style.display = "inline-block";
window.controlling = false;
}
</script>
@@ -812,7 +814,13 @@ if (count($parts) === 2 || count($parts) === 3) {
<ul class="list-group">
<?php foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata"), function ($i) {
return !str_starts_with($i, ".");
- }) as $file): $computer = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $file), true); $id = substr($file, 0, -5); $owner = explode("-", $id)[0]; ?>
+ }) as $file): $computer = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $file), true); $id = substr($file, 0, -5); $owner = explode("-", $id)[0];
+
+ if (str_ends_with($computer["os"], "unknown")) {
+ $computer["os"] = trim(substr($computer["os"], 0, -7));
+ }
+
+ ?>
<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">
@@ -821,12 +829,16 @@ if (count($parts) === 2 || count($parts) === 3) {
<div>
<b><?= $computer["host"] ?></b> ยท <?= $computer["os"] ?><br>
Owned by <?= $owner === "raindrops" ? "Raindrops System" : "Cloudburst System"; ?><br>
- Last seen <?= timeAgo($computer["date"]) ?>
+ <?php if (timeAgo($computer["date"]) === "now"): ?>Online<?php else: ?>Offline since <?= timeAgo($computer["date"]) ?><?php endif; ?>
</div>
</div>
</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>
@@ -881,4 +893,4 @@ if (count($parts) === 2 || count($parts) === 3) {
}
</style>
-<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?>