From 80af7b94608e883716a3839a5aa2292924517ad7 Mon Sep 17 00:00:00 2001 From: asepharyana Date: Mon, 31 Aug 2026 20:42:12 +0700 Subject: [PATCH] fix(komik): keep api.komiku.org for lists, source genre-list from komiku.org root MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Blanket-switching the whole komik module to komiku.org broke the manga list: komiku.org/manga/?tipe=manga 301-redirects to /pustaka/ (the new library layout, 0 .bge items), while api.komiku.org/manga/?tipe=manga serves the .bge grid the parser expects unredirected. Correct split: - api_url() = api.komiku.org -> manga/manhua/manhwa/genre/search lists (.bge layout) - genre_list fetches base_url() = komiku.org root, which is POPULATED (#Genre .ls3 .ls3p h4 + /genre// links) — api.komiku.org root is empty Reverts the api_url() half of a46adf1; keeps the underlying insight that the genre-list needs the populated komiku.org root. --- src/application/komik/use_cases.rs | 2 +- src/infrastructure/scraping/scraping_urls.rs | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/application/komik/use_cases.rs b/src/application/komik/use_cases.rs index 88bb5ec..1ed0217 100644 --- a/src/application/komik/use_cases.rs +++ b/src/application/komik/use_cases.rs @@ -49,7 +49,7 @@ impl KomikUseCases { .get_or_set("komik:genres:list:v3", GENRE_LIST_CACHE_TTL, || async { let html = self .repository - .fetch_html(&self.repository.api_url()) + .fetch_html(&self.repository.base_url()) .await .map_err(|e| e.to_string())?; let genres = tokio::task::spawn_blocking(move || parser::parse_genres(&html)) diff --git a/src/infrastructure/scraping/scraping_urls.rs b/src/infrastructure/scraping/scraping_urls.rs index 3548b01..e78a43d 100644 --- a/src/infrastructure/scraping/scraping_urls.rs +++ b/src/infrastructure/scraping/scraping_urls.rs @@ -21,13 +21,14 @@ pub fn get_production_url() -> String { /// Get Komik API URL from environment config. /// -/// Defaults to `https://komiku.org` (NOT the legacy `api.komiku.org`): the -/// `api.komiku.org` root returns an empty body (site-side), which broke the -/// komik genre-list endpoint. `komiku.org` serves identical sub-path content -/// (manga lists, genre, search) plus a populated root, so the module is -/// consolidated onto the canonical, working domain. +/// Defaults to `https://api.komiku.org`. This is the API mirror whose +/// sub-paths (`/manga/?tipe=manga`, `/genre//`, `/search//`) serve +/// the `.bge` grid layout the parsers expect. NOTE: `api.komiku.org`'s ROOT +/// path returns an empty body — the komik genre-list endpoint must therefore +/// fetch from `komiku.org` (base URL) instead of this root (see +/// `KomikUseCase::genre_list`, which uses `base_url()`). pub fn get_komik_api_url() -> String { - env::var("KOMIK2_API_URL").unwrap_or_else(|_| "https://komiku.org".to_string()) + env::var("KOMIK2_API_URL").unwrap_or_else(|_| "https://api.komiku.org".to_string()) } /// Get Otakudesu URL from environment config.