diff --git a/.gitmodules b/.gitmodules index cc92494..cdb20ba 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,9 +4,6 @@ [submodule "build/3rdparty/jwt-cpp"] path = build/3rdparty/jwt-cpp url = https://github.com/Thalhammer/jwt-cpp -[submodule "3rdparty/jwt-cpp"] - path = 3rdparty/jwt-cpp - url = https://github.com/Thalhammer/jwt-cpp [submodule "3rdparty/ormpp"] path = 3rdparty/ormpp url = https://github.com/qicosmos/ormpp diff --git a/3rdparty/jwt-cpp b/3rdparty/jwt-cpp deleted file mode 160000 index 65b632b..0000000 --- a/3rdparty/jwt-cpp +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 65b632b674da7fcc189adf7336c652108188aa29 diff --git a/CMakeLists.txt b/CMakeLists.txt index 33a8506..e738439 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,19 +90,11 @@ set (BCRYPTLIB ${CMAKE_SOURCE_DIR}/3rdparty/libbcrypt ) -set(JWT_CPP_INCLUDE - ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/jwt-cpp/include -) - - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() #find_library(BCRYPT bcrypt ${BCRYPTLIB}) -include_directories(include ${CPR_INCLUDE_DIRS} ${BCRYPTLIB}) +include_directories(include ${BCRYPTLIB}) -add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/cpr) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/oatpp) add_library(bcrypt STATIC IMPORTED) @@ -117,7 +109,13 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/database.json ${CMAKE_BINARY_DIR}/bin configure_file(${CMAKE_CURRENT_SOURCE_DIR}/paths.json ${CMAKE_BINARY_DIR}/bin/paths.json COPYONLY) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Images/Stock/CoverArt.png ${CMAKE_BINARY_DIR}/bin/CoverArt.png COPYONLY) +find_path(JWT_CPP_INCLUDE_DIRS "jwt-cpp/base.h") + +find_package(nlohmann_json CONFIG REQUIRED) +find_package(cpr CONFIG REQUIRED) + add_executable(icarus ${SOURCES} ${HEADERS}) -target_include_directories(icarus PUBLIC ${JWT_CPP_INCLUDE}) -target_link_libraries(icarus "-lstdc++fs" oatpp tag mysqlclient ${CONAN_LIBS} ${CPR_LIBRARIES} bcrypt) + +target_include_directories(icarus PRIVATE ${JWT_CPP_INCLUDE_DIRS}) +target_link_libraries(icarus PRIVATE "-lstdc++fs" oatpp tag mysqlclient nlohmann_json nlohmann_json::nlohmann_json cpr bcrypt) diff --git a/README.md b/README.md index d2b848f..6b1e88c 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ One can interface with Icarus the music server either by: * [cpr](https://www.github.com/whoshuu/cpr) * [TagLib](https://github.com/taglib/taglib) * [jwt-cpp](https://github.com/Thalhammer/jwt-cpp) +* libmysql * [libbcrypt](https://github.com/rg3/libbcrypt) * [oatpp](https://github.com/oatpp/oatpp) @@ -149,14 +150,19 @@ From this point the database has been successfully created. Metadata and song fi ## Building and Running ``` git clone --recursive https://github.com/kdeng00/icarus -cd 3rdparty/libbcrypt/ + +cd icarus/3rdparty/vcpkg +./bootstrap-vcpkg.sh +./vcpkg install nlohmann-json cpr taglib jwt-cpp + +cd ../3rdparty/libbcrypt/ make + cd ../.. mkdir build cd build -conan install .. cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DUSE_SYSTEM_CURL=ON -DBUILD_CPR_TESTS=OFF -DOATPP_BUILD_TESTS=OFF -make +cmake --build . bin/icarus ``` Runs the server on localhost port 5002 diff --git a/conanfile.txt b/conanfile.txt deleted file mode 100644 index 579327d..0000000 --- a/conanfile.txt +++ /dev/null @@ -1,5 +0,0 @@ -[requires] -jsonformoderncpp/3.7.3@vthiery/stable - -[generators] -cmake diff --git a/src/manager/TokenManager.cpp b/src/manager/TokenManager.cpp index bff3121..e56ea78 100644 --- a/src/manager/TokenManager.cpp +++ b/src/manager/TokenManager.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include @@ -11,8 +10,6 @@ #include "manager/DirectoryManager.h" -namespace fs = std::filesystem; - namespace manager { model::Token TokenManager::retrieveToken(const model::BinaryPath& bConf) { auto cred = parseAuthCredentials(bConf); @@ -93,7 +90,9 @@ namespace manager { cpr::Response TokenManager::sendRequest(std::string_view uri, nlohmann::json& obj) { - auto resp = cpr::Post(cpr::Url{uri}, cpr::Body{obj.dump()}, + const std::string uriString(uri.begin(), uri.end()); + + auto resp = cpr::Post(cpr::Url(uriString), cpr::Body{obj.dump()}, cpr::Header{{"Content-type", "application/json"}, {"Connection", "keep-alive"}});