diff options
| author | Andrew Dolgov <fox@fakecake.org> | 2026-05-26 11:24:58 +0300 |
|---|---|---|
| committer | Andrew Dolgov <fox@fakecake.org> | 2026-05-26 11:24:58 +0300 |
| commit | a865ff1754f812e8cd163e4bfc1b8cbb2d10c2df (patch) | |
| tree | 3f12009857aea047d99b998e881dee13835f87b4 /classes/Handler/GetlastreadHandler.php | |
| parent | fa1bccd968647f6ab5cce0ec4293b39c6fde7633 (diff) | |
| download | the-epube-a865ff1754f812e8cd163e4bfc1b8cbb2d10c2df.tar.gz the-epube-a865ff1754f812e8cd163e4bfc1b8cbb2d10c2df.tar.xz | |
unify lastread position handlers
Diffstat (limited to 'classes/Handler/GetlastreadHandler.php')
| -rw-r--r-- | classes/Handler/GetlastreadHandler.php | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/classes/Handler/GetlastreadHandler.php b/classes/Handler/GetlastreadHandler.php deleted file mode 100644 index d6b82e7..0000000 --- a/classes/Handler/GetlastreadHandler.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -namespace Handler; - -use AuthRequired; -use ORM; -use Request; -use RequestHandlerInterface; -use Response; - -class GetlastreadHandler implements RequestHandlerInterface, AuthRequired -{ - public function handle(Request $request): Response - { - $bookid = (int) $request->getAttribute('id'); - $owner = $_SESSION["owner"] ?? ""; - - if ($bookid) { - $book = ORM::for_table('epube_books') - ->where('bookid', $bookid) - ->where('owner', $owner) - ->find_one(); - - if ($book) { - return (new Response())->withBody(json_encode([ - "page" => (int)$book->lastread, - "cfi" => $book->lastcfi, - "total" => 100, - "timestamp" => (int)$book->lastts - ])); - } - } - - return (new Response()) - ->withStatus(404) - ->withBody("Not found."); - } -} |
