2021-12-07 22:47:41 +01:00
|
|
|
#include "content/views/view_store.hpp"
|
2023-04-19 21:56:34 +02:00
|
|
|
#include <hex/api/theme_manager.hpp>
|
2023-08-06 21:33:15 +02:00
|
|
|
#include <hex/api/achievement_manager.hpp>
|
2023-04-19 21:56:34 +02:00
|
|
|
#include <hex/api_urls.hpp>
|
2021-08-29 11:10:48 +02:00
|
|
|
|
2022-02-01 18:09:40 +01:00
|
|
|
#include <hex/api/content_registry.hpp>
|
|
|
|
|
2023-04-08 12:30:38 +02:00
|
|
|
#include <content/popups/popup_notification.hpp>
|
|
|
|
|
2021-09-03 02:34:40 +02:00
|
|
|
#include <imgui.h>
|
|
|
|
|
|
|
|
#include <hex/helpers/utils.hpp>
|
|
|
|
#include <hex/helpers/crypto.hpp>
|
|
|
|
#include <hex/helpers/logger.hpp>
|
2021-09-08 17:22:54 +02:00
|
|
|
#include <hex/helpers/magic.hpp>
|
2022-03-04 11:36:37 +01:00
|
|
|
#include <hex/helpers/fs.hpp>
|
2022-06-16 15:42:08 +02:00
|
|
|
#include <hex/helpers/tar.hpp>
|
2021-09-03 02:34:40 +02:00
|
|
|
|
|
|
|
#include <filesystem>
|
2021-09-08 17:22:54 +02:00
|
|
|
#include <functional>
|
2021-09-03 02:34:40 +02:00
|
|
|
#include <nlohmann/json.hpp>
|
2021-08-29 11:10:48 +02:00
|
|
|
|
2023-03-12 18:27:29 +01:00
|
|
|
#include <wolv/io/file.hpp>
|
|
|
|
|
2021-12-07 22:47:41 +01:00
|
|
|
namespace hex::plugin::builtin {
|
2021-08-29 11:10:48 +02:00
|
|
|
|
2021-09-03 02:34:40 +02:00
|
|
|
using namespace std::literals::string_literals;
|
|
|
|
using namespace std::literals::chrono_literals;
|
|
|
|
|
2021-12-07 22:47:41 +01:00
|
|
|
ViewStore::ViewStore() : View("hex.builtin.view.store.name") {
|
2023-05-12 08:38:32 +02:00
|
|
|
ContentRegistry::Interface::addMenuItem({ "hex.builtin.menu.extras", "hex.builtin.view.store.name" }, 1000, Shortcut::None, [&, this] {
|
2023-03-20 13:11:43 +01:00
|
|
|
if (this->m_requestStatus == RequestStatus::NotAttempted)
|
|
|
|
this->refresh();
|
|
|
|
TaskManager::doLater([] { ImGui::OpenPopup(View::toWindowName("hex.builtin.view.store.name").c_str()); });
|
|
|
|
this->getWindowOpenState() = true;
|
2022-01-23 02:28:38 +01:00
|
|
|
});
|
2023-03-23 11:23:07 +01:00
|
|
|
|
|
|
|
this->m_httpRequest.setTimeout(30'0000);
|
2023-07-11 09:19:52 +02:00
|
|
|
|
|
|
|
addCategory("hex.builtin.view.store.tab.patterns"_lang, "patterns", fs::ImHexPath::Patterns);
|
|
|
|
addCategory("hex.builtin.view.store.tab.includes"_lang, "includes", fs::ImHexPath::PatternsInclude);
|
|
|
|
addCategory("hex.builtin.view.store.tab.magic"_lang, "magic", fs::ImHexPath::Magic, []{
|
|
|
|
magic::compile();
|
|
|
|
});
|
|
|
|
addCategory("hex.builtin.view.store.tab.nodes"_lang, "nodes", fs::ImHexPath::Nodes);
|
|
|
|
addCategory("hex.builtin.view.store.tab.encodings"_lang, "encodings", fs::ImHexPath::Encodings);
|
|
|
|
addCategory("hex.builtin.view.store.tab.constants"_lang, "constants", fs::ImHexPath::Constants);
|
|
|
|
addCategory("hex.builtin.view.store.tab.themes"_lang, "themes", fs::ImHexPath::Themes, [this]{
|
|
|
|
auto themeFile = wolv::io::File(this->m_downloadPath, wolv::io::File::Mode::Read);
|
|
|
|
|
|
|
|
ThemeManager::addTheme(themeFile.readString());
|
|
|
|
});
|
|
|
|
addCategory("hex.builtin.view.store.tab.yara"_lang, "yara", fs::ImHexPath::Yara);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ViewStore::drawTab(hex::plugin::builtin::StoreCategory &category) {
|
|
|
|
if (ImGui::BeginTabItem(LangEntry(category.unlocalizedName))) {
|
2023-09-02 18:36:34 +02:00
|
|
|
if (ImGui::BeginTable("##pattern_language", 4, ImGuiTableFlags_ScrollY | ImGuiTableFlags_Borders | ImGuiTableFlags_SizingStretchSame | ImGuiTableFlags_RowBg)) {
|
2023-07-11 09:19:52 +02:00
|
|
|
ImGui::TableSetupScrollFreeze(0, 1);
|
|
|
|
ImGui::TableSetupColumn("hex.builtin.view.store.row.name"_lang, ImGuiTableColumnFlags_WidthFixed);
|
|
|
|
ImGui::TableSetupColumn("hex.builtin.view.store.row.description"_lang, ImGuiTableColumnFlags_None);
|
2023-09-02 18:36:34 +02:00
|
|
|
ImGui::TableSetupColumn("hex.builtin.view.store.row.authors"_lang, ImGuiTableColumnFlags_WidthFixed);
|
2023-07-11 09:19:52 +02:00
|
|
|
ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthFixed);
|
|
|
|
|
|
|
|
ImGui::TableHeadersRow();
|
|
|
|
|
|
|
|
u32 id = 1;
|
|
|
|
for (auto &entry : category.entries) {
|
|
|
|
ImGui::TableNextRow();
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
ImGui::TextUnformatted(entry.name.c_str());
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
ImGui::TextUnformatted(entry.description.c_str());
|
2023-09-02 18:36:34 +02:00
|
|
|
if (ImGui::IsItemHovered()) {
|
|
|
|
ImGui::BeginTooltip();
|
|
|
|
ImGui::PushTextWrapPos(500);
|
|
|
|
ImGui::TextUnformatted(entry.description.c_str());
|
|
|
|
ImGui::PopTextWrapPos();
|
|
|
|
ImGui::EndTooltip();
|
|
|
|
}
|
|
|
|
ImGui::TableNextColumn();
|
2023-10-04 12:00:32 +02:00
|
|
|
// The space makes a padding in the UI
|
2023-09-02 18:36:34 +02:00
|
|
|
ImGui::Text("%s ", wolv::util::combineStrings(entry.authors, ", ").c_str());
|
2023-07-11 09:19:52 +02:00
|
|
|
ImGui::TableNextColumn();
|
|
|
|
|
|
|
|
const auto buttonSize = ImVec2(100_scaled, ImGui::GetTextLineHeightWithSpacing());
|
|
|
|
|
|
|
|
ImGui::PushID(id);
|
|
|
|
ImGui::BeginDisabled(this->m_updateAllTask.isRunning() || (this->m_download.valid() && this->m_download.wait_for(0s) != std::future_status::ready));
|
|
|
|
{
|
|
|
|
if (entry.downloading) {
|
|
|
|
ImGui::ProgressBar(this->m_httpRequest.getProgress(), buttonSize, "");
|
|
|
|
|
|
|
|
if (this->m_download.valid() && this->m_download.wait_for(0s) == std::future_status::ready) {
|
|
|
|
this->handleDownloadFinished(category, entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
|
|
|
|
|
|
|
|
if (entry.hasUpdate) {
|
|
|
|
if (ImGui::Button("hex.builtin.view.store.update"_lang, buttonSize)) {
|
|
|
|
entry.downloading = this->download(category.path, entry.fileName, entry.link, true);
|
|
|
|
}
|
|
|
|
} else if (!entry.installed) {
|
|
|
|
if (ImGui::Button("hex.builtin.view.store.download"_lang, buttonSize)) {
|
|
|
|
entry.downloading = this->download(category.path, entry.fileName, entry.link, false);
|
2023-08-06 21:33:15 +02:00
|
|
|
AchievementManager::unlockAchievement("hex.builtin.achievement.misc", "hex.builtin.achievement.misc.download_from_store.name");
|
2023-07-11 09:19:52 +02:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (ImGui::Button("hex.builtin.view.store.remove"_lang, buttonSize)) {
|
|
|
|
entry.installed = !this->remove(category.path, entry.fileName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ImGui::PopStyleVar();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ImGui::EndDisabled();
|
|
|
|
ImGui::PopID();
|
|
|
|
id++;
|
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::EndTable();
|
|
|
|
}
|
|
|
|
ImGui::EndTabItem();
|
|
|
|
}
|
2021-09-03 02:34:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ViewStore::drawStore() {
|
2021-12-07 22:47:41 +01:00
|
|
|
ImGui::Header("hex.builtin.view.store.desc"_lang, true);
|
2021-09-03 02:34:40 +02:00
|
|
|
|
2023-03-23 13:32:47 +01:00
|
|
|
bool reloading = false;
|
|
|
|
if (this->m_apiRequest.valid()) {
|
|
|
|
if (this->m_apiRequest.wait_for(0s) != std::future_status::ready)
|
|
|
|
reloading = true;
|
|
|
|
else
|
|
|
|
this->parseResponse();
|
|
|
|
}
|
|
|
|
|
|
|
|
ImGui::BeginDisabled(reloading);
|
2021-12-07 22:47:41 +01:00
|
|
|
if (ImGui::Button("hex.builtin.view.store.reload"_lang)) {
|
2021-09-03 02:34:40 +02:00
|
|
|
this->refresh();
|
|
|
|
}
|
2023-03-23 13:32:47 +01:00
|
|
|
ImGui::EndDisabled();
|
|
|
|
|
|
|
|
if (reloading) {
|
|
|
|
ImGui::SameLine();
|
|
|
|
ImGui::TextSpinner("hex.builtin.view.store.loading"_lang);
|
|
|
|
}
|
|
|
|
|
2023-07-11 09:19:52 +02:00
|
|
|
// Align the button to the right
|
|
|
|
ImGui::SameLine(ImGui::GetWindowWidth() - ImGui::GetCursorPosX() - 25_scaled);
|
|
|
|
ImGui::BeginDisabled(this->m_updateAllTask.isRunning() || this->m_updateCount == 0);
|
|
|
|
if (ImGui::IconButton(ICON_VS_CLOUD_DOWNLOAD, ImGui::GetStyleColorVec4(ImGuiCol_Text))) {
|
|
|
|
this->m_updateAllTask = TaskManager::createTask("Update All...", this->m_updateCount, [this](auto &task) {
|
|
|
|
u32 progress = 0;
|
|
|
|
for (auto &category : this->m_categories) {
|
|
|
|
for (auto &entry : category.entries) {
|
|
|
|
if (entry.hasUpdate) {
|
|
|
|
entry.downloading = this->download(category.path, entry.fileName, entry.link, true);
|
|
|
|
this->m_download.wait();
|
|
|
|
this->handleDownloadFinished(category, entry);
|
|
|
|
task.update(progress);
|
2021-09-03 02:34:40 +02:00
|
|
|
}
|
|
|
|
}
|
2021-08-29 11:10:48 +02:00
|
|
|
}
|
2023-03-23 20:35:16 +01:00
|
|
|
});
|
2023-07-11 09:19:52 +02:00
|
|
|
}
|
|
|
|
ImGui::InfoTooltip(hex::format("hex.builtin.view.store.update_count"_lang, this->m_updateCount.load()).c_str());
|
2023-03-23 20:35:16 +01:00
|
|
|
|
2023-07-11 09:19:52 +02:00
|
|
|
ImGui::EndDisabled();
|
|
|
|
|
|
|
|
if (ImGui::BeginTabBar("storeTabs")) {
|
|
|
|
for (auto &category : this->m_categories) {
|
|
|
|
this->drawTab(category);
|
|
|
|
}
|
2021-09-03 02:34:40 +02:00
|
|
|
|
|
|
|
ImGui::EndTabBar();
|
2021-08-29 11:10:48 +02:00
|
|
|
}
|
2023-07-11 09:19:52 +02:00
|
|
|
|
2021-08-29 11:10:48 +02:00
|
|
|
}
|
|
|
|
|
2021-09-03 02:34:40 +02:00
|
|
|
void ViewStore::refresh() {
|
2023-10-04 12:00:32 +02:00
|
|
|
// Do not refresh if a refresh is already in progress
|
2022-10-27 13:12:24 +02:00
|
|
|
if (this->m_requestStatus == RequestStatus::InProgress)
|
|
|
|
return;
|
|
|
|
this->m_requestStatus = RequestStatus::InProgress;
|
|
|
|
|
2023-07-11 09:19:52 +02:00
|
|
|
for (auto &category : this->m_categories) {
|
|
|
|
category.entries.clear();
|
|
|
|
}
|
2021-09-03 02:34:40 +02:00
|
|
|
|
2023-03-23 11:23:07 +01:00
|
|
|
this->m_httpRequest.setUrl(ImHexApiURL + "/store"s);
|
|
|
|
this->m_apiRequest = this->m_httpRequest.execute();
|
2021-09-03 02:34:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ViewStore::parseResponse() {
|
|
|
|
auto response = this->m_apiRequest.get();
|
2023-03-23 11:23:07 +01:00
|
|
|
this->m_requestStatus = response.isSuccess() ? RequestStatus::Succeeded : RequestStatus::Failed;
|
2023-02-16 18:55:21 +01:00
|
|
|
if (this->m_requestStatus == RequestStatus::Succeeded) {
|
2023-03-23 11:23:07 +01:00
|
|
|
auto json = nlohmann::json::parse(response.getData());
|
2021-09-03 02:34:40 +02:00
|
|
|
|
2023-07-11 09:19:52 +02:00
|
|
|
auto parseStoreEntries = [](auto storeJson, StoreCategory &category) {
|
2021-09-03 02:34:40 +02:00
|
|
|
// Check if the response handles the type of files
|
2023-07-11 09:19:52 +02:00
|
|
|
if (storeJson.contains(category.requestName)) {
|
2021-09-03 02:34:40 +02:00
|
|
|
|
2023-07-11 09:19:52 +02:00
|
|
|
for (auto &entry : storeJson[category.requestName]) {
|
2021-09-03 02:34:40 +02:00
|
|
|
|
|
|
|
// Check if entry is valid
|
2023-09-02 18:36:34 +02:00
|
|
|
if (entry.contains("name") && entry.contains("desc") && entry.contains("authors") && entry.contains("file") && entry.contains("url") && entry.contains("hash") && entry.contains("folder")) {
|
2021-09-03 02:34:40 +02:00
|
|
|
|
|
|
|
// Parse entry
|
2023-09-02 18:36:34 +02:00
|
|
|
StoreEntry storeEntry = { entry["name"], entry["desc"], entry["authors"], entry["file"], entry["url"], entry["hash"], entry["folder"], false, false, false };
|
2021-09-03 02:34:40 +02:00
|
|
|
|
|
|
|
// Check if file is installed already or has an update available
|
2023-07-11 09:19:52 +02:00
|
|
|
for (const auto &folder : fs::getDefaultPaths(category.path)) {
|
2021-09-03 02:34:40 +02:00
|
|
|
|
2022-03-04 11:36:37 +01:00
|
|
|
auto path = folder / std::fs::path(storeEntry.fileName);
|
2021-09-03 02:34:40 +02:00
|
|
|
|
2023-03-12 18:27:29 +01:00
|
|
|
if (wolv::io::fs::exists(path) && fs::isPathWritable(folder)) {
|
2021-09-03 02:34:40 +02:00
|
|
|
storeEntry.installed = true;
|
2021-08-29 11:10:48 +02:00
|
|
|
|
2023-03-23 11:23:07 +01:00
|
|
|
wolv::io::File file(path, wolv::io::File::Mode::Read);
|
|
|
|
auto bytes = file.readVector();
|
2021-09-03 02:34:40 +02:00
|
|
|
|
2023-03-23 11:23:07 +01:00
|
|
|
auto fileHash = crypt::sha256(bytes);
|
2021-09-03 02:34:40 +02:00
|
|
|
|
|
|
|
// Compare installed file hash with hash of repo file
|
|
|
|
if (std::vector(fileHash.begin(), fileHash.end()) != crypt::decode16(storeEntry.hash))
|
|
|
|
storeEntry.hasUpdate = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-11 09:19:52 +02:00
|
|
|
category.entries.push_back(storeEntry);
|
2021-09-03 02:34:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2023-03-23 13:32:47 +01:00
|
|
|
|
2023-07-11 09:19:52 +02:00
|
|
|
std::sort(category.entries.begin(), category.entries.end(), [](const auto &lhs, const auto &rhs) {
|
2023-03-23 13:32:47 +01:00
|
|
|
return lhs.name < rhs.name;
|
|
|
|
});
|
2021-09-03 02:34:40 +02:00
|
|
|
};
|
|
|
|
|
2023-07-11 09:19:52 +02:00
|
|
|
for (auto &category : this->m_categories) {
|
|
|
|
parseStoreEntries(json, category);
|
|
|
|
}
|
|
|
|
|
|
|
|
this->m_updateCount = 0;
|
|
|
|
for (auto &category : this->m_categories) {
|
|
|
|
for (auto &entry : category.entries) {
|
|
|
|
if (entry.hasUpdate)
|
|
|
|
this->m_updateCount += 1;
|
|
|
|
}
|
|
|
|
}
|
2021-09-03 02:34:40 +02:00
|
|
|
}
|
2022-01-24 20:53:17 +01:00
|
|
|
this->m_apiRequest = {};
|
2021-09-03 02:34:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void ViewStore::drawContent() {
|
2022-02-21 18:57:53 +01:00
|
|
|
if (ImGui::BeginPopupModal(View::toWindowName("hex.builtin.view.store.name").c_str(), &this->getWindowOpenState())) {
|
2022-10-27 13:12:24 +02:00
|
|
|
if (this->m_requestStatus == RequestStatus::Failed)
|
|
|
|
ImGui::TextFormattedColored(ImGui::GetCustomColorVec4(ImGuiCustomCol_ToolbarRed), "hex.builtin.view.store.netfailed"_lang);
|
|
|
|
|
|
|
|
this->drawStore();
|
2021-09-03 02:34:40 +02:00
|
|
|
|
|
|
|
ImGui::EndPopup();
|
|
|
|
} else {
|
|
|
|
this->getWindowOpenState() = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-03-04 11:36:37 +01:00
|
|
|
bool ViewStore::download(fs::ImHexPath pathType, const std::string &fileName, const std::string &url, bool update) {
|
2022-01-23 21:52:24 +01:00
|
|
|
bool downloading = false;
|
2023-09-02 17:51:21 +02:00
|
|
|
for (const auto &folderPath : fs::getDefaultPaths(pathType)) {
|
|
|
|
if (!fs::isPathWritable(folderPath))
|
2022-02-28 23:10:04 +01:00
|
|
|
continue;
|
|
|
|
|
2023-10-04 12:00:32 +02:00
|
|
|
// Verify that we write the file to the right folder
|
2023-09-02 17:51:21 +02:00
|
|
|
// this is to prevent the filename from having elements like ../
|
|
|
|
auto fullPath = std::fs::weakly_canonical(folderPath / std::fs::path(fileName));
|
|
|
|
auto [folderIter, pathIter] = std::mismatch(folderPath.begin(), folderPath.end(), fullPath.begin());
|
|
|
|
if(folderIter != folderPath.end()) {
|
|
|
|
log::warn("The destination file name '{}' is invalid", fileName);
|
|
|
|
return false;
|
|
|
|
}
|
2022-02-28 23:10:04 +01:00
|
|
|
|
2023-03-12 18:27:29 +01:00
|
|
|
if (!update || wolv::io::fs::exists(fullPath)) {
|
2022-02-01 22:09:44 +01:00
|
|
|
downloading = true;
|
2022-01-23 21:52:24 +01:00
|
|
|
this->m_downloadPath = fullPath;
|
2023-03-23 11:23:07 +01:00
|
|
|
|
|
|
|
this->m_httpRequest.setUrl(url);
|
|
|
|
this->m_download = this->m_httpRequest.downloadFile(fullPath);
|
2022-01-23 21:52:24 +01:00
|
|
|
break;
|
2021-09-03 02:34:40 +02:00
|
|
|
}
|
|
|
|
}
|
2022-01-23 21:52:24 +01:00
|
|
|
|
|
|
|
if (!downloading) {
|
2023-04-08 11:58:12 +02:00
|
|
|
PopupError::open("hex.builtin.view.store.download_error"_lang);
|
2022-01-23 21:52:24 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2021-09-03 02:34:40 +02:00
|
|
|
}
|
2022-01-24 20:53:17 +01:00
|
|
|
|
2022-03-04 11:36:37 +01:00
|
|
|
bool ViewStore::remove(fs::ImHexPath pathType, const std::string &fileName) {
|
2022-06-16 15:42:08 +02:00
|
|
|
bool removed = true;
|
2022-03-04 11:36:37 +01:00
|
|
|
for (const auto &path : fs::getDefaultPaths(pathType)) {
|
2022-06-16 15:42:08 +02:00
|
|
|
const auto filePath = path / fileName;
|
|
|
|
const auto folderPath = (path / std::fs::path(fileName).stem());
|
2022-01-23 21:52:24 +01:00
|
|
|
|
2023-03-12 18:27:29 +01:00
|
|
|
wolv::io::fs::remove(filePath);
|
|
|
|
wolv::io::fs::removeAll(folderPath);
|
2022-06-16 15:42:08 +02:00
|
|
|
|
2023-03-12 18:27:29 +01:00
|
|
|
removed = removed && !wolv::io::fs::exists(filePath) && !wolv::io::fs::exists(folderPath);
|
2023-04-06 17:36:28 +02:00
|
|
|
EventManager::post<EventStoreContentRemoved>(filePath);
|
2021-10-17 22:23:01 +02:00
|
|
|
}
|
2022-01-23 21:52:24 +01:00
|
|
|
|
|
|
|
return removed;
|
2021-08-29 11:10:48 +02:00
|
|
|
}
|
|
|
|
|
2023-07-11 09:19:52 +02:00
|
|
|
void ViewStore::addCategory(const std::string &unlocalizedName, const std::string &requestName, fs::ImHexPath path, std::function<void()> downloadCallback) {
|
|
|
|
this->m_categories.push_back({ unlocalizedName, requestName, path, { }, std::move(downloadCallback) });
|
|
|
|
}
|
|
|
|
|
|
|
|
void ViewStore::handleDownloadFinished(const StoreCategory &category, StoreEntry &entry) {
|
|
|
|
entry.downloading = false;
|
|
|
|
|
|
|
|
auto response = this->m_download.get();
|
|
|
|
if (response.isSuccess()) {
|
|
|
|
if (entry.hasUpdate)
|
|
|
|
this->m_updateCount -= 1;
|
|
|
|
|
|
|
|
entry.installed = true;
|
|
|
|
entry.hasUpdate = false;
|
|
|
|
|
|
|
|
if (entry.isFolder) {
|
|
|
|
Tar tar(this->m_downloadPath, Tar::Mode::Read);
|
|
|
|
tar.extractAll(this->m_downloadPath.parent_path() / this->m_downloadPath.stem());
|
|
|
|
EventManager::post<EventStoreContentDownloaded>(this->m_downloadPath.parent_path() / this->m_downloadPath.stem());
|
|
|
|
} else {
|
|
|
|
EventManager::post<EventStoreContentDownloaded>(this->m_downloadPath);
|
|
|
|
}
|
|
|
|
|
|
|
|
category.downloadCallback();
|
|
|
|
} else
|
|
|
|
log::error("Download failed! HTTP Code {}", response.getStatusCode());
|
|
|
|
|
|
|
|
|
|
|
|
this->m_download = {};
|
|
|
|
}
|
|
|
|
|
2021-08-29 11:10:48 +02:00
|
|
|
}
|