aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/Mangadex.cpp12
1 files changed, 9 insertions, 3 deletions
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 <json/writer.h>
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())