diff --git a/src/aria2.cpp b/src/aria2.cpp index 2bc163d83..1ee015ff4 100644 --- a/src/aria2.cpp +++ b/src/aria2.cpp @@ -3,12 +3,14 @@ #include "aria2.h" #include "xmlrpc.h" #include +#include #include #include #include #include "tools.h" #include "tools/pathTools.h" #include "tools/stringTools.h" +#include "tools/otherTools.h" #include "downloader.h" // For AriaError #ifdef _WIN32 @@ -30,7 +32,7 @@ namespace kiwix { Aria2::Aria2(): mp_aria(nullptr), m_port(42042), - m_secret("kiwixariarpc"), + m_secret(getNewRpcSecret()), m_curlErrorBuffer(new char[CURL_ERROR_SIZE]), mp_curl(nullptr) { @@ -195,6 +197,13 @@ std::string Aria2::tellStatus(const std::string& gid, const std::vector Aria2::tellActive() { MethodCall methodCall("aria2.tellActive", m_secret); diff --git a/src/aria2.h b/src/aria2.h index b07018f00..47a3f826a 100644 --- a/src/aria2.h +++ b/src/aria2.h @@ -37,6 +37,7 @@ class Aria2 std::string addUri(const std::vector& uri, const std::vector>& options = {}); std::string tellStatus(const std::string& gid, const std::vector& statusKey); + static std::string getNewRpcSecret(); std::vector tellActive(); std::vector tellWaiting(); void saveSession();