diff options
author | Minteck <contact@minteck.org> | 2022-04-06 19:56:46 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-04-06 19:56:46 +0200 |
commit | 01632caf82659e4e8025b4fad91ff7388b369770 (patch) | |
tree | 18127ad9abbd877dc4c6731040fa12eea2982497 /api | |
parent | 86bb68d8e7e9c2158939810b9343c7824886d6f4 (diff) | |
download | cloudsdale-01632caf82659e4e8025b4fad91ff7388b369770.tar.gz cloudsdale-01632caf82659e4e8025b4fad91ff7388b369770.tar.bz2 cloudsdale-01632caf82659e4e8025b4fad91ff7388b369770.zip |
Public API is complete
Diffstat (limited to 'api')
-rw-r--r-- | api/index.php | 15 | ||||
-rw-r--r-- | api/pluralkit/fronters/index.php | 5 | ||||
-rw-r--r-- | api/pluralkit/index.php | 15 | ||||
-rw-r--r-- | api/pluralkit/members/index.php | 5 | ||||
-rw-r--r-- | api/pluralkit/system/index.php | 5 | ||||
-rw-r--r-- | api/projects/all/index.php | 5 | ||||
-rw-r--r-- | api/projects/count/index.php | 5 | ||||
-rw-r--r-- | api/projects/index.php | 15 | ||||
-rw-r--r-- | api/projects/list/index.php | 12 | ||||
-rw-r--r-- | api/projects/showcase/index.php | 14 |
10 files changed, 96 insertions, 0 deletions
diff --git a/api/index.php b/api/index.php new file mode 100644 index 0000000..71cf001 --- /dev/null +++ b/api/index.php @@ -0,0 +1,15 @@ +<?php header("Content-Type: text/html"); if (str_ends_with($_SERVER["REQUEST_URI"], "/")) $_SERVER["REQUEST_URI"] = substr($_SERVER["REQUEST_URI"], 0, -1); if (str_contains($_SERVER["REQUEST_URI"], "..")) die(); ?> +<h1>Available endpoints at <?= $_SERVER['REQUEST_URI'] ?></h1> + +<ul> + <?php foreach (scandir($_SERVER["DOCUMENT_ROOT"] . $_SERVER['REQUEST_URI']) as $i1): if (is_dir($_SERVER["DOCUMENT_ROOT"] . $_SERVER['REQUEST_URI'] . "/" . $i1) && !str_starts_with($i1, ".")): ?> + <li><a href="<?= $_SERVER['REQUEST_URI'] ?>/<?= $i1 ?>"><?= $_SERVER['REQUEST_URI'] ?>/<?= $i1 ?></a><ul> + + <?php foreach (scandir($_SERVER["DOCUMENT_ROOT"] . $_SERVER['REQUEST_URI'] . "/" . $i1) as $i2): if (is_dir($_SERVER["DOCUMENT_ROOT"] . $_SERVER['REQUEST_URI'] . "/" . $i1 . "/" . $i2) && !str_starts_with($i2, ".")): ?> + <li><a href="<?= $_SERVER['REQUEST_URI'] ?>/<?= $i1 ?>/<?= $i2 ?>"><?= $_SERVER['REQUEST_URI'] ?>/<?= $i1 ?>/<?= $i2 ?></a></li> + + <?php endif; endforeach; ?> + </ul></li> + <?php endif; endforeach; ?> + +</ul>
\ No newline at end of file diff --git a/api/pluralkit/fronters/index.php b/api/pluralkit/fronters/index.php new file mode 100644 index 0000000..ae4b196 --- /dev/null +++ b/api/pluralkit/fronters/index.php @@ -0,0 +1,5 @@ +<?php + +$config = json_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/data/pluralkit.json"), true); +header("Content-Type: application/json"); +die(file_get_contents("https://api.pluralkit.me/v2/systems/$config[system]/list"));
\ No newline at end of file diff --git a/api/pluralkit/index.php b/api/pluralkit/index.php new file mode 100644 index 0000000..71cf001 --- /dev/null +++ b/api/pluralkit/index.php @@ -0,0 +1,15 @@ +<?php header("Content-Type: text/html"); if (str_ends_with($_SERVER["REQUEST_URI"], "/")) $_SERVER["REQUEST_URI"] = substr($_SERVER["REQUEST_URI"], 0, -1); if (str_contains($_SERVER["REQUEST_URI"], "..")) die(); ?> +<h1>Available endpoints at <?= $_SERVER['REQUEST_URI'] ?></h1> + +<ul> + <?php foreach (scandir($_SERVER["DOCUMENT_ROOT"] . $_SERVER['REQUEST_URI']) as $i1): if (is_dir($_SERVER["DOCUMENT_ROOT"] . $_SERVER['REQUEST_URI'] . "/" . $i1) && !str_starts_with($i1, ".")): ?> + <li><a href="<?= $_SERVER['REQUEST_URI'] ?>/<?= $i1 ?>"><?= $_SERVER['REQUEST_URI'] ?>/<?= $i1 ?></a><ul> + + <?php foreach (scandir($_SERVER["DOCUMENT_ROOT"] . $_SERVER['REQUEST_URI'] . "/" . $i1) as $i2): if (is_dir($_SERVER["DOCUMENT_ROOT"] . $_SERVER['REQUEST_URI'] . "/" . $i1 . "/" . $i2) && !str_starts_with($i2, ".")): ?> + <li><a href="<?= $_SERVER['REQUEST_URI'] ?>/<?= $i1 ?>/<?= $i2 ?>"><?= $_SERVER['REQUEST_URI'] ?>/<?= $i1 ?>/<?= $i2 ?></a></li> + + <?php endif; endforeach; ?> + </ul></li> + <?php endif; endforeach; ?> + +</ul>
\ No newline at end of file diff --git a/api/pluralkit/members/index.php b/api/pluralkit/members/index.php new file mode 100644 index 0000000..fb5fa6c --- /dev/null +++ b/api/pluralkit/members/index.php @@ -0,0 +1,5 @@ +<?php + +$config = json_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/data/pluralkit.json"), true); +header("Content-Type: application/json"); +die(file_get_contents("https://api.pluralkit.me/v2/systems/$config[system]/count"));
\ No newline at end of file diff --git a/api/pluralkit/system/index.php b/api/pluralkit/system/index.php new file mode 100644 index 0000000..a8fda5c --- /dev/null +++ b/api/pluralkit/system/index.php @@ -0,0 +1,5 @@ +<?php + +$config = json_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/data/pluralkit.json"), true); +header("Content-Type: application/json"); +die(file_get_contents("https://api.pluralkit.me/v2/systems/$config[system]"));
\ No newline at end of file diff --git a/api/projects/all/index.php b/api/projects/all/index.php new file mode 100644 index 0000000..608789d --- /dev/null +++ b/api/projects/all/index.php @@ -0,0 +1,5 @@ +<?php + +$config = json_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/data/projects.json"), true); +header("Content-Type: application/json"); +die(json_encode($config));
\ No newline at end of file diff --git a/api/projects/count/index.php b/api/projects/count/index.php new file mode 100644 index 0000000..809902b --- /dev/null +++ b/api/projects/count/index.php @@ -0,0 +1,5 @@ +<?php + +$config = json_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/data/projects.json"), true); +header("Content-Type: application/json"); +echo(count($config));
\ No newline at end of file diff --git a/api/projects/index.php b/api/projects/index.php new file mode 100644 index 0000000..71cf001 --- /dev/null +++ b/api/projects/index.php @@ -0,0 +1,15 @@ +<?php header("Content-Type: text/html"); if (str_ends_with($_SERVER["REQUEST_URI"], "/")) $_SERVER["REQUEST_URI"] = substr($_SERVER["REQUEST_URI"], 0, -1); if (str_contains($_SERVER["REQUEST_URI"], "..")) die(); ?> +<h1>Available endpoints at <?= $_SERVER['REQUEST_URI'] ?></h1> + +<ul> + <?php foreach (scandir($_SERVER["DOCUMENT_ROOT"] . $_SERVER['REQUEST_URI']) as $i1): if (is_dir($_SERVER["DOCUMENT_ROOT"] . $_SERVER['REQUEST_URI'] . "/" . $i1) && !str_starts_with($i1, ".")): ?> + <li><a href="<?= $_SERVER['REQUEST_URI'] ?>/<?= $i1 ?>"><?= $_SERVER['REQUEST_URI'] ?>/<?= $i1 ?></a><ul> + + <?php foreach (scandir($_SERVER["DOCUMENT_ROOT"] . $_SERVER['REQUEST_URI'] . "/" . $i1) as $i2): if (is_dir($_SERVER["DOCUMENT_ROOT"] . $_SERVER['REQUEST_URI'] . "/" . $i1 . "/" . $i2) && !str_starts_with($i2, ".")): ?> + <li><a href="<?= $_SERVER['REQUEST_URI'] ?>/<?= $i1 ?>/<?= $i2 ?>"><?= $_SERVER['REQUEST_URI'] ?>/<?= $i1 ?>/<?= $i2 ?></a></li> + + <?php endif; endforeach; ?> + </ul></li> + <?php endif; endforeach; ?> + +</ul>
\ No newline at end of file diff --git a/api/projects/list/index.php b/api/projects/list/index.php new file mode 100644 index 0000000..884821c --- /dev/null +++ b/api/projects/list/index.php @@ -0,0 +1,12 @@ +<?php + +$config = json_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/data/projects.json"), true); +$listed = []; +header("Content-Type: application/json"); + +foreach ($config as $project) { + unset($project["showcase"]); + $listed[] = $project; +} + +die(json_encode($listed));
\ No newline at end of file diff --git a/api/projects/showcase/index.php b/api/projects/showcase/index.php new file mode 100644 index 0000000..60dc597 --- /dev/null +++ b/api/projects/showcase/index.php @@ -0,0 +1,14 @@ +<?php + +$config = json_decode(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/data/projects.json"), true); +$listed = []; +header("Content-Type: application/json"); + +foreach ($config as $project) { + if ($project["showcase"]) { + unset($project["showcase"]); + $listed[] = $project; + } +} + +die(json_encode($listed));
\ No newline at end of file |