1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 13:12:41 +00:00

Prototype feed icon querying

This commit is contained in:
J. King 2021-01-24 21:53:45 -05:00
parent 9197a8d08b
commit bdf9c0e9d2

View file

@ -808,6 +808,22 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler {
}
}
protected function getFeedIcon(array $path): ResponseInterface {
try {
$icon = Arsse::$db->subscriptionIcon(Arsse::$user->id, (int) $path[1]);
} catch (ExceptionInput $e) {
return new ErrorResponse("404", 404);
}
if (!$icon['id']) {
return new ErrorResponse("404", 404);
}
return new Response([
'id' => $icon['id'],
'data' => ($icon['type'] ?? "application/octet-stream").";base64,".base64_encode($icon['data']),
'mime_type' => $icon['type'],
]);
}
public static function tokenGenerate(string $user, string $label): string {
// Miniflux produces tokens in base64url alphabet
$t = str_replace(["+", "/"], ["-", "_"], base64_encode(random_bytes(self::TOKEN_LENGTH)));