aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO3
-rw-r--r--example-config.json3
-rw-r--r--include/Config.hpp5
-rw-r--r--src/Config.cpp7
-rw-r--r--src/plugins/Mangadex.cpp12
5 files changed, 25 insertions, 5 deletions
diff --git a/TODO b/TODO
index dd8887a..d6f8594 100644
--- a/TODO
+++ b/TODO
@@ -249,4 +249,5 @@ Use matrix /sync "since" param. Its beneficial even to quickmedia because synaps
/encrypt should support formatted text like greentext, custom emoji, mentions etc.
allow navigating to cross-post/dead thread with ctrl+i, fallback to 4chan archive if thread is dead, allow navigating to thread post in the same thread as well using archive to bring the post back alive, revive deleted images using archive.
Add option to open youtube/4chan links in a new instance of quickmedia (maybe with ctrl+enter?).
-AAAAA Resizing 4chan post with no images but with replies (reactions) gives incorrect body item height compared to the rendered height. \ No newline at end of file
+AAAAA Resizing 4chan post with no images but with replies (reactions) gives incorrect body item height compared to the rendered height.
+Some mangadex chapter images are .webp files, such as the images for chapter 0 for "the lolicon killer". Quickmedia doesn't work for that because quickmedia doesn't support manga webp files. Fix that. \ No newline at end of file
diff --git a/example-config.json b/example-config.json
index 1a687c5..2e50d70 100644
--- a/example-config.json
+++ b/example-config.json
@@ -87,6 +87,9 @@
"cjk": "",
"symbols": ""
},
+ "mangadex": {
+ "allow_hentai": false
+ },
"use_system_fonts": false,
"use_system_mpv_config": false,
"enable_shaders": true,
diff --git a/include/Config.hpp b/include/Config.hpp
index 832824f..48e6213 100644
--- a/include/Config.hpp
+++ b/include/Config.hpp
@@ -71,6 +71,10 @@ namespace QuickMedia {
std::string symbols;
};
+ struct MangadexConfig {
+ bool allow_hentai = false;
+ };
+
struct Config {
Config() = default;
Config(const Config&) = delete;
@@ -88,6 +92,7 @@ namespace QuickMedia {
PeertubeConfig peertube;
DownloadConfig download;
FontConfig font;
+ MangadexConfig mangadex;
bool use_system_fonts = false;
bool use_system_mpv_config = false;
bool enable_shaders = true;
diff --git a/src/Config.cpp b/src/Config.cpp
index 570504f..dd7f7ad 100644
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -273,7 +273,7 @@ namespace QuickMedia {
for(const DownloadPaths &download_paths : download_paths_list) {
const Json::Value &directory_json = download_json[download_paths.json_field];
if(!directory_json.isString()) {
- fprintf(stderr, "Warning: config variable config.download.%s is not a string, using path \"%s\" instead\n", download_paths.json_field, download_paths.fallback_dir.c_str());
+ fprintf(stderr, "Warning: config variable config.download.%s is not a string, using path \"%s\" or \"%s\" instead\n", download_paths.json_field, download_paths.xdg_var_name, download_paths.fallback_dir.c_str());
continue;
}
*download_paths.config_var = path_expanduser(directory_json.asString());
@@ -299,6 +299,11 @@ namespace QuickMedia {
get_json_value_path(font_json, "symbols", config->font.symbols);
}
+ const Json::Value &mangadex_json = json_root["mangadex"];
+ if(mangadex_json.isObject()) {
+ get_json_value(mangadex_json, "allow_hentai", config->mangadex.allow_hentai);
+ }
+
get_json_value(json_root, "use_system_fonts", config->use_system_fonts);
get_json_value(json_root, "use_system_mpv_config", config->use_system_mpv_config);
get_json_value(json_root, "enable_shaders", config->enable_shaders);
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())