mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Send steam auth ticket on game start
This commit is contained in:
parent
cc835312f4
commit
6b0fecb4af
@ -126,7 +126,23 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface {
|
||||
if (error === FILE_NOT_FOUND) {
|
||||
logger.log("Retrieving new player key");
|
||||
|
||||
let authTicket = Promise.resolve(undefined);
|
||||
|
||||
if (G_IS_STANDALONE && !G_IS_STEAM_DEMO) {
|
||||
logger.log("Will send auth ticket");
|
||||
authTicket = Promise.all([
|
||||
ipcRenderer.invoke("steam:get-ticket"),
|
||||
new Promise((resolve, reject) => setTimeout(reject, 15000)),
|
||||
]);
|
||||
}
|
||||
|
||||
authTicket
|
||||
.catch(err => {
|
||||
logger.warn("Failed to get steam auth ticket for register:", err);
|
||||
})
|
||||
.then(
|
||||
// Perform call to get a new key from the API
|
||||
ticket =>
|
||||
this.sendToApi("/v1/register", {
|
||||
environment: this.environment,
|
||||
standalone:
|
||||
@ -134,7 +150,9 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface {
|
||||
!G_IS_STEAM_DEMO &&
|
||||
this.app.achievementProvider instanceof SteamAchievementProvider,
|
||||
commit: G_BUILD_COMMIT_HASH,
|
||||
ticket,
|
||||
})
|
||||
)
|
||||
.then(res => {
|
||||
// Try to read and parse the key from the api
|
||||
if (res.key && typeof res.key === "string" && res.key.length === 40) {
|
||||
|
Loading…
Reference in New Issue
Block a user