diff options
author | B3n30 <bene_thomas@web.de> | 2017-09-19 03:18:26 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2017-09-19 03:18:26 +0200 |
commit | 28c726f20545744a3052a3e8a0a3bf5ff95a5042 (patch) | |
tree | 496b81a9d2cefbdb3ac2ed12c6525ecd72610c14 /src/core | |
parent | Merge pull request #2906 from Subv/ns_new_framework (diff) | |
download | yuzu-28c726f20545744a3052a3e8a0a3bf5ff95a5042.tar yuzu-28c726f20545744a3052a3e8a0a3bf5ff95a5042.tar.gz yuzu-28c726f20545744a3052a3e8a0a3bf5ff95a5042.tar.bz2 yuzu-28c726f20545744a3052a3e8a0a3bf5ff95a5042.tar.lz yuzu-28c726f20545744a3052a3e8a0a3bf5ff95a5042.tar.xz yuzu-28c726f20545744a3052a3e8a0a3bf5ff95a5042.tar.zst yuzu-28c726f20545744a3052a3e8a0a3bf5ff95a5042.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/settings.h | 1 | ||||
-rw-r--r-- | src/core/telemetry_session.cpp | 12 | ||||
-rw-r--r-- | src/core/telemetry_session.h | 10 |
3 files changed, 23 insertions, 0 deletions
diff --git a/src/core/settings.h b/src/core/settings.h index 024f14666..8d78cb424 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -133,6 +133,7 @@ struct Values { // WebService bool enable_telemetry; std::string telemetry_endpoint_url; + std::string verify_endpoint_url; std::string citra_username; std::string citra_token; } extern values; diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp index 104a16cc9..ca517ff44 100644 --- a/src/core/telemetry_session.cpp +++ b/src/core/telemetry_session.cpp @@ -15,6 +15,7 @@ #ifdef ENABLE_WEB_SERVICE #include "web_service/telemetry_json.h" +#include "web_service/verify_login.h" #endif namespace Core { @@ -75,6 +76,17 @@ u64 RegenerateTelemetryId() { return new_telemetry_id; } +std::future<bool> VerifyLogin(std::string username, std::string token, std::function<void()> func) { +#ifdef ENABLE_WEB_SERVICE + return WebService::VerifyLogin(username, token, Settings::values.verify_endpoint_url, func); +#else + return std::async(std::launch::async, [func{std::move(func)}]() { + func(); + return false; + }); +#endif +} + TelemetrySession::TelemetrySession() { #ifdef ENABLE_WEB_SERVICE if (Settings::values.enable_telemetry) { diff --git a/src/core/telemetry_session.h b/src/core/telemetry_session.h index 65613daae..550c6ea2d 100644 --- a/src/core/telemetry_session.h +++ b/src/core/telemetry_session.h @@ -4,6 +4,7 @@ #pragma once +#include <future> #include <memory> #include "common/telemetry.h" @@ -47,4 +48,13 @@ u64 GetTelemetryId(); */ u64 RegenerateTelemetryId(); +/** + * Verifies the username and token. + * @param username Citra username to use for authentication. + * @param token Citra token to use for authentication. + * @param func A function that gets exectued when the verification is finished + * @returns Future with bool indicating whether the verification succeeded + */ +std::future<bool> VerifyLogin(std::string username, std::string token, std::function<void()> func); + } // namespace Core |