summaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-04-20 16:20:07 +0200
committerRaindropsSys <contact@minteck.org>2023-04-20 16:20:07 +0200
commitb4bcb0912c5fe1c7f00c7ac76e5b67620781d3cc (patch)
tree027238ccdf43719ae4bbb65eedeaf9823fff6471 /pages
parentb484fc41a94e18f679f2494d598ac3d0ae72e3f8 (diff)
downloadpluralconnect-b4bcb0912c5fe1c7f00c7ac76e5b67620781d3cc.tar.gz
pluralconnect-b4bcb0912c5fe1c7f00c7ac76e5b67620781d3cc.tar.bz2
pluralconnect-b4bcb0912c5fe1c7f00c7ac76e5b67620781d3cc.zip
Updated 12 files and added 3 files (automated)
Diffstat (limited to 'pages')
-rw-r--r--pages/api/computername.php10
-rw-r--r--pages/api/docs.php1
-rw-r--r--pages/byspecies.inc2
-rw-r--r--pages/computers.inc34
-rw-r--r--pages/docs.inc38
-rw-r--r--pages/relations.inc37
-rw-r--r--pages/toys.inc2
7 files changed, 96 insertions, 28 deletions
diff --git a/pages/api/computername.php b/pages/api/computername.php
new file mode 100644
index 0000000..1a719b0
--- /dev/null
+++ b/pages/api/computername.php
@@ -0,0 +1,10 @@
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $_PROFILE;
+if (!$isLoggedIn) header("Location: /-/login") and die();
+
+$names = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/names.json"), true);
+$names[$_GET["id"]] = $_GET["name"];
+file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/names.json", json_encode($names));
+
+die(); \ No newline at end of file
diff --git a/pages/api/docs.php b/pages/api/docs.php
index 3d11831..a60a6e6 100644
--- a/pages/api/docs.php
+++ b/pages/api/docs.php
@@ -22,6 +22,7 @@ if (isset($select)) {
if ($json_object["content"]) $data["contents"] = $json_object["content"];
if ($json_object["name"]) $data["name"] = $json_object["name"];
+if ($json_object["explicit"]) $data["nsfw"] = $json_object["explicit"];
if ($json_object["category"]) $data["category"] = trim($json_object["category"]) !== "" && trim($json_object["category"]) !== "Unsorted" && trim($json_object["category"]) !== "unsorted" && trim($json_object["category"]) !== "/no" && trim($json_object["category"]) !== "Unsort" && trim($json_object["category"]) !== "unsort" ? $json_object["category"] : null;
$data["last"]["date"] = time();
diff --git a/pages/byspecies.inc b/pages/byspecies.inc
index d2a2930..e3bdcc4 100644
--- a/pages/byspecies.inc
+++ b/pages/byspecies.inc
@@ -1,4 +1,4 @@
-<?php global $system; global $systemCommonName; global $lang; global $pages; global $systemID; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:species"]["name"][$lang["_name"]] . " · " . $systemCommonName; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; global $travelling;
+<?php global $system; global $systemCommonName; global $lang; global $pages; global $systemID; $pages = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/pages.json"), true); $title = $pages["s:species"]["name"][$lang["_name"]]; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; global $travelling;
$members = scoreOrderGlobal();
diff --git a/pages/computers.inc b/pages/computers.inc
index 7b25133..2e493fa 100644
--- a/pages/computers.inc
+++ b/pages/computers.inc
@@ -26,6 +26,7 @@ if (isset($parts[2]) && $parts[2] !== "control") {
die();
}
+$names = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/names.json"), true);
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc';
$parts = array_values(array_filter($parts, function ($i) {
@@ -62,7 +63,19 @@ if (str_ends_with($computer["os"], "unknown")) {
<?php if (isset($parts[2]) && !isset($parts[3])): $id = $parts[2]; ?>
<div>
<h2>
- <span style="vertical-align: middle;"><?= $computer["host"] ?></span>
+ <script>
+ async function updateComputerName() {
+ let name = document.getElementById("computer_name").innerText.trim();
+
+ if (name === "") {
+ name = "<?= $computer["host"] ?>";
+ document.getElementById("computer_name").innerText = name;
+ } else {
+ await fetch("/api/computername?id=<?= $id ?>&name=" + encodeURIComponent(name));
+ }
+ }
+ </script>
+ <span id="computer_name" style="vertical-align: middle;" contenteditable="true" onkeyup="updateComputerName();"><?= $names[$id] ?? $computer["host"] ?></span>
<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>
@@ -273,7 +286,7 @@ if (str_ends_with($computer["os"], "unknown")) {
</tr>
<tr>
<td style="padding-right: 10px; text-align: right;"><b>System:</b></td>
- <td><?= $computer["os_info"]["distro"] ?> <?= $computer["os_info"]["release"] === "unknown" ? "" : $computer["os_info"]["release"] ?></td>
+ <td><?= $computer["os_info"]["distro"] ?> <?= $computer["os_info"]["release"] === "unknown" || $computer["os_info"]["release"] === "rolling" ? "" : $computer["os_info"]["release"] ?></td>
</tr>
<tr>
<td style="padding-right: 10px; text-align: right;"><b>CPU architecture:</b></td>
@@ -871,16 +884,25 @@ if (str_ends_with($computer["os"], "unknown")) {
<p>Click on a device to view information about it</p>
<ul class="list-group">
- <?php foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata"), function ($i) {
+ <?php
+
+ $list = 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];
+ });
+ uasort($list, function ($a, $b) {
+ $ca = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $a), true);
+ $cb = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $b), true);
+ return strtotime($cb["date"]) - strtotime($ca["date"]);
+ });
+
+ foreach ($list 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;">
+ <a href="/-/computers/<?= $id ?>" class="list-group-item list-group-item-action" style="display: grid; grid-template-columns: 100px 1fr; grid-column-gap: 10px; <?php if (timeAgo($computer["date"]) !== "now"): ?>opacity: .5;<?php endif; ?>">
<div style="display: flex; align-items: center;">
<img style="width: 100px;" src="<?php
@@ -902,7 +924,7 @@ if (str_ends_with($computer["os"], "unknown")) {
</div>
<div style="display: flex; align-items: center;">
<div>
- <b><?= $computer["host"] ?></b><br>
+ <b><?= $names[$id] ?? $computer["host"] ?></b><br>
<?php
if (str_starts_with($computer["os"], "Google ")) {
diff --git a/pages/docs.inc b/pages/docs.inc
index a94f92e..84d9d87 100644
--- a/pages/docs.inc
+++ b/pages/docs.inc
@@ -36,7 +36,12 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc';
function showDocument($item) { ?>
<div style="display: grid; grid-template-columns: 2fr repeat(3, 1fr);">
- <?= $item["name"] ?>&nbsp;
+ <span>
+ <?= $item["name"] ?>
+ <?php if ($item["nsfw"]): ?>
+ <span class="badge bg-danger rounded-pill">NSFW</span>
+ <?php endif; ?>
+ </span>
<?php if (str_starts_with(strip_tags($item["contents"]), "/delete")): ?>
<span class="badge bg-warning rounded-pill text-black" style="width: max-content;">Deleting in <?= round((($item["last"]["date"] + 86400) - time()) / 3600) ?> hours</span>
<?php else: ?>
@@ -53,11 +58,15 @@ function showDocument($item) { ?>
<div class="container">
<div>
<?php if (isset($data)): ?><div id="page-content">
+ <?php if ($data["nsfw"]): ?><script>requestExplicit("back");</script><?php endif; ?>
<h2>
<span contenteditable="true" id="document-name" style="outline: none;"><?= $data["name"] ?></span>
<a href="/-/docs" class="small btn btn-outline-light" style="float:right;margin-top:5px;vertical-align:middle;opacity:1 !important; color:white;">Back</a>
</h2>
- <p><b>Category:</b> <span id="category" contenteditable="true" style="outline: none;"><?= $data["category"] ?? "Unsorted" ?></span></p>
+ <p><b>Category:</b> <span id="category" contenteditable="true" style="outline: none;"><?= $data["category"] ?? "Unsorted" ?></span> · <label style="margin-bottom:5px;">
+ <input <?= $data["nsfw"] ? "checked" : "" ?> class="form-check-input" type="checkbox" id="explicit">
+ Explicit
+ </label></p>
<p>
<?php if ($data["last"]["date"] === 0): ?>
Last modified <span id="last-edit-time" class="relative-time" data-relative-timestamp="">never</span>
@@ -139,8 +148,8 @@ function showDocument($item) { ?>
<script>
let titleBase = "<?= $titleBase ?>";
- let lastSavedData = editor.getData();
- let lastFetchedData = editor.getData();
+ let lastSavedData = getData();
+ let lastFetchedData = getData();
let timeSinceLastModified = 0;
let saving = false;
@@ -156,7 +165,7 @@ function showDocument($item) { ?>
try {
await window.fetch("/api/docs?id=<?= $_documentId ?>", {
method: "POST",
- body: JSON.stringify({ content: data, name: document.getElementById("document-name").innerText, category: document.getElementById("category").innerText })
+ body: JSON.stringify({ content: data, name: document.getElementById("document-name").innerText, category: document.getElementById("category").innerText, explicit: document.getElementById("explicit").checked })
});
document.getElementById("last-edit-time").setAttribute("data-relative-timestamp", (new Date().getTime() / 1000).toFixed(0));
if (document.getElementById("last-edit-author")) document.getElementById("last-edit-author").outerHTML = "";
@@ -166,7 +175,7 @@ function showDocument($item) { ?>
document.getElementById("editor-save-status").classList.add("text-muted");
document.getElementById("editor-save-status").classList.remove("text-warning");
document.getElementById("editor-save-status").classList.remove("text-primary");
- lastSavedData = data;
+ lastSavedData = getData();
saving = false;
} catch (e) {
console.error(e);
@@ -181,23 +190,32 @@ function showDocument($item) { ?>
document.onclick = async () => {
if (saving) return;
- if (editor.getData() !== lastSavedData) {
+ if (getData() !== lastSavedData) {
await save();
}
}
+ function getData() {
+ return JSON.stringify({
+ document: editor.getData(),
+ name: document.getElementById("document-name").innerText,
+ category: document.getElementById("category").innerText,
+ explicit: document.getElementById("explicit").checked
+ });
+ }
+
setInterval(async () => {
if (saving) return;
- if (editor.getData() !== lastSavedData) {
+ if (getData() !== lastSavedData) {
document.getElementById("editor-save-status").innerHTML = "Modified";
document.getElementById("editor-save-status").classList.remove("text-danger");
document.getElementById("editor-save-status").classList.remove("text-muted");
document.getElementById("editor-save-status").classList.add("text-warning");
document.getElementById("editor-save-status").classList.remove("text-primary");
- if (editor.getData() !== lastFetchedData) {
- lastFetchedData = editor.getData();
+ if (getData() !== lastFetchedData) {
+ lastFetchedData = getData();
timeSinceLastModified = 0;
} else {
timeSinceLastModified++;
diff --git a/pages/relations.inc b/pages/relations.inc
index 7a05def..f872a2f 100644
--- a/pages/relations.inc
+++ b/pages/relations.inc
@@ -1,6 +1,6 @@
<?php
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages;
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; global $isLowerLoggedIn; global $app;
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc';
?>
@@ -10,7 +10,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc';
<div id="page-content">
<h2><?= $pages["relations"]["name"][$lang["_name"]] ?></h2>
<?php foreach (withCaretakersDown(scoreOrderGlobal()) as $member): ?>
- <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 1.5fr 2fr 2fr 2fr;">
+ <div class="relation" style="background-color:rgba(255, 255, 255, .1);margin-bottom:10px;padding:10px;border-radius:10px;display:grid;grid-template-columns: 2fr 2.25fr 2.25fr 2.25fr 2.25fr;">
<a class="relation-intro" style="background-color:rgba(255, 255, 255, .05);border-right:1px solid rgba(255, 255, 255, .1);margin:-10px;padding:10px;border-top-left-radius:10px;border-bottom-left-radius:10px;color: white;text-decoration: none;" href="/<?= $member["name"] ?>">
<img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?>
</a>
@@ -24,9 +24,9 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc';
<?php if (count($member["_metadata"]["marefriends"]) === 0): ?>
<span class="text-muted"><?= $lang["relations"]["no"] ?></span>
<?php else: ?>
- <?php foreach ($member["_metadata"]["marefriends"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); ?>
+ <?php foreach ($member["_metadata"]["marefriends"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)): ?>
<a title="<?= getMiniName($marefriend["display_name"] ?? $marefriend["name"]) ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a>
- <?php endforeach; ?>
+ <?php endif; endforeach; ?>
<?php endif; ?>
</td>
</tr></tbody>
@@ -41,15 +41,14 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc';
<?php if (count($member["_metadata"]["sisters"]) === 0): ?>
<span class="text-muted"><?= $lang["relations"]["no"] ?></span>
<?php else: ?>
- <?php foreach ($member["_metadata"]["sisters"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); ?>
+ <?php foreach ($member["_metadata"]["sisters"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)): ?>
<a title="<?= getMiniName($marefriend["display_name"] ?? $marefriend["name"]) ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a>
- <?php endforeach; ?>
+ <?php endif; endforeach; ?>
<?php endif; ?>
</td>
</tr></tbody>
</table>
- <?php if ($member["_metadata"]["little"] >= 2): ?>
<table class="relation-item relation-item-caretakers" style="padding:0 20px;">
<tbody><tr>
<td style="width: 50%;text-align:right;">
@@ -59,14 +58,30 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc';
<?php if (count($member["_metadata"]["caretakers"]) === 0): ?>
<span class="text-muted"><?= $lang["relations"]["no"] ?></span>
<?php else: ?>
- <?php foreach ($member["_metadata"]["caretakers"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); ?>
- <a title="<?= getMiniName($marefriend["display_name"] ?? $marefriend["name"]) ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a>
- <?php endforeach; ?>
+ <?php foreach ($member["_metadata"]["caretakers"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)): ?>
+ <a title="<?= $marefriend["display_name"] ?? $marefriend["name"] ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a>
+ <?php endif; endforeach; ?>
+ <?php endif; ?>
+ </td>
+ </tr></tbody>
+ </table>
+
+ <table class="relation-item relation-item-friends" style="padding:0 20px;">
+ <tbody><tr>
+ <td style="width: 50%;text-align:right;">
+ <b style="padding-right:5px;">Friends:</b><span class="list-separator-mobile"><br></span>
+ </td>
+ <td style="width: 50%;text-align:left;">
+ <?php if (!isset($member["_metadata"]["friends"]) || count($member["_metadata"]["friends"]) === 0): ?>
+ <span class="text-muted"><?= $lang["relations"]["no"] ?></span>
+ <?php else: ?>
+ <?php foreach ($member["_metadata"]["friends"] as $id): $mfSystem = explode("/", $id)[0]; $marefriend = getSystemMember(explode("/", $id)[0], explode("/", $id)[1]); if (!($mfSystem === $app["other"]["id"] && !$isLoggedIn && !$isLowerLoggedIn)): ?>
+ <a title="<?= $marefriend["display_name"] ?? $marefriend["name"] ?>" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="/<?= $marefriend["name"] ?>"><img src="<?= getAsset($mfSystem, $marefriend["id"], "heads") ?>" style="width:24px;"></a>
+ <?php endif; endforeach; ?>
<?php endif; ?>
</td>
</tr></tbody>
</table>
- <?php endif; ?>
</div>
<?php endforeach; ?>
</div>
diff --git a/pages/toys.inc b/pages/toys.inc
index afcd5ef..870bb62 100644
--- a/pages/toys.inc
+++ b/pages/toys.inc
@@ -197,6 +197,8 @@ $parts = explode("/", $pagename);
?>
+<script>requestExplicit("back");</script>
+
<style>
@media (max-width: 800px) {
#toy-grid-img {