aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-11-26 20:29:09 +0100
committerdec05eba <dec05eba@protonmail.com>2022-11-26 20:29:09 +0100
commitc5f465fe6c04afa26fd20ca600457d8de50cf42e (patch)
tree5801d74b030b22401f7507ae08bc7a1458e23865 /src/plugins
parent2409bd1b0dc0118036c3024fdf19a5dc16a26586 (diff)
Allow nsfw ecchi in artists/authors page, add option to show h
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())