static thumbs

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

@ -1,10 +1,35 @@
[ [
{
"info":
{ {
"id": 1, "id": 1,
"titles": ["testing!"], "type": "Manga",
"authors": ["nipponeselandian"], "titles":
"artists": ["nipponeselandian"], [
"last_updated": 1, "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": "chapters":
[ [
{ {

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

@ -8,12 +8,17 @@ function route($path, $ml)
return file_get_contents("db/info.json"); return file_get_contents("db/info.json");
break; break;
case "/manga/search": 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; break;
case "/manga/from_id": 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); http_response_code(404);
break; break;
@ -28,13 +33,14 @@ function route($path, $ml)
if (isset($_GET["id"])) if (isset($_GET["id"]))
{ {
header('Content-Type:image/webp'); header('Content-Type:image/webp');
readfile("db/thumb/".$_GET["id"].".webp"); readfile("thumbnail/".$_GET["id"].".webp");
return; return;
} }
http_response_code(404); http_response_code(404);
break; break;
default: default:
http_response_code(404); http_response_code(404);
return("lol@".$path);
} }
} }
?> ?>

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

Loading…
Cancel
Save