summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/settings.h1
-rw-r--r--src/core/telemetry_session.cpp12
-rw-r--r--src/core/telemetry_session.h10
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 {
133 // WebService 133 // WebService
134 bool enable_telemetry; 134 bool enable_telemetry;
135 std::string telemetry_endpoint_url; 135 std::string telemetry_endpoint_url;
136 std::string verify_endpoint_url;
136 std::string citra_username; 137 std::string citra_username;
137 std::string citra_token; 138 std::string citra_token;
138} extern values; 139} 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 @@
15 15
16#ifdef ENABLE_WEB_SERVICE 16#ifdef ENABLE_WEB_SERVICE
17#include "web_service/telemetry_json.h" 17#include "web_service/telemetry_json.h"
18#include "web_service/verify_login.h"
18#endif 19#endif
19 20
20namespace Core { 21namespace Core {
@@ -75,6 +76,17 @@ u64 RegenerateTelemetryId() {
75 return new_telemetry_id; 76 return new_telemetry_id;
76} 77}
77 78
79std::future<bool> VerifyLogin(std::string username, std::string token, std::function<void()> func) {
80#ifdef ENABLE_WEB_SERVICE
81 return WebService::VerifyLogin(username, token, Settings::values.verify_endpoint_url, func);
82#else
83 return std::async(std::launch::async, [func{std::move(func)}]() {
84 func();
85 return false;
86 });
87#endif
88}
89
78TelemetrySession::TelemetrySession() { 90TelemetrySession::TelemetrySession() {
79#ifdef ENABLE_WEB_SERVICE 91#ifdef ENABLE_WEB_SERVICE
80 if (Settings::values.enable_telemetry) { 92 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 @@
4 4
5#pragma once 5#pragma once
6 6
7#include <future>
7#include <memory> 8#include <memory>
8#include "common/telemetry.h" 9#include "common/telemetry.h"
9 10
@@ -47,4 +48,13 @@ u64 GetTelemetryId();
47 */ 48 */
48u64 RegenerateTelemetryId(); 49u64 RegenerateTelemetryId();
49 50
51/**
52 * Verifies the username and token.
53 * @param username Citra username to use for authentication.
54 * @param token Citra token to use for authentication.
55 * @param func A function that gets exectued when the verification is finished
56 * @returns Future with bool indicating whether the verification succeeded
57 */
58std::future<bool> VerifyLogin(std::string username, std::string token, std::function<void()> func);
59
50} // namespace Core 60} // namespace Core