feat(*): refactor metadata handling; move metadata to backend where possible, refine client views

This commit is contained in:
Cory Dransfeldt 2025-05-25 20:15:45 -07:00
parent 929bc9f9f8
commit 9687509e4a
No known key found for this signature in database
35 changed files with 506 additions and 339 deletions

View file

@ -1,22 +1,24 @@
<?php
namespace App\Classes;
namespace App\Classes;
class BookFetcher extends PageFetcher
{
public function fetch(string $url): ?array
class BookFetcher extends PageFetcher
{
$cacheKey = "book_" . md5($url);
$cached = $this->cacheGet($cacheKey);
public function fetch(string $url): ?array
{
$cacheKey = "book_" . md5($url);
$cached = $this->cacheGet($cacheKey);
if ($cached) return $cached;
if ($cached) return $cached;
$book = $this->fetchSingleFromApi("optimized_books", $url);
$book = $this->fetchSingleFromApi("optimized_books", $url);
if (!$book) return null;
if (!$book) return null;
$this->cacheSet($cacheKey, $book);
$book['globals'] = $this->getGlobals();
return $book;
$this->cacheSet($cacheKey, $book);
return $book;
}
}
}