aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-07-01 23:57:51 +0200
committerdec05eba <dec05eba@protonmail.com>2022-07-01 23:57:51 +0200
commit0bf55deae8d8a681b32a1fa91908ed1f566dbbf5 (patch)
tree4ada8aa2fa69c1da2bb6be2a03473f15e0a17611
parent9650dba396e737649254050f6e421adf611766c8 (diff)
Mangatown: use referer header for thumbnails to fix permission issue
-rw-r--r--src/AsyncImageLoader.cpp2
-rw-r--r--src/plugins/MangaGeneric.cpp3
2 files changed, 5 insertions, 0 deletions
diff --git a/src/AsyncImageLoader.cpp b/src/AsyncImageLoader.cpp
index 2919f41..883073f 100644
--- a/src/AsyncImageLoader.cpp
+++ b/src/AsyncImageLoader.cpp
@@ -277,9 +277,11 @@ namespace QuickMedia {
}
static bool download_file_async(const char *url, const char *save_filepath, ReadProgram *read_program) {
+ std::string referer = "Referer: " + std::string(url);
const char *args[] = {
"curl", "-H", "Accept-Language: en-US,en;q=0.5", "-H", "Connection: keep-alive", "--compressed", "-g", "-s", "-L", "-f",
"-H", "user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36",
+ "-H", referer.c_str(),
"-o", save_filepath,
"--", url,
nullptr
diff --git a/src/plugins/MangaGeneric.cpp b/src/plugins/MangaGeneric.cpp
index 47fbf08..767f077 100644
--- a/src/plugins/MangaGeneric.cpp
+++ b/src/plugins/MangaGeneric.cpp
@@ -142,6 +142,9 @@ namespace QuickMedia {
}
SearchResult MangaGenericSearchPage::search(const std::string &str, BodyItems &result_items) {
+ if(str.empty())
+ return SearchResult::OK;
+
return plugin_result_to_search_result(get_page(str, 0, result_items));
}