From 3d1cd02f27518f1a04374c7c8320cd5d82ede6e9 Mon Sep 17 00:00:00 2001 From: Minteck Date: Thu, 23 Feb 2023 19:34:56 +0100 Subject: Updated 40 files, added 37 files, deleted 1103 files and renamed 3905 files (automated) --- api/app-images.php | 43 ----------- api/camera.php | 6 -- api/cloudburst-banners.php | 19 ----- api/cloudburst-data.php | 44 ----------- api/cloudburst-scored.php | 9 --- api/cloudburst.php | 6 -- api/computer.php | 50 ------------ api/data.php | 12 --- api/desktop-app.php | 81 ------------------- api/docs.php | 29 ------- api/emergency-real.php | 22 ------ api/emergency.php | 22 ------ api/eval.php | 12 --- api/fronter.php | 113 --------------------------- api/me-picture.php | 22 ------ api/me.php | 13 ---- api/pleasure-real.php | 35 --------- api/pleasure.php | 35 --------- api/pluralkit-integration.php | 176 ------------------------------------------ api/raindrops-banners.php | 19 ----- api/raindrops-data.php | 44 ----------- api/raindrops-img-round.php | 94 ---------------------- api/raindrops-img.php | 11 --- api/raindrops-img2-round.php | 94 ---------------------- api/raindrops-scored.php | 9 --- api/raindrops-two.php | 8 -- api/raindrops.php | 6 -- api/save-private.php | 43 ----------- api/save.php | 45 ----------- api/session.php | 6 -- api/test.php | 4 - api/test1.php | 5 -- api/token.php | 7 -- api/video.php | 34 -------- api/wakeup-real.php | 28 ------- api/wakeup.php | 28 ------- 36 files changed, 1234 deletions(-) delete mode 100644 api/app-images.php delete mode 100644 api/camera.php delete mode 100644 api/cloudburst-banners.php delete mode 100644 api/cloudburst-data.php delete mode 100644 api/cloudburst-scored.php delete mode 100644 api/cloudburst.php delete mode 100644 api/computer.php delete mode 100644 api/data.php delete mode 100644 api/desktop-app.php delete mode 100644 api/docs.php delete mode 100644 api/emergency-real.php delete mode 100644 api/emergency.php delete mode 100644 api/eval.php delete mode 100644 api/fronter.php delete mode 100644 api/me-picture.php delete mode 100644 api/me.php delete mode 100644 api/pleasure-real.php delete mode 100644 api/pleasure.php delete mode 100644 api/pluralkit-integration.php delete mode 100644 api/raindrops-banners.php delete mode 100644 api/raindrops-data.php delete mode 100644 api/raindrops-img-round.php delete mode 100644 api/raindrops-img.php delete mode 100644 api/raindrops-img2-round.php delete mode 100644 api/raindrops-scored.php delete mode 100644 api/raindrops-two.php delete mode 100644 api/raindrops.php delete mode 100644 api/save-private.php delete mode 100644 api/save.php delete mode 100644 api/session.php delete mode 100644 api/test.php delete mode 100644 api/test1.php delete mode 100644 api/token.php delete mode 100644 api/video.php delete mode 100644 api/wakeup-real.php delete mode 100644 api/wakeup.php (limited to 'api') diff --git a/api/app-images.php b/api/app-images.php deleted file mode 100644 index dea66cb..0000000 --- a/api/app-images.php +++ /dev/null @@ -1,43 +0,0 @@ - [], - "profile" => [], - "misc" => [] -]; - -$data["misc"]["systems"] = [ - "cloudburst.png" => "data:image/png;base64," . base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/cloudburst.png")), - "raindrops.png" => "data:image/png;base64," . base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/raindrops.png")) -]; - -foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads"), function ($i) { return str_starts_with($i, "ss-") && str_ends_with($i, ".png"); }) as $file) { - $data["misc"]["systems"][$file] = "data:image/png;base64," . base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/" . $file)); -} - -$data["misc"]["species"] = []; - -foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/assets/species"), function ($i) { return !str_starts_with($i, "."); }) as $file) { - $name = substr($file, 0, strlen($file) - 4); - $data["misc"]["species"][$name] = "data:" . mime_content_type($_SERVER['DOCUMENT_ROOT'] . "/assets/species/" . $file) . ";base64," . base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/assets/species/" . $file)); -} - -foreach (array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/images"), function ($i) { return !str_starts_with($i, "."); }) as $file) { - $name = explode(".", $file)[0]; - $parts = explode("-", $name); - $type = mime_content_type($_SERVER['DOCUMENT_ROOT'] . "/includes/data/images/" . $file); - $category = match ($parts[0]) { - "pt" => "ponytown", - "pf" => "profile" - }; - - if (!isset($data[$category][$parts[1]])) $data[$category][$parts[1]] = []; - $data[$category][$parts[1]][$parts[2]] = "data:" . $type . ";base64," . base64_encode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/images/" . $file)); -} - -header("Content-Type: application/json"); -die(json_encode($data, JSON_PRETTY_PRINT)); \ No newline at end of file diff --git a/api/camera.php b/api/camera.php deleted file mode 100644 index cbf7efc..0000000 --- a/api/camera.php +++ /dev/null @@ -1,6 +0,0 @@ - null, - "content" => null - ]; - if ($parts[1] === "metadata") { - $data["members"][$parts[0]][$parts[1]] = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file), true)); - } else { - $data["members"][$parts[0]][$parts[1]] = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file), true); - } - } else { - $data[$name] = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file), true); - } - } else { - if (strlen($parts[0]) === 5) { - if (!isset($data["members"][$parts[0]])) $data["members"][$parts[0]] = [ - "metadata" => null, - "content" => null - ]; - $data["members"][$parts[0]][$parts[1]] = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file); - } else { - $data[$name] = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file); - } - } - } -} - -header("Content-Type: application/json"); -die(json_encode($data, JSON_PRETTY_PRINT)); \ No newline at end of file diff --git a/api/cloudburst-scored.php b/api/cloudburst-scored.php deleted file mode 100644 index 649b4fc..0000000 --- a/api/cloudburst-scored.php +++ /dev/null @@ -1,9 +0,0 @@ - 0) { - $fronter = $fronters[0]; - $info = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $fronter["id"] . ".json"), true); - $info = parseMetadata($info); - - if (isset($info["birth"]["age"]) && $info["birth"]["age"] < 16 && $info["birth"]["age"] > 0) { - $proceed = false; - } else if (isset($info["birth"]["year"]) && $info["birth"]["year"] > 1900) { - if (!isset($info["birth"]["date"])) $info["birth"]["date"] = "01-01"; - - $age = (int)date('Y') - $info["birth"]["year"] + (strtotime(date('Y') . "-" . $info["birth"]["date"]) <= time() ? 0 : -1); - - if ($age < 16) { - $proceed = false; - } - } - } - } - - if ($proceed) { - if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/app-usage.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/app-usage.json", "{}"); - $usage = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/app-usage.json"), true); - $usage[$_GET['id']] = date('c'); - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/app-usage.json", json_encode($usage)); - - $data = $keys[$_GET["id"]]["config"] ?? []; - } -} else { - $data = [ - "success" => true, - "valid" => false, - "underage" => false, - "normal" => false - ]; - - $keys = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/permitted.json"), true); - - if (in_array($_GET["id"], array_keys($keys))) { - $data["valid"] = true; - - $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $keys[$_GET["id"]]["system"] . "/fronters.json"), true)["members"]; - - if (count($fronters) > 0) { - $fronter = $fronters[0]; - $info = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $fronter["id"] . ".json"), true); - $info = parseMetadata($info); - - $data["normal"] = $info["sexually_active"]; - - if (isset($info["birth"]["age"]) && $info["birth"]["age"] < 16 && $info["birth"]["age"] > 0) { - $data["underage"] = true; - } else if (isset($info["birth"]["year"]) && $info["birth"]["year"] > 1900) { - if (!isset($info["birth"]["date"])) $info["birth"]["date"] = "01-01"; - - $age = (int)date('Y') - $info["birth"]["year"] + (strtotime(date('Y') . "-" . $info["birth"]["date"]) <= time() ? 0 : -1); - - if ($age < 16) { - $data["underage"] = true; - } - } - } - } -} - -die(json_encode($data)); \ No newline at end of file diff --git a/api/docs.php b/api/docs.php deleted file mode 100644 index 89e9216..0000000 --- a/api/docs.php +++ /dev/null @@ -1,29 +0,0 @@ - [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: ⚠️🆘 EMERGENCY ⚠️🆘\r\n" . - "Priority: urgent\r\n" . - "Tags: emergency\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => "This is an emergency, " . $_PROFILE['name'] . " is in need of IMMEDIATE help. Please act now!" - ] -])); - -die(); \ No newline at end of file diff --git a/api/emergency.php b/api/emergency.php deleted file mode 100644 index e0726e7..0000000 --- a/api/emergency.php +++ /dev/null @@ -1,22 +0,0 @@ - [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: [Test] ⚠️🆘 EMERGENCY ⚠️🆘\r\n" . - "Priority: urgent\r\n" . - "Tags: emergency\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => "[This notification is test] This is an emergency, " . $_PROFILE['name'] . " is in need of IMMEDIATE help. Please act now! [This notification is test]" - ] -])); - -die(); \ No newline at end of file diff --git a/api/eval.php b/api/eval.php deleted file mode 100644 index cebf38b..0000000 --- a/api/eval.php +++ /dev/null @@ -1,12 +0,0 @@ - -1 ? $index - 1 : $index); - - break; - - default: - header("Location: /?error=Invalid type name") and die(); - break; -} - -file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/$system.json", json_encode($list)); - -die(); \ No newline at end of file diff --git a/api/me-picture.php b/api/me-picture.php deleted file mode 100644 index 3f0bce0..0000000 --- a/api/me-picture.php +++ /dev/null @@ -1,22 +0,0 @@ - [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: 🏩 $pony wants to play for a bit\r\n" . - "Priority: high\r\n" . - "Tags: pleasure\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => "Hey, $pony wants to play and have fun for a bit, get up!" - ] -])); - -die(); \ No newline at end of file diff --git a/api/pleasure.php b/api/pleasure.php deleted file mode 100644 index 1a561df..0000000 --- a/api/pleasure.php +++ /dev/null @@ -1,35 +0,0 @@ - [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: [Test] 🏩 $pony wants to play for a bit\r\n" . - "Priority: high\r\n" . - "Tags: pleasure\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => "[This notification is test] Hey, $pony wants to play and have fun for a bit, get up! [This notification is test]" - ] -])); - -die(); \ No newline at end of file diff --git a/api/pluralkit-integration.php b/api/pluralkit-integration.php deleted file mode 100644 index 0793873..0000000 --- a/api/pluralkit-integration.php +++ /dev/null @@ -1,176 +0,0 @@ - [ - '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([ - '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")); - } - - $fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/fronters.json"), true); - $currentFronter = $fronters["members"][0]["id"]; - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$system/last.json", json_encode($currentFronter)); - - $ntfy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true)["ntfy"]; - - if (count($fronters["members"]) > 0 && ($system !== $app["other"]["id"] || !isset($app["other"]))) { - foreach ($fronters["members"] as $member) { - if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member["id"] . ".json")) { - $metadata = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member["id"] . ".json"), true); - - if (!isset($metadata["birth"])) { - showWarning($member["display_name"] ?? $member["name"], $member["name"], $system); - } else if (isset($metadata['birth']["age"]) && $metadata["birth"]["age"] === 0 && (!isset($metadata['birth']["year"]) || $metadata["birth"]["year"] < 1900)) { - showWarning($member["display_name"] ?? $member["name"], $member["name"], $system); - } else if (isset($metadata['birth']["year"]) && $metadata["birth"]["year"] < 1900) { - showWarning($member["display_name"] ?? $member["name"], $member["name"], $system); - } else if (!isset($metadata['birth']["year"]) && !isset($metadata['birth']["age"])) { - showWarning($member["display_name"] ?? $member["name"], $member["name"], $system); - } - } - } - } - - if ($system !== $app["other"]["id"] || !isset($app["other"])) { - if (count($fronters["members"]) > 1) { - $context = stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: 🐴 Switch occurred in the $name\r\n" . - "Priority: default\r\n" . - "Tags: switch\r\n" . - "Actions: view, Open " . $fronters["members"][0]["display_name"] . " on Cold Haze, https://ponies.equestria.horse/" . $fronters["members"][0]["name"] . "/, clear=true;view, Open " . $fronters["members"][1]["display_name"] . " on Cold Haze, https://ponies.equestria.horse/" . $fronters["members"][1]["name"] . "/, clear=true\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => ($fronters["members"][0]["display_name"] ?? $fronters["members"][0]["name"]) . " and " . ($fronters["members"][1]["display_name"] ?? $fronters["members"][1]["name"]) . " switched in just now" - ] - ]); - } else if (count($fronters["members"]) > 0) { - $context = stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: 🐴 Switch occurred in the $name\r\n" . - "Priority: default\r\n" . - "Tags: switch\r\n" . - "Actions: view, Open on Cold Haze, https://ponies.equestria.horse/" . $fronters["members"][0]["name"] . "/, clear=true\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => ($fronters["members"][0]["display_name"] ?? $fronters["members"][0]["name"]) . " switched in just now" - ] - ]); - } else { - $context = stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: 🐴 Switch occurred in the $name\r\n" . - "Priority: default\r\n" . - "Tags: switch\r\n" . - "Actions: view, Open on Cold Haze, https://ponies.equestria.horse/, clear=true\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => "The fallback pony switched in just now" - ] - ]); - } - - file_get_contents('https://' . $ntfy["server"] . '/public-switches', false, $context); - } - - if ($system === "gdapd") { - $topic = "public-switches-raindrops"; - - if (count($fronters["members"]) > 0) { - file_get_contents('https://' . $ntfy["server"] . '/public-switches-fr', false, stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: 🐴 $name vient de switch\r\n" . - "Priority: default\r\n" . - "Tags: switch\r\n" . - "Actions: view, Voir sur Cold Haze, https://fr.equestria.horse/" . $fronters["members"][0]["name"] . "/, clear=true\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => ($fronters["members"][0]["display_name"] ?? $fronters["members"][0]["name"]) . " est désormais au front" - ] - ])); - } else { - file_get_contents('https://' . $ntfy["server"] . '/public-switches-fr', false, stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: 🐴 $name vient de switch\r\n" . - "Priority: default\r\n" . - "Tags: switch\r\n" . - "Actions: view, Voir sur Cold Haze, https://fr.equestria.horse/, clear=true\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => "Le poney de trait est désormais au front" - ] - ])); - } - } else if ($system === "ynmuc") { - $topic = "public-switches-cloudburst"; - } else { - $topic = "main"; - } - - file_get_contents('https://' . $ntfy["server"] . '/' . $topic, false, $context); -} \ No newline at end of file diff --git a/api/raindrops-banners.php b/api/raindrops-banners.php deleted file mode 100644 index 97fc954..0000000 --- a/api/raindrops-banners.php +++ /dev/null @@ -1,19 +0,0 @@ - null, - "content" => null - ]; - if ($parts[1] === "metadata") { - $data["members"][$parts[0]][$parts[1]] = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file), true)); - } else { - $data["members"][$parts[0]][$parts[1]] = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file), true); - } - } else { - $data[$name] = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file), true); - } - } else { - if (strlen($parts[0]) === 5) { - if (!isset($data["members"][$parts[0]])) $data["members"][$parts[0]] = [ - "metadata" => null, - "content" => null - ]; - $data["members"][$parts[0]][$parts[1]] = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file); - } else { - $data[$name] = file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . $file); - } - } - } -} - -header("Content-Type: application/json"); -die(json_encode($data, JSON_PRETTY_PRINT)); \ No newline at end of file diff --git a/api/raindrops-img-round.php b/api/raindrops-img-round.php deleted file mode 100644 index f733cc8..0000000 --- a/api/raindrops-img-round.php +++ /dev/null @@ -1,94 +0,0 @@ - count($fronters["members"]) > 1 -])); \ No newline at end of file diff --git a/api/raindrops.php b/api/raindrops.php deleted file mode 100644 index c44faa6..0000000 --- a/api/raindrops.php +++ /dev/null @@ -1,6 +0,0 @@ - $i["height"], - "id" => $i['format_id'] - ]; - }, $data["formats"]), function ($i) { - return !is_null($i["quality"]); - })); - $hd = array_values(array_filter($qualities, function ($i) { - return $i["quality"] >= 720; - })); - $selected = count($hd) > 0 ? $hd[0] : $qualities[count($qualities) - 1]; - $stream = array_values(array_filter($data["formats"], function ($i) use ($selected) { - return $i["height"] === $selected["quality"] && $i["acodec"] !== null && $i["acodec"] !== "none"; - }))[0]; - - echo(json_encode([ - "title" => $data["fulltitle"], - "author" => $data["channel"], - "duration" => $data["duration"], - "stream" => $selected, - "url" => $stream["url"], - "duration_pretty" => $data["duration_string"], - "poster" => $data["thumbnail"], - ], JSON_PRETTY_PRINT)); -} \ No newline at end of file diff --git a/api/wakeup-real.php b/api/wakeup-real.php deleted file mode 100644 index 2267a4e..0000000 --- a/api/wakeup-real.php +++ /dev/null @@ -1,28 +0,0 @@ - [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: 🥱 Wake up!\r\n" . - "Priority: high\r\n" . - "Tags: wakeup\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => "Hey, $pony wants you to wake up!" - ] -])); - -die(); \ No newline at end of file diff --git a/api/wakeup.php b/api/wakeup.php deleted file mode 100644 index 69b0a68..0000000 --- a/api/wakeup.php +++ /dev/null @@ -1,28 +0,0 @@ - [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: [Test] 🥱 Wake up!\r\n" . - "Priority: high\r\n" . - "Tags: wakeup\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => "[This notification is test] Hey, $pony wants you to wake up! [This notification is test]" - ] -])); - -die(); \ No newline at end of file -- cgit