download modules

This commit is contained in:
2025-03-26 20:08:44 +03:00
parent 3b26dbc29d
commit 7a52905cff
10 changed files with 48 additions and 16 deletions

View File

@@ -21,6 +21,9 @@
#include <QWidget>
#include <fstream>
#include <boost/regex.hpp>
#include <net/net.h>
#include <parser/parser.h>
#include <settings/settings.h>
#ifdef BUILD_OFD_BINARYEYE_SCAN
@@ -307,3 +310,25 @@ void generate_qr_code(std::string data) {
}
#endif // ifdef BUILD_OFD_BINARYEYE_SCAN
void fetch_and_download_modules() {
Net n;
Parser p;
std::string settings_file_path = get_path_relative_to_home(".local/share/checks_parser/settings.json");
Settings s(settings_file_path);
std::vector<std::string> storesUpdates = p.check_updates();
for (auto &update : storesUpdates) {
std::cout << "Downloading "
<< s.get_setting("stores_modules_url") + update << " to "
<< get_path_relative_to_home(s.get_setting("stores_modules_dir") +
"/" + update)
<< std::endl;
n.get_file(s.get_setting("stores_modules_url") + "/" + update,
get_path_relative_to_home(s.get_setting("stores_modules_dir") +
"/" + update));
}
}

View File

@@ -30,6 +30,6 @@ void generate_qr_code(std::string data);
std::string get_local_ip_address();
#endif
void fetch_and_download_modules();
#endif // UTILS_H