summaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
Diffstat (limited to 'game')
-rw-r--r--game/core.rpy1
-rw-r--r--game/renpy.rpy3
-rw-r--r--game/update.rpy35
3 files changed, 28 insertions, 11 deletions
diff --git a/game/core.rpy b/game/core.rpy
index 292c664..b1ee630 100644
--- a/game/core.rpy
+++ b/game/core.rpy
@@ -30,6 +30,7 @@ init -3 python:
persistent.release_name = "Core"
HOST_LIST = ["https://tmw2.org/launcher", "http://localhost/launcher"]
#, "themanaworld.org", "germantmw.de", "moubootaurlegends.org"]
+ VAULT_HOST = "http://localhost:13370"
#############################################################################
# Smart Print command
diff --git a/game/renpy.rpy b/game/renpy.rpy
index f827855..8568a90 100644
--- a/game/renpy.rpy
+++ b/game/renpy.rpy
@@ -55,8 +55,7 @@ label start:
pause 1.5
hide TMW2 with dissolve
centered "Error"
- #steam.get_account_id()
- "User ID: [accId]"
+ "User ID: [vaultId]"
return
diff --git a/game/update.rpy b/game/update.rpy
index b50af4c..912ef7d 100644
--- a/game/update.rpy
+++ b/game/update.rpy
@@ -79,7 +79,7 @@ init python:
#############################################################################
def CONFIGURE_LAUNCHER():
- global progress, statusmsg, responsive, accId
+ global progress, statusmsg, responsive, has_steam, vaultId, vaultToken
statusmsg="Loading user configuration..."
#########################################################################
# If persistent data is not yet set, it must be created
@@ -166,21 +166,38 @@ init python:
status_update("Attempting Steam authentication...", 81)
accId = steam.get_account_id()
stdout("Steam login active, user %d" % accId)
+ steam.cancel_ticket()
token = steam.get_session_ticket()
- auth = {"accId": accId, "token": token}
+ # The token is a bytearray but we want a string, so we convert it
+ print(base64.b64encode(token))
+ auth = {"accId": accId, "token": base64.b64encode(token)}
+ time.sleep(1.0)
status_update("Waiting for Vault reply...", 85)
- # Erm.
- time.sleep(2.0)
- steam.cancel_ticket()
- # r.post
- # Get reply
+
+ ## Request the Vault for the ticket validation
+ r = requests.post(VAULT_HOST+"/steam_auth", json=auth, timeout=15.0)
+ if (r.status_code != 200):
+ steam.cancel_ticket()
+ raise Exception("Vault returned code %d" % r.status_code)
+
# Receive the Vault Token
+ stdout("Steam result: [%d] %s" % str(r.status_code, r.text))
+ auth2 = json.loads(r.text)
+ vaultId = auth2["accId"]
+ vaultToken = auth2["token"]
+
+ # If everything went well, inform Steam support is ON
+ # Enable all Steam features and skip Vault-only auth
has_steam = True
stdout("Steam session initialized successfully", True)
+ status_update("Steam session initialized successfully", 99)
+ time.sleep(0.1)
except:
traceback.print_exc()
- accId = 0
- status_update("Steam login disabled, trying Vault...", 90)
+ status_update("Steam auth failed, trying Vault...", 90)
+ time.sleep(1.0)
+ vaultId = 0
+ vaultToken = "ERROR"
status_update("Complete!", 100)