diff --git a/src/app.py b/src/app.py index 7ab03e8..11f2a9a 100644 --- a/src/app.py +++ b/src/app.py @@ -70,7 +70,6 @@ async def fetch_data(data: Dict[str, Any]) -> List[Dict[str, Any]]: in_komga = komga.getSeries( manga.title.english if manga.title.english else manga.title.romaji ) - print(in_komga, manga.title.english) results.append( { "id": manga.id, @@ -81,7 +80,7 @@ async def fetch_data(data: Dict[str, Any]) -> List[Dict[str, Any]]: if manga.coverImage else "https://demofree.sirv.com/nope-not-here.jpg", "status": manga.status, - "type": manga.type, + "type": manga.format, "genres": manga.genres or [], "tags": [tag.name for tag in (manga.tags or [])], "description": manga.description.replace("
", "\n") @@ -106,7 +105,7 @@ async def get_genres(): async with httpx.AsyncClient() as client: try: response = await client.post( - f"https://graphql.anilist.co", + "https://graphql.anilist.co", json={"query": GENRES_QUERY}, ) response.raise_for_status() @@ -124,7 +123,7 @@ async def get_tags(): async with httpx.AsyncClient() as client: try: response = await client.post( - f"https://graphql.anilist.co", + "https://graphql.anilist.co", json={"query": TAGS_QUERY}, ) response.raise_for_status() @@ -139,7 +138,6 @@ async def get_tags(): @app.route("/search", methods=["POST"]) async def search(): data = await request.get_json() - print(data) results = await fetch_data(data) if not results: return jsonify({"error": "No results found"}), 404 @@ -154,13 +152,12 @@ async def index(): @app.route("/request", methods=["POST"]) async def log_request(): data = await request.get_json() - item = data.get("title") + item = data.get("item") if item: asynccache = KomCache() - manga_title = data.get("title") asynccache.insert( - "INSERT INTO manga_requests (manga_id, manga_title) VALUES (?, ?)", - (item, manga_title), + "INSERT INTO manga_requests (manga_id) VALUES (?)", + (item,), ) return jsonify({"status": "success"}) return jsonify({"status": "failed"}), 400 diff --git a/src/static/style.css b/src/static/style.css index e5f0eb2..4291f69 100644 --- a/src/static/style.css +++ b/src/static/style.css @@ -155,11 +155,19 @@ body.nsfw-disabled .image-container.nsfw:hover img { /* Implement design here */ } +/* ========== KOMGA SPECIFIC STYLES ========== */ + + .card.komga { border: 3px solid green; box-sizing: border-box; /* disable the request button for entries in Komga */ + /* only allow the info button to be clicked */ + opacity: 0.3; + +} + +.card.komga .request { pointer-events: none; opacity: 0.5; - } \ No newline at end of file diff --git a/src/templates/index.html b/src/templates/index.html index b5ad9cc..4086836 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -37,7 +37,13 @@ Show NSFW content + + + {% if results %} @@ -45,7 +51,7 @@
{% for result in results %} -
+
Cover @@ -56,7 +62,7 @@

{{ result.title }}

- + {% if not result.in_komga %} @@ -86,6 +92,10 @@
+ +