Skip to content

Commit

Permalink
#37 use conan libcurl and custom cacert.pem
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanJakobo committed Jan 14, 2024
1 parent 68d8a2e commit 31ba2ba
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CMAKE_MINIMUM_REQUIRED (VERSION 3.27.5)
PROJECT (Pocketbook-Nextcloud VERSION 1.10)

find_package(CURL REQUIRED)

add_compile_options(-std=c++17)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
Expand Down Expand Up @@ -69,7 +70,7 @@ add_executable(Nextcloud.app ${SOURCES})

target_compile_options(Nextcloud.app PRIVATE -Wall -Wextra -Wpedantic -Werror -pedantic -pedantic -Wall -Wextra -Wcast-align -Wcast-qual -Wctor-dtor-privacy -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-declarations -Wmissing-include-dirs -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wsign-conversion -Wsign-promo -Wstrict-overflow=5 -Wswitch-default -Wundef -Wno-unused)

TARGET_LINK_LIBRARIES (Nextcloud.app PRIVATE inkview freetype sqlite3 stdc++fs curl)
TARGET_LINK_LIBRARIES (Nextcloud.app PRIVATE inkview freetype sqlite3 stdc++fs CURL::libcurl)

target_compile_definitions(Nextcloud.app PRIVATE DBVERSION=2 PROGRAMVERSION="1.10")

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ Currently there are multiple methods to build the application. It is recommended
### Dockerimage
The easiest way to build applications as of now to use the Dockerimage. (https://github.com/JuanJakobo/Pocketbook-dev-docker)

conan install . --output-folder=build --build=missing -pr=pocketbook

### Setup Toolchain
First you need to install the basic build tools for linux.

Expand Down
17 changes: 17 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from conan import ConanFile
from conan.tools.cmake import cmake_layout

class CompressorRecipe(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeToolchain", "CMakeDeps"

def requirements(self):
self.requires("libcurl/8.4.0")
if self.settings.build_type == "Debug":
self.requires("gtest/1.14.0")

def build_requirements(self):
self.tool_requires("cmake/3.27.5")

def layout(self):
cmake_layout(self)
7 changes: 7 additions & 0 deletions src/api/webDAV.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ string WebDAV::propfind(const string &pathUrl)
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, Util::writeCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer);

if (iv_access(CACERT_PATH, R_OK) == 0)
curl_easy_setopt(curl, CURLOPT_CAINFO, CACERT_PATH);

if (_ignoreCert)
{
Log::writeInfoLog("Cert ignored");
Expand Down Expand Up @@ -414,6 +417,10 @@ bool WebDAV::get(WebDAVItem &item)
curl_easy_setopt(curl, CURLOPT_NOPROGRESS, false);
curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, Util::progress_callback);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);

if (iv_access(CACERT_PATH, R_OK) == 0)
curl_easy_setopt(curl, CURLOPT_CAINFO, CACERT_PATH);

if (_ignoreCert)
{
Log::writeInfoLog("Cert ignored");
Expand Down
1 change: 1 addition & 0 deletions src/api/webDAV.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ using namespace std::string_literals;

const auto NEXTCLOUD_ROOT_PATH{"/remote.php/dav/files/"s};
constexpr auto NEXTCLOUD_START_PATH{"/remote.php/"};
constexpr auto CACERT_PATH{"/mnt/ext1/applications/cacert.pem"};

class WebDAV
{
Expand Down

0 comments on commit 31ba2ba

Please sign in to comment.