getting rid of CPR

This commit is contained in:
leca 2024-09-03 20:55:58 +03:00
parent 7866d0cc27
commit 4c5b956fa5
3 changed files with 15 additions and 14 deletions

View File

@ -80,11 +80,11 @@ if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(checks-parser) qt_finalize_executable(checks-parser)
endif() endif()
include(FetchContent) # include(FetchContent)
FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/libcpr/cpr.git # FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/libcpr/cpr.git
GIT_TAG 3b15fa82ea74739b574d705fea44959b58142eb8) # GIT_TAG 3b15fa82ea74739b574d705fea44959b58142eb8)
FetchContent_MakeAvailable(cpr) # FetchContent_MakeAvailable(cpr)
target_link_libraries(checks-parser PRIVATE cpr::cpr) # target_link_libraries(checks-parser PRIVATE cpr::cpr)
find_package(PkgConfig REQUIRED) find_package(PkgConfig REQUIRED)

3
TODO
View File

@ -7,4 +7,5 @@ Complete module "image-to-text":
Add features: Add features:
autodetect store type autodetect store type
auto download of stores modules auto download of stores modules
Refactor:
Get rid of CPR, use libcurl instead

View File

@ -1,7 +1,6 @@
#include "ofd.h" #include "ofd.h"
#include "../settings.h" #include "../settings.h"
#include "../utils/utils.h" #include "../utils/utils.h"
#include <cpr/cpr.h>
#include <filesystem> #include <filesystem>
#include <iostream> #include <iostream>
#include <string> #include <string>
@ -68,12 +67,13 @@ std::string OFD::get_check_data(std::string fn, std::string fd,
-H 'sec-ch-ua-mobile: ?0' \ -H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "Linux"' -H 'sec-ch-ua-platform: "Linux"'
// cpr::Response r = cpr::Get(cpr::Url{"https://httpbin.org/get"}); // // cpr::Response r = cpr::Get(cpr::Url{"https://httpbin.org/get"});
std::cout << fn << " " << fd << " " << fp << std::endl; // std::cout << fn << " " << fd << " " << fp << std::endl;
cpr::Response r = // cpr::Response r =
//to_utf8(module.get_url()) // //to_utf8(module.get_url())
cpr::Get(cpr::Url{"https://ofd.beeline.ru/api/ofdcheck/checkf"}, // cpr::Get(cpr::Url{"https://ofd.beeline.ru/api/ofdcheck/checkf"},
cpr::Parameters{{"fn", fn}, {"fd", fd}, {"fp", fp}, {"format", "4"}}); // cpr::Parameters{{"fn", fn}, {"fd", fd}, {"fp", fp}, {"format", "4"}});
return r.text; // return r.text;
return "";
} }