summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-03-07 22:15:48 +0100
committerRaindropsSys <contact@minteck.org>2023-03-07 22:15:48 +0100
commit5385f0ed8fbb4325203a222a75e6700ffb519349 (patch)
treee0fd07ae8abe7ef40eb58cf3c45cfa7a024e863b
parent65a38d43f056944525d89c18f0137eae58f60e83 (diff)
downloadpluralconnect-5385f0ed8fbb4325203a222a75e6700ffb519349.tar.gz
pluralconnect-5385f0ed8fbb4325203a222a75e6700ffb519349.tar.bz2
pluralconnect-5385f0ed8fbb4325203a222a75e6700ffb519349.zip
Updated 3 files and added pages/api/me.php (automated)
-rw-r--r--includes/external/computers/index.js2
-rw-r--r--pages/api/computer.php2
-rw-r--r--pages/api/me.php21
-rw-r--r--pages/computers.inc16
4 files changed, 23 insertions, 18 deletions
diff --git a/includes/external/computers/index.js b/includes/external/computers/index.js
index 4a5115e..a8109cb 100644
--- a/includes/external/computers/index.js
+++ b/includes/external/computers/index.js
@@ -28,7 +28,7 @@ wss.on('connection', function connection(ws, req) {
if (data.type === "client") {
if (Object.keys(servers).includes(data.id)) {
- if (fs.existsSync(__dirname + "/../includes/tokens/" + data.token.replaceAll(".", "").replaceAll("/", ""))) {
+ if (fs.existsSync(__dirname + "/../../../includes/tokens/" + data.token.replaceAll(".", "").replaceAll("/", ""))) {
ws.linked = data.id;
ws.id = uuid();
diff --git a/pages/api/computer.php b/pages/api/computer.php
index cd065e7..d3ec15a 100644
--- a/pages/api/computer.php
+++ b/pages/api/computer.php
@@ -47,4 +47,4 @@ switch ($_GET['type']) {
break;
}
-die("OK"); \ No newline at end of file
+die($_PROFILE['login'] . "-" . $host); \ No newline at end of file
diff --git a/pages/api/me.php b/pages/api/me.php
new file mode 100644
index 0000000..817b106
--- /dev/null
+++ b/pages/api/me.php
@@ -0,0 +1,21 @@
+<?php
+
+$app = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true);
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.inc"; global $isLoggedIn; global $isLowerLoggedIn;
+if (!$isLoggedIn && !$isLowerLoggedIn) header("Location: /-/login") and die();
+global $_PROFILE;
+
+header("Content-Type: application/json");
+
+if ($_PROFILE['login'] === "raindrops") {
+ die('{"name": "Raindrops System", "id": "raindrops", "pluralkit": "gdapd"}');
+} else if ($_PROFILE["login"] === "cloudburst") {
+ die('{"name": "Cloudburst System", "id": "cloudburst", "pluralkit": "ynmuc"}');
+} else {
+ die(json_encode([
+ "name" => $app["other"]["name"],
+ "id" => $app["other"]["slug"],
+ "pluralkit" => $app["other"]["id"]
+ ]));
+} \ No newline at end of file
diff --git a/pages/computers.inc b/pages/computers.inc
index 0d41a23..56a1b5d 100644
--- a/pages/computers.inc
+++ b/pages/computers.inc
@@ -342,22 +342,6 @@ if (count($parts) === 2 || count($parts) === 3) {
<tbody>
<?php
- function prettySize($bytes) {
- if ($bytes > 1024) {
- if ($bytes > 1024**2) {
- if ($bytes > 1024**3) {
- return round($bytes / 1024**3, 1) . " GB";
- } else {
- return round($bytes / 1024**2, 1) . " MB";
- }
- } else {
- return round($bytes / 1024, 1) . " KB";
- }
- } else {
- return $bytes . " B";
- }
- }
-
uasort($computer["filesystems"], function ($a, $b) {
return $b["use"] - $a["use"];
});