From c5f465fe6c04afa26fd20ca600457d8de50cf42e Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 26 Nov 2022 20:29:09 +0100 Subject: Allow nsfw ecchi in artists/authors page, add option to show h --- src/plugins/Mangadex.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/plugins/Mangadex.cpp') diff --git a/src/plugins/Mangadex.cpp b/src/plugins/Mangadex.cpp index bc19536..f517869 100644 --- a/src/plugins/Mangadex.cpp +++ b/src/plugins/Mangadex.cpp @@ -1,6 +1,7 @@ #include "../../plugins/Mangadex.hpp" #include "../../include/Utils.hpp" #include "../../include/Theme.hpp" +#include "../../include/Config.hpp" #include namespace QuickMedia { @@ -62,7 +63,10 @@ namespace QuickMedia { }; static PluginResult search_manga(Page *plugin_page, SearchType search_type, const std::string &query, int page, BodyItems &result_items) { - std::string url = "https://api.mangadex.org/manga?limit=20&order[relevance]=desc&includes[]=cover_art&offset=" + std::to_string(page * 20); + std::string url = "https://api.mangadex.org/manga?limit=20&order[relevance]=desc&includes[]=cover_art&offset=" + std::to_string(page * 20) + "&contentRating[]=safe&contentRating[]=suggestive&contentRating[]=erotica"; + if(get_config().mangadex.allow_hentai) + url += "&contentRating[]=pornographic"; + const std::string query_encoded = url_param_encode(query); switch(search_type) { case SearchType::TITLE: @@ -165,10 +169,12 @@ namespace QuickMedia { } static PluginResult get_chapters_for_manga(Page *page, const std::string &manga_id, int page_num, BodyItems &result_items) { - std::string request_url = "https://api.mangadex.org/manga/" + manga_id + "/feed?order[chapter]=desc&limit=100&translatedLanguage[]=en&offset=" + std::to_string(page_num * 100); + std::string url = "https://api.mangadex.org/manga/" + manga_id + "/feed?order[chapter]=desc&limit=100&translatedLanguage[]=en&offset=" + std::to_string(page_num * 100) + "&contentRating[]=safe&contentRating[]=suggestive&contentRating[]=erotica"; + if(get_config().mangadex.allow_hentai) + url += "&contentRating[]=pornographic"; Json::Value json_root; - if(page->download_json(json_root, request_url, {}, true) != DownloadResult::OK) + if(page->download_json(json_root, url, {}, true) != DownloadResult::OK) return PluginResult::NET_ERR; if(!json_root.isObject()) -- cgit v1.2.3