diff options
author | Minteck <contact@minteck.org> | 2023-02-06 22:53:06 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2023-02-06 22:53:06 +0100 |
commit | a0b85ee44c07ac7ffd3f69227069e8835f0f2730 (patch) | |
tree | 4edc61c5a642915b55b8f9a12b4213dd5fca4339 | |
parent | abd342282b48d742cca1740f76d220037fd13800 (diff) | |
download | pluralconnect-a0b85ee44c07ac7ffd3f69227069e8835f0f2730.tar.gz pluralconnect-a0b85ee44c07ac7ffd3f69227069e8835f0f2730.tar.bz2 pluralconnect-a0b85ee44c07ac7ffd3f69227069e8835f0f2730.zip |
Updated 9 files and added assets/uploads/pt-pinkiepie.png (automated)
-rw-r--r-- | api/computer.php | 8 | ||||
-rw-r--r-- | assets/logo/custom.css | 4 | ||||
-rw-r--r-- | assets/uploads/pt-pinkiepie.png | bin | 0 -> 4595 bytes | |||
-rw-r--r-- | comproxy/index.js | 4 | ||||
-rw-r--r-- | includes/fullbanner.inc | 1 | ||||
-rw-r--r-- | includes/member.inc | 154 | ||||
-rw-r--r-- | includes/navigation.inc | 8 | ||||
-rw-r--r-- | includes/search.inc | 2 | ||||
-rw-r--r-- | pages/bitset.inc | 26 | ||||
-rw-r--r-- | pages/computers.inc | 133 |
10 files changed, 200 insertions, 140 deletions
diff --git a/api/computer.php b/api/computer.php index a4ead80..cd065e7 100644 --- a/api/computer.php +++ b/api/computer.php @@ -9,6 +9,14 @@ $json_object = json_decode($request_raw, true); $host = md5($json_object['host']); switch ($_GET['type']) { + case "heartbeat": + if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $_PROFILE['login'] . "-" . $host . ".json")) { + $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $_PROFILE['login'] . "-" . $host . ".json"), true); + $data["date"] = date('c'); + file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $_PROFILE['login'] . "-" . $host . ".json", json_encode($data)); + } + break; + case "screenshot": $id = $json_object['id']; $data = base64_decode($json_object['data']); diff --git a/assets/logo/custom.css b/assets/logo/custom.css index a67eb02..ad308e2 100644 --- a/assets/logo/custom.css +++ b/assets/logo/custom.css @@ -707,4 +707,8 @@ peh-muted { html, body { overflow-x: hidden; +} + +.form-check-input { + filter: invert(1) hue-rotate(180deg); }
\ No newline at end of file diff --git a/assets/uploads/pt-pinkiepie.png b/assets/uploads/pt-pinkiepie.png Binary files differnew file mode 100644 index 0000000..75e9071 --- /dev/null +++ b/assets/uploads/pt-pinkiepie.png diff --git a/comproxy/index.js b/comproxy/index.js index 60b4baa..4a5115e 100644 --- a/comproxy/index.js +++ b/comproxy/index.js @@ -34,7 +34,9 @@ wss.on('connection', function connection(ws, req) { servers[data.id].send(JSON.stringify({ type: "client", - id: ws.id + id: ws.id, + address: req.headers['x-forwarded-for'].split(',')[0].trim(), + name: data.name })); clients[ws.id] = ws; diff --git a/includes/fullbanner.inc b/includes/fullbanner.inc index 30bdf3e..b5a05b1 100644 --- a/includes/fullbanner.inc +++ b/includes/fullbanner.inc @@ -12,7 +12,6 @@ <?php endif; ?> <script src="/assets/logo/banner.js"></script><script>refreshBanner(false, <?= $lang["_french"] ? "true" : "false" ?>)</script> -<br> <?php global $isLoggedIn; if ($isLoggedIn && $memberData["name"] !== "unknown" && $memberData["name"] !== "fusion"): ?> <?php if (!isset($metadata["bitset"])): ?> diff --git a/includes/member.inc b/includes/member.inc index e984861..488ff7f 100644 --- a/includes/member.inc +++ b/includes/member.inc @@ -39,23 +39,24 @@ if ($memberData["name"] === "fusion") { ?> -<div id="member-banner-container" style="width: calc(100% - 300px);height: 65vh;position: fixed;background-image: url('<?= getAsset($systemID, $memberID, "banners") ?>');background-size: cover;background-position: center; top: 0;"> - <div id="member-banner-inner" style="height: 100%;width: 100%;background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.25) 50%, rgba(0,0,0,1) 100%);"></div> +<div id="member-banner-container" style="width: calc(100% - 300px);height: <?= !isset($memberData["banner"]) ? "33vh" : "65vh" ?>;position: fixed;background-image: url('<?= getAsset($systemID, $memberID, !isset($memberData["banner"]) ? "avatars" : "banners") ?>');background-size: cover;background-position: center; top: 0;"> + <div id="member-banner-inner" style="height: 100%;width: 100%;background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.25) 50%, rgba(0,0,0,1) 100%);<?= !isset($memberData["banner"]) ? "backdrop-filter:blur(100px);" : "" ?>"></div> </div> <script> window.onscroll = () => { - document.getElementById("member-banner-container").style.height = (65 - ((window.scrollY / window.screen.availHeight) * 100)) + "vh"; + document.getElementById("member-banner-container").style.height = (<?= !isset($memberData["banner"]) ? "33" : "65" ?> - ((window.scrollY / window.screen.availHeight) * 100)) + "vh"; } </script> <br> <div class="container"> - <div id="member-page" style="background-color: rgba(26,26,26,0.8);border-radius: 10px;padding:20px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);margin-top:30vh;"> + <div id="member-page" style="background-color: rgba(26,26,26,0.8);border-radius: 10px;padding:20px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);margin-top:<?= !isset($memberData["banner"]) ? "15vh" : "30vh" ?>;<?php if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID.html") && !($isLoggedIn && file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID-private.html"))): ?> padding-bottom: 0 !important;<?php endif; ?>"> <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/fullbanner.inc"; ?> <div id="page-content"> <?php if ($memberData["name"] === "unknown"): ?> + <br> <div class="alert alert-secondary"> <p><?= $lang["member"]["unknown"][0] ?></p> <p><?= $lang["member"]["unknown"][1] ?></p> @@ -63,6 +64,7 @@ if ($memberData["name"] === "fusion") { <span><?= $lang["member"]["unknown"][3] ?></span> </div> <?php elseif ($memberData["name"] === "fusion"): ?> + <br> <div class="alert alert-secondary"> <p><?= $lang["member"]["fusion"][0] ?></p> <p><?= $lang["member"]["fusion"][1] ?></p> @@ -77,80 +79,14 @@ if ($memberData["name"] === "fusion") { <?php endif; ?> </div> <?php else: ?> - <?php global $isLoggedIn; if ($isLoggedIn): ?> - <details> - <summary style="list-style: none;"> - <small style="opacity:.5;display:block;">(edit: <a href="/-/metadata/<?= $system ?>/<?= $memberData['name'] ?>">metadata</a>, <a href="/-/edit/<?= $system ?>/<?= $memberData['name'] ?>">public</a>, <a href="/-/edit-private/<?= $system ?>/<?= $memberData['name'] ?>">private</a>)</small> - </summary> - <div class="alert alert-dark"> - <ul style="margin-bottom:0;"> - <li><b>ID:</b> <code><?= $memberID ?></code> (<code><?= $systemID . "/" . $memberID ?></code>, <?= $memberData["name"] ?>)</li> - <li><b>Files:</b> - <ul> - <li><code><?= $_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$memberID.json" ?></code> (<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$memberID.json") ? filesize($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$memberID.json") . " bytes" : "not found" ?>)</li> - <li><code><?= $_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID.html" ?></code> (<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID.html") ? filesize($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID.html") . " bytes" : "not found" ?>)</li> - <li><code><?= $_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID-private.html" ?></code> (<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID-private.html") ? filesize($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID-private.html") . " bytes" : "not found" ?>)</li> - </ul> - </li> - <li><b>Date added:</b> <?= date('l j F Y', strtotime($memberData["created"])) ?> (<?= timeAgo($memberData["created"]) ?>, <code><?= $memberData["created"] ?></code>)</li> - <li><b>Pronouns:</b> <?= implode(", ", getPronounsFromMark($memberData['pronouns'])) ?></li> - <li><b>Pronouns usage:</b> <ul><?php - - foreach (getMemberPronouns($memberData['pronouns']) as $type => $usage) { - if (is_string($usage) && $type !== "color") { - echo("<li><b>" . $type . ":</b> " . $usage . "</li>"); - } - } - - ?></ul></li> - <li><b>Color:</b> <span style="border:1px solid rgba(255, 255, 255, .5);background-color:#<?= $memberData["color"] ?? "ffffff" ?>;display:inline-block;width:16px;height:16px;border-radius:5px;vertical-align: middle;filter: invert(1) hue-rotate(180deg);"></span> <span style="vertical-align: middle;"><code>#<?= $memberData["color"] ?? "ffffff" ?></code></span> - <li><b>Bitset:</b><?php if (isset($metadata["bitset"])): ?> <code><?= str_repeat("0", 48 - strlen(decbin($metadata["bitset"]))) . decbin($metadata["bitset"]) ?></code> (0x<?= str_repeat("0", 12 - strlen(dechex($metadata["bitset"]))) . dechex($metadata["bitset"]) ?>, <?= $metadata["bitset"] ?>)</li><?php else: ?> <span class="text-warning" style="filter:invert(1) hue-rotate(180deg);">Not using bitset; please update.</span><?php endif; ?> - <li><b>Reduced name:</b> <?= getMiniName($memberData["display_name"] ?? $member["name"]) ?></li> - <li><b>Shared memory access:</b> <code><?= $metadata["shared_memory"] ?></code> (<?= $metadata["shared_memory"] === 2 ? "Full direct access" : ($metadata["shared_memory"] === 0 ? "No direct access" : "Partial direct access") ?>)</li> - <li><b>Protector:</b> <code><?= $metadata["protector"] ? "1" : "0" ?></code> (<?= $metadata["protector"] ? "Yes" : "No" ?>)</li> - <li><b>Little:</b> <code><?= $metadata["little"] ?></code> (<?= $metadata["little"] === 2 ? "Is a little" : ($metadata["little"] === 1 ? "Is an age regressor" : ($metadata["little"] === 3 ? "Not a little, but younger" : "No")) ?>)</li> - <li><b>Relations count:</b> <code><?= count($metadata["marefriends"]) + count($metadata["sisters"]) ?></code></li> - <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.inc"; $score = calculateScore($metadata, $memberData["display_name"] ?? $memberData["name"]); ?> - <li> - <b>Score breakdown:</b> <code><?= $score["total"] ?></code> - <ul><?php - - foreach ($metadata as $type => $usage) { - if (is_string($usage)) { - echo("<li><b>" . $type . ":</b> " . $usage . "</li>"); - } else if (is_array($usage)) { - if (count($usage) === 0) { - echo("<li><b>" . $type . ":</b> []</li>"); - } else { - echo("<li><b>" . $type . ":</b><ul>"); - - foreach ($usage as $key => $item) { - if (is_string($item)) { - echo("<li><b>" . $key . ":</b> " . $item . "</li>"); - } else { - echo("<li><b>" . $key . ":</b> " . json_encode($item, JSON_UNESCAPED_SLASHES) . "</li>"); - } - } - - echo("</ul></li>"); - } - } else { - echo("<li><b>" . $type . ":</b> " . json_encode($usage, JSON_UNESCAPED_SLASHES) . "</li>"); - } - } - - ?></ul></li> - </ul> - </div> - </details> - <?php endif; ?> - <?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID-private.html") && $isLoggedIn): ?> + <br> <?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID-private.html") ?> - <hr> + <?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID.html")): ?><hr><?php endif; ?> <?php endif; ?> <?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID.html")): ?> + <?php if (!$isLoggedIn || !file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID-private.html")) echo("<br>"); ?> <?= file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID.html") ?> <?php endif; ?> <?php endif; ?> @@ -158,4 +94,76 @@ if ($memberData["name"] === "fusion") { </div> </div> +<div class="container"> + <?php global $isLoggedIn; if ($isLoggedIn): ?> + <hr> + + <details> + <summary style="list-style: none;"> + <small style="opacity:.5;display:block;">(edit: <a href="/-/metadata/<?= $system ?>/<?= $memberData['name'] ?>">metadata</a>, <a href="/-/edit/<?= $system ?>/<?= $memberData['name'] ?>">public</a>, <a href="/-/edit-private/<?= $system ?>/<?= $memberData['name'] ?>">private</a>)</small> + </summary> + <div class="alert alert-dark"> + <ul style="margin-bottom:0;"> + <li><b>ID:</b> <code><?= $memberID ?></code> (<code><?= $systemID . "/" . $memberID ?></code>, <?= $memberData["name"] ?>)</li> + <li><b>Files:</b> + <ul> + <li><code><?= $_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$memberID.json" ?></code> (<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$memberID.json") ? filesize($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/$memberID.json") . " bytes" : "not found" ?>)</li> + <li><code><?= $_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID.html" ?></code> (<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID.html") ? filesize($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID.html") . " bytes" : "not found" ?>)</li> + <li><code><?= $_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID-private.html" ?></code> (<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID-private.html") ? filesize($_SERVER['DOCUMENT_ROOT'] . "/includes/data/content/$memberID-private.html") . " bytes" : "not found" ?>)</li> + </ul> + </li> + <li><b>Date added:</b> <?= date('l j F Y', strtotime($memberData["created"])) ?> (<?= timeAgo($memberData["created"]) ?>, <code><?= $memberData["created"] ?></code>)</li> + <li><b>Pronouns:</b> <?= implode(", ", getPronounsFromMark($memberData['pronouns'])) ?></li> + <li><b>Pronouns usage:</b> <ul><?php + + foreach (getMemberPronouns($memberData['pronouns']) as $type => $usage) { + if (is_string($usage) && $type !== "color") { + echo("<li><b>" . $type . ":</b> " . $usage . "</li>"); + } + } + + ?></ul></li> + <li><b>Color:</b> <span style="border:1px solid rgba(255, 255, 255, .5);background-color:#<?= $memberData["color"] ?? "ffffff" ?>;display:inline-block;width:16px;height:16px;border-radius:5px;vertical-align: middle;filter: invert(1) hue-rotate(180deg);"></span> <span style="vertical-align: middle;"><code>#<?= $memberData["color"] ?? "ffffff" ?></code></span> + <li><b>Bitset:</b><?php if (isset($metadata["bitset"])): ?> <code><?= str_repeat("0", 48 - strlen(decbin($metadata["bitset"]))) . decbin($metadata["bitset"]) ?></code> (0x<?= str_repeat("0", 12 - strlen(dechex($metadata["bitset"]))) . dechex($metadata["bitset"]) ?>, <?= $metadata["bitset"] ?>)</li><?php else: ?> <span class="text-warning" style="filter:invert(1) hue-rotate(180deg);">Not using bitset; please update.</span><?php endif; ?> + <li><b>Reduced name:</b> <?= getMiniName($memberData["display_name"] ?? $member["name"]) ?></li> + <li><b>Shared memory access:</b> <code><?= $metadata["shared_memory"] ?></code> (<?= $metadata["shared_memory"] === 2 ? "Full direct access" : ($metadata["shared_memory"] === 0 ? "No direct access" : "Partial direct access") ?>)</li> + <li><b>Protector:</b> <code><?= $metadata["protector"] ? "1" : "0" ?></code> (<?= $metadata["protector"] ? "Yes" : "No" ?>)</li> + <li><b>Little:</b> <code><?= $metadata["little"] ?></code> (<?= $metadata["little"] === 2 ? "Is a little" : ($metadata["little"] === 1 ? "Is an age regressor" : ($metadata["little"] === 3 ? "Not a little, but younger" : "No")) ?>)</li> + <li><b>Relations count:</b> <code><?= count($metadata["marefriends"]) + count($metadata["sisters"]) ?></code></li> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.inc"; $score = calculateScore($metadata, $memberData["display_name"] ?? $memberData["name"]); ?> + <li> + <b>Score breakdown:</b> <code><?= $score["total"] ?></code> + <ul><?php + + foreach ($metadata as $type => $usage) { + if (is_string($usage)) { + echo("<li><b>" . $type . ":</b> " . $usage . "</li>"); + } else if (is_array($usage)) { + if (count($usage) === 0) { + echo("<li><b>" . $type . ":</b> []</li>"); + } else { + echo("<li><b>" . $type . ":</b><ul>"); + + foreach ($usage as $key => $item) { + if (is_string($item)) { + echo("<li><b>" . $key . ":</b> " . $item . "</li>"); + } else { + echo("<li><b>" . $key . ":</b> " . json_encode($item, JSON_UNESCAPED_SLASHES) . "</li>"); + } + } + + echo("</ul></li>"); + } + } else { + echo("<li><b>" . $type . ":</b> " . json_encode($usage, JSON_UNESCAPED_SLASHES) . "</li>"); + } + } + + ?></ul></li> + </ul> + </div> + </details> + <?php endif; ?> +</div> + <?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>
\ No newline at end of file diff --git a/includes/navigation.inc b/includes/navigation.inc index 3db5d21..b61c069 100644 --- a/includes/navigation.inc +++ b/includes/navigation.inc @@ -270,7 +270,7 @@ $navigation_cloudburst = [ ] ] ], - "subsystems" => [ + /*"subsystems" => [ "name" => $lang["navigation"]["subsystems"], "minimal" => false, "items" => array_map(function ($subsystem) { @@ -284,7 +284,7 @@ $navigation_cloudburst = [ "stepped" => null ]; }, $cloudburst_subsystemsNotMember) - ], + ],*/ "members" => [ "name" => $lang["navigation"]["members"], "minimal" => false, @@ -342,7 +342,7 @@ $navigation_raindrops = [ ] ] ], - "subsystems" => [ + /*"subsystems" => [ "name" => $lang["navigation"]["subsystems"], "minimal" => false, "items" => array_map(function ($subsystem) { @@ -356,7 +356,7 @@ $navigation_raindrops = [ "stepped" => null ]; }, $raindrops_subsystemsNotMember) - ], + ],*/ "members" => [ "name" => $lang["navigation"]["members"], "minimal" => false, diff --git a/includes/search.inc b/includes/search.inc index c125556..0f0a868 100644 --- a/includes/search.inc +++ b/includes/search.inc @@ -8,7 +8,7 @@ <div id="global-search-results" style="border-bottom-left-radius: 15px; border-bottom-right-radius: 15px; border-top-style: none; border-right: 1px solid rgba(100, 100, 100, .5); border-bottom: 1px solid rgba(100, 100, 100, .5); border-left: 1px solid rgba(100, 100, 100, .5); width: 768px; max-width: 90vw; height: 400px; max-height: calc(90vh - 60px);"> <div id="global-search-intro" style="display: flex; align-items: center; justify-content: center; height: 100%; text-align: center;"> <div style="opacity: .5;"> - <img src="/assets/logo/logo.png" style="width: 64px; height: 64px; margin-bottom: 10px;"> + <img src="/assets/logo/newlogo.png" style="width: 64px; height: 64px; margin-bottom: 10px;"> <p><?= $lang["search"]["placeholder"] ?></p> </div> </div> diff --git a/pages/bitset.inc b/pages/bitset.inc index b16a23e..bd8412b 100644 --- a/pages/bitset.inc +++ b/pages/bitset.inc @@ -322,7 +322,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; <option value="3">Can eat everything</option> </select> </td> - </tr><tr> + </tr><tr style="display:none;"> <td style="padding-right: 10px; text-align: right;"> <b>Little/younger: </b> </td> @@ -395,51 +395,51 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; </table> <p> <label style="margin-bottom:5px;"> - <input type="checkbox" id="value-5" onchange="updateFromSelection();"> + <input class="form-check-input" type="checkbox" id="value-5" onchange="updateFromSelection();"> Protector </label><br> <label style="margin-bottom:5px;"> - <input type="checkbox" id="value-20" onchange="updateFromSelection();"> + <input class="form-check-input" type="checkbox" id="value-20" onchange="updateFromSelection();"> Leader </label><br> <label style="margin-bottom:5px;"> - <input type="checkbox" id="value-6" onchange="updateFromSelection();"> + <input class="form-check-input" type="checkbox" id="value-6" onchange="updateFromSelection();"> Fictive </label><br> <label style="margin-bottom:5px;"> - <input type="checkbox" id="value-26" onchange="updateFromSelection();"> + <input class="form-check-input" type="checkbox" id="value-26" onchange="updateFromSelection();"> Enable sexual features (for ponies below 16) </label><br> <label style="margin-bottom:5px;"> - <input type="checkbox" id="value-18" onchange="updateFromSelection();"> + <input class="form-check-input" type="checkbox" id="value-18" onchange="updateFromSelection();"> Preemptive sexual consent </label><br> <label style="margin-bottom:5px;"> - <input type="checkbox" id="value-9" onchange="updateFromSelection();"> + <input class="form-check-input" type="checkbox" id="value-9" onchange="updateFromSelection();"> Robot </label><br> <label style="margin-bottom:5px;"> - <input type="checkbox" id="value-10" onchange="updateFromSelection();"> + <input class="form-check-input" type="checkbox" id="value-10" onchange="updateFromSelection();"> Plush </label><br> <label style="margin-bottom:5px;"> - <input type="checkbox" id="value-22" onchange="updateFromSelection();"> + <input class="form-check-input" type="checkbox" id="value-22" onchange="updateFromSelection();"> Polyamorous (romantic) </label><br> <label style="margin-bottom:5px;"> - <input type="checkbox" id="value-23" onchange="updateFromSelection();"> + <input class="form-check-input" type="checkbox" id="value-23" onchange="updateFromSelection();"> Polyamorous (sexual) </label><br> <label style="margin-bottom:5px;"> - <input type="checkbox" id="value-16" onchange="updateFromSelection();"> + <input class="form-check-input" type="checkbox" id="value-16" onchange="updateFromSelection();"> Non verbal in real life </label><br> <label style="margin-bottom:5px;"> - <input type="checkbox" id="value-17" onchange="updateFromSelection();"> + <input class="form-check-input" type="checkbox" id="value-17" onchange="updateFromSelection();"> Fronts less frequently </label><br> <label style="margin-bottom:5px;"> - <input type="checkbox" id="value-21" onchange="updateFromSelection();"> + <input class="form-check-input" type="checkbox" id="value-21" onchange="updateFromSelection();"> Persecutor </label><br> </p> diff --git a/pages/computers.inc b/pages/computers.inc index 1541fa6..0d41a23 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; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $pagename; global $_USER; $computer = []; $parts = explode("/", $pagename); @@ -38,6 +38,21 @@ if (count($parts) === 2 || count($parts) === 3) { ?> +<script> + window.userName = "<?php + + $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($_PROFILE["login"] === "raindrops" ? "gdapd" : "ynmuc") . "/fronters.json"), true); + $name = $_PROFILE["login"] === "raindrops" ? "Raindrops System" : "Cloudburst Sys"; + + if (count($fronters["members"]) > 0) { + $name = $fronters["members"][0]["display_name"] ?? $fronters["members"][0]["name"]; + } + + echo($name); + + ?>"; +</script> + <br> <div class="container"> <?php if (isset($parts[2]) && !isset($parts[3])): $id = $parts[2]; ?> @@ -47,6 +62,13 @@ if (count($parts) === 2 || count($parts) === 3) { <a href="/-/computers" class="small btn btn-outline-light" style="float:right;margin-top:5px;vertical-align:middle;opacity:1 !important; color:white;">Back</a> </h2> + <?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> + Update this computer to run Luna 1.1.0 or newer and try again. + </div> + <?php else: ?> <h4 style="margin-top: 20px;margin-bottom: 10px;">Overview</h4> <style> @media (max-width: 700px) { @@ -275,33 +297,11 @@ if (count($parts) === 2 || count($parts) === 3) { </tbody> </table> - <h4 style="margin-top: 20px;margin-bottom: 10px;" id="screens">Screens</h4> + <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> + 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> - <div style="display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 10px;"> - <?php foreach ($computer["screens"] as $screen): ?> - <div class="card"> - <div class="card-body"> - <img style="width: 100%;" src="https://ponies.equestria.horse/api/data?f=computers/screens/<?= $id . "-" . $screen["id"] ?>.jpg"> - </div> - </div> - <?php endforeach; ?> - </div> - - <h4 style="margin-top: 20px;margin-bottom: 10px;" id="windows">Windows</h4> - <div style="display: grid; grid-template-columns: repeat(3, 1fr); grid-gap: 10px;"> - <?php foreach ($computer["windows"] as $window): ?> - <div class="card"> - <div class="card-body" style="display: flex; align-items: center;"> - <div style="width: 100%;"> - <img style="max-width: 100%; max-height: 100%;" src="https://ponies.equestria.horse/api/data?f=computers/windows/<?= $id . "-" . sha1($window["gid"]) ?>.jpg"> - <div style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden; width: 100%; text-align: center; margin-top: 7px; margin-bottom: -7px;"><?= $window["name"] ?></div> - </div> - </div> - </div> - <?php endforeach; ?> - </div> <h4 style="margin-top: 20px;margin-bottom: 10px;">Sessions</h4> <table class="table"> @@ -534,42 +534,60 @@ if (count($parts) === 2 || count($parts) === 3) { <?php endforeach; ?> </tbody> </table> + <?php endif; ?> </div> <?php elseif (isset($parts[3]) && $parts[3] === "control"): $id = $parts[2]; ?> + <?php if ($computer["luna_version"] !== "1.0.0"): ?> <div> <h2> <span style="vertical-align: middle;">Remote controlling <?= $computer["host"] ?></span> <a href="/-/computers/<?= $id ?>" class="small btn btn-outline-light" style="float:right;margin-top:5px;vertical-align:middle;opacity:1 !important; color:white;">Back</a> </h2> - <div style="display: flex; align-items: center;"> - <img id="display" style="max-width: 100%; max-height: 100%; height: 100%; width: 100%; opacity: .5" src="https://ponies.equestria.horse/api/data?f=computers/screens/<?= $id . "-" . $computer["screens"][0]["id"] ?>.jpg"> + <div id="remote-control-load"> + <img src="/assets/editor/load.svg" style="width: 36px; vertical-align: middle;" id="rc-loader-img" alt=""><span style="vertical-align: middle;" id="remote-control-load-msg">Initialising connection...</span></div> + </div> + + <div class="alert alert-danger" id="remote-control-error" style="display:none;"> + <b>Unable to connect:</b> <span id="remote-control-error-message">Error</span> </div> - <div id="commands" style="background: #151515; border: 1px solid #333; margin-top: 10px; border-radius: 10px; font-family: 'JetBrains Mono', monospace; font-size: 14px;"> - <div id="output" style="height: 200px; padding: 10px 20px; overflow: auto;"> - <pre id="output-text"></pre> - <div id="loader" style="display: none;"> - <img src="/assets/editor/load.svg" style="width: 36px; vertical-align: middle; margin-left: -8px; margin-top: -8px;" id="loader-img" alt=""> - <span id="loader-time" style="vertical-align: middle; opacity: .5; display: inline-block; margin-top: -8px; margin-left: -8px;"> + <div id="remote-control-app" style="display: none;"> + <div style="display: flex; align-items: center;"> + <img id="display" style="max-width: 100%; max-height: 100%; height: 100%; width: 100%; opacity: .5" src="https://ponies.equestria.horse/api/data?f=computers/screens/<?= $id . "-" . $computer["screens"][0]["id"] ?>.jpg"> + </div> + + <div id="commands" style="background: #151515; border: 1px solid #333; margin-top: 10px; border-radius: 10px; font-family: 'JetBrains Mono', monospace; font-size: 14px;"> + <div id="output" style="height: 200px; padding: 10px 20px; overflow: auto;"> + <pre id="output-text"></pre> + <div id="loader" style="display: none;"> + <img src="/assets/editor/load.svg" style="width: 36px; vertical-align: middle; margin-left: -8px; margin-top: -8px;" id="loader-img" alt=""> + <span id="loader-time" style="vertical-align: middle; opacity: .5; display: inline-block; margin-top: -8px; margin-left: -8px;"> <span id="loader-time-inner"></span> <span id="loader-time-stopper"> | <a id="loader-time-stopper-link" style="cursor: pointer; text-decoration: underline;" onclick="stopCommand();">Stop</a> </span> </span> + </div> + </div> + <div id="entry" style="border-top: 1px solid #333;"> + <input type="text" id="command-entry" placeholder="Enter a command" style="width: 100%; color: white; background: transparent; border: none; padding: 10px 20px; outline: none;"> </div> - </div> - <div id="entry" style="border-top: 1px solid #333;"> - <input type="text" id="command-entry" placeholder="Enter a command" style="width: 100%; color: white; background: transparent; border: none; padding: 10px 20px; outline: none;"> </div> </div> <script> + function setLoadMessage(msg) { + document.getElementById("remote-control-load-msg").innerText = msg; + } + function stopCommand() { ws.send(JSON.stringify({ type: "halt" })); } + + let rejected = false; function scrollToBottom() { document.getElementById("output").scrollTop = document.getElementById("output").scrollHeight; @@ -601,22 +619,38 @@ if (count($parts) === 2 || count($parts) === 3) { window.commandRunInterval = null; function connect() { + setLoadMessage("Connecting to server..."); window.ws = new WebSocket("wss://ponies.equestria.horse/_Computers-RemoteControl-EntryPoint/socket"); window.baseLatency = null; ws.addEventListener('open', (data) => { + setLoadMessage("Authenticating..."); console.log(data); + ws.send(JSON.stringify({ type: "client", id: "<?= $id ?>", + name: window.userName, token: "<?= $_COOKIE['PEH2_SESSION_TOKEN'] ?>" - })) + })); + + setLoadMessage("Waiting for the user to accept..."); }); ws.addEventListener('message', async (_data) => { + setLoadMessage("Loading..."); let data = JSON.parse(await (_data.data.text())); + if (data.rejected) { + document.getElementById("remote-control-load").style.display = "none"; + document.getElementById("remote-control-error").style.display = ""; + document.getElementById("remote-control-error-message").innerText = "The user has rejected the connection request."; + rejected = true; + } + if (data.type === "image") { + setLoadMessage("Loading initial image..."); + document.getElementById("display").style.opacity = "1"; document.getElementById("display").src = data.url; @@ -638,6 +672,9 @@ if (count($parts) === 2 || count($parts) === 3) { } else { window.baseLatency = Math.abs(new Date().getTime() - data.time); } + + document.getElementById("remote-control-load").style.display = "none"; + document.getElementById("remote-control-app").style.display = ""; } else if (data.type === "command_stop") { if (data.code !== 0) { if (data.signal) { @@ -655,6 +692,7 @@ if (count($parts) === 2 || count($parts) === 3) { document.getElementById("command-entry").disabled = false; document.getElementById("loader").style.display = "none"; scrollToBottom(); + document.getElementById("command-entry").focus(); } else if (data.type === "command_start") { document.getElementById("loader-time").style.display = "inline-block"; document.getElementById("loader-time-inner").innerText = ""; @@ -680,9 +718,14 @@ if (count($parts) === 2 || count($parts) === 3) { document.getElementById("display").style.opacity = "0.5"; console.log(data); - setTimeout(() => { - connect(); - }, 1000); + if (!rejected) { + setLoadMessage("Connection error, retrying in 1 second."); + + setTimeout(() => { + setLoadMessage("Retrying connection..."); + connect(); + }, 1000); + } }); } @@ -776,16 +819,12 @@ if (count($parts) === 2 || count($parts) === 3) { window.controlling = false; } </script> + <?php endif; ?> <?php else: ?> <div> <h2>Computers</h2> <p>Click on a computer to view information about it (open windows, installed apps, ...).</p> - <div class="alert alert-danger"> - <b>Luna is not for production.</b> The Luna program version 1.0.0 is considered malware and must not be used on any computer other than a development machine. - </div> - - <!-- <ul class="list-group"> <?php foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata"), function ($i) { return !str_starts_with($i, "."); @@ -803,7 +842,7 @@ if (count($parts) === 2 || count($parts) === 3) { </div> </a> <?php endforeach; ?> - </ul>--> + </ul> </div> <?php endif; ?> </div> |