From ad781086586562108274f53501a705d243b04e6d Mon Sep 17 00:00:00 2001 From: NaysKutzu Date: Thu, 19 Oct 2023 19:01:20 +0000 Subject: [PATCH 1/4] PUSH -> Started a api rewrite -> Now using headers for api --- api/admin/base.php | 62 ++++++++++------------- api/admin/statistics.php | 76 ++++++++++++++++++++-------- api/base.php | 11 +++- api/client/base.php | 38 +------------- api/info.php | 5 -- api/main.php | 20 ++++++++ oldapi/admin/base.php | 38 ++++++++++++++ oldapi/admin/statistics.php | 45 ++++++++++++++++ {api => oldapi}/admin/user/ban.php | 0 {api => oldapi}/admin/user/info.php | 0 {api => oldapi}/admin/users.php | 0 oldapi/base.php | 6 +++ oldapi/client/base.php | 37 ++++++++++++++ {api => oldapi}/client/user/info.php | 0 {api => oldapi}/encryptpwd.php | 0 {api => oldapi}/mysql.php | 0 {api => oldapi}/ticket.php | 0 routes/api/admin/index.php | 8 +-- routes/api/admin/user.php | 18 +++---- routes/api/client/user.php | 8 +-- routes/api/index.php | 11 +++- 21 files changed, 268 insertions(+), 115 deletions(-) delete mode 100644 api/info.php create mode 100644 api/main.php create mode 100644 oldapi/admin/base.php create mode 100644 oldapi/admin/statistics.php rename {api => oldapi}/admin/user/ban.php (100%) rename {api => oldapi}/admin/user/info.php (100%) rename {api => oldapi}/admin/users.php (100%) create mode 100644 oldapi/base.php create mode 100644 oldapi/client/base.php rename {api => oldapi}/client/user/info.php (100%) rename {api => oldapi}/encryptpwd.php (100%) rename {api => oldapi}/mysql.php (100%) rename {api => oldapi}/ticket.php (100%) diff --git a/api/admin/base.php b/api/admin/base.php index 2727b625..834b1c7e 100644 --- a/api/admin/base.php +++ b/api/admin/base.php @@ -1,38 +1,32 @@ - 0) { - //CONTINUE CODE HERE - - } else { - $rsp = array( - "code" => 403, - "error" => "The server understood the request, but it refuses to authorize it.", - "message" => "Im sorry but the api key is wrong" - ); - http_response_code(403); - die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); - } + 0) { + //CONTINUE CODE HERE + } else { - $rsp = array( - "code" => 400, - "error" => "The server cannot understand the request due to a client error.", - "message" => "Please provide an api key" - ); - http_response_code(400); - die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + $response = [ + "code" => 403, + "error" => "Unauthorized", + "message" => "Please make sure your API key is valid." + ]; + http_response_code(403); + die(json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); } +} else { + $response = [ + "code" => 401, + "error" => "Authentication required", + "message" => "Please provide your API key." + ]; + http_response_code(401); + die(json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); } -else { - $rsp = array( - "code" => 400, - "error" => "The server cannot understand the request due to a client error.", - "message" => "Please provide an api key" - ); - http_response_code(400); - die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); -} + ?> \ No newline at end of file diff --git a/api/admin/statistics.php b/api/admin/statistics.php index a6e9c815..7da7e263 100644 --- a/api/admin/statistics.php +++ b/api/admin/statistics.php @@ -1,25 +1,61 @@ query($userCountQuery); + $userCount = $userCountResult->fetch_assoc()['user_count']; -$userCountQuery = "SELECT COUNT(*) AS user_count FROM mythicaldash_users"; -$userCountResult = $conn->query($userCountQuery); -$userCount = $userCountResult->fetch_assoc()['user_count']; + $ticketCountQuery = "SELECT COUNT(*) AS ticket_count FROM mythicaldash_tickets"; + $ticketCountResult = $conn->query($ticketCountQuery); + $ticketCount = $ticketCountResult->fetch_assoc()['ticket_count']; -$ticketCountQuery = "SELECT COUNT(*) AS ticket_count FROM mythicaldash_tickets"; -$ticketCountResult = $conn->query($ticketCountQuery); -$ticketCount = $ticketCountResult->fetch_assoc()['ticket_count']; + $serverCountQuery = "SELECT COUNT(*) AS servers FROM mythicaldash_servers"; + $serverCountResult = $conn->query($serverCountQuery); + $serverCount = $serverCountResult->fetch_assoc()['servers']; -$rsp = array( - "code" => 200, - "error" => null, - "message" => "Sure here you go:", - "statistics" => array( - "users" => $userCount, - "tickets" => $ticketCount - ) -); -http_response_code(200); -$conn->close(); -die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + $serverQueueQuery = "SELECT COUNT(*) AS serversq FROM mythicaldash_servers_queue"; + $serverQueueCountResult = $conn->query($serverQueueQuery); + $serverQueueCount = $serverQueueCountResult->fetch_assoc()['serversq']; + + $locationsQuery = "SELECT COUNT(*) AS locations FROM mythicaldash_locations"; + $locationsCountResult = $conn->query($locationsQuery); + $locationsCount = $locationsCountResult->fetch_assoc()['locations']; + + $eggsQuery = "SELECT COUNT(*) AS eggs FROM mythicaldash_eggs"; + $eggsCountResult = $conn->query($eggsQuery); + $eggCount = $eggsCountResult->fetch_assoc()['eggs']; + $rsp = array( + "code" => 200, + "error" => null, + "message" => null, + "data" => array( + "users" => $userCount, + "tickets" => $ticketCount, + "servers" => $serverCount, + "servers_queue" => $serverQueueCount, + "locations" => $locationsCount, + "eggs" => $eggCount, + ) + ); + http_response_code(200); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } catch (Exception $e) { + $rsp = array( + "code" => 500, + "error" => "The server encountered a situation it doesn't know how to handle.", + "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + ); + http_response_code(500); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } +} else { + $rsp = array( + "code" => 405, + "error" => "A request was made of a page using a request method not supported by that page", + "message" => "Please use a get request" + ); + http_response_code(405); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); +} ?> \ No newline at end of file diff --git a/api/base.php b/api/base.php index 0afa1a9a..aeb1aede 100644 --- a/api/base.php +++ b/api/base.php @@ -1,6 +1,15 @@ 500, + "error" => "The server is not ready to handle the request.", + "message" => "We have no write permission for our home directory. Please update the permission by executing this in the server shell: chown -R www-data:www-data /var/www/client/ && chown -R www-data:www-data /var/www/client/*" + ); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); +} ?> \ No newline at end of file diff --git a/api/client/base.php b/api/client/base.php index df616eda..f6232d9e 100644 --- a/api/client/base.php +++ b/api/client/base.php @@ -1,37 +1,3 @@ - 0) { - //CONTINUE CODE HERE - - } else { - $rsp = array( - "code" => 403, - "error" => "The server understood the request, but it refuses to authorize it.", - "message" => "Im sorry but the api key is wrong" - ); - http_response_code(403); - die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); - } - } else { - $rsp = array( - "code" => 400, - "error" => "The server cannot understand the request due to a client error.", - "message" => "Please provide an api key" - ); - http_response_code(400); - die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); - } -} else { - $rsp = array( - "code" => 400, - "error" => "The server cannot understand the request due to a client error.", - "message" => "Please provide an api key" - ); - http_response_code(400); - die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); -} + \ No newline at end of file diff --git a/api/info.php b/api/info.php deleted file mode 100644 index e74a2956..00000000 --- a/api/info.php +++ /dev/null @@ -1,5 +0,0 @@ - 'error', 'message' => 'Hi this is a wrong api endpoint please check: https://github.com/MythicalLTD/MythicalDash#api-reference'),JSON_PRETTY_PRINT); -?> \ No newline at end of file diff --git a/api/main.php b/api/main.php new file mode 100644 index 00000000..4ea49940 --- /dev/null +++ b/api/main.php @@ -0,0 +1,20 @@ + 200, + "error" => null, + "message" => "Hi, and welcome to MythicalDash main api this is the main path of our API. Make sure to check our docs for the requests you can make!" + ); + http_response_code(200); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); +} else { + $rsp = array( + "code" => 405, + "error" => "A request was made of a page using a request method not supported by that page", + "message" => "Please use a get request" + ); + http_response_code(405); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); +} +?> \ No newline at end of file diff --git a/oldapi/admin/base.php b/oldapi/admin/base.php new file mode 100644 index 00000000..2727b625 --- /dev/null +++ b/oldapi/admin/base.php @@ -0,0 +1,38 @@ + 0) { + //CONTINUE CODE HERE + + } else { + $rsp = array( + "code" => 403, + "error" => "The server understood the request, but it refuses to authorize it.", + "message" => "Im sorry but the api key is wrong" + ); + http_response_code(403); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "The server cannot understand the request due to a client error.", + "message" => "Please provide an api key" + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } +} +else { + $rsp = array( + "code" => 400, + "error" => "The server cannot understand the request due to a client error.", + "message" => "Please provide an api key" + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); +} +?> \ No newline at end of file diff --git a/oldapi/admin/statistics.php b/oldapi/admin/statistics.php new file mode 100644 index 00000000..67d10f61 --- /dev/null +++ b/oldapi/admin/statistics.php @@ -0,0 +1,45 @@ +query($userCountQuery); +$userCount = $userCountResult->fetch_assoc()['user_count']; + +$ticketCountQuery = "SELECT COUNT(*) AS ticket_count FROM mythicaldash_tickets"; +$ticketCountResult = $conn->query($ticketCountQuery); +$ticketCount = $ticketCountResult->fetch_assoc()['ticket_count']; + +$Servers = "SELECT COUNT(*) AS servers FROM mythicaldash_servers"; +$serverCountResult = $conn->query($Servers); +$serverCount = $serverCountResult->fetch_assoc()['servers']; + +$servers_queue = "SELECT COUNT(*) AS serversq FROM mythicaldash_servers_queue"; +$serverqCountResult = $conn->query($servers_queue); +$servers_queueCount = $serverqCountResult->fetch_assoc()['serversq']; + +$locations = "SELECT COUNT(*) AS locations FROM mythicaldash_locations"; +$locationsCountResult = $conn->query($locations); +$locationsCount = $locationsCountResult->fetch_assoc()['locations']; + +$eggs = "SELECT COUNT(*) AS eggs FROM mythicaldash_eggs"; +$eggsCountResult = $conn->query($eggs); +$eggCount = $eggsCountResult->fetch_assoc()['eggs']; + +$rsp = array( + "code" => 200, + "error" => null, + "message" => null, + "statistics" => array( + "servers" => $serverCount, + "servers_queue" => $servers_queueCount, + "eggs" => $eggCount, + "locations" => $locationsCount, + "users" => $userCount, + "tickets" => $ticketCount, + ) +); +http_response_code(200); +$conn->close(); +die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); +?> \ No newline at end of file diff --git a/api/admin/user/ban.php b/oldapi/admin/user/ban.php similarity index 100% rename from api/admin/user/ban.php rename to oldapi/admin/user/ban.php diff --git a/api/admin/user/info.php b/oldapi/admin/user/info.php similarity index 100% rename from api/admin/user/info.php rename to oldapi/admin/user/info.php diff --git a/api/admin/users.php b/oldapi/admin/users.php similarity index 100% rename from api/admin/users.php rename to oldapi/admin/users.php diff --git a/oldapi/base.php b/oldapi/base.php new file mode 100644 index 00000000..0afa1a9a --- /dev/null +++ b/oldapi/base.php @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/oldapi/client/base.php b/oldapi/client/base.php new file mode 100644 index 00000000..df616eda --- /dev/null +++ b/oldapi/client/base.php @@ -0,0 +1,37 @@ + 0) { + //CONTINUE CODE HERE + + } else { + $rsp = array( + "code" => 403, + "error" => "The server understood the request, but it refuses to authorize it.", + "message" => "Im sorry but the api key is wrong" + ); + http_response_code(403); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "The server cannot understand the request due to a client error.", + "message" => "Please provide an api key" + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } +} else { + $rsp = array( + "code" => 400, + "error" => "The server cannot understand the request due to a client error.", + "message" => "Please provide an api key" + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); +} +?> \ No newline at end of file diff --git a/api/client/user/info.php b/oldapi/client/user/info.php similarity index 100% rename from api/client/user/info.php rename to oldapi/client/user/info.php diff --git a/api/encryptpwd.php b/oldapi/encryptpwd.php similarity index 100% rename from api/encryptpwd.php rename to oldapi/encryptpwd.php diff --git a/api/mysql.php b/oldapi/mysql.php similarity index 100% rename from api/mysql.php rename to oldapi/mysql.php diff --git a/api/ticket.php b/oldapi/ticket.php similarity index 100% rename from api/ticket.php rename to oldapi/ticket.php diff --git a/routes/api/admin/index.php b/routes/api/admin/index.php index bbb9abfa..914883e3 100644 --- a/routes/api/admin/index.php +++ b/routes/api/admin/index.php @@ -1,7 +1,7 @@ add("/api/admin/statistics", function () { - require("../include/main.php"); - require("../api/admin/statistics.php"); -}); +//$router->add("/api/admin/statistics", function () { +// require("../include/main.php"); +// require("../api/admin/statistics.php"); +//}); ?> \ No newline at end of file diff --git a/routes/api/admin/user.php b/routes/api/admin/user.php index a61978f3..91813ccb 100644 --- a/routes/api/admin/user.php +++ b/routes/api/admin/user.php @@ -1,12 +1,12 @@ add("/api/admin/user/info", function () { - require("../include/main.php"); - require("../api/admin/user/info.php"); -}); - -$router->add("/api/admin/user/list", function () { - require("../include/main.php"); - require("../api/admin/users.php"); -}); +//$router->add("/api/admin/user/info", function () { +// require("../include/main.php"); +// require("../api/admin/user/info.php"); +//}); +// +//$router->add("/api/admin/user/list", function () { +// require("../include/main.php"); +// require("../api/admin/users.php"); +//}); ?> \ No newline at end of file diff --git a/routes/api/client/user.php b/routes/api/client/user.php index 633deda1..a49f92c1 100644 --- a/routes/api/client/user.php +++ b/routes/api/client/user.php @@ -1,7 +1,7 @@ add("/api/client/user/info", function () { - require("../include/main.php"); - require("../api/client/user/info.php"); -}); +//$router->add("/api/client/user/info", function () { +// require("../include/main.php"); +// require("../api/client/user/info.php"); +//}); ?> \ No newline at end of file diff --git a/routes/api/index.php b/routes/api/index.php index c8e38026..c3e62180 100644 --- a/routes/api/index.php +++ b/routes/api/index.php @@ -1,6 +1,13 @@ add("/api/ticket", function () { +$router->add("/api", function () { require("../include/main.php"); - require("../api/ticket.php"); + require("../api/main.php"); }); + +$router->add("/api/admin/statistics", function () { + require("../include/main.php"); + require("../api/admin/statistics.php"); +}); + + ?> \ No newline at end of file From 3e3909a461daa940207f42bca751474aa484a8c5 Mon Sep 17 00:00:00 2001 From: NaysKutzu Date: Thu, 19 Oct 2023 20:43:44 +0000 Subject: [PATCH 2/4] PUSH --- Insomnia_2023-10-19.json | 1 + api/admin/user/ban.php | 72 +++++++++++++ api/admin/user/info.php | 90 ++++++++++++++++ api/admin/user/list.php | 81 ++++++++++++++ api/admin/user/reset-password.php | 61 +++++++++++ api/admin/user/resources/add.php | 168 ++++++++++++++++++++++++++++++ api/admin/user/resources/set.php | 152 +++++++++++++++++++++++++++ api/admin/user/unban.php | 66 ++++++++++++ migrate/14.sql | 1 + oldapi/admin/base.php | 38 ------- oldapi/admin/statistics.php | 45 -------- oldapi/admin/user/ban.php | 6 -- oldapi/admin/user/info.php | 68 ------------ oldapi/admin/users.php | 24 ----- oldapi/base.php | 6 -- oldapi/client/base.php | 37 ------- oldapi/client/user/info.php | 34 ------ oldapi/encryptpwd.php | 12 --- oldapi/mysql.php | 26 ----- oldapi/ticket.php | 66 ------------ routes/api/index.php | 33 ++++++ view/auth/forgot-password.php | 2 +- 22 files changed, 726 insertions(+), 363 deletions(-) create mode 100644 Insomnia_2023-10-19.json create mode 100644 api/admin/user/ban.php create mode 100644 api/admin/user/info.php create mode 100644 api/admin/user/list.php create mode 100644 api/admin/user/reset-password.php create mode 100644 api/admin/user/resources/add.php create mode 100644 api/admin/user/resources/set.php create mode 100644 api/admin/user/unban.php create mode 100644 migrate/14.sql delete mode 100644 oldapi/admin/base.php delete mode 100644 oldapi/admin/statistics.php delete mode 100644 oldapi/admin/user/ban.php delete mode 100644 oldapi/admin/user/info.php delete mode 100644 oldapi/admin/users.php delete mode 100644 oldapi/base.php delete mode 100644 oldapi/client/base.php delete mode 100644 oldapi/client/user/info.php delete mode 100644 oldapi/encryptpwd.php delete mode 100644 oldapi/mysql.php delete mode 100644 oldapi/ticket.php diff --git a/Insomnia_2023-10-19.json b/Insomnia_2023-10-19.json new file mode 100644 index 00000000..35a0c94c --- /dev/null +++ b/Insomnia_2023-10-19.json @@ -0,0 +1 @@ +{"_type":"export","__export_format":4,"__export_date":"2023-10-19T20:42:04.363Z","__export_source":"insomnia.desktop.app:v8.3.0","resources":[{"_id":"req_5c04f332fd5d47e399f1c9beeeb66a65","parentId":"fld_e104fd81a13d448b880f4f8921ac8028","modified":1697746630922,"created":1697744921958,"url":"https://devclient.mythicalsystems.me/api/admin/user/resources/set","name":"Set","description":"This just assigns resources to the user.","method":"POST","body":{"mimeType":"multipart/form-data","params":[{"id":"pair_786fa7c51a9847758381b99be88d5942","name":"email","value":"dummy@dummy.net","description":""},{"id":"pair_bd61ca0e3aa6445fb9c84423cbf4af37","name":"coins","value":"150","description":""},{"id":"pair_2f9ef79ce3ff4650b369a4e13c423e2e","name":"ram","value":"1024","description":""},{"id":"pair_c5b179fdfc5147228ea28b9a58c05498","name":"disk","value":"1024","description":""},{"id":"pair_bf996290689e4d01802538fe67f7e7b4","name":"cpu","value":"100","description":""},{"id":"pair_2c86496730e64070b1829a5eec9040f7","name":"server_limit","value":"1","description":""},{"id":"pair_351b69b1fe0747059893ca98e1243d36","name":"ports","value":"1","description":""},{"id":"pair_c9b374c78d75445e851f438a9e6a4338","name":"databases","value":"1","description":""},{"id":"pair_b305b47d376f4a718457757698f17edd","name":"backups","value":"1","description":""}]},"parameters":[],"headers":[{"name":"Content-Type","value":"multipart/form-data"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_d1897202eda04fa58bfa3f24ec3e8107"},{"id":"pair_a40e75d71994400d9675a72c9d4b8673","name":"Authorization","value":"mythicaldash_apikey","description":""}],"authentication":{},"metaSortKey":-1697744875752,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"fld_e104fd81a13d448b880f4f8921ac8028","parentId":"fld_e8ff218397174389bae6a3a5661669c0","modified":1697744844978,"created":1697744840177,"name":"Resources","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1697742197784,"_type":"request_group"},{"_id":"fld_e8ff218397174389bae6a3a5661669c0","parentId":"fld_1e79fba929fc4d72bb47e7eb24ec1737","modified":1697742189325,"created":1697742176368,"name":"User","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1697740779163,"_type":"request_group"},{"_id":"fld_1e79fba929fc4d72bb47e7eb24ec1737","parentId":"wrk_a2ea7d20da784d39a2211928ba8a016f","modified":1697740702126,"created":1697740702126,"name":"Admin","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1697740702126,"_type":"request_group"},{"_id":"wrk_a2ea7d20da784d39a2211928ba8a016f","parentId":null,"modified":1697740507721,"created":1697740507721,"name":"MythicalDash API","description":"","scope":"collection","_type":"workspace"},{"_id":"req_7219bb298f4f487a9fff86d14f7a7c2b","parentId":"fld_e104fd81a13d448b880f4f8921ac8028","modified":1697747863230,"created":1697744848474,"url":"https://devclient.mythicalsystems.me/api/admin/user/resources/add","name":"Add","description":"This just adds resources to the user.","method":"POST","body":{"mimeType":"multipart/form-data","params":[{"id":"pair_61239e6aebf748eaa512e784c5d06aae","name":"email","value":"dummy@dummy.net","description":""},{"id":"pair_49bc7f42e8f14355919bc9bcba11c16a","name":"coins","value":"0","description":""},{"id":"pair_6ca9896e89484881ba8e5c221929120b","name":"ram","value":"0","description":""},{"id":"pair_0c7483614a85494f89fe258044b5e5c2","name":"disk","value":"0","description":""},{"id":"pair_4ecd5a6dc69b4bf5b1876f83714ad958","name":"cpu","value":"0","description":""},{"id":"pair_9d1b3fc865c24db499e43fa2b163cf2c","name":"server_limit","value":"0","description":""},{"id":"pair_41c75a5885594d1c9d4189229f935643","name":"ports","value":"0","description":""},{"id":"pair_4f4c82aeab6a46a2bd2fc3428d1007de","name":"databases","value":"0","description":""},{"id":"pair_0cf0342cf5cd4eb5a2d2af363c25c974","name":"backups","value":"0","description":""}]},"parameters":[],"headers":[{"name":"Content-Type","value":"multipart/form-data"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_9537cfb9de5c498f8dd8c3673ef25bd4"},{"id":"pair_28df8e45bc3149f2a1489d7bc76159f9","name":"Authorization","value":"mythicaldash_apikey","description":""}],"authentication":{},"metaSortKey":-1697744875652,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_a99d49ff72144407a8a82f0a62dd5e0b","parentId":"fld_e8ff218397174389bae6a3a5661669c0","modified":1697744734268,"created":1697744162993,"url":"https://devclient.mythicalsystems.me/api/admin/user/unban","name":"UnBan","description":"This just unbans the user","method":"POST","body":{"mimeType":"multipart/form-data","params":[{"id":"pair_c594e08be34c4407823b1b5e47b3e653","name":"email","value":"dummy@dummy.net","description":""}]},"parameters":[],"headers":[{"name":"Content-Type","value":"multipart/form-data"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_7de2161e9d1749448b3084018dff7ed5"},{"id":"pair_76dc3d74fad04d8fa5d64476ce41e1ff","name":"Authorization","value":"mythicaldash_apikey","description":""}],"authentication":{},"metaSortKey":-1697742197684,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_da47a5a9e6da4b6fad000de655d92af7","parentId":"fld_e8ff218397174389bae6a3a5661669c0","modified":1697744759828,"created":1697743754282,"url":"https://devclient.mythicalsystems.me/api/admin/user/ban","name":"Ban","description":"This just bans the user","method":"POST","body":{"mimeType":"multipart/form-data","params":[{"id":"pair_eae57274a71e470ba08874f58b9360ac","name":"email","value":"dummy@dummy.net","description":""}]},"parameters":[{"id":"pair_1c87f16c519549ee8214c152f67ecee5","name":"email","value":"dummy@dummy.net","description":""}],"headers":[{"name":"Content-Type","value":"multipart/form-data"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_11fd718730a54fdc86c132feb9cd95f8"},{"id":"pair_8ffae0e5b0c349a89cb16eb4602543e3","name":"Authorization","value":"mythicaldash_apikey","description":""}],"authentication":{},"metaSortKey":-1697742197584,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_90ae0bacdb83448394c98a758eaeb836","parentId":"fld_e8ff218397174389bae6a3a5661669c0","modified":1697747477606,"created":1697747326361,"url":"https://devclient.mythicalsystems.me/api/admin/user/reset-password","name":"Reset-Password","description":"Created a code for a password reset!","method":"POST","body":{"mimeType":"multipart/form-data","params":[{"id":"pair_39a363f2bb3e4df3a116f4fd68b509b4","name":"email","value":"dummy@dummy.net","description":""}]},"parameters":[],"headers":[{"name":"Content-Type","value":"multipart/form-data","id":"pair_f8e17e133adf4338bd923cdb0b5f1fc8"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_fee36d87652942a5a1c194866d8b0c0b"},{"id":"pair_5c8abceb26ea42a28a5a5abb96952c4c","name":"Authorization","value":"mythicaldash_apikey","description":""}],"authentication":{},"metaSortKey":-1697742197534,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_fe1fa766bcec471a8a21d2c11965866e","parentId":"fld_e8ff218397174389bae6a3a5661669c0","modified":1697744605637,"created":1697742998516,"url":"https://devclient.mythicalsystems.me/api/admin/user/{% os 'userInfo', '' %}","name":"Info ","description":"This thing gets info about the user","method":"GET","body":{"mimeType":"application/json","text":""},"parameters":[{"id":"pair_0253fef8faa045e5894fc2766df9e28c","name":"email","value":"dummy@dummy.net","description":""}],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_9a33a6992501492eb76edb45c3036efe"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_6fb35dbd784449f796946d1d98d017a3"},{"id":"pair_b1f3c0065c61437b89e8862818c7481e","name":"Authorization","value":"mythicaldash_apikey","description":""}],"authentication":{},"metaSortKey":-1697742197484,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_1e289ae49b444a509e7b91c6c40acee4","parentId":"fld_e8ff218397174389bae6a3a5661669c0","modified":1697742897891,"created":1697742191918,"url":"https://devclient.mythicalsystems.me/api/admin/user/list","name":"List","description":"List all users from the database","method":"GET","body":{"mimeType":"application/json","text":""},"parameters":[{"id":"pair_fbf53b9fc1a34fe293680c85bf157788","name":"page","value":"2","description":""}],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_af99c4dffac040e4b7c9d291c62dd7bf"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_0442a6887683493891e5585b60530e35"},{"id":"pair_7b70e9741eea493692dad339b83269aa","name":"Authorization","value":"mythicaldash_apikey","description":""}],"authentication":{},"metaSortKey":-1697742197384,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_9e23eaa6a5034f35b0aa4483b1bb076c","parentId":"fld_1e79fba929fc4d72bb47e7eb24ec1737","modified":1697741102255,"created":1697740704720,"url":"https://devclient.mythicalsystems.me/api/admin/statistics","name":"Statistics","description":"Get the statistics like total users or servers. ","method":"GET","body":{"mimeType":"application/json","text":""},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_0ad1e4468cf34a96a1ec9365e52123eb"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_b2a11c367ba04277995facb1677e2faa"},{"id":"pair_7de0770235aa41428c3010d6f09d408e","name":"Authorization","value":"mythicaldash_apikey","description":""}],"authentication":{},"metaSortKey":-1697740779063,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_a872852d26284b63b48593ef47a0f8ae","parentId":"wrk_a2ea7d20da784d39a2211928ba8a016f","modified":1697740564415,"created":1697740511067,"url":"https://devclient.mythicalsystems.me/api","name":"Main","description":"This does nothing it is just the main API path.","method":"GET","body":{"mimeType":"application/json","text":""},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json"},{"name":"User-Agent","value":"insomnia/8.3.0"}],"authentication":{},"metaSortKey":-1697740511067,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"env_75e6215485b10e994d1f4dc9866824c7d9b84a91","parentId":"wrk_a2ea7d20da784d39a2211928ba8a016f","modified":1697740507722,"created":1697740507722,"name":"Base Environment","data":{},"dataPropertyOrder":null,"color":null,"isPrivate":false,"metaSortKey":1697740507722,"_type":"environment"},{"_id":"jar_75e6215485b10e994d1f4dc9866824c7d9b84a91","parentId":"wrk_a2ea7d20da784d39a2211928ba8a016f","modified":1697740523072,"created":1697740507722,"name":"Default Jar","cookies":[{"key":"PHPSESSID","value":"pi2u6pkf2bohb5mn5jb1ariune","domain":"devclient.mythicalsystems.me","path":"/","hostOnly":true,"creation":"2023-10-19T18:35:23.072Z","lastAccessed":"2023-10-19T18:35:23.072Z","id":"29508785360150114"}],"_type":"cookie_jar"}]} \ No newline at end of file diff --git a/api/admin/user/ban.php b/api/admin/user/ban.php new file mode 100644 index 00000000..7bee50b3 --- /dev/null +++ b/api/admin/user/ban.php @@ -0,0 +1,72 @@ + 0) { + $userdb = $conn->query("SELECT * FROM mythicaldash_users WHERE email = '" . $email . "'")->fetch_array(); + if ($userdb['banned'] == "") { + if (isset($_POST['reason'])) { + $reason = mysqli_real_escape_string($conn, $_POST['reason']); + } else { + $reason = 'Unknown'; + } + $conn->query("UPDATE `mythicaldash_users` SET `banned` = '$reason' WHERE `mythicaldash_users`.`email` = '$email';"); + $rsp = array( + "code" => 200, + "error" => null, + "message" => "We banned ".$userdb['username'], + ); + http_response_code(200); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } else { + $rsp = array( + "code" => 403, + "error" => "The server understood the request, but it refuses to authorize it.", + "message" => "User is already banned!" + ); + http_response_code(403); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + + } else { + $rsp = array( + "code" => 403, + "error" => "The server understood the request, but it refuses to authorize it.", + "message" => "We can't find this user in our database!" + ); + http_response_code(403); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Email is required, but not provided." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + + } catch (Exception $e) { + $rsp = array( + "code" => 500, + "error" => "The server encountered a situation it doesn't know how to handle.", + "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + ); + http_response_code(500); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } +} else { + $rsp = array( + "code" => 405, + "error" => "A request was made of a page using a request method not supported by that page", + "message" => "Please use a post request" + ); + http_response_code(405); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); +} +?> \ No newline at end of file diff --git a/api/admin/user/info.php b/api/admin/user/info.php new file mode 100644 index 00000000..96fb0c18 --- /dev/null +++ b/api/admin/user/info.php @@ -0,0 +1,90 @@ + 0) { + $userdb = $conn->query("SELECT * FROM mythicaldash_users WHERE email = '" . $email . "'")->fetch_array(); + $rsp = array( + "code" => 200, + "error" => null, + "info" => array( + "database_id" => $userdb['id'], + "pterodactyl_id" => $userdb["panel_id"], + "username" => $userdb['username'], + "email" => $userdb['email'], + "first_name" => decrypt($userdb['first_name'], $ekey), + "last_name" => decrypt($userdb['last_name'], $ekey), + "role" => $userdb['role'], + "banned" => $userdb['banned'], + "last_ip" => $userdb["last_ip"], + "first_ip" => $userdb["first_ip"], + "registred_at" => $userdb['registred'] + ), + "resources" => array( + "coins" => $userdb['coins'], + "ram" => $userdb['ram'], + "disk" => $userdb['disk'], + "cpu" => $userdb['cpu'], + "server_limit" => $userdb['server_limit'], + "ports" => $userdb['ports'], + "databases" => $userdb['databases'], + "backups" => $userdb['backups'], + "minutes_afk" => $userdb["minutes_afk"], + ), + "discord" => array( + "linked" => $userdb["discord_linked"], + "discord_id" => $userdb["discord_id"], + "discord_username" => $userdb["discord_username"], + "discord_global_username" => $userdb["discord_global_username"], + "discord_email" => $userdb["discord_email"], + ), + "profile" => array( + "avatar" => $userdb['avatar'], + "banner" => $userdb['banner'], + ), + ); + $conn->close(); + http_response_code(200); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } else { + $rsp = array( + "code" => 403, + "error" => "The server understood the request, but it refuses to authorize it.", + "message" => "We can't find this user in our database!" + ); + http_response_code(403); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Email is required, but not provided." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + + } catch (Exception $e) { + $rsp = array( + "code" => 500, + "error" => "The server encountered a situation it doesn't know how to handle.", + "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + ); + http_response_code(500); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } +} else { + $rsp = array( + "code" => 405, + "error" => "A request was made of a page using a request method not supported by that page", + "message" => "Please use a get request" + ); + http_response_code(405); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); +} +?> \ No newline at end of file diff --git a/api/admin/user/list.php b/api/admin/user/list.php new file mode 100644 index 00000000..5f4fd981 --- /dev/null +++ b/api/admin/user/list.php @@ -0,0 +1,81 @@ +query($sql); + $totalUsers = $totalUsersResult->num_rows; + $totalPages = ceil($totalUsers / $usersPerPage); + + $sql = "SELECT * FROM mythicaldash_users LIMIT $usersPerPage OFFSET $offset"; + $result = $conn->query($sql); + + if ($result) { + if ($result->num_rows > 0) { + $users = array(); + while ($row = $result->fetch_assoc()) { + $users[] = $row; + } + $conn->close(); + + $response = array( + "page" => $page, + "message" => null, + "users" => $users, + "total_pages" => $totalPages + ); + + http_response_code(200); + die(json_encode($response)); + } else { + $conn->close(); + $rsp = array( + "code" => 403, + "error" => "The server understood the request, but it refuses to authorize it.", + "message" => "No users found for this page." + ); + http_response_code(403); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $conn->close(); + $rsp = array( + "code" => 500, + "error" => "The server encountered a situation it doesn't know how to handle.", + "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + ); + http_response_code(500); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } catch (Exception $e) { + $rsp = array( + "code" => 500, + "error" => "The server encountered a situation it doesn't know how to handle.", + "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + ); + http_response_code(500); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } +} else { + $rsp = array( + "code" => 405, + "error" => "A request was made of a page using a request method not supported by that page", + "message" => "Please use a get request" + ); + http_response_code(405); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); +} + +?> \ No newline at end of file diff --git a/api/admin/user/reset-password.php b/api/admin/user/reset-password.php new file mode 100644 index 00000000..47af597d --- /dev/null +++ b/api/admin/user/reset-password.php @@ -0,0 +1,61 @@ + 0) { + $userdb = $conn->query("SELECT * FROM mythicaldash_users WHERE email = '" . $email . "'")->fetch_array(); + $skey = generate_keynoinfo(); + $conn->query("INSERT INTO `mythicaldash_resetpasswords` (`email`, `user-apikey`, `user-resetkeycode`, `ip_addres`) VALUES ('".$email."', '".$userdb['api_key']."', '".$skey."', '127.0.0.7');"); + $rsp = array( + "code" => 200, + "error" => null, + "message" => "We created a reset password key for the user ".$userbd['username']."!", + "data" => array( + "code" => $skey, + "link" => $appURL."/auth/reset-password?code=".$skey, + ) + ); + http_response_code(200); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } else { + $rsp = array( + "code" => 403, + "error" => "The server understood the request, but it refuses to authorize it.", + "message" => "We can't find this user in our database!" + ); + http_response_code(403); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Email is required, but not provided." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + + } catch (Exception $e) { + $rsp = array( + "code" => 500, + "error" => "The server encountered a situation it doesn't know how to handle.", + "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + ); + http_response_code(500); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } +} else { + $rsp = array( + "code" => 405, + "error" => "A request was made of a page using a request method not supported by that page", + "message" => "Please use a post request" + ); + http_response_code(405); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); +} +?> \ No newline at end of file diff --git a/api/admin/user/resources/add.php b/api/admin/user/resources/add.php new file mode 100644 index 00000000..d1a18073 --- /dev/null +++ b/api/admin/user/resources/add.php @@ -0,0 +1,168 @@ + 0) { + $userdb = $conn->query("SELECT * FROM mythicaldash_users WHERE email = '" . $email . "'")->fetch_array(); + $userdb_coins = $userdb["coins"]; + $userdb_ram = $userdb["ram"]; + $userdb_disk = $userdb["disk"]; + $userdb_cpu = $userdb["cpu"]; + $userdb_server_limit = $userdb["server_limit"]; + $userdb_ports = $userdb["ports"]; + $userdb_databases = $userdb["databases"]; + $userdb_backups = $userdb["backups"]; + if (isset($_POST["coins"]) && $_POST["coins"] >= 0 && is_numeric($_POST['coins'])) { + $request_coins = mysqli_real_escape_string($conn, $_POST['coins']); + if (isset($_POST["ram"]) && $_POST["ram"] >= 0 && is_numeric($_POST['ram'])) { + $request_ram = mysqli_real_escape_string($conn, $_POST['ram']); + if (isset($_POST["disk"]) && $_POST["disk"] >= 0 && is_numeric($_POST['disk'])) { + $request_disk = mysqli_real_escape_string($conn, $_POST['disk']); + if (isset($_POST["cpu"]) && $_POST["cpu"] >= 0 && is_numeric($_POST['cpu'])) { + $request_cpu = mysqli_real_escape_string($conn, $_POST['cpu']); + if (isset($_POST["server_limit"]) && $_POST["server_limit"] >= 0 && is_numeric($_POST['server_limit'])) { + $request_server_limit = mysqli_real_escape_string($conn, $_POST['server_limit']); + if (isset($_POST["ports"]) && $_POST["ports"] >= 0 && is_numeric($_POST['ports'])) { + $request_ports = mysqli_real_escape_string($conn, $_POST['ports']); + if (isset($_POST["databases"]) && $_POST["databases"] >= 0 && is_numeric($_POST['databases'])) { + $request_databases = mysqli_real_escape_string($conn, $_POST['databases']); + if (isset($_POST["backups"]) && $_POST["backups"] >= 0 && is_numeric($_POST['backups'])) { + $request_backups = mysqli_real_escape_string($conn, $_POST['backups']); + $new_coins = $userdb_coins + $request_coins; + $new_ram = $userdb_ram + $request_ram; + $new_disk = $userdb_disk + $request_disk; + $new_cpu = $userdb_cpu + $request_cpu; + $new_server_limit = $userdb_server_limit + $request_server_limit; + $new_ports = $userdb_ports + $request_ports; + $new_databases = $userdb_databases + $request_databases; + $new_backups = $userdb_backups + $request_backups; + $conn->query("UPDATE `mythicaldash_users` SET `coins` = '$new_coins' WHERE `mythicaldash_users`.`email` = '$email';"); + $conn->query("UPDATE `mythicaldash_users` SET `ram` = '$new_ram' WHERE `mythicaldash_users`.`email` = '$email';"); + $conn->query("UPDATE `mythicaldash_users` SET `disk` = '$new_disk' WHERE `mythicaldash_users`.`email` = '$email';"); + $conn->query("UPDATE `mythicaldash_users` SET `cpu` = '$new_cpu' WHERE `mythicaldash_users`.`email` = '$email';"); + $conn->query("UPDATE `mythicaldash_users` SET `server_limit` = '$new_server_limit' WHERE `mythicaldash_users`.`email` = '$email';"); + $conn->query("UPDATE `mythicaldash_users` SET `ports` = '$new_ports' WHERE `mythicaldash_users`.`email` = '$email';"); + $conn->query("UPDATE `mythicaldash_users` SET `databases` = '$new_databases' WHERE `mythicaldash_users`.`email` = '$email';"); + $conn->query("UPDATE `mythicaldash_users` SET `backups` = '$new_backups' WHERE `mythicaldash_users`.`email` = '$email';"); + $conn->close(); + $rsp = array( + "code" => 200, + "error" => null, + "message" => "We updated the resources for " . $userdb['username'], + ); + http_response_code(200); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Backups is required, but not provided or wrong value." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Databases is required, but not provided or wrong value." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Ports is required, but not provided or wrong value." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Server Limit is required, but not provided or wrong value." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Cpu is required, but not provided or wrong value." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Disk is required, but not provided or wrong value." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Ram is required, but not provided or wrong value." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Coins is required, but not provided or wrong value." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 403, + "error" => "The server understood the request, but it refuses to authorize it.", + "message" => "We can't find this user in our database!" + ); + http_response_code(403); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Email is required, but not provided." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + + } catch (Exception $e) { + $rsp = array( + "code" => 500, + "error" => "The server encountered a situation it doesn't know how to handle.", + "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + ); + http_response_code(500); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } +} else { + $rsp = array( + "code" => 405, + "error" => "A request was made of a page using a request method not supported by that page", + "message" => "Please use a post request" + ); + http_response_code(405); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); +} +?> \ No newline at end of file diff --git a/api/admin/user/resources/set.php b/api/admin/user/resources/set.php new file mode 100644 index 00000000..736e7018 --- /dev/null +++ b/api/admin/user/resources/set.php @@ -0,0 +1,152 @@ + 0) { + $userdb = $conn->query("SELECT * FROM mythicaldash_users WHERE email = '" . $email . "'")->fetch_array(); + if (isset($_POST["coins"]) && !$_POST['coins'] == "" && is_numeric($_POST['coins'])) { + $request_coins = mysqli_real_escape_string($conn, $_POST['coins']); + if (isset($_POST["ram"]) && !$_POST['ram'] == "" && is_numeric($_POST['ram'])) { + $request_ram = mysqli_real_escape_string($conn, $_POST['ram']); + if (isset($_POST["disk"]) && !$_POST['disk'] == "" && is_numeric($_POST['disk'])) { + $request_disk = mysqli_real_escape_string($conn, $_POST['disk']); + if (isset($_POST["cpu"]) && !$_POST['cpu'] == "" && is_numeric($_POST['cpu'])) { + $request_cpu = mysqli_real_escape_string($conn, $_POST['cpu']); + if (isset($_POST["server_limit"]) && !$_POST['server_limit'] == "" && is_numeric($_POST['server_limit'])) { + $request_server_limit = mysqli_real_escape_string($conn, $_POST['server_limit']); + if (isset($_POST["ports"]) && !$_POST['ports'] == "" && is_numeric($_POST['ports'])) { + $request_ports = mysqli_real_escape_string($conn, $_POST['ports']); + if (isset($_POST["databases"]) && !$_POST['databases'] == "" && is_numeric($_POST['databases'])) { + $request_databases = mysqli_real_escape_string($conn, $_POST['databases']); + if (isset($_POST["backups"]) && !$_POST['backups'] == "" && is_numeric($_POST['backups'])) { + $request_backups = mysqli_real_escape_string($conn, $_POST['backups']); + $conn->query("UPDATE `mythicaldash_users` SET `coins` = '$request_coins' WHERE `mythicaldash_users`.`email` = '$email';"); + $conn->query("UPDATE `mythicaldash_users` SET `ram` = '$request_ram' WHERE `mythicaldash_users`.`email` = '$email';"); + $conn->query("UPDATE `mythicaldash_users` SET `disk` = '$request_disk' WHERE `mythicaldash_users`.`email` = '$email';"); + $conn->query("UPDATE `mythicaldash_users` SET `cpu` = '$request_cpu' WHERE `mythicaldash_users`.`email` = '$email';"); + $conn->query("UPDATE `mythicaldash_users` SET `server_limit` = '$request_server_limit' WHERE `mythicaldash_users`.`email` = '$email';"); + $conn->query("UPDATE `mythicaldash_users` SET `ports` = '$request_ports' WHERE `mythicaldash_users`.`email` = '$email';"); + $conn->query("UPDATE `mythicaldash_users` SET `databases` = '$request_databases' WHERE `mythicaldash_users`.`email` = '$email';"); + $conn->query("UPDATE `mythicaldash_users` SET `backups` = '$request_backups' WHERE `mythicaldash_users`.`email` = '$email';"); + $conn->close(); + $rsp = array( + "code" => 200, + "error" => null, + "message" => "We updated the resources for " . $userdb['username'], + ); + http_response_code(200); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Backups is required, but not provided or wrong value." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Databases is required, but not provided or wrong value." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Ports is required, but not provided or wrong value." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Server Limit is required, but not provided or wrong value." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Cpu is required, but not provided or wrong value." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Disk is required, but not provided or wrong value." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Ram is required, but not provided or wrong value." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Coins is required, but not provided or wrong value." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 403, + "error" => "The server understood the request, but it refuses to authorize it.", + "message" => "We can't find this user in our database!" + ); + http_response_code(403); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Email is required, but not provided." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + + } catch (Exception $e) { + $rsp = array( + "code" => 500, + "error" => "The server encountered a situation it doesn't know how to handle.", + "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + ); + http_response_code(500); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } +} else { + $rsp = array( + "code" => 405, + "error" => "A request was made of a page using a request method not supported by that page", + "message" => "Please use a post request" + ); + http_response_code(405); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); +} +?> \ No newline at end of file diff --git a/api/admin/user/unban.php b/api/admin/user/unban.php new file mode 100644 index 00000000..9002c99a --- /dev/null +++ b/api/admin/user/unban.php @@ -0,0 +1,66 @@ + 0) { + $userdb = $conn->query("SELECT * FROM mythicaldash_users WHERE email = '" . $email . "'")->fetch_array(); + if (!$userdb["banned"] == "") { + $conn->query("UPDATE `mythicaldash_users` SET `banned` = '' WHERE `mythicaldash_users`.`email` = '$email';"); + $rsp = array( + "code" => 200, + "error" => null, + "message" => "We unbanned " . $userdb['username'], + ); + http_response_code(200); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } else { + $rsp = array( + "code" => 403, + "error" => "The server understood the request, but it refuses to authorize it.", + "message" => "User is not banned" + ); + http_response_code(403); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 403, + "error" => "The server understood the request, but it refuses to authorize it.", + "message" => "We can't find this user in our database!" + ); + http_response_code(403); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Email is required, but not provided." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + + } catch (Exception $e) { + $rsp = array( + "code" => 500, + "error" => "The server encountered a situation it doesn't know how to handle.", + "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + ); + http_response_code(500); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } +} else { + $rsp = array( + "code" => 405, + "error" => "A request was made of a page using a request method not supported by that page", + "message" => "Please use a post request" + ); + http_response_code(405); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); +} +?> \ No newline at end of file diff --git a/migrate/14.sql b/migrate/14.sql new file mode 100644 index 00000000..b6b3b884 --- /dev/null +++ b/migrate/14.sql @@ -0,0 +1 @@ +ALTER TABLE `mythicaldash_resetpasswords` CHANGE `dateinfo` `dateinfo` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP; \ No newline at end of file diff --git a/oldapi/admin/base.php b/oldapi/admin/base.php deleted file mode 100644 index 2727b625..00000000 --- a/oldapi/admin/base.php +++ /dev/null @@ -1,38 +0,0 @@ - 0) { - //CONTINUE CODE HERE - - } else { - $rsp = array( - "code" => 403, - "error" => "The server understood the request, but it refuses to authorize it.", - "message" => "Im sorry but the api key is wrong" - ); - http_response_code(403); - die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); - } - } else { - $rsp = array( - "code" => 400, - "error" => "The server cannot understand the request due to a client error.", - "message" => "Please provide an api key" - ); - http_response_code(400); - die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); - } -} -else { - $rsp = array( - "code" => 400, - "error" => "The server cannot understand the request due to a client error.", - "message" => "Please provide an api key" - ); - http_response_code(400); - die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); -} -?> \ No newline at end of file diff --git a/oldapi/admin/statistics.php b/oldapi/admin/statistics.php deleted file mode 100644 index 67d10f61..00000000 --- a/oldapi/admin/statistics.php +++ /dev/null @@ -1,45 +0,0 @@ -query($userCountQuery); -$userCount = $userCountResult->fetch_assoc()['user_count']; - -$ticketCountQuery = "SELECT COUNT(*) AS ticket_count FROM mythicaldash_tickets"; -$ticketCountResult = $conn->query($ticketCountQuery); -$ticketCount = $ticketCountResult->fetch_assoc()['ticket_count']; - -$Servers = "SELECT COUNT(*) AS servers FROM mythicaldash_servers"; -$serverCountResult = $conn->query($Servers); -$serverCount = $serverCountResult->fetch_assoc()['servers']; - -$servers_queue = "SELECT COUNT(*) AS serversq FROM mythicaldash_servers_queue"; -$serverqCountResult = $conn->query($servers_queue); -$servers_queueCount = $serverqCountResult->fetch_assoc()['serversq']; - -$locations = "SELECT COUNT(*) AS locations FROM mythicaldash_locations"; -$locationsCountResult = $conn->query($locations); -$locationsCount = $locationsCountResult->fetch_assoc()['locations']; - -$eggs = "SELECT COUNT(*) AS eggs FROM mythicaldash_eggs"; -$eggsCountResult = $conn->query($eggs); -$eggCount = $eggsCountResult->fetch_assoc()['eggs']; - -$rsp = array( - "code" => 200, - "error" => null, - "message" => null, - "statistics" => array( - "servers" => $serverCount, - "servers_queue" => $servers_queueCount, - "eggs" => $eggCount, - "locations" => $locationsCount, - "users" => $userCount, - "tickets" => $ticketCount, - ) -); -http_response_code(200); -$conn->close(); -die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); -?> \ No newline at end of file diff --git a/oldapi/admin/user/ban.php b/oldapi/admin/user/ban.php deleted file mode 100644 index 0e1dbd49..00000000 --- a/oldapi/admin/user/ban.php +++ /dev/null @@ -1,6 +0,0 @@ - \ No newline at end of file diff --git a/oldapi/admin/user/info.php b/oldapi/admin/user/info.php deleted file mode 100644 index 811faddb..00000000 --- a/oldapi/admin/user/info.php +++ /dev/null @@ -1,68 +0,0 @@ - 0) { - $userdb = $conn->query("SELECT * FROM mythicaldash_users WHERE email = '" . $email . "'")->fetch_array(); - $rsp = array( - "code" => 200, - "error" => null, - "info" => array( - "database_id" => $userdb['id'], - "username" => $userdb['username'], - "email" => $userdb['email'], - "first_name" => decrypt($userdb['first_name'],$ekey), - "last_name" => decrypt($userdb['last_name'],$ekey), - "avatar" => $userdb['avatar'], - "role" => $userdb['role'], - "banned" => $userdb['banned'], - "registred_at" => $userdb['registred'] - ), - "resources" => array( - "coins" => $userdb['coins'], - "ram" => $userdb['ram'], - "disk" => $userdb['disk'], - "cpu" => $userdb['cpu'], - "server_limit" => $userdb['server_limit'], - "ports" => $userdb['ports'], - "databases" => $userdb['databases'], - "backups" => $userdb['backups'], - ), - ); - $conn->close(); - http_response_code(200); - die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); - } else { - $rsp = array( - "code" => 403, - "error" => "The server understood the request, but it refuses to authorize it.", - "message" => "We can't find this user in our database!" - ); - http_response_code(403); - die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); - } - - } else { - $rsp = array( - "code" => 400, - "error" => "The server cannot understand the request due to a client error.", - "message" => "Email is required, but not provided." - ); - http_response_code(400); - die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); - } -} else { - $rsp = array( - "code" => 400, - "error" => "The server cannot understand the request due to a client error.", - "message" => "Email is required, but not provided." - ); - http_response_code(400); - die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); -} - -?> \ No newline at end of file diff --git a/oldapi/admin/users.php b/oldapi/admin/users.php deleted file mode 100644 index 315b8fa4..00000000 --- a/oldapi/admin/users.php +++ /dev/null @@ -1,24 +0,0 @@ -query($sql); -if ($result->num_rows > 0) { - $users = array(); - while ($row = $result->fetch_assoc()) { - $users[] = $row; - } - $conn->close(); - http_response_code(200); - die(json_encode($users)); -} else { - $conn->close(); - $rsp = array( - "code" => 403, - "error" => "The server understood the request, but it refuses to authorize it.", - "message" => "We can't find any user in the database!" - ); - http_response_code(403); - die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); -} -?> \ No newline at end of file diff --git a/oldapi/base.php b/oldapi/base.php deleted file mode 100644 index 0afa1a9a..00000000 --- a/oldapi/base.php +++ /dev/null @@ -1,6 +0,0 @@ - \ No newline at end of file diff --git a/oldapi/client/base.php b/oldapi/client/base.php deleted file mode 100644 index df616eda..00000000 --- a/oldapi/client/base.php +++ /dev/null @@ -1,37 +0,0 @@ - 0) { - //CONTINUE CODE HERE - - } else { - $rsp = array( - "code" => 403, - "error" => "The server understood the request, but it refuses to authorize it.", - "message" => "Im sorry but the api key is wrong" - ); - http_response_code(403); - die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); - } - } else { - $rsp = array( - "code" => 400, - "error" => "The server cannot understand the request due to a client error.", - "message" => "Please provide an api key" - ); - http_response_code(400); - die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); - } -} else { - $rsp = array( - "code" => 400, - "error" => "The server cannot understand the request due to a client error.", - "message" => "Please provide an api key" - ); - http_response_code(400); - die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); -} -?> \ No newline at end of file diff --git a/oldapi/client/user/info.php b/oldapi/client/user/info.php deleted file mode 100644 index e6b4a12e..00000000 --- a/oldapi/client/user/info.php +++ /dev/null @@ -1,34 +0,0 @@ -query("SELECT * FROM mythicaldash_users WHERE api_key = '" . $api_key . "'")->fetch_array(); -$rsp = array( - "code" => 200, - "error" => null, - "info" => array( - "database_id" => $userdb['id'], - "username" => $userdb['username'], - "email" => $userdb['email'], - "first_name" => $userdb['first_name'], - "last_name" => $userdb['last_name'], - "avatar" => $userdb['avatar'], - "role" => $userdb['role'], - "banned" => $userdb['banned'], - "registred_at" => $userdb['registred'] - ), - "resources" => array( - "coins" => $userdb['coins'], - "ram" => $userdb['ram'], - "disk" => $userdb['disk'], - "cpu" => $userdb['cpu'], - "server_limit" => $userdb['server_limit'], - "ports" => $userdb['ports'], - "databases" => $userdb['databases'], - "backups" => $userdb['backups'], - ), -); -$conn->close(); -http_response_code(200); -die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); -?> \ No newline at end of file diff --git a/oldapi/encryptpwd.php b/oldapi/encryptpwd.php deleted file mode 100644 index 5bd0b953..00000000 --- a/oldapi/encryptpwd.php +++ /dev/null @@ -1,12 +0,0 @@ - 'success', 'hashed_password' => $hpwd), JSON_PRETTY_PRINT); -} else { - http_response_code(400); - echo json_encode(array('status' => 'error', 'message' => 'Please specify a password by appending ?pwd= to the URL'), JSON_PRETTY_PRINT); -} -?> \ No newline at end of file diff --git a/oldapi/mysql.php b/oldapi/mysql.php deleted file mode 100644 index 98514c57..00000000 --- a/oldapi/mysql.php +++ /dev/null @@ -1,26 +0,0 @@ -connect_error) { - http_response_code(500); - echo json_encode(array('status' => 'error', 'message' => 'The connection failed: '.$connection->connect_error), JSON_PRETTY_PRINT); - } - echo json_encode(array('status' => 'success', 'message' => 'The connection was successful'), JSON_PRETTY_PRINT); - $connection->close(); - http_response_code(200); -} -else -{ - http_response_code(400); - echo json_encode(array('status' => 'error', 'message' => 'Missing database connection info: https://github.com/MythicalLTD/MythicalDash#api-reference'),JSON_PRETTY_PRINT); -} -?> \ No newline at end of file diff --git a/oldapi/ticket.php b/oldapi/ticket.php deleted file mode 100644 index 2903d35f..00000000 --- a/oldapi/ticket.php +++ /dev/null @@ -1,66 +0,0 @@ - 0) { - $ticket_info = null; - $messages = array(); - - while ($row = mysqli_fetch_assoc($result)) { - if (!$ticket_info) { - $ticket_info = array( - "id" => $row["id"], - "ticketuuid" => $row["ticketuuid"], - "subject" => $row["subject"], - "priority" => $row["priority"], - "description" => $row["description"], - "attachment" => $row["attachment"], - "status" => $row["status"], - "timestamp" => $row["created"] - ); - } - - if ($row["userkey"]) { - $messages[] = array( - "message" => $row["message"], - "attachment" => $row["attachment"], - "timestamp" => $row["created"] - ); - } - } - - $response = array( - "ticket_info" => $ticket_info, - "messages" => $messages - ); - - header('Content-Type: application/json'); - echo json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); - } else { - $rsp = array( - "code" => 403, - "error" => "The server understood the request, but it refuses to authorize it.", - "message" => "We can't find the ticket in the database" - ); - http_response_code(403); - die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); - } -} else { - $rsp = array( - "code" => 400, - "error" => "The server cannot understand the request due to a client error.", - "message" => "Please provide a ticket uuid" - ); - http_response_code(400); - die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); -} -?> diff --git a/routes/api/index.php b/routes/api/index.php index c3e62180..608f20d8 100644 --- a/routes/api/index.php +++ b/routes/api/index.php @@ -9,5 +9,38 @@ require("../api/admin/statistics.php"); }); +$router->add("/api/admin/user/list", function () { + require("../include/main.php"); + require("../api/admin/user/list.php"); +}); + +$router->add("/api/admin/user/info", function () { + require("../include/main.php"); + require("../api/admin/user/info.php"); +}); +$router->add("/api/admin/user/ban", function () { + require("../include/main.php"); + require("../api/admin/user/ban.php"); +}); + +$router->add("/api/admin/user/unban", function () { + require("../include/main.php"); + require("../api/admin/user/unban.php"); +}); + +$router->add("/api/admin/user/resources/set", function () { + require("../include/main.php"); + require("../api/admin/user/resources/set.php"); +}); + +$router->add("/api/admin/user/resources/add", function () { + require("../include/main.php"); + require("../api/admin/user/resources/add.php"); +}); + +$router->add("/api/admin/user/reset-password", function () { + require("../include/main.php"); + require("../api/admin/user/reset-password.php"); +}); ?> \ No newline at end of file diff --git a/view/auth/forgot-password.php b/view/auth/forgot-password.php index 83ae618e..ba70b371 100644 --- a/view/auth/forgot-password.php +++ b/view/auth/forgot-password.php @@ -202,7 +202,7 @@ try { $mail->send(); //LOG TO DATABASE - $conn->query("INSERT INTO `mythicaldash_resetpasswords` (`email`, `user-apikey`, `user-resetkeycode`, `ip_addres`) VALUES ('" . $email . "', '" . $userdb['user-apikey'] . "', '" . $skey . "', '" . $ip_address . "');"); + $conn->query("INSERT INTO `mythicaldash_resetpasswords` (`email`, `user-apikey`, `user-resetkeycode`, `ip_addres`) VALUES ('" . $email . "', '" . $userdb['api_key'] . "', '" . $skey . "', '" . $ip_address . "');"); //SOME Functions $domain = substr(strrchr($email, "@"), 1); $redirections = array('gmail.com' => 'https://mail.google.com', 'yahoo.com' => 'https://mail.yahoo.com', 'hotmail.com' => 'https://outlook.live.com', 'outlook.com' => "https://outlook.live.com", 'gmx.net' => "https://gmx.net", 'icloud.com' => "https://www.icloud.com/mail", 'me.com' => "https://www.icloud.com/mail", 'mac.com' => "https://www.icloud.com/mail", ); From d8ff2a2ea6d1e1f92af9d0388d318f58d52f5c70 Mon Sep 17 00:00:00 2001 From: NaysKutzu Date: Fri, 20 Oct 2023 18:12:02 +0000 Subject: [PATCH 3/4] PUSH --- api/admin/redeem/create.php | 166 +++++++++++++++++++++++++++++++ api/admin/redeem/delete.php | 56 +++++++++++ api/admin/redeem/info.php | 74 ++++++++++++++ api/admin/settings/get.php | 67 +++++++++++++ api/admin/user/info.php | 72 +++++++------- migrate/15.sql | 1 + routes/api/index.php | 20 ++++ view/admin/users/delete_user.php | 84 +++++++++++----- view/components/modals.php | 2 +- 9 files changed, 484 insertions(+), 58 deletions(-) create mode 100644 api/admin/redeem/create.php create mode 100644 api/admin/redeem/delete.php create mode 100644 api/admin/redeem/info.php create mode 100644 api/admin/settings/get.php create mode 100644 migrate/15.sql diff --git a/api/admin/redeem/create.php b/api/admin/redeem/create.php new file mode 100644 index 00000000..348a6957 --- /dev/null +++ b/api/admin/redeem/create.php @@ -0,0 +1,166 @@ += 0) { + $coins = mysqli_real_escape_string($conn, $_POST['coins']); + if (isset($_POST['ram']) && is_numeric($_POST['ram']) && $_POST['ram'] >= 0) { + $ram = mysqli_real_escape_string($conn, $_POST['ram']); + if (isset($_POST['disk']) && is_numeric($_POST['disk']) && $_POST['disk'] >= 0) { + $disk = mysqli_real_escape_string($conn, $_POST['disk']); + if (isset($_POST['cpu']) && is_numeric($_POST['cpu']) && $_POST['cpu'] >= 0) { + $cpu = mysqli_real_escape_string($conn, $_POST['cpu']); + if (isset($_POST['server_limit']) && is_numeric($_POST['server_limit']) && $_POST['server_limit'] >= 0) { + $server_limit = mysqli_real_escape_string($conn, $_POST['server_limit']); + if (isset($_POST['ports']) && is_numeric($_POST['ports']) && $_POST['ports'] >= 0) { + $ports = mysqli_real_escape_string($conn, $_POST['ports']); + if (isset($_POST['databases']) && is_numeric($_POST['databases']) && $_POST['databases'] >= 0) { + $databases = mysqli_real_escape_string($conn, $_POST['databases']); + if (isset($_POST['backups']) && is_numeric($_POST['backups']) && $_POST['backups'] >= 0) { + $backups = mysqli_real_escape_string($conn, $_POST['backups']); + if (isset($_POST['uses']) && is_numeric($_POST['uses']) && $_POST['uses'] >= 0) { + $uses = mysqli_real_escape_string($conn, $_POST['uses']); + $conn->query("INSERT INTO `mythicaldash_redeem` ( + `code`, + `uses`, + `coins`, + `ram`, + `disk`, + `cpu`, + `server_limit`, + `ports`, + `databases`, + `backups` + ) VALUES ( + '" . $code . "', + '" . $uses . "', + '" . $coins . "', + '" . $ram . "', + '" . $disk . "', + '" . $cpu . "', + '" . $server_limit . "', + '" . $ports . "', + '" . $databases . "', + '" . $backups . "' + );"); + $conn->close(); + $rsp = array( + "code" => 200, + "error" => null, + "message" => "Added a new redeem key in the database!" + ); + http_response_code(200); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Uses is required, but not provided." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Backups is required, but not provided." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Databases is required, but not provided." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Ports is required, but not provided." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Server Limit is required, but not provided." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Cpu is required, but not provided." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Disk is required, but not provided." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Ram is required, but not provided." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Coins is required, but not provided." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Code is required, but not provided." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } catch (Exception $e) { + $rsp = array( + "code" => 500, + "error" => "The server encountered a situation it doesn't know how to handle.", + "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + ); + http_response_code(500); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } +} else { + $rsp = array( + "code" => 405, + "error" => "A request was made of a page using a request method not supported by that page", + "message" => "Please use a post request" + ); + http_response_code(405); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); +} +?> \ No newline at end of file diff --git a/api/admin/redeem/delete.php b/api/admin/redeem/delete.php new file mode 100644 index 00000000..4ed2f91f --- /dev/null +++ b/api/admin/redeem/delete.php @@ -0,0 +1,56 @@ + 0) { + $conn->query("DELETE FROM `mythicaldash_redeem` WHERE `mythicaldash_redeem`.`code` = '" . mysqli_real_escape_string($conn, $_POST['code']) . "';"); + $conn->close(); + $rsp = array( + "code" => 200, + "error" => null, + "message" => "Code removed from the database" + ); + http_response_code(200); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } else { + $rsp = array( + "code" => 403, + "error" => "The server understood the request, but it refuses to authorize it.", + "message" => "We can't find the code in our database!" + ); + http_response_code(403); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Code is required, but not provided." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } catch (Exception $e) { + $rsp = array( + "code" => 500, + "error" => "The server encountered a situation it doesn't know how to handle.", + "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + ); + http_response_code(500); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } +} else { + $rsp = array( + "code" => 405, + "error" => "A request was made of a page using a request method not supported by that page", + "message" => "Please use a post request" + ); + http_response_code(405); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); +} +?> \ No newline at end of file diff --git a/api/admin/redeem/info.php b/api/admin/redeem/info.php new file mode 100644 index 00000000..d5a3ee01 --- /dev/null +++ b/api/admin/redeem/info.php @@ -0,0 +1,74 @@ + 0) { + $redeemDb = $conn->query("SELECT * FROM mythicaldash_redeem WHERE code = '" . $code . "'")->fetch_array(); + $rsp = array( + "code" => 200, + "error" => null, + "message" => null, + "data" => array( + "database_id" => $redeemDb['id'], + "code" => $redeemDb['code'], + "resources" => array( + "coins" => $redeemDb['coins'], + "ram" => $redeemDb['ram'], + "disk" => $redeemDb['disk'], + "cpu" => $redeemDb['cpu'], + "server_limit" => $redeemDb['server_limit'], + "ports" => $redeemDb['ports'], + "databases" => $redeemDb['databases'], + "backups" => $redeemDb['backups'], + ), + "dateinfo" => $redeemDb['created'] + ), + ); + http_response_code(200); + $conn->close(); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } else { + $rsp = array( + "code" => 403, + "error" => "The server understood the request, but it refuses to authorize it.", + "message" => "We can't find the code in our database!" + ); + http_response_code(403); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } else { + $rsp = array( + "code" => 400, + "error" => "Bad request syntax", + "message" => "Code is required, but not provided." + ); + http_response_code(400); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } + } catch (Exception $e) { + $rsp = array( + "code" => 500, + "error" => "The server encountered a situation it doesn't know how to handle.", + "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + ); + http_response_code(500); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } +} else { + $rsp = array( + "code" => 405, + "error" => "A request was made of a page using a request method not supported by that page", + "message" => "Please use a get request" + ); + http_response_code(405); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); +} + +?> \ No newline at end of file diff --git a/api/admin/settings/get.php b/api/admin/settings/get.php new file mode 100644 index 00000000..6350e079 --- /dev/null +++ b/api/admin/settings/get.php @@ -0,0 +1,67 @@ + 200, + "error" => null, + "data" => array( + "name" => $settings['name'], + "logo" => $settings["logo"], + "seo" => array( + "description" => $settings["seo_description"], + "keywords" => $settings["seo_keywords"], + ), + "turnstile" => array( + "enabled" => $settings["enable_turnstile"], + "sitekey" => $settings["turnstile_sitekey"], + "secretkey" => $settings["turnstile_secretkey"], + ), + "discord" => array( + "enabled" => $settings["enable_discord_link"], + "invite" => $settings["discord_invite"], + "serverid" => $settings["discord_serverid"], + "clientid" => $settings["discord_clientid"], + "clientsecret" => $settings["discord_clientsecret"], + "webhook" => $settings["discord_webhook"], + ), + "mailserver" => array( + "enabled" => $settings["enable_smtp"], + "host" => $settings["smtpHost"], + "port" => $settings["smtpPort"], + "encryption" => $settings["smtpSecure"], + "username" => $settings["smtpUsername"], + "password" => $settings["smtpPassword"], + "email" => $settings["fromEmail"], + ), + "pterodactyl" => array( + "url" => $settings["PterodactylURL"], + "key" => $settings["PterodactylAPIKey"], + ), + "mythicaldash" => array( + "version" => $settings["version"], + ) + ), + ); + $conn->close(); + http_response_code(200); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } catch (Exception $e) { + $rsp = array( + "code" => 500, + "error" => "The server encountered a situation it doesn't know how to handle.", + "message" => "We are sorry, but our server can't handle this request. Please do not try again!" + ); + http_response_code(500); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); + } +} else { + $rsp = array( + "code" => 405, + "error" => "A request was made of a page using a request method not supported by that page", + "message" => "Please use a get request" + ); + http_response_code(405); + die(json_encode($rsp, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); +} +?> \ No newline at end of file diff --git a/api/admin/user/info.php b/api/admin/user/info.php index 96fb0c18..c22f1e59 100644 --- a/api/admin/user/info.php +++ b/api/admin/user/info.php @@ -11,41 +11,45 @@ $rsp = array( "code" => 200, "error" => null, - "info" => array( - "database_id" => $userdb['id'], - "pterodactyl_id" => $userdb["panel_id"], - "username" => $userdb['username'], - "email" => $userdb['email'], - "first_name" => decrypt($userdb['first_name'], $ekey), - "last_name" => decrypt($userdb['last_name'], $ekey), - "role" => $userdb['role'], - "banned" => $userdb['banned'], - "last_ip" => $userdb["last_ip"], - "first_ip" => $userdb["first_ip"], - "registred_at" => $userdb['registred'] - ), - "resources" => array( - "coins" => $userdb['coins'], - "ram" => $userdb['ram'], - "disk" => $userdb['disk'], - "cpu" => $userdb['cpu'], - "server_limit" => $userdb['server_limit'], - "ports" => $userdb['ports'], - "databases" => $userdb['databases'], - "backups" => $userdb['backups'], - "minutes_afk" => $userdb["minutes_afk"], - ), - "discord" => array( - "linked" => $userdb["discord_linked"], - "discord_id" => $userdb["discord_id"], - "discord_username" => $userdb["discord_username"], - "discord_global_username" => $userdb["discord_global_username"], - "discord_email" => $userdb["discord_email"], - ), - "profile" => array( - "avatar" => $userdb['avatar'], - "banner" => $userdb['banner'], + "message" => null, + "data" => array( + "info" => array( + "database_id" => $userdb['id'], + "pterodactyl_id" => $userdb["panel_id"], + "username" => $userdb['username'], + "email" => $userdb['email'], + "first_name" => decrypt($userdb['first_name'], $ekey), + "last_name" => decrypt($userdb['last_name'], $ekey), + "role" => $userdb['role'], + "banned" => $userdb['banned'], + "last_ip" => $userdb["last_ip"], + "first_ip" => $userdb["first_ip"], + "registred_at" => $userdb['registred'] + ), + "resources" => array( + "coins" => $userdb['coins'], + "ram" => $userdb['ram'], + "disk" => $userdb['disk'], + "cpu" => $userdb['cpu'], + "server_limit" => $userdb['server_limit'], + "ports" => $userdb['ports'], + "databases" => $userdb['databases'], + "backups" => $userdb['backups'], + "minutes_afk" => $userdb["minutes_afk"], + ), + "discord" => array( + "linked" => $userdb["discord_linked"], + "discord_id" => $userdb["discord_id"], + "discord_username" => $userdb["discord_username"], + "discord_global_username" => $userdb["discord_global_username"], + "discord_email" => $userdb["discord_email"], + ), + "profile" => array( + "avatar" => $userdb['avatar'], + "banner" => $userdb['banner'], + ), ), + ); $conn->close(); http_response_code(200); diff --git a/migrate/15.sql b/migrate/15.sql new file mode 100644 index 00000000..e7179dcd --- /dev/null +++ b/migrate/15.sql @@ -0,0 +1 @@ +ALTER TABLE `mythicaldash_settings` CHANGE `linkvertise_code` `linkvertise_code` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL; \ No newline at end of file diff --git a/routes/api/index.php b/routes/api/index.php index 608f20d8..05a8e1ad 100644 --- a/routes/api/index.php +++ b/routes/api/index.php @@ -43,4 +43,24 @@ require("../include/main.php"); require("../api/admin/user/reset-password.php"); }); + +$router->add("/api/admin/settings/get", function () { + require("../include/main.php"); + require("../api/admin/settings/get.php"); +}); + +$router->add("/api/admin/redeem/create", function () { + require("../include/main.php"); + require("../api/admin/redeem/create.php"); +}); + +$router->add("/api/admin/redeem/info", function () { + require("../include/main.php"); + require("../api/admin/redeem/info.php"); +}); + +$router->add("/api/admin/redeem/delete", function () { + require("../include/main.php"); + require("../api/admin/redeem/delete.php"); +}); ?> \ No newline at end of file diff --git a/view/admin/users/delete_user.php b/view/admin/users/delete_user.php index 9c55cd31..ac7d20c0 100644 --- a/view/admin/users/delete_user.php +++ b/view/admin/users/delete_user.php @@ -2,35 +2,73 @@ include(__DIR__ . '/../../requirements/page.php'); include(__DIR__ . '/../../requirements/admin.php'); -if (isset($_GET['id'])) { - if (!$_GET['id'] == "") { - $user_query = "SELECT * FROM mythicaldash_users WHERE id = ?"; - $stmt = mysqli_prepare($conn, $user_query); - mysqli_stmt_bind_param($stmt, "s", $_GET['id']); - mysqli_stmt_execute($stmt); - $result = mysqli_stmt_get_result($stmt); - if (mysqli_num_rows($result) > 0) { - $user_info = $conn->query("SELECT * FROM mythicaldash_users WHERE id = '" . $_GET['id'] . "'")->fetch_array(); - if ($user_info['api_key'] == $_COOKIE['token']) { - header('location: /admin/users?e=Can`t delete your own account'); - die(); - } - $conn->query('DELETE FROM `mythicaldash_users` WHERE `mythicaldash_users`.`id` = '.$_GET['id'].';'); - $conn->close(); - header('location: /admin/users?s=We updated the user settings in the database'); - die(); - } else { - header('location: /admin/users?e=Can`t find this user in the database'); - $conn->close(); - die(); - } +if (isset($_GET['id']) && !$_GET['id'] == "") { + $user_query = "SELECT * FROM mythicaldash_users WHERE id = ?"; + $stmt = mysqli_prepare($conn, $user_query); + mysqli_stmt_bind_param($stmt, "s", $_GET['id']); + mysqli_stmt_execute($stmt); + $result = mysqli_stmt_get_result($stmt); + if (mysqli_num_rows($result) > 0) { + //header('location: /admin/users?e=This function is disabled please wait for a update'); + //$conn->close(); + //die(); + $user_info = $conn->query("SELECT * FROM mythicaldash_users WHERE id = '" . $_GET['id'] . "'")->fetch_array(); + deleteUserServers($conn, $user_info['api_key'], $settings['PterodactylURL'], $settings['PterodactylAPIKey']); + //if ($user_info['api_key'] == $_COOKIE['token']) { + // header('location: /admin/users?e=Can`t delete your own account'); + // die(); + //} + //$conn->query('DELETE FROM `mythicaldash_users` WHERE `mythicaldash_users`.`id` = '.$_GET['id'].';'); + //$conn->close(); + //header('location: /admin/users?s=We updated the user settings in the database'); + //die(); } else { header('location: /admin/users?e=Can`t find this user in the database'); + $conn->close(); die(); } - } else { header('location: /admin/users'); die(); } + + + +function deleteUsersInQueue() { + +} + +function deleteUserServers($dbconn, $userkey, $panel_url, $panel_apikey) { + $query = "SELECT pid FROM mythicaldash_servers WHERE mythicaldash_servers.uid='".$userkey."'"; + $result = mysqli_query($dbconn, $query); + if ($result) { + while ($row = mysqli_fetch_assoc($result)) { + $panel_id = $row['pid']; + $delete_server = curl_init($panel_url. "/api/application/servers/" . $panel_id . "/force"); + curl_setopt($delete_server, CURLOPT_CUSTOMREQUEST, "DELETE"); + $headers = array( + 'Accept: application/json', + 'Content-Type: application/json', + "Authorization: Bearer " . $panel_apikey + ); + curl_setopt($delete_server, CURLOPT_HTTPHEADER, $headers); + curl_setopt($delete_server, CURLOPT_RETURNTRANSFER, 1); + $result = curl_exec($delete_server); + curl_close($delete_server); + if (!empty($result)) { + $dbconn->close(); + header('location: /admin/users?e=Failed to remove server from panel'); + die(); + } + if (mysqli_query($dbconn, "DELETE FROM mythicaldash_servers WHERE pid = '" . mysqli_real_escape_string($dbconn, $panel_id) . "'")) { + $dbconn->close(); + } else { + $dbconn->close(); + header('location: /admin/users?e=Failed to remove server from database'); + die(); + } + } + mysqli_free_result($result); + } +} ?> \ No newline at end of file diff --git a/view/components/modals.php b/view/components/modals.php index 4cc88ff5..e493bbbb 100644 --- a/view/components/modals.php +++ b/view/components/modals.php @@ -15,7 +15,7 @@
- From 7f64396bc48e683a53cc373b0fd312a078917d1e Mon Sep 17 00:00:00 2001 From: NaysKutzu Date: Fri, 20 Oct 2023 18:14:04 +0000 Subject: [PATCH 4/4] PUSH --- Insomnia_2023-10-19.json | 1 - Insomnia_2023-10-20.json | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 Insomnia_2023-10-19.json create mode 100644 Insomnia_2023-10-20.json diff --git a/Insomnia_2023-10-19.json b/Insomnia_2023-10-19.json deleted file mode 100644 index 35a0c94c..00000000 --- a/Insomnia_2023-10-19.json +++ /dev/null @@ -1 +0,0 @@ -{"_type":"export","__export_format":4,"__export_date":"2023-10-19T20:42:04.363Z","__export_source":"insomnia.desktop.app:v8.3.0","resources":[{"_id":"req_5c04f332fd5d47e399f1c9beeeb66a65","parentId":"fld_e104fd81a13d448b880f4f8921ac8028","modified":1697746630922,"created":1697744921958,"url":"https://devclient.mythicalsystems.me/api/admin/user/resources/set","name":"Set","description":"This just assigns resources to the user.","method":"POST","body":{"mimeType":"multipart/form-data","params":[{"id":"pair_786fa7c51a9847758381b99be88d5942","name":"email","value":"dummy@dummy.net","description":""},{"id":"pair_bd61ca0e3aa6445fb9c84423cbf4af37","name":"coins","value":"150","description":""},{"id":"pair_2f9ef79ce3ff4650b369a4e13c423e2e","name":"ram","value":"1024","description":""},{"id":"pair_c5b179fdfc5147228ea28b9a58c05498","name":"disk","value":"1024","description":""},{"id":"pair_bf996290689e4d01802538fe67f7e7b4","name":"cpu","value":"100","description":""},{"id":"pair_2c86496730e64070b1829a5eec9040f7","name":"server_limit","value":"1","description":""},{"id":"pair_351b69b1fe0747059893ca98e1243d36","name":"ports","value":"1","description":""},{"id":"pair_c9b374c78d75445e851f438a9e6a4338","name":"databases","value":"1","description":""},{"id":"pair_b305b47d376f4a718457757698f17edd","name":"backups","value":"1","description":""}]},"parameters":[],"headers":[{"name":"Content-Type","value":"multipart/form-data"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_d1897202eda04fa58bfa3f24ec3e8107"},{"id":"pair_a40e75d71994400d9675a72c9d4b8673","name":"Authorization","value":"mythicaldash_apikey","description":""}],"authentication":{},"metaSortKey":-1697744875752,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"fld_e104fd81a13d448b880f4f8921ac8028","parentId":"fld_e8ff218397174389bae6a3a5661669c0","modified":1697744844978,"created":1697744840177,"name":"Resources","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1697742197784,"_type":"request_group"},{"_id":"fld_e8ff218397174389bae6a3a5661669c0","parentId":"fld_1e79fba929fc4d72bb47e7eb24ec1737","modified":1697742189325,"created":1697742176368,"name":"User","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1697740779163,"_type":"request_group"},{"_id":"fld_1e79fba929fc4d72bb47e7eb24ec1737","parentId":"wrk_a2ea7d20da784d39a2211928ba8a016f","modified":1697740702126,"created":1697740702126,"name":"Admin","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1697740702126,"_type":"request_group"},{"_id":"wrk_a2ea7d20da784d39a2211928ba8a016f","parentId":null,"modified":1697740507721,"created":1697740507721,"name":"MythicalDash API","description":"","scope":"collection","_type":"workspace"},{"_id":"req_7219bb298f4f487a9fff86d14f7a7c2b","parentId":"fld_e104fd81a13d448b880f4f8921ac8028","modified":1697747863230,"created":1697744848474,"url":"https://devclient.mythicalsystems.me/api/admin/user/resources/add","name":"Add","description":"This just adds resources to the user.","method":"POST","body":{"mimeType":"multipart/form-data","params":[{"id":"pair_61239e6aebf748eaa512e784c5d06aae","name":"email","value":"dummy@dummy.net","description":""},{"id":"pair_49bc7f42e8f14355919bc9bcba11c16a","name":"coins","value":"0","description":""},{"id":"pair_6ca9896e89484881ba8e5c221929120b","name":"ram","value":"0","description":""},{"id":"pair_0c7483614a85494f89fe258044b5e5c2","name":"disk","value":"0","description":""},{"id":"pair_4ecd5a6dc69b4bf5b1876f83714ad958","name":"cpu","value":"0","description":""},{"id":"pair_9d1b3fc865c24db499e43fa2b163cf2c","name":"server_limit","value":"0","description":""},{"id":"pair_41c75a5885594d1c9d4189229f935643","name":"ports","value":"0","description":""},{"id":"pair_4f4c82aeab6a46a2bd2fc3428d1007de","name":"databases","value":"0","description":""},{"id":"pair_0cf0342cf5cd4eb5a2d2af363c25c974","name":"backups","value":"0","description":""}]},"parameters":[],"headers":[{"name":"Content-Type","value":"multipart/form-data"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_9537cfb9de5c498f8dd8c3673ef25bd4"},{"id":"pair_28df8e45bc3149f2a1489d7bc76159f9","name":"Authorization","value":"mythicaldash_apikey","description":""}],"authentication":{},"metaSortKey":-1697744875652,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_a99d49ff72144407a8a82f0a62dd5e0b","parentId":"fld_e8ff218397174389bae6a3a5661669c0","modified":1697744734268,"created":1697744162993,"url":"https://devclient.mythicalsystems.me/api/admin/user/unban","name":"UnBan","description":"This just unbans the user","method":"POST","body":{"mimeType":"multipart/form-data","params":[{"id":"pair_c594e08be34c4407823b1b5e47b3e653","name":"email","value":"dummy@dummy.net","description":""}]},"parameters":[],"headers":[{"name":"Content-Type","value":"multipart/form-data"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_7de2161e9d1749448b3084018dff7ed5"},{"id":"pair_76dc3d74fad04d8fa5d64476ce41e1ff","name":"Authorization","value":"mythicaldash_apikey","description":""}],"authentication":{},"metaSortKey":-1697742197684,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_da47a5a9e6da4b6fad000de655d92af7","parentId":"fld_e8ff218397174389bae6a3a5661669c0","modified":1697744759828,"created":1697743754282,"url":"https://devclient.mythicalsystems.me/api/admin/user/ban","name":"Ban","description":"This just bans the user","method":"POST","body":{"mimeType":"multipart/form-data","params":[{"id":"pair_eae57274a71e470ba08874f58b9360ac","name":"email","value":"dummy@dummy.net","description":""}]},"parameters":[{"id":"pair_1c87f16c519549ee8214c152f67ecee5","name":"email","value":"dummy@dummy.net","description":""}],"headers":[{"name":"Content-Type","value":"multipart/form-data"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_11fd718730a54fdc86c132feb9cd95f8"},{"id":"pair_8ffae0e5b0c349a89cb16eb4602543e3","name":"Authorization","value":"mythicaldash_apikey","description":""}],"authentication":{},"metaSortKey":-1697742197584,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_90ae0bacdb83448394c98a758eaeb836","parentId":"fld_e8ff218397174389bae6a3a5661669c0","modified":1697747477606,"created":1697747326361,"url":"https://devclient.mythicalsystems.me/api/admin/user/reset-password","name":"Reset-Password","description":"Created a code for a password reset!","method":"POST","body":{"mimeType":"multipart/form-data","params":[{"id":"pair_39a363f2bb3e4df3a116f4fd68b509b4","name":"email","value":"dummy@dummy.net","description":""}]},"parameters":[],"headers":[{"name":"Content-Type","value":"multipart/form-data","id":"pair_f8e17e133adf4338bd923cdb0b5f1fc8"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_fee36d87652942a5a1c194866d8b0c0b"},{"id":"pair_5c8abceb26ea42a28a5a5abb96952c4c","name":"Authorization","value":"mythicaldash_apikey","description":""}],"authentication":{},"metaSortKey":-1697742197534,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_fe1fa766bcec471a8a21d2c11965866e","parentId":"fld_e8ff218397174389bae6a3a5661669c0","modified":1697744605637,"created":1697742998516,"url":"https://devclient.mythicalsystems.me/api/admin/user/{% os 'userInfo', '' %}","name":"Info ","description":"This thing gets info about the user","method":"GET","body":{"mimeType":"application/json","text":""},"parameters":[{"id":"pair_0253fef8faa045e5894fc2766df9e28c","name":"email","value":"dummy@dummy.net","description":""}],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_9a33a6992501492eb76edb45c3036efe"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_6fb35dbd784449f796946d1d98d017a3"},{"id":"pair_b1f3c0065c61437b89e8862818c7481e","name":"Authorization","value":"mythicaldash_apikey","description":""}],"authentication":{},"metaSortKey":-1697742197484,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_1e289ae49b444a509e7b91c6c40acee4","parentId":"fld_e8ff218397174389bae6a3a5661669c0","modified":1697742897891,"created":1697742191918,"url":"https://devclient.mythicalsystems.me/api/admin/user/list","name":"List","description":"List all users from the database","method":"GET","body":{"mimeType":"application/json","text":""},"parameters":[{"id":"pair_fbf53b9fc1a34fe293680c85bf157788","name":"page","value":"2","description":""}],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_af99c4dffac040e4b7c9d291c62dd7bf"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_0442a6887683493891e5585b60530e35"},{"id":"pair_7b70e9741eea493692dad339b83269aa","name":"Authorization","value":"mythicaldash_apikey","description":""}],"authentication":{},"metaSortKey":-1697742197384,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_9e23eaa6a5034f35b0aa4483b1bb076c","parentId":"fld_1e79fba929fc4d72bb47e7eb24ec1737","modified":1697741102255,"created":1697740704720,"url":"https://devclient.mythicalsystems.me/api/admin/statistics","name":"Statistics","description":"Get the statistics like total users or servers. ","method":"GET","body":{"mimeType":"application/json","text":""},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_0ad1e4468cf34a96a1ec9365e52123eb"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_b2a11c367ba04277995facb1677e2faa"},{"id":"pair_7de0770235aa41428c3010d6f09d408e","name":"Authorization","value":"mythicaldash_apikey","description":""}],"authentication":{},"metaSortKey":-1697740779063,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_a872852d26284b63b48593ef47a0f8ae","parentId":"wrk_a2ea7d20da784d39a2211928ba8a016f","modified":1697740564415,"created":1697740511067,"url":"https://devclient.mythicalsystems.me/api","name":"Main","description":"This does nothing it is just the main API path.","method":"GET","body":{"mimeType":"application/json","text":""},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json"},{"name":"User-Agent","value":"insomnia/8.3.0"}],"authentication":{},"metaSortKey":-1697740511067,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"env_75e6215485b10e994d1f4dc9866824c7d9b84a91","parentId":"wrk_a2ea7d20da784d39a2211928ba8a016f","modified":1697740507722,"created":1697740507722,"name":"Base Environment","data":{},"dataPropertyOrder":null,"color":null,"isPrivate":false,"metaSortKey":1697740507722,"_type":"environment"},{"_id":"jar_75e6215485b10e994d1f4dc9866824c7d9b84a91","parentId":"wrk_a2ea7d20da784d39a2211928ba8a016f","modified":1697740523072,"created":1697740507722,"name":"Default Jar","cookies":[{"key":"PHPSESSID","value":"pi2u6pkf2bohb5mn5jb1ariune","domain":"devclient.mythicalsystems.me","path":"/","hostOnly":true,"creation":"2023-10-19T18:35:23.072Z","lastAccessed":"2023-10-19T18:35:23.072Z","id":"29508785360150114"}],"_type":"cookie_jar"}]} \ No newline at end of file diff --git a/Insomnia_2023-10-20.json b/Insomnia_2023-10-20.json new file mode 100644 index 00000000..e5c7f4d3 --- /dev/null +++ b/Insomnia_2023-10-20.json @@ -0,0 +1 @@ +{"_type":"export","__export_format":4,"__export_date":"2023-10-20T18:12:48.106Z","__export_source":"insomnia.desktop.app:v8.3.0","resources":[{"_id":"req_2a2fed989cba41d6b50bc7c90346b3b9","parentId":"fld_a92c2aa9259b41468d43d9e6a8fec5a2","modified":1697781165299,"created":1697781026322,"url":"https://devclient.mythicalsystems.me/api/admin/settings/get","name":"Get","description":"This function can be used to get the settings from the database","method":"GET","body":{"mimeType":"application/json","text":""},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_5cee4b632f76406491ad5d017700df05"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_3eed5496af2a4733bd2d03ce41ceb52a"},{"id":"pair_29a3324ecba64fb0a3129ee90a83a7c5","name":"Authorization","value":"api_key_here","description":""}],"authentication":{},"metaSortKey":-1697781097616,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"fld_a92c2aa9259b41468d43d9e6a8fec5a2","parentId":"fld_1e79fba929fc4d72bb47e7eb24ec1737","modified":1697781092776,"created":1697781091017,"name":"Settings","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1697740779363,"_type":"request_group"},{"_id":"fld_1e79fba929fc4d72bb47e7eb24ec1737","parentId":"wrk_a2ea7d20da784d39a2211928ba8a016f","modified":1697740702126,"created":1697740702126,"name":"Admin","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1697740702126,"_type":"request_group"},{"_id":"wrk_a2ea7d20da784d39a2211928ba8a016f","parentId":null,"modified":1697740507721,"created":1697740507721,"name":"MythicalDash API","description":"","scope":"collection","_type":"workspace"},{"_id":"req_0b097f19414741ddb8b315fd7487c5e8","parentId":"fld_ecb010b6b9064e23b5066ed251d4eaf0","modified":1697820681814,"created":1697790464199,"url":"https://devclient.mythicalsystems.me/api/admin/redeem/info","name":"Info","description":"This will just give you information about a coupon code.","method":"GET","body":{"mimeType":"application/json","text":""},"parameters":[{"id":"pair_12a9c06853a54584b4a8559a9b9fd46b","name":"code","value":"das","description":""}],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_279b5fce1e9f491e9938eb1bf2076a4b"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_800b5a04d93b40c18b3e8cb543427830"},{"id":"pair_deab291f7ca54933a862dc0a05698b05","name":"Authorization","value":"api_key_here","description":""}],"authentication":{},"metaSortKey":-1697780985403,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"fld_ecb010b6b9064e23b5066ed251d4eaf0","parentId":"fld_1e79fba929fc4d72bb47e7eb24ec1737","modified":1697780978864,"created":1697780976628,"name":"Redeem","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1697740779263,"_type":"request_group"},{"_id":"req_610d99271e95438980e032db115a3ea5","parentId":"fld_ecb010b6b9064e23b5066ed251d4eaf0","modified":1697786962177,"created":1697780983016,"url":"https://devclient.mythicalsystems.me/api/admin/redeem/create","name":"Create","description":"This will create a new redeem key that can be used to get resources from inside the dash.","method":"POST","body":{"mimeType":"multipart/form-data","params":[{"id":"pair_bd389113f6944bd1867f2de0d6567473","name":"code","value":"pussy","description":""},{"id":"pair_9d90a35cdb2e481b8464907429290f67","name":"coins","value":"1","description":""},{"id":"pair_d0e396de37a24c6cad48e7be542ed2fe","name":"ram","value":"1024","description":""},{"id":"pair_0b976a154153451d840a773cd6e2d84d","name":"disk","value":"1024","description":""},{"id":"pair_1f667f69adce4d469d66585d0330d2cf","name":"cpu","value":"100","description":""},{"id":"pair_406cc121893041e883a23bb70367c074","name":"server_limit","value":"1","description":""},{"id":"pair_8b11b6a69c2c4c42811809d795b28a40","name":"ports","value":"1","description":""},{"id":"pair_808571957c0543c58b240ec0e6413ff5","name":"databases","value":"1","description":""},{"id":"pair_a0cc8379d4d44b6791523f9e085aa7a3","name":"backups","value":"1","description":""},{"id":"pair_532ce1ae54044325be3c6bb2383d1451","name":"uses","value":"1","description":""}]},"parameters":[],"headers":[{"name":"Content-Type","value":"multipart/form-data","id":"pair_0db5e4d0da45413da00b5f223ab1e4a7"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_6e913a3c4e4346d3bddb9e77f7e2e951"},{"id":"pair_24f56ce5237441a0a7b02532e2931317","name":"Authorization","value":"api_key_here","description":""}],"authentication":{},"metaSortKey":-1697780985303,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_ca14ccac56c54d9ba965f39aee7eb618","parentId":"fld_ecb010b6b9064e23b5066ed251d4eaf0","modified":1697820762896,"created":1697820688113,"url":"https://devclient.mythicalsystems.me/api/admin/redeem/delete","name":"Delete","description":"This removed a code from the database.","method":"POST","body":{"mimeType":"multipart/form-data","params":[{"id":"pair_497b89b3f7034a72b38bc7d70cab9157","name":"code","value":"das","description":""}]},"parameters":[],"headers":[{"name":"Content-Type","value":"multipart/form-data","id":"pair_aa755abd3cb843b48b4392534fab5bac"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_9ae1b5f5d4204dd68f9fb9804f0be9e8"},{"id":"pair_d532447716ad49bfb5d274c243adeed1","name":"Authorization","value":"api_key_here","description":""}],"authentication":{},"metaSortKey":-1697780985203,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_5c04f332fd5d47e399f1c9beeeb66a65","parentId":"fld_e104fd81a13d448b880f4f8921ac8028","modified":1697746630922,"created":1697744921958,"url":"https://devclient.mythicalsystems.me/api/admin/user/resources/set","name":"Set","description":"This just assigns resources to the user.","method":"POST","body":{"mimeType":"multipart/form-data","params":[{"id":"pair_786fa7c51a9847758381b99be88d5942","name":"email","value":"admin@mythicalsystems.me","description":""},{"id":"pair_bd61ca0e3aa6445fb9c84423cbf4af37","name":"coins","value":"150","description":""},{"id":"pair_2f9ef79ce3ff4650b369a4e13c423e2e","name":"ram","value":"1024","description":""},{"id":"pair_c5b179fdfc5147228ea28b9a58c05498","name":"disk","value":"1024","description":""},{"id":"pair_bf996290689e4d01802538fe67f7e7b4","name":"cpu","value":"100","description":""},{"id":"pair_2c86496730e64070b1829a5eec9040f7","name":"server_limit","value":"1","description":""},{"id":"pair_351b69b1fe0747059893ca98e1243d36","name":"ports","value":"1","description":""},{"id":"pair_c9b374c78d75445e851f438a9e6a4338","name":"databases","value":"1","description":""},{"id":"pair_b305b47d376f4a718457757698f17edd","name":"backups","value":"1","description":""}]},"parameters":[],"headers":[{"name":"Content-Type","value":"multipart/form-data"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_d1897202eda04fa58bfa3f24ec3e8107"},{"id":"pair_a40e75d71994400d9675a72c9d4b8673","name":"Authorization","value":"api_key_here","description":""}],"authentication":{},"metaSortKey":-1697744875752,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"fld_e104fd81a13d448b880f4f8921ac8028","parentId":"fld_e8ff218397174389bae6a3a5661669c0","modified":1697744844978,"created":1697744840177,"name":"Resources","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1697742197784,"_type":"request_group"},{"_id":"fld_e8ff218397174389bae6a3a5661669c0","parentId":"fld_1e79fba929fc4d72bb47e7eb24ec1737","modified":1697820554849,"created":1697742176368,"name":"User","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1697740779188,"_type":"request_group"},{"_id":"req_7219bb298f4f487a9fff86d14f7a7c2b","parentId":"fld_e104fd81a13d448b880f4f8921ac8028","modified":1697747863230,"created":1697744848474,"url":"https://devclient.mythicalsystems.me/api/admin/user/resources/add","name":"Add","description":"This just adds resources to the user.","method":"POST","body":{"mimeType":"multipart/form-data","params":[{"id":"pair_61239e6aebf748eaa512e784c5d06aae","name":"email","value":"admin@mythicalsystems.me","description":""},{"id":"pair_49bc7f42e8f14355919bc9bcba11c16a","name":"coins","value":"0","description":""},{"id":"pair_6ca9896e89484881ba8e5c221929120b","name":"ram","value":"0","description":""},{"id":"pair_0c7483614a85494f89fe258044b5e5c2","name":"disk","value":"0","description":""},{"id":"pair_4ecd5a6dc69b4bf5b1876f83714ad958","name":"cpu","value":"0","description":""},{"id":"pair_9d1b3fc865c24db499e43fa2b163cf2c","name":"server_limit","value":"0","description":""},{"id":"pair_41c75a5885594d1c9d4189229f935643","name":"ports","value":"0","description":""},{"id":"pair_4f4c82aeab6a46a2bd2fc3428d1007de","name":"databases","value":"0","description":""},{"id":"pair_0cf0342cf5cd4eb5a2d2af363c25c974","name":"backups","value":"0","description":""}]},"parameters":[],"headers":[{"name":"Content-Type","value":"multipart/form-data"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_9537cfb9de5c498f8dd8c3673ef25bd4"},{"id":"pair_28df8e45bc3149f2a1489d7bc76159f9","name":"Authorization","value":"api_key_here","description":""}],"authentication":{},"metaSortKey":-1697744875652,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_a99d49ff72144407a8a82f0a62dd5e0b","parentId":"fld_e8ff218397174389bae6a3a5661669c0","modified":1697744734268,"created":1697744162993,"url":"https://devclient.mythicalsystems.me/api/admin/user/unban","name":"UnBan","description":"This just unbans the user","method":"POST","body":{"mimeType":"multipart/form-data","params":[{"id":"pair_c594e08be34c4407823b1b5e47b3e653","name":"email","value":"admin@mythicalsystems.me","description":""}]},"parameters":[],"headers":[{"name":"Content-Type","value":"multipart/form-data"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_7de2161e9d1749448b3084018dff7ed5"},{"id":"pair_76dc3d74fad04d8fa5d64476ce41e1ff","name":"Authorization","value":"api_key_here","description":""}],"authentication":{},"metaSortKey":-1697742197684,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_da47a5a9e6da4b6fad000de655d92af7","parentId":"fld_e8ff218397174389bae6a3a5661669c0","modified":1697744759828,"created":1697743754282,"url":"https://devclient.mythicalsystems.me/api/admin/user/ban","name":"Ban","description":"This just bans the user","method":"POST","body":{"mimeType":"multipart/form-data","params":[{"id":"pair_eae57274a71e470ba08874f58b9360ac","name":"email","value":"admin@mythicalsystems.me","description":""}]},"parameters":[{"id":"pair_1c87f16c519549ee8214c152f67ecee5","name":"email","value":"admin@mythicalsystems.me","description":""}],"headers":[{"name":"Content-Type","value":"multipart/form-data"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_11fd718730a54fdc86c132feb9cd95f8"},{"id":"pair_8ffae0e5b0c349a89cb16eb4602543e3","name":"Authorization","value":"api_key_here","description":""}],"authentication":{},"metaSortKey":-1697742197584,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_90ae0bacdb83448394c98a758eaeb836","parentId":"fld_e8ff218397174389bae6a3a5661669c0","modified":1697747477606,"created":1697747326361,"url":"https://devclient.mythicalsystems.me/api/admin/user/reset-password","name":"Reset-Password","description":"Created a code for a password reset!","method":"POST","body":{"mimeType":"multipart/form-data","params":[{"id":"pair_39a363f2bb3e4df3a116f4fd68b509b4","name":"email","value":"admin@mythicalsystems.me","description":""}]},"parameters":[],"headers":[{"name":"Content-Type","value":"multipart/form-data","id":"pair_f8e17e133adf4338bd923cdb0b5f1fc8"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_fee36d87652942a5a1c194866d8b0c0b"},{"id":"pair_5c8abceb26ea42a28a5a5abb96952c4c","name":"Authorization","value":"api_key_here","description":""}],"authentication":{},"metaSortKey":-1697742197534,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_fe1fa766bcec471a8a21d2c11965866e","parentId":"fld_e8ff218397174389bae6a3a5661669c0","modified":1697781304873,"created":1697742998516,"url":"https://devclient.mythicalsystems.me/api/admin/user/info","name":"Info ","description":"This thing gets info about the user","method":"GET","body":{"mimeType":"application/json","text":""},"parameters":[{"id":"pair_0253fef8faa045e5894fc2766df9e28c","name":"email","value":"admin@mythicalsystems.me","description":""}],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_9a33a6992501492eb76edb45c3036efe"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_6fb35dbd784449f796946d1d98d017a3"},{"id":"pair_b1f3c0065c61437b89e8862818c7481e","name":"Authorization","value":"api_key_here","description":""}],"authentication":{},"metaSortKey":-1697742197484,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_1e289ae49b444a509e7b91c6c40acee4","parentId":"fld_e8ff218397174389bae6a3a5661669c0","modified":1697742897891,"created":1697742191918,"url":"https://devclient.mythicalsystems.me/api/admin/user/list","name":"List","description":"List all users from the database","method":"GET","body":{"mimeType":"application/json","text":""},"parameters":[{"id":"pair_fbf53b9fc1a34fe293680c85bf157788","name":"page","value":"2","description":""}],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_af99c4dffac040e4b7c9d291c62dd7bf"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_0442a6887683493891e5585b60530e35"},{"id":"pair_7b70e9741eea493692dad339b83269aa","name":"Authorization","value":"api_key_here","description":""}],"authentication":{},"metaSortKey":-1697742197384,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_9e23eaa6a5034f35b0aa4483b1bb076c","parentId":"fld_1e79fba929fc4d72bb47e7eb24ec1737","modified":1697741102255,"created":1697740704720,"url":"https://devclient.mythicalsystems.me/api/admin/statistics","name":"Statistics","description":"Get the statistics like total users or servers. ","method":"GET","body":{"mimeType":"application/json","text":""},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_0ad1e4468cf34a96a1ec9365e52123eb"},{"name":"User-Agent","value":"insomnia/8.3.0","id":"pair_b2a11c367ba04277995facb1677e2faa"},{"id":"pair_7de0770235aa41428c3010d6f09d408e","name":"Authorization","value":"api_key_here","description":""}],"authentication":{},"metaSortKey":-1697740779063,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"req_a872852d26284b63b48593ef47a0f8ae","parentId":"wrk_a2ea7d20da784d39a2211928ba8a016f","modified":1697740564415,"created":1697740511067,"url":"https://devclient.mythicalsystems.me/api","name":"Main","description":"This does nothing it is just the main API path.","method":"GET","body":{"mimeType":"application/json","text":""},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json"},{"name":"User-Agent","value":"insomnia/8.3.0"}],"authentication":{},"metaSortKey":-1697740511067,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"env_75e6215485b10e994d1f4dc9866824c7d9b84a91","parentId":"wrk_a2ea7d20da784d39a2211928ba8a016f","modified":1697740507722,"created":1697740507722,"name":"Base Environment","data":{},"dataPropertyOrder":null,"color":null,"isPrivate":false,"metaSortKey":1697740507722,"_type":"environment"},{"_id":"jar_75e6215485b10e994d1f4dc9866824c7d9b84a91","parentId":"wrk_a2ea7d20da784d39a2211928ba8a016f","modified":1697740523072,"created":1697740507722,"name":"Default Jar","cookies":[{"key":"PHPSESSID","value":"pi2u6pkf2bohb5mn5jb1ariune","domain":"devclient.mythicalsystems.me","path":"/","hostOnly":true,"creation":"2023-10-19T18:35:23.072Z","lastAccessed":"2023-10-19T18:35:23.072Z","id":"29508785360150114"}],"_type":"cookie_jar"}]} \ No newline at end of file