stadia-avatar/endpoint/get.php
Victor Westerlund d3ab9fae75 Concat of friends and messages array
Concatinating friends and messages for bulk processing.

Added empty catch() and response.status check on getStadiaAvatar() to ignore all missing avatars. (Default to Stadia avatar)

Changing HTTP Response code from 404 to 200 for missing avatars (but a userID was supplied). CORS headers are not set for error pages in NGINX. This oculd be adressed by recompiling NGINX with more_headers.
2021-02-06 05:58:54 +01:00

15 lines
No EOL
350 B
PHP

<?php
require "../classes/Message.php";
require "../classes/Database.php";
$user_id = $_GET["userID"] ?? error("400","No userID provided");
$db = new StadiaAvatarDB();
$avatar = $db->get_avatar($user_id);
if(!$avatar) {
error("200","No avatar was found for the supplied userID");
}
echo "{\"status\":\"OK\",\"avatar\":\"${avatar}\"}";