From bdf9c0e9d2e0f58df52d6fb084e4dee2bbcb3b8e Mon Sep 17 00:00:00 2001 From: "J. King" Date: Sun, 24 Jan 2021 21:53:45 -0500 Subject: [PATCH] Prototype feed icon querying --- lib/REST/Miniflux/V1.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/REST/Miniflux/V1.php b/lib/REST/Miniflux/V1.php index 705a77f..c577ce0 100644 --- a/lib/REST/Miniflux/V1.php +++ b/lib/REST/Miniflux/V1.php @@ -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)));