diff options
Diffstat (limited to 'pages/api')
-rw-r--r-- | pages/api/cloudburst-img-round.php | 18 | ||||
-rw-r--r-- | pages/api/cloudburst-img.php | 11 | ||||
-rw-r--r-- | pages/api/cloudburst-img2-round.php | 18 | ||||
-rw-r--r-- | pages/api/cloudburst-two.php | 8 | ||||
-rw-r--r-- | pages/api/cloudburst.php | 6 | ||||
-rw-r--r-- | pages/api/emergency-real.php | 2 | ||||
-rw-r--r-- | pages/api/emergency.php | 2 | ||||
-rw-r--r-- | pages/api/me.php | 10 | ||||
-rw-r--r-- | pages/api/money/account.php | 62 | ||||
-rw-r--r-- | pages/api/money/accounts.php | 96 | ||||
-rw-r--r-- | pages/api/money/create.php | 99 | ||||
-rw-r--r-- | pages/api/pleasure-real.php | 5 | ||||
-rw-r--r-- | pages/api/pleasure.php | 5 | ||||
-rw-r--r-- | pages/api/pluralkit-integration.php | 3 | ||||
-rw-r--r-- | pages/api/raindrops-img-round.php | 18 | ||||
-rw-r--r-- | pages/api/raindrops-img-round2.php | 20 | ||||
-rw-r--r-- | pages/api/raindrops-img.php | 11 | ||||
-rw-r--r-- | pages/api/raindrops-img2-round.php | 18 | ||||
-rw-r--r-- | pages/api/raindrops-img2-round2.php | 20 | ||||
-rw-r--r-- | pages/api/raindrops-two.php | 8 | ||||
-rw-r--r-- | pages/api/raindrops.php | 6 | ||||
-rw-r--r-- | pages/api/timeline.php | 2 | ||||
-rw-r--r-- | pages/api/wakeup-real.php | 33 | ||||
-rw-r--r-- | pages/api/wakeup.php | 33 |
24 files changed, 12 insertions, 502 deletions
diff --git a/pages/api/cloudburst-img-round.php b/pages/api/cloudburst-img-round.php deleted file mode 100644 index 3238696..0000000 --- a/pages/api/cloudburst-img-round.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true); - -$url = isset($fronters['members'][0]) ? ($fronters['members'][0]["avatar_url"] ?? "/assets/uploads/cloudburst.png") : "/assets/uploads/cloudburst.png"; -file_put_contents("/tmp/temp", file_get_contents($url)); - -header("Content-Type: image/png"); - -$id = bin2hex(random_bytes(8)); -exec('convert -size 128x128 xc:none -draw "roundrectangle 0,0,128,128,128,128" /tmp/' . $id . '-mask.png', $out); - -exec('convert -resize 128x128 "/tmp/temp" /tmp/' . $id . '-source.png'); -exec('convert /tmp/' . $id . '-source.png -matte /tmp/' . $id . '-mask.png -compose DstIn -composite /tmp/' . $id . '.png', $out2); - -unlink("/tmp/temp"); - -echo(file_get_contents('/tmp/' . $id . '.png'));
\ No newline at end of file diff --git a/pages/api/cloudburst-img.php b/pages/api/cloudburst-img.php deleted file mode 100644 index 7d22aad..0000000 --- a/pages/api/cloudburst-img.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true); - -$url = isset($fronters['members'][0]) ? ($fronters['members'][0]["avatar_url"] ? $_SERVER['DOCUMENT_ROOT'] . getAsset("ynmuc", $fronters['members'][0]["id"]) : $_SERVER['DOCUMENT_ROOT'] . "/uploads/raindrops.png") : $_SERVER['DOCUMENT_ROOT'] . "/uploads/raindrops.png"; -file_put_contents("/tmp/temp", file_get_contents($url)); -header("Content-Type: " . mime_content_type("/tmp/temp")); -unlink("/tmp/temp"); - -echo(file_get_contents($url));
\ No newline at end of file diff --git a/pages/api/cloudburst-img2-round.php b/pages/api/cloudburst-img2-round.php deleted file mode 100644 index 5f4f0dc..0000000 --- a/pages/api/cloudburst-img2-round.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true); - -$url = isset($fronters['members'][1]) ? ($fronters['members'][1]["avatar_url"] ?? "/assets/uploads/cloudburst.png") : "/assets/uploads/cloudburst.png"; -file_put_contents("/tmp/temp", file_get_contents($url)); - -header("Content-Type: image/png"); - -$id = bin2hex(random_bytes(8)); -exec('convert -size 128x128 xc:none -draw "roundrectangle 0,0,128,128,128,128" /tmp/' . $id . '-mask.png', $out); - -exec('convert -resize 128x128 "/tmp/temp" /tmp/' . $id . '-source.png'); -exec('convert /tmp/' . $id . '-source.png -matte /tmp/' . $id . '-mask.png -compose DstIn -composite /tmp/' . $id . '.png', $out2); - -unlink("/tmp/temp"); - -echo(file_get_contents('/tmp/' . $id . '.png'));
\ No newline at end of file diff --git a/pages/api/cloudburst-two.php b/pages/api/cloudburst-two.php deleted file mode 100644 index 8272d81..0000000 --- a/pages/api/cloudburst-two.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php - -header("Content-Type: text/plain"); - -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true); -echo(json_encode([ - "multiple" => count($fronters["members"]) > 1 -]));
\ No newline at end of file diff --git a/pages/api/cloudburst.php b/pages/api/cloudburst.php deleted file mode 100644 index 2750a98..0000000 --- a/pages/api/cloudburst.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -header("Content-Type: text/plain"); - -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true); -echo($fronters['members'][0]['display_name'] ?? $fronters['members'][0]['name']);
\ No newline at end of file diff --git a/pages/api/emergency-real.php b/pages/api/emergency-real.php index 700a6a7..04fd56e 100644 --- a/pages/api/emergency-real.php +++ b/pages/api/emergency-real.php @@ -1,7 +1,6 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $_PROFILE; -if ($_PROFILE["login"] === "cloudburst") die(); if (!$isLoggedIn && !$isLowerLoggedIn) { header("Location: /-/login"); @@ -15,6 +14,7 @@ $channels = []; if (isset($_GET["raindrops"])) $channels[] = "emergency-raindrops"; if (isset($_GET["moonglow"])) $channels[] = "emergency-moonglow"; +if (isset($_GET["hailstorm"])) $channels[] = "emergency-hailstorm"; if (isset($_GET[$GLOBALS["ColdHazeApp"]["other"]["slug"]])) $channels[] = "emergency"; $context = stream_context_create([ diff --git a/pages/api/emergency.php b/pages/api/emergency.php index a8a6e20..e682598 100644 --- a/pages/api/emergency.php +++ b/pages/api/emergency.php @@ -1,7 +1,6 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $_PROFILE; -if ($_PROFILE["login"] === "cloudburst") die(); if (!$isLoggedIn && !$isLowerLoggedIn) { header("Location: /-/login"); @@ -15,6 +14,7 @@ $channels = []; if (isset($_GET["raindrops"])) $channels[] = "emergency-raindrops"; if (isset($_GET["moonglow"])) $channels[] = "emergency-moonglow"; +if (isset($_GET["hailstorm"])) $channels[] = "emergency-hailstorm"; if (isset($_GET[$GLOBALS["ColdHazeApp"]["other"]["slug"]])) $channels[] = "emergency"; $context = stream_context_create([ diff --git a/pages/api/me.php b/pages/api/me.php index 5b13208..0e91189 100644 --- a/pages/api/me.php +++ b/pages/api/me.php @@ -18,13 +18,13 @@ if ($_PROFILE['login'] === "raindrops") { "avatar" => getAsset("gdapd"), "email" => $_PROFILE["profile"]["email"]["email"] ])); -} else if ($_PROFILE["login"] === "cloudburst") { +} else if ($_PROFILE["login"] === "Moonglow") { die(json_encode([ "valid" => true, - "name" => "Cloudburst System", - "id" => "cloudburst", - "pluralkit" => "ynmuc", - "avatar" => getAsset("ynmuc"), + "name" => "Moonglow", + "id" => "moonglow", + "pluralkit" => "hrbom", + "avatar" => getAsset("hrbom"), "email" => $_PROFILE["profile"]["email"]["email"] ])); } else { diff --git a/pages/api/money/account.php b/pages/api/money/account.php deleted file mode 100644 index 1801b28..0000000 --- a/pages/api/money/account.php +++ /dev/null @@ -1,62 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $_PROFILE; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; -if (!$isLoggedIn) header("Location: /-/login") and die(); -header("Content-Type: application/json"); - -$accounts = array_map(function ($i) { - $name = substr($i, 0, -5); - $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $i), true); - $data["_name"] = $name; - return $data; -}, array_values(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money"), function ($i) { return !str_starts_with($i, "."); }))); -$rate = (float)trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/exchange.txt")); -$obj = []; - -if (!isset($_GET["id"])) { - die(json_encode($obj, JSON_PRETTY_PRINT)); -} - -foreach ($accounts as $account) { - if ($account["_name"] === $_GET["id"]) { - $acc = []; - - $acc["id"] = $account["_name"]; - $acc["name"] = $account["name"]; - $acc["currency"] = $account["currency"]; - $acc["default"] = $account["default"]; - $acc["total"] = round(calculateFullAmount($account, true), 2); - $acc["interests"] = $account["interests"]; - $acc["max"] = $account["max"]; - $acc["used_percentage"] = isset($account["max"]) ? round((calculateFullAmount($account, true) / $account["max"]) * 100, 2) : null; - $acc["transactions"] = []; - - foreach ($account["transactions"] as $index => $transaction) { - $member = getMemberWithoutSystem($transaction["author"]) ?? getMemberWithoutSystem("zdtsg"); - $trans = [ - "id" => $index, - "author" => [ - "avatar" => getAsset($member["_system"], $member["id"]), - "name" => $member["display_name"] ?? $member["name"] - ], - "type" => $transaction["amount"] < 0 ? "REMOVE" : "ADD", - "amount" => round(abs($transaction["amount"]), 2), - "date" => [ - "ts" => strtotime($transaction["date"]), - "iso" => date('c', strtotime($transaction["date"])), - "relative" => timeAgo($transaction["date"]) - ], - "description" => (isset($transaction["description"]) && trim($transaction["description"]) !== "") ? trim($transaction["description"]) : null - ]; - - $acc["transactions"][] = $trans; - } - - $obj = $acc; - } -} - -/* ------------------- */ - -die(json_encode($obj, JSON_PRETTY_PRINT));
\ No newline at end of file diff --git a/pages/api/money/accounts.php b/pages/api/money/accounts.php deleted file mode 100644 index 9f85323..0000000 --- a/pages/api/money/accounts.php +++ /dev/null @@ -1,96 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $_PROFILE; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; -if (!$isLoggedIn) header("Location: /-/login") and die(); -header("Content-Type: application/json"); - -$accounts = array_map(function ($i) { - $name = substr($i, 0, -5); - $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $i), true); - $data["_name"] = $name; - return $data; -}, array_values(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money"), function ($i) { return !str_starts_with($i, "."); }))); -$rate = (float)trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/exchange.txt")); -$obj = [ - "total" => 0, - "exchange_rate" => $rate, - "users" => [ - "cloudburst" => [ - "total" => 0, - "accounts" => [] - ], - "raindrops" => [ - "total" => 0, - "accounts" => [] - ] - ] -]; - -$allAccounts = array_reduce(array_map(function ($i) { - return calculateFullAmount($i, true, true); -}, $accounts), function ($a, $b) { - return $a + $b; -}); -$obj["total"] = [ - "gbp" => round($allAccounts, 2), - "eur" => round($allAccounts * (1 / $rate), 2) -]; - -/* ------------------- */ - -$allAccounts = array_reduce(array_map(function ($i) { - return calculateFullAmount($i, true, true); -}, array_values(array_filter($accounts, function ($i) { return $i["owner"] === "cloudburst"; }))), function ($a, $b) { - return $a + $b; -}); - -$obj["users"]["cloudburst"]["total"] = $allAccounts; - -foreach ($accounts as $index => $account) { - if ($account["owner"] === "cloudburst") { - $acc = []; - - $acc["id"] = $account["_name"]; - $acc["name"] = $account["name"]; - $acc["currency"] = $account["currency"]; - $acc["default"] = $account["default"]; - $acc["total"] = round(calculateFullAmount($account, true), 2); - $acc["interests"] = $account["interests"]; - $acc["max"] = $account["max"]; - $acc["used_percentage"] = isset($account["max"]) ? round((calculateFullAmount($account, true) / $account["max"]) * 100, 2) : null; - - $obj["users"]["cloudburst"]["accounts"][] = $acc; - } -} -/* ------------------- */ - -$allAccounts = array_reduce(array_map(function ($i) { - return calculateFullAmount($i, true, true); -}, array_values(array_filter($accounts, function ($i) { return $i["owner"] === "raindrops"; }))), function ($a, $b) { - return $a + $b; -}); - -$obj["users"]["raindrops"]["total"] = $allAccounts; - -foreach ($accounts as $index => $account) { - if ($account["owner"] === "raindrops") { - $acc = []; - - $acc["id"] = $account["_name"]; - $acc["name"] = $account["name"]; - $acc["currency"] = $account["currency"]; - $acc["default"] = $account["default"]; - $acc["total"] = round(calculateFullAmount($account, true), 2); - $acc["interests"] = $account["interests"]; - $acc["max"] = $account["max"]; - $acc["used_percentage"] = isset($account["max"]) ? round((calculateFullAmount($account, true) / $account["max"]) * 100, 2) : null; - $acc["transactions"] = null; - - $obj["users"]["raindrops"]["accounts"][] = $acc; - } -} - -/* ------------------- */ - -die(json_encode($obj, JSON_PRETTY_PRINT));
\ No newline at end of file diff --git a/pages/api/money/create.php b/pages/api/money/create.php deleted file mode 100644 index 12cc7c9..0000000 --- a/pages/api/money/create.php +++ /dev/null @@ -1,99 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $_PROFILE; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; -$app = $GLOBALS["ColdHazeApp"] = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true); -if (!$isLoggedIn) header("Location: /-/login") and die(); -header("Content-Type: application/json"); - -$request_raw = file_get_contents('php://input'); -$json_object = $data = json_decode($request_raw, true); - -$systemID = $_PROFILE["login"] === "cloudburst" ? "ynmuc" : "gdapd"; -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($_PROFILE["login"] === "cloudburst" ? "ynmuc" : "gdapd") . "/fronters.json"), true)["members"]; - -if (count($fronters) > 0) { - $myId = $fronters[0]["id"]; -} else { - $myId = "zdtsg"; -} - -$accounts = array_map(function ($i) { - $name = substr($i, 0, -5); - $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $i), true); - $data["_name"] = $name; - return $data; -}, array_values(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money"), function ($i) { return !str_starts_with($i, "."); }))); -$rate = (float)trim(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/exchange.txt")); - -$obj = [ - "success" => false, - "error" => null -]; - -if ($_SERVER["REQUEST_METHOD"] !== "POST") { - $obj["success"] = false; - $obj["error"] = "INVALID_METHOD"; - die(json_encode($obj, JSON_PRETTY_PRINT)); -} - -if (!isset($data["amount"]) || !isset($data["id"]) || !isset($data["description"])) { - $obj["success"] = false; - $obj["error"] = "MISSING_OPERAND"; - die(json_encode($obj, JSON_PRETTY_PRINT)); -} - -$account = array_values(array_filter($accounts, function ($i) use ($data) { return $i["_name"] === $data["id"]; }))[0] ?? null; - -if (!isset($account)) { - $obj["success"] = false; - $obj["error"] = "ACCOUNT_NOT_FOUND"; - die(json_encode($obj, JSON_PRETTY_PRINT)); -} - -if (!(isset($data["amount"]) && is_numeric($data["amount"]) && (float)$data["amount"] < 9999 && (float)$data["amount"] > -9999)) { - $obj["success"] = false; - $obj["error"] = "INVALID_AMOUNT"; - die(json_encode($obj, JSON_PRETTY_PRINT)); -} -if (!isset($data["description"])) $data["description"] = ""; - -if (strlen($data["description"]) > 150) { - $obj["success"] = false; - $obj["error"] = "DESCRIPTION_TOO_LONG"; - die(json_encode($obj, JSON_PRETTY_PRINT)); -} - -if ($data["amount"] === 0) { - $obj["success"] = false; - $obj["error"] = "AMOUNT_IS_ZERO"; - die(json_encode($obj, JSON_PRETTY_PRINT)); -} - -$ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; -file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: " . formatPonypush((getMember($myId)["display_name"] ?? getMember($myId)["name"]) . " created a transaction to " . $account["name"] . " (" . ucfirst($account["owner"]) . ")") . "\r\n" . - "Tags: bits\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => formatPonypush(($account["currency"] === "gbp" ? "£" : "€") . abs((float)$data["amount"]) . " were " . ((float)$data["amount"] >= 0 ? "added" : "removed") . " just now" . (trim($data["description"]) !== "" ? ": " . $data["description"] : "")) - ] -])); - -array_unshift($account["transactions"], [ - "author" => $myId, - "description" => $data["description"], - "amount" => (float)$data["amount"], - "date" => date('c') -]); - -$name = $account["_name"]; -unset($account["_name"]); - -file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/money/" . $name . ".json", json_encode($account, JSON_PRETTY_PRINT)); - -$obj["success"] = true; -die(json_encode($obj, JSON_PRETTY_PRINT));
\ No newline at end of file diff --git a/pages/api/pleasure-real.php b/pages/api/pleasure-real.php index adfe732..c1cbd59 100644 --- a/pages/api/pleasure-real.php +++ b/pages/api/pleasure-real.php @@ -1,7 +1,6 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $_PROFILE; -if ($_PROFILE["login"] === "cloudburst") die(); if (!$isLoggedIn && !$isLowerLoggedIn) { header("Location: /-/login"); @@ -16,9 +15,9 @@ $frontMoonglow = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/inc if ($_PROFILE["login"] === "raindrops" && isset($frontRaindrops[0])) { $pony = $frontRaindrops[0]["display_name"] ?? $frontRaindrops[0]["name"]; -} else if ($_PROFILE["login"] === "Moonwind" && isset($frontMoonglow[0])) { +} else if ($_PROFILE["login"] === "Moonglow" && isset($frontMoonglow[0])) { $pony = $frontMoonglow[0]["display_name"] ?? $frontMoonglow[0]["name"]; -} else if ($_PROFILE["login"] !== "raindrops" && $_PROFILE["login"] !== "Moonwind" && isset($frontOther[0])) { +} else if ($_PROFILE["login"] !== "raindrops" && $_PROFILE["login"] !== "Moonglow" && isset($frontOther[0])) { $pony = $frontOther[0]["display_name"] ?? $frontOther[0]["name"]; } else { $pony = "somepony"; diff --git a/pages/api/pleasure.php b/pages/api/pleasure.php index 7d331ce..7b268cb 100644 --- a/pages/api/pleasure.php +++ b/pages/api/pleasure.php @@ -1,7 +1,6 @@ <?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; global $_PROFILE; -if ($_PROFILE["login"] === "cloudburst") die(); if (!$isLoggedIn && !$isLowerLoggedIn) { header("Location: /-/login"); @@ -16,9 +15,9 @@ $frontMoonglow = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/inc if ($_PROFILE["login"] === "raindrops" && isset($frontRaindrops[0])) { $pony = $frontRaindrops[0]["display_name"] ?? $frontRaindrops[0]["name"]; -} else if ($_PROFILE["login"] === "Moonwind" && isset($frontMoonglow[0])) { +} else if ($_PROFILE["login"] === "Moonglow" && isset($frontMoonglow[0])) { $pony = $frontMoonglow[0]["display_name"] ?? $frontMoonglow[0]["name"]; -} else if ($_PROFILE["login"] !== "raindrops" && $_PROFILE["login"] !== "Moonwind" && isset($frontOther[0])) { +} else if ($_PROFILE["login"] !== "raindrops" && $_PROFILE["login"] !== "Moonglow" && isset($frontOther[0])) { $pony = $frontOther[0]["display_name"] ?? $frontOther[0]["name"]; } else { $pony = "somepony"; diff --git a/pages/api/pluralkit-integration.php b/pages/api/pluralkit-integration.php index 7d7c641..a3faa6f 100644 --- a/pages/api/pluralkit-integration.php +++ b/pages/api/pluralkit-integration.php @@ -23,9 +23,6 @@ if ($input["signing_token"] !== $data[$user]) { if ($input['system_id'] === "7d9f543e-f742-40f6-9d07-86c3f2983124") { $system = "gdapd"; $name = "Raindrops System"; -} elseif ($input['system_id'] === "ade46823-206b-4b0c-ad3c-caae934a5f3b") { - $system = "ynmuc"; - $name = "Cloudburst System"; } elseif ($input['system_id'] === "d1cd97eb-9c92-4e42-94cd-4397a5074ff9") { $system = "hrbom"; $name = "Moonglow"; diff --git a/pages/api/raindrops-img-round.php b/pages/api/raindrops-img-round.php deleted file mode 100644 index 5e80bd0..0000000 --- a/pages/api/raindrops-img-round.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true); - -$url = isset($fronters['members'][0]) ? ($fronters['members'][0]["avatar_url"] ?? "/assets/uploads/raindrops.png") : "/assets/uploads/raindrops.png"; -file_put_contents("/tmp/temp", file_get_contents($url)); - -header("Content-Type: image/png"); - -$id = bin2hex(random_bytes(8)); -exec('convert -size 128x128 xc:none -draw "roundrectangle 0,0,128,128,128,128" /tmp/' . $id . '-mask.png', $out); - -exec('convert -resize 128x128 "/tmp/temp" /tmp/' . $id . '-source.png'); -exec('convert /tmp/' . $id . '-source.png -matte /tmp/' . $id . '-mask.png -compose DstIn -composite /tmp/' . $id . '.png', $out2); - -unlink("/tmp/temp"); - -echo(file_get_contents('/tmp/' . $id . '.png'));
\ No newline at end of file diff --git a/pages/api/raindrops-img-round2.php b/pages/api/raindrops-img-round2.php deleted file mode 100644 index 2560ed0..0000000 --- a/pages/api/raindrops-img-round2.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true); - -$url = isset($fronters['members'][0]) ? (getAsset("gdapd", $fronters["members"][0]["id"], "avatars") ?? "/assets/uploads/pt.png") : "/assets/uploads/pt.png"; -file_put_contents("/tmp/temp", file_get_contents($_SERVER['DOCUMENT_ROOT'] . $url)); - -header("Content-Type: image/png"); - -$id = bin2hex(random_bytes(8)); -exec('convert -size 256x128 xc:none -draw "roundrectangle 0,0,256,128,128,128" -chop 128x0 -resize 64x128\! /tmp/' . $id . '-mask.png', $out); -exec('convert /tmp/' . $id . '-mask.png -gravity West -background black -splice 64x0 -distort SRT 90 /tmp/' . $id . '-mask2.png', $out); - -exec('convert -resize 128x128 -filter Point -background transparent -gravity center -extent 128x128 "/tmp/temp" /tmp/' . $id . '-source.png'); -exec('convert /tmp/' . $id . '-source.png -matte /tmp/' . $id . '-mask2.png -compose DstIn -composite -gravity East /tmp/' . $id . '.png', $out2); - -unlink("/tmp/temp"); - -echo(file_get_contents('/tmp/' . $id . '.png'));
\ No newline at end of file diff --git a/pages/api/raindrops-img.php b/pages/api/raindrops-img.php deleted file mode 100644 index fcf1ae6..0000000 --- a/pages/api/raindrops-img.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true); - -$url = isset($fronters['members'][0]) ? ($fronters['members'][0]["avatar_url"] ? $_SERVER['DOCUMENT_ROOT'] . getAsset("gdapd", $fronters['members'][0]["id"]) : $_SERVER['DOCUMENT_ROOT'] . "/uploads/raindrops.png") : $_SERVER['DOCUMENT_ROOT'] . "/uploads/raindrops.png"; -file_put_contents("/tmp/temp", file_get_contents($url)); -header("Content-Type: " . mime_content_type("/tmp/temp")); -unlink("/tmp/temp"); - -echo(file_get_contents($url));
\ No newline at end of file diff --git a/pages/api/raindrops-img2-round.php b/pages/api/raindrops-img2-round.php deleted file mode 100644 index 1b0d320..0000000 --- a/pages/api/raindrops-img2-round.php +++ /dev/null @@ -1,18 +0,0 @@ -<?php - -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true); - -$url = isset($fronters['members'][1]) ? ($fronters['members'][1]["avatar_url"] ?? "/assets/uploads/raindrops.png") : "/assets/uploads/raindrops.png"; -file_put_contents("/tmp/temp", file_get_contents($url)); - -header("Content-Type: image/png"); - -$id = bin2hex(random_bytes(8)); -exec('convert -size 128x128 xc:none -draw "roundrectangle 0,0,128,128,128,128" /tmp/' . $id . '-mask.png', $out); - -exec('convert -resize 128x128 "/tmp/temp" /tmp/' . $id . '-source.png'); -exec('convert /tmp/' . $id . '-source.png -matte /tmp/' . $id . '-mask.png -compose DstIn -composite /tmp/' . $id . '.png', $out2); - -unlink("/tmp/temp"); - -echo(file_get_contents('/tmp/' . $id . '.png'));
\ No newline at end of file diff --git a/pages/api/raindrops-img2-round2.php b/pages/api/raindrops-img2-round2.php deleted file mode 100644 index 5eb7e3f..0000000 --- a/pages/api/raindrops-img2-round2.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true); - -$url = isset($fronters['members'][1]) ? (getAsset("gdapd", $fronters["members"][1]["id"], "avatars") ?? "/assets/uploads/pt.png") : "/assets/uploads/pt.png"; -file_put_contents("/tmp/temp", file_get_contents($_SERVER['DOCUMENT_ROOT'] . $url)); - -header("Content-Type: image/png"); - -$id = bin2hex(random_bytes(8)); -exec('convert -size 256x128 xc:none -draw "roundrectangle 0,0,256,128,128,128" -chop 128x0 -resize 64x128\! /tmp/' . $id . '-mask.png', $out); -exec('convert /tmp/' . $id . '-mask.png -gravity West -background black -splice 64x0 -distort SRT 90 /tmp/' . $id . '-mask2.png', $out); - -exec('convert -resize 128x128 -filter Point -background transparent -gravity center -extent 128x128 "/tmp/temp" /tmp/' . $id . '-source.png'); -exec('convert /tmp/' . $id . '-source.png -matte /tmp/' . $id . '-mask2.png -compose DstIn -composite -gravity East /tmp/' . $id . '.png', $out2); - -unlink("/tmp/temp"); - -echo(file_get_contents('/tmp/' . $id . '.png'));
\ No newline at end of file diff --git a/pages/api/raindrops-two.php b/pages/api/raindrops-two.php deleted file mode 100644 index 2fa09f2..0000000 --- a/pages/api/raindrops-two.php +++ /dev/null @@ -1,8 +0,0 @@ -<?php - -header("Content-Type: text/plain"); - -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true); -echo(json_encode([ - "multiple" => count($fronters["members"]) > 1 -]));
\ No newline at end of file diff --git a/pages/api/raindrops.php b/pages/api/raindrops.php deleted file mode 100644 index c44faa6..0000000 --- a/pages/api/raindrops.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -header("Content-Type: text/plain"); - -$fronters = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true); -echo($fronters['members'][0]['display_name'] ?? $fronters['members'][0]['name']);
\ No newline at end of file diff --git a/pages/api/timeline.php b/pages/api/timeline.php index ccd19f9..8271b7a 100644 --- a/pages/api/timeline.php +++ b/pages/api/timeline.php @@ -5,7 +5,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $i $systems = array_filter(array_keys($_GET), function ($i) { global $isLowerLoggedIn; global $isLoggedIn; global $app; - return $i === "gdapd" || $i === "ynmuc" || $i === "hrbom" || (($isLowerLoggedIn || $isLoggedIn) && $i === $app["other"]["id"]); + return $i === "gdapd" || $i === "hrbom" || (($isLowerLoggedIn || $isLoggedIn) && $i === $app["other"]["id"]); }); require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/components/timeline.inc"; diff --git a/pages/api/wakeup-real.php b/pages/api/wakeup-real.php deleted file mode 100644 index f00d5ea..0000000 --- a/pages/api/wakeup-real.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; - -if (!$isLoggedIn) { - header("Location: /-/login"); - die(); -} - -global $_PROFILE; - -$frontCloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true)["members"]; -$frontRaindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true)["members"]; - -$pony = "somepony"; -if ($_PROFILE['login'] === "raindrops") $pony = $frontRaindrops[0]["display_name"]; else $pony = $frontCloudburst[0]["display_name"]; - -$ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; - -file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: " . formatPonypush("🥱 Wake up!") . "\r\n" . - "Priority: high\r\n" . - "Tags: wakeup\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => formatPonypush("Hey, $pony wants you to wake up!") - ] -])); - -die();
\ No newline at end of file diff --git a/pages/api/wakeup.php b/pages/api/wakeup.php deleted file mode 100644 index a5d2b9f..0000000 --- a/pages/api/wakeup.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; - -if (!$isLoggedIn) { - header("Location: /-/login"); - die(); -} - -global $_PROFILE; - -$frontCloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/fronters.json"), true)["members"]; -$frontRaindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/fronters.json"), true)["members"]; - -$pony = "somepony"; -if ($_PROFILE['login'] === "raindrops") $pony = $frontRaindrops[0]["display_name"]; else $pony = $frontCloudburst[0]["display_name"]; - -$ntfy = $GLOBALS["ColdHazeApp"]["ntfy"]; - -file_get_contents('https://' . $ntfy["server"] . '/' . $ntfy["topic"], false, stream_context_create([ - 'http' => [ - 'method' => 'POST', - 'header' => - "Content-Type: text/plain\r\n" . - "Title: " . formatPonypush("[Test] 🥱 Wake up!") . "\r\n" . - "Priority: high\r\n" . - "Tags: wakeup\r\n" . - "Authorization: Basic " . base64_encode($ntfy["user"] . ":" . $ntfy["password"]), - 'content' => formatPonypush("[This notification is test] Hey, $pony wants you to wake up! [This notification is test]") - ] -])); - -die();
\ No newline at end of file |