diff --git a/pyproject.toml b/pyproject.toml index 2640fc7..85fada5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,6 +9,7 @@ dependencies = [ "httpx>=0.28.1", "jinja2>=3.1.6", "komgapi", + "limit>=0.2.3", "quart>=0.20.0", ] diff --git a/src/app.py b/src/app.py index d58b301..41d80d9 100644 --- a/src/app.py +++ b/src/app.py @@ -36,12 +36,15 @@ async def fetch_data( ) -> List[Dict[str, Any]]: async with httpx.AsyncClient() as client: try: - variables: Dict[str, Any] = {"search": data["query"], "type": "MANGA"} + variables: Dict[str, Any] = {"search": data["query"]} if data.get("genres"): variables["genres"] = data["genres"] if data.get("tags"): variables["tags"] = data["tags"] - # print(data["query"], variables) + if data.get("type"): + if data["type"] in ["MANGA", "NOVEL"]: + variables["format"] = data["type"] + print(data["query"], variables) response = await client.post( "https://graphql.anilist.co", json={ diff --git a/src/templates/index.html b/src/templates/index.html index 6b66161..7387e41 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -14,6 +14,7 @@
+ @@ -30,6 +31,14 @@
+
+ + +
@@ -256,13 +265,14 @@ const searchTerm = document.getElementById("searchInput").value.trim(); const selectedGenres = document.getElementById("genreInput").value.split(',').map(v => v.trim()).filter(v => v); const selectedTags = document.getElementById("tagInput").value.split(',').map(v => v.trim()).filter(v => v); - - + const selectedType = document.getElementById("typeSelect").value; const query = { query: searchTerm, genres: selectedGenres, - tags: selectedTags + tags: selectedTags, + type: selectedType // Include the selected type in the query + }; const loadingElement = document.getElementById("loading");