You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mlPHP/routes.php

40 lines
1.1 KiB

<?php
include_once("instance.php");
function route($path, $ml)
{
switch ($path)
{
case "/info":
return file_get_contents("db/info.json");
break;
case "/manga/search":
return file_get_contents("db/test.json");
break;
case "/manga/from_id":
if (!isset($_GET["id"]))
{
return json_encode($ml->getManga($_GET["id"]));
}
http_response_code(404);
break;
case "/manga/get_chapters":
if (isset($_GET["id"]))
{
return json_encode($ml->getManga($_GET["id"])["chapters"]);
}
http_response_code(404);
break;
case "/manga/thumbnail":
if (isset($_GET["id"]))
{
header('Content-Type:image/webp');
readfile("db/thumb/".$_GET["id"].".webp");
return;
}
http_response_code(404);
break;
default:
http_response_code(404);
}
}
?>