diff --git a/db/info.json b/db/info.json new file mode 100644 index 0000000..ac167f4 --- /dev/null +++ b/db/info.json @@ -0,0 +1,8 @@ +{ + "name": "php instance testing", + "test.cynic.moe": "localhost", + "operator": "cynic", + "icon": "", + "description": "aaaathats4as", + "version": "0.1" +} \ No newline at end of file diff --git a/db/test.json b/db/test.json new file mode 100644 index 0000000..af57374 --- /dev/null +++ b/db/test.json @@ -0,0 +1,32 @@ +[ + { + "id": 1, + "titles": ["testing!"], + "authors": ["nipponeselandian"], + "artists": ["nipponeselandian"], + "last_updated": 1, + "chapters": + [ + { + "id": 1, + "manga_id": 1, + "chapter_no": 1, + "chapter_postfix": "", + "ordinal": null, + "title": "c001", + "page_count": 6069, + "version": 1, + "language_id": "en", + "group_id": null, + "date_added": 1, + "ipfs_link": "bafybeihnoou2av5w2bzmwkl6hi25scyzz6sjwdfqp4cwq2ikf6dfmev3ta", + "scanlator": + { + "id": 1, + "name": "Yado Inn", + "website": "https://yado-inn.com" + } + } + ] + } +] \ No newline at end of file diff --git a/db/thumb/1.webp b/db/thumb/1.webp new file mode 100644 index 0000000..93359c7 Binary files /dev/null and b/db/thumb/1.webp differ diff --git a/index.php b/index.php new file mode 100644 index 0000000..ed5dc82 --- /dev/null +++ b/index.php @@ -0,0 +1,7 @@ +run(); +exit(); +?> \ No newline at end of file diff --git a/instance.php b/instance.php new file mode 100644 index 0000000..7f9b92b --- /dev/null +++ b/instance.php @@ -0,0 +1,28 @@ +info = json_decode(file_get_contents("db/info.json"), $associative = true); + $this->db = json_decode(file_get_contents("db/test.json"), $associative = true); + } + function getManga($id) + { + foreach ($this->db as $manga) + { + if ($manga["id"] == $id) + { + return($manga); + } + } + return(0); + } + function run() + { + echo(route($_SERVER["PATH_INFO"], $this)); + } +} +?> \ No newline at end of file diff --git a/routes.php b/routes.php new file mode 100644 index 0000000..81c36d4 --- /dev/null +++ b/routes.php @@ -0,0 +1,40 @@ +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); + } +} +?> \ No newline at end of file