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,15 +126,33 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface {
|
|||||||
if (error === FILE_NOT_FOUND) {
|
if (error === FILE_NOT_FOUND) {
|
||||||
logger.log("Retrieving new player key");
|
logger.log("Retrieving new player key");
|
||||||
|
|
||||||
// Perform call to get a new key from the API
|
let authTicket = Promise.resolve(undefined);
|
||||||
this.sendToApi("/v1/register", {
|
|
||||||
environment: this.environment,
|
if (G_IS_STANDALONE && !G_IS_STEAM_DEMO) {
|
||||||
standalone:
|
logger.log("Will send auth ticket");
|
||||||
G_IS_STANDALONE &&
|
authTicket = Promise.all([
|
||||||
!G_IS_STEAM_DEMO &&
|
ipcRenderer.invoke("steam:get-ticket"),
|
||||||
this.app.achievementProvider instanceof SteamAchievementProvider,
|
new Promise((resolve, reject) => setTimeout(reject, 15000)),
|
||||||
commit: G_BUILD_COMMIT_HASH,
|
]);
|
||||||
})
|
}
|
||||||
|
|
||||||
|
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:
|
||||||
|
G_IS_STANDALONE &&
|
||||||
|
!G_IS_STEAM_DEMO &&
|
||||||
|
this.app.achievementProvider instanceof SteamAchievementProvider,
|
||||||
|
commit: G_BUILD_COMMIT_HASH,
|
||||||
|
ticket,
|
||||||
|
})
|
||||||
|
)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
// Try to read and parse the key from the api
|
// Try to read and parse the key from the api
|
||||||
if (res.key && typeof res.key === "string" && res.key.length === 40) {
|
if (res.key && typeof res.key === "string" && res.key.length === 40) {
|
||||||
|
Loading…
Reference in New Issue
Block a user