static thumbs

main
cynic 4 years ago
parent 27e99039a4
commit 2497eb0342
  1. 35
      db/test.json
  2. 2
      instance.php
  3. 14
      routes.php
  4. 0
      thumbnail/1.webp

@ -1,10 +1,35 @@
[
{
"id": 1,
"titles": ["testing!"],
"authors": ["nipponeselandian"],
"artists": ["nipponeselandian"],
"last_updated": 1,
"info":
{
"id": 1,
"type": "Manga",
"titles":
[
"testing!"
],
"artists":
[
"artist!"
],
"authors":
[
"Sakurai Norio"
],
"genres":
[
"Comedy",
"Romance",
"School"
],
"country_of_origin": "JP",
"publication_status": "Ongoing",
"scanlation_status": true,
"mal_id": 0,
"anilist_id": 0,
"mangaupdates_id": 0,
"last_updated": 1617791510
},
"chapters":
[
{

@ -13,7 +13,7 @@ class ml
{
foreach ($this->db as $manga)
{
if ($manga["id"] == $id)
if ($manga["info"]["id"] == $id)
{
return($manga);
}

@ -8,12 +8,17 @@ function route($path, $ml)
return file_get_contents("db/info.json");
break;
case "/manga/search":
return file_get_contents("db/test.json");
$response = [];
foreach ($ml->db as $manga)
{
array_push($response, $manga["info"]);
}
return json_encode($response);
break;
case "/manga/from_id":
if (!isset($_GET["id"]))
if (isset($_GET["id"]))
{
return json_encode($ml->getManga($_GET["id"]));
return json_encode($ml->getManga($_GET["id"])["info"]);
}
http_response_code(404);
break;
@ -28,13 +33,14 @@ function route($path, $ml)
if (isset($_GET["id"]))
{
header('Content-Type:image/webp');
readfile("db/thumb/".$_GET["id"].".webp");
readfile("thumbnail/".$_GET["id"].".webp");
return;
}
http_response_code(404);
break;
default:
http_response_code(404);
return("lol@".$path);
}
}
?>

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

Loading…
Cancel
Save