summaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-03-15 22:40:55 +0100
committerRaindropsSys <contact@minteck.org>2023-03-15 22:40:55 +0100
commit940defd2939f52480ed5b548189b549457944995 (patch)
tree7ca52eca3c3fcafe507dc24b4e2812ab785acc29 /pages
parenteb89b15c0f044673c1206a418a21d0baba1a675e (diff)
downloadpluralconnect-940defd2939f52480ed5b548189b549457944995.tar.gz
pluralconnect-940defd2939f52480ed5b548189b549457944995.tar.bz2
pluralconnect-940defd2939f52480ed5b548189b549457944995.zip
Updated 14 files (automated)
Diffstat (limited to 'pages')
-rw-r--r--pages/api/chrome.php3
-rw-r--r--pages/api/computer.php3
-rw-r--r--pages/api/pluralkit-integration.php8
-rw-r--r--pages/api/ponytown.php2
-rw-r--r--pages/computers.inc114
-rw-r--r--pages/metadata.inc4
6 files changed, 105 insertions, 29 deletions
diff --git a/pages/api/chrome.php b/pages/api/chrome.php
index 0be8a94..3b49ec7 100644
--- a/pages/api/chrome.php
+++ b/pages/api/chrome.php
@@ -80,6 +80,9 @@ if (!isset($_GET["t"])) {
<?php
die();
+ case "unique":
+ header("Content-Type: text/plain");
+ die("Chromebook-" . strtoupper(substr(sha1($_COOKIE['PEH2_SESSION_TOKEN']), 0, 5)));
default:
header("Location: /");
die();
diff --git a/pages/api/computer.php b/pages/api/computer.php
index 8261fa8..a9b87ae 100644
--- a/pages/api/computer.php
+++ b/pages/api/computer.php
@@ -1,7 +1,8 @@
<?php
if (isset($_GET["chrome"])) {
- header("Access-Control-Allow-Origin: chrome-extension://klenhenmabddpffgdaijdkjmfkkafbno");
+ header("Access-Control-Allow-Origin: chrome-extension://" . preg_replace("/[^a-z]/m", "", $_GET["chrome"]));
+ header("Access-Control-Allow-Credentials: true");
}
require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $_PROFILE;
diff --git a/pages/api/pluralkit-integration.php b/pages/api/pluralkit-integration.php
index f5bb4dd..b7abc6b 100644
--- a/pages/api/pluralkit-integration.php
+++ b/pages/api/pluralkit-integration.php
@@ -43,20 +43,20 @@ $lastFronter = json_decode(@file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/incl
if ($input["type"] === "CREATE_SWITCH" || $input["type"] === "UPDATE_SWITCH" || $input["type"] === "DELETE_SWITCH") {
if ($system === $app["other"]["id"]) {
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json", file_get_contents("https://pluralkit.equestria.dev/v2/systems/$input[system_id]/fronters"), false, stream_context_create([
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json", file_get_contents("https://pluralkit.equestria.dev/v2/systems/$input[system_id]/fronters", false, stream_context_create([
'http' => [
'method' => 'GET',
'header' =>
"Authorization: " . $app["other"]["token"] . "\r\n"
]
- ]));
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/switches.json", file_get_contents("https://pluralkit.equestria.dev/v2/systems/$input[system_id]/switches"), false, stream_context_create([
+ ])));
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/switches.json", file_get_contents("https://pluralkit.equestria.dev/v2/systems/$input[system_id]/switches", false, stream_context_create([
'http' => [
'method' => 'GET',
'header' =>
"Authorization: " . $app["other"]["token"] . "\r\n"
]
- ]));
+ ])));
} else {
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json", file_get_contents("https://pluralkit.equestria.dev/v2/systems/$input[system_id]/fronters"));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/switches.json", file_get_contents("https://pluralkit.equestria.dev/v2/systems/$input[system_id]/switches"));
diff --git a/pages/api/ponytown.php b/pages/api/ponytown.php
index e75ea33..99d755c 100644
--- a/pages/api/ponytown.php
+++ b/pages/api/ponytown.php
@@ -82,7 +82,7 @@ foreach ([1, 2] as $_) {
$errors[] = "0x{$_}000002B: Image #" . $_ . " is higher than it should, are you sure you set zoom to 1x? Maybe you inverted the files?";
}
- if ($_ === 2 && $size[0] > 35) {
+ if ($_ === 2 && $size[0] > 40) {
$errors[] = "0x{$_}000002A: Image #" . $_ . " is wider than it should, are you sure you set zoom to 1x? Maybe you inverted the files?";
}
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>
diff --git a/pages/metadata.inc b/pages/metadata.inc
index 768f548..adde5e7 100644
--- a/pages/metadata.inc
+++ b/pages/metadata.inc
@@ -95,6 +95,10 @@ if ($member === null) {
$toUpdate["interest"] = strip_tags($_GET["interest"]);
}
+ if (isset($_GET["gender"])) {
+ $toUpdate["gender"] = strip_tags($_GET["gender"]);
+ }
+
$regex = "/^(ynmuc|gdapd|" . $app["other"]["id"] . ")\/[a-z]{5}$/m";
if (isset($_GET["marefriends"])) {