diff --git a/lib/REST/Miniflux/V1.php b/lib/REST/Miniflux/V1.php index 51884ea4..2198ebb6 100644 --- a/lib/REST/Miniflux/V1.php +++ b/lib/REST/Miniflux/V1.php @@ -1161,6 +1161,22 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler { return new EmptyResponse(204); } + protected function refreshFeed(array $path): ResponseInterface { + // NOTE: This is a no-op; we simply check that the feed exists + try { + Arsse::$db->subscriptionPropertiesGet(Arsse::$user->id, (int) $path[1]); + } catch (ExceptionInput $e) { + return new ErrorResponse("404", 404); + } + return new EmptyResponse(204); + } + + protected function refreshAllFeeds(): ResponseInterface { + // NOTE: This is a no-op + // It could be implemented, but the need is considered low since we use a dynamic schedule always + return new EmptyResponse(204); + } + public static function tokenGenerate(string $user, string $label): string { // Miniflux produces tokenss in base64url alphabet $t = str_replace(["+", "/"], ["-", "_"], base64_encode(random_bytes(self::TOKEN_LENGTH))); diff --git a/tests/cases/REST/Miniflux/TestV1.php b/tests/cases/REST/Miniflux/TestV1.php index 18982f34..22a53db6 100644 --- a/tests/cases/REST/Miniflux/TestV1.php +++ b/tests/cases/REST/Miniflux/TestV1.php @@ -921,4 +921,20 @@ class TestV1 extends \JKingWeb\Arsse\Test\AbstractTest { [new ExceptionInput("subjectMissing"), null, new ErrorResponse("404", 404)], ]; } + + public function testRefreshAFeed(): void { + \Phake::when(Arsse::$db)->subscriptionPropertiesGet->thenReturn([]); + $this->assertMessage(new EmptyResponse(204), $this->req("PUT", "/feeds/47/refresh")); + \Phake::verify(Arsse::$db)->subscriptionPropertiesGet(Arsse::$user->id, 47); + } + + public function testRefreshAMissingFeed(): void { + \Phake::when(Arsse::$db)->subscriptionPropertiesGet->thenThrow(new ExceptionInput("subjectMissing")); + $this->assertMessage(new ErrorResponse("404", 404), $this->req("PUT", "/feeds/2112/refresh")); + \Phake::verify(Arsse::$db)->subscriptionPropertiesGet(Arsse::$user->id, 2112); + } + + public function testRefreshAllFeeds(): void { + $this->assertMessage(new EmptyResponse(204), $this->req("PUT", "/feeds/refresh")); + } }