diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/web_service/telemetry_json.cpp | 4 | ||||
| -rw-r--r-- | src/web_service/web_backend.cpp | 20 |
2 files changed, 12 insertions, 12 deletions
diff --git a/src/web_service/telemetry_json.cpp b/src/web_service/telemetry_json.cpp index 6215c914f..46faddb61 100644 --- a/src/web_service/telemetry_json.cpp +++ b/src/web_service/telemetry_json.cpp | |||
| @@ -13,8 +13,8 @@ namespace WebService { | |||
| 13 | namespace Telemetry = Common::Telemetry; | 13 | namespace Telemetry = Common::Telemetry; |
| 14 | 14 | ||
| 15 | struct TelemetryJson::Impl { | 15 | struct TelemetryJson::Impl { |
| 16 | Impl(std::string host, std::string username, std::string token) | 16 | Impl(std::string host_, std::string username_, std::string token_) |
| 17 | : host{std::move(host)}, username{std::move(username)}, token{std::move(token)} {} | 17 | : host{std::move(host_)}, username{std::move(username_)}, token{std::move(token_)} {} |
| 18 | 18 | ||
| 19 | nlohmann::json& TopSection() { | 19 | nlohmann::json& TopSection() { |
| 20 | return sections[static_cast<u8>(Telemetry::FieldType::None)]; | 20 | return sections[static_cast<u8>(Telemetry::FieldType::None)]; |
diff --git a/src/web_service/web_backend.cpp b/src/web_service/web_backend.cpp index 58b0c2f10..dce9772fe 100644 --- a/src/web_service/web_backend.cpp +++ b/src/web_service/web_backend.cpp | |||
| @@ -30,10 +30,10 @@ constexpr std::array<const char, 1> API_VERSION{'1'}; | |||
| 30 | constexpr std::size_t TIMEOUT_SECONDS = 30; | 30 | constexpr std::size_t TIMEOUT_SECONDS = 30; |
| 31 | 31 | ||
| 32 | struct Client::Impl { | 32 | struct Client::Impl { |
| 33 | Impl(std::string host, std::string username, std::string token) | 33 | Impl(std::string host_, std::string username_, std::string token_) |
| 34 | : host{std::move(host)}, username{std::move(username)}, token{std::move(token)} { | 34 | : host{std::move(host_)}, username{std::move(username_)}, token{std::move(token_)} { |
| 35 | std::scoped_lock lock{jwt_cache.mutex}; | 35 | std::scoped_lock lock{jwt_cache.mutex}; |
| 36 | if (this->username == jwt_cache.username && this->token == jwt_cache.token) { | 36 | if (username == jwt_cache.username && token == jwt_cache.token) { |
| 37 | jwt = jwt_cache.jwt; | 37 | jwt = jwt_cache.jwt; |
| 38 | } | 38 | } |
| 39 | } | 39 | } |
| @@ -69,8 +69,8 @@ struct Client::Impl { | |||
| 69 | */ | 69 | */ |
| 70 | WebResult GenericRequest(const std::string& method, const std::string& path, | 70 | WebResult GenericRequest(const std::string& method, const std::string& path, |
| 71 | const std::string& data, const std::string& accept, | 71 | const std::string& data, const std::string& accept, |
| 72 | const std::string& jwt = "", const std::string& username = "", | 72 | const std::string& jwt_ = "", const std::string& username_ = "", |
| 73 | const std::string& token = "") { | 73 | const std::string& token_ = "") { |
| 74 | if (cli == nullptr) { | 74 | if (cli == nullptr) { |
| 75 | cli = std::make_unique<httplib::Client>(host.c_str()); | 75 | cli = std::make_unique<httplib::Client>(host.c_str()); |
| 76 | } | 76 | } |
| @@ -85,14 +85,14 @@ struct Client::Impl { | |||
| 85 | cli->set_write_timeout(TIMEOUT_SECONDS); | 85 | cli->set_write_timeout(TIMEOUT_SECONDS); |
| 86 | 86 | ||
| 87 | httplib::Headers params; | 87 | httplib::Headers params; |
| 88 | if (!jwt.empty()) { | 88 | if (!jwt_.empty()) { |
| 89 | params = { | 89 | params = { |
| 90 | {std::string("Authorization"), fmt::format("Bearer {}", jwt)}, | 90 | {std::string("Authorization"), fmt::format("Bearer {}", jwt_)}, |
| 91 | }; | 91 | }; |
| 92 | } else if (!username.empty()) { | 92 | } else if (!username_.empty()) { |
| 93 | params = { | 93 | params = { |
| 94 | {std::string("x-username"), username}, | 94 | {std::string("x-username"), username_}, |
| 95 | {std::string("x-token"), token}, | 95 | {std::string("x-token"), token_}, |
| 96 | }; | 96 | }; |
| 97 | } | 97 | } |
| 98 | 98 | ||