Skip to content

New Source: es.manhwaweb#264

Open
Llavesuke wants to merge 2 commits into
Aidoku-Community:mainfrom
Llavesuke:refactor/es-manhwaweb
Open

New Source: es.manhwaweb#264
Llavesuke wants to merge 2 commits into
Aidoku-Community:mainfrom
Llavesuke:refactor/es-manhwaweb

Conversation

@Llavesuke
Copy link
Copy Markdown

New Source: Es.manhwaweb

Description

This PR adds a new source for ManhwaWeb (Spanish web).

Features

  • Listing: Latest Chapters, New Works.
  • Search: Supports text search and filtering by genre, status, and sort order.
  • Manga Details: Fetches cover, synopsis, status, authors, and chapter list.
  • Chapter Images: correctly resolves and displays chapter pages.

Verification

I have manually built the package and tested it on an iPhone:

  • Source installs and loads correctly.
  • Home page sections populate.
  • Search and filters work.
  • Chapter images load successfully.

This is my first contribution to Aidoku! I'm happy to help the community. I'll be waiting for any feedback or requested changes. Thanks for all the great work all has been doing

Copy link
Copy Markdown
Contributor

@kkantan kkantan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for the pr!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all the json files should use tabs for indentation and end with a single newline, for convention.

Comment thread sources/es.manhwaweb/res/icon.png
Comment thread sources/es.manhwaweb/src/helper.rs Outdated
/// This prevents spamming the server and getting IP banned.
pub fn request_with_limits(url: &str, method: &str) -> Result<Request> {
// Sleep for 1 second to respect rate limits.
sleep(1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead, could you use set_rate_limit? this sets a specific rate limit in a given period. for example, 1 request allowed every 2 seconds. for reference, the mangadex source uses this.

Comment thread sources/es.manhwaweb/src/helper.rs Outdated
// Sleep for 1 second to respect rate limits.
sleep(1);
match method {
"POST" => Request::post(url).map_err(|e| e.into()),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can do this.

Suggested change
"POST" => Request::post(url).map_err(|e| e.into()),
"POST" => Request::post(url).map_err(Into::into),

[dev-dependencies]
aidoku = { git = "https://github.com/Aidoku/aidoku-rs.git", features = ["test"] }
aidoku-test = { git = "https://github.com/Aidoku/aidoku-rs.git" }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Comment thread sources/es.manhwaweb/src/imp.rs Outdated
Comment on lines +159 to +171
/// Helper function to map genre IDs to Spanish names.
fn get_genre_name(id: &str) -> String {
match id {
"3" => "Acción", "29" => "Aventura", "18" => "Comedia", "1" => "Drama",
"42" => "Recuentos de la vida", "2" => "Romance", "5" => "Venganza", "6" => "Harem",
"23" => "Fantasía", "31" => "Sobrenatural", "25" => "Tragedia", "43" => "Psicológico",
"32" => "Horror", "44" => "Thriller", "28" => "Historias cortas", "30" => "Ecchi",
"34" => "Gore", "37" => "Girls love", "27" => "Boys love", "45" => "Reencarnación",
"41" => "Sistema de niveles", "33" => "Ciencia ficción", "38" => "Apocalíptico",
"39" => "Artes marciales", "40" => "Superpoderes", "35" => "Cultivación (cultivo)",
"8" => "Milf", _ => "Desconocido",
}.to_string()
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should probably be moved into the helpers module.

Suggested change
/// Helper function to map genre IDs to Spanish names.
fn get_genre_name(id: &str) -> String {
match id {
"3" => "Acción", "29" => "Aventura", "18" => "Comedia", "1" => "Drama",
"42" => "Recuentos de la vida", "2" => "Romance", "5" => "Venganza", "6" => "Harem",
"23" => "Fantasía", "31" => "Sobrenatural", "25" => "Tragedia", "43" => "Psicológico",
"32" => "Horror", "44" => "Thriller", "28" => "Historias cortas", "30" => "Ecchi",
"34" => "Gore", "37" => "Girls love", "27" => "Boys love", "45" => "Reencarnación",
"41" => "Sistema de niveles", "33" => "Ciencia ficción", "38" => "Apocalíptico",
"39" => "Artes marciales", "40" => "Superpoderes", "35" => "Cultivación (cultivo)",
"8" => "Milf", _ => "Desconocido",
}.to_string()
}
/// Helper function to map genre IDs to Spanish names.
fn get_genre_name(id: &str) -> String {
match id {
"3" => "Acción", "29" => "Aventura", "18" => "Comedia", "1" => "Drama",
"42" => "Recuentos de la vida", "2" => "Romance", "5" => "Venganza", "6" => "Harem",
"23" => "Fantasía", "31" => "Sobrenatural", "25" => "Tragedia", "43" => "Psicológico",
"32" => "Horror", "44" => "Thriller", "28" => "Historias cortas", "30" => "Ecchi",
"34" => "Gore", "37" => "Girls love", "27" => "Boys love", "45" => "Reencarnación",
"41" => "Sistema de niveles", "33" => "Ciencia ficción", "38" => "Apocalíptico",
"39" => "Artes marciales", "40" => "Superpoderes", "35" => "Cultivación (cultivo)",
"8" => "Milf", _ => "Desconocido",
}.into()
}

Comment thread sources/es.manhwaweb/src/helper.rs Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should rename this to helpers.rs and move the other helper function(s) here.

Comment thread sources/es.manhwaweb/src/imp.rs Outdated
Comment on lines +187 to +191
key: m.id_manhwa.clone().into(),
title: m.name_manhwa.clone(),
authors: Some(vec![subtitle]),
cover: m.img.clone().map(|s| s.into()),
url: Some(format!("{}/manhwa/{}", BASE_URL, m.id_manhwa)),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you shouldn't need to clone anything here. if you define the url above, before you use the key, that clone can be avoided, and if you use into_iter instead of iter that should allow the other two to be avoided.

Comment thread sources/es.manhwaweb/src/imp.rs Outdated
let id = name.split(':').nth(1).unwrap_or("");
// Ensure 'creacion' (creation date) sort is properly applied for these listings too
let url = format!("{BACKEND_URL}/manhwa/library?page={}&perPage={}&erotico=no&generes={}&order_item=creacion&order_dir=desc", api_page, PER_PAGE, id);
let resp = crate::helper::request_with_limits(&url, "GET")?.send()?.get_json::<LibraryResponse>()?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let resp = crate::helper::request_with_limits(&url, "GET")?.send()?.get_json::<LibraryResponse>()?;
let resp = crate::helper::request_with_limits(&url, "GET")?.json_owned::<LibraryResponse>()?;

Comment thread sources/es.manhwaweb/src/models.rs Outdated
}

impl LibraryManga {
pub fn to_manga(&self, base_url: &str) -> Manga {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function should probably be consuming, and then you can avoid the clone()s. just make sure to use into_iter when collecting.

Suggested change
pub fn to_manga(&self, base_url: &str) -> Manga {
pub fn to_manga(self, base_url: &str) -> Manga {

@Llavesuke
Copy link
Copy Markdown
Author

Thanks a lot for the feedback, I really appreciate it!

I've reviewed all your comments and they should now be fixed. If there's anything else that needs to be changed, just let me know

Copy link
Copy Markdown
Contributor

@kkantan kkantan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, there are just a few other things:

  • json files still need tabs and newlines at the end.
  • there are some clippy warnings you can see by running cargo clippy.
  • there's still one extra newline in the Cargo.toml file you could remove.
  • is there api support for fetching authors? it looks like the site has the names for some titles, for example "Inaka no Home Center Otoko no Jiyuu na Isekai Seikatsu" from the home page.

}

impl LibraryManga {
pub fn to_manga(self, base_url: &str) -> Manga {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that prefixing this with into_ instead will fix the clippy warning.

Suggested change
pub fn to_manga(self, base_url: &str) -> Manga {
pub fn into_manga(self, base_url: &str) -> Manga {

Manga {
key: m.id_manhwa.into(),
title: m.name_manhwa,
authors: Some(vec![subtitle]),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is best to put as the description instead.

}
}
}
FilterValue::Sort { index, .. } => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you don't use the ascending value, you should set canAscend to false in the filters.json.


// Default to "no" erotic content if the filter wasn't explicitly set
if !erotic_filter_set {
qs.push("erotico", Some("no"));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the same thing for both the "no" option and the "ver todo" option.

since the source rating is set to 18+, and there's an 18+ listing, it seems like the default option should be "ver todo", if it can be made to work.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd still prefer not to show 18+ content by default and keep it as an optional choice for the user. If we go with that approach, should we adjust how the source rating is handled or labeled to make it more consistent with a 'hidden by default' policy?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in that case, you should remove the 18+ listing and then change the contentRating in the source.json to 1 instead of 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants