mirror of
https://codeberg.org/vlw/vlw.se.git
synced 2025-09-13 21:13:40 +02:00
wip: 2024-11-18T16:41:08+0100 (1731944468)
This commit is contained in:
parent
ff7d4f5397
commit
675f3962af
4 changed files with 52 additions and 1 deletions
|
@ -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 = ""
|
29
api/endpoints/about/languages/GET.php
Normal file
29
api/endpoints/about/languages/GET.php
Normal 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;
|
||||
}
|
||||
}
|
13
api/endpoints/about/languages/POST.php
Normal file
13
api/endpoints/about/languages/POST.php
Normal 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");
|
||||
}
|
||||
}
|
|
@ -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";
|
||||
|
|
Loading…
Add table
Reference in a new issue