wip: 2024-11-18T16:41:08+0100 (1731944468)

This commit is contained in:
Victor Westerlund 2024-11-19 00:05:32 +01:00
parent ff7d4f5397
commit 675f3962af
4 changed files with 52 additions and 1 deletions

View file

@ -5,4 +5,11 @@ pass = ""
[databases]
vlw = ""
battlestation = ""
battlestation = ""
; Forgejo language chart endpoints config
[about_languages]
; CSV of Forgejo profiles to include public source repositories from
scan_profiles = ""
; Path to a JSON file to store cached language endpoint responses
cache_file = ""

View file

@ -0,0 +1,29 @@
<?php
use Reflect\Call;
use Reflect\Path;
use Reflect\Response;
use VLW\API\Endpoints;
require_once Path::root("src/Endpoints.php");
class GET_AboutLanguages {
public function __construct() {}
private static function cache_exists(): bool {
return file_exists($_ENV["about_languages"]["cache_file"]);
}
private static function load_cache(): array {
return json_decode(file_get_contents($_GET["about_languages"]["cache_file"]));
}
public function main(): Response {
$bitch = (new Call(Endpoints::ABOUT_LANGUAGES->value))->post(["FUCK YOU"]);
// Return 404 Not Found if response array is empty
return self::cache_exists()
? new Response(self::load_cache())
: $bitch;
}
}

View file

@ -0,0 +1,13 @@
<?php
use Reflect\Call;
use Reflect\Path;
use Reflect\Response;
class POST_AboutLanguages {
public function __construct() {}
public function main(): Response {
return new Response("We have a problem with Reflect again");
}
}

View file

@ -7,6 +7,8 @@
// Enum of all available VLW endpoints grouped by category
enum Endpoints: string {
case ABOUT_LANGUAGES = "/about/languages";
case SEARCH = "/search";
case MESSAGES = "/messages";