summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-05-17 22:57:28 -0300
committerJesusaves <cpntb1@ymail.com>2021-05-17 22:57:28 -0300
commit5c085d5e96372fdc62c75db96b4a5dac635c121d (patch)
tree326096374152704f12a8b91e94db58eae5772b52
parentf55c8a2a8105d3458806f98cacbd83a6729a6c66 (diff)
downloadrenpy-5c085d5e96372fdc62c75db96b4a5dac635c121d.tar.gz
renpy-5c085d5e96372fdc62c75db96b4a5dac635c121d.tar.bz2
renpy-5c085d5e96372fdc62c75db96b4a5dac635c121d.tar.xz
renpy-5c085d5e96372fdc62c75db96b4a5dac635c121d.zip
Improve a bit Vault error handling, no longer allow M+ to launch without credentials
-rw-r--r--game/client.rpy24
-rw-r--r--game/renpy.rpy3
2 files changed, 24 insertions, 3 deletions
diff --git a/game/client.rpy b/game/client.rpy
index 0644e73..aece878 100644
--- a/game/client.rpy
+++ b/game/client.rpy
@@ -22,7 +22,7 @@ init 2 python:
return f
def launch_game(idx):
- global progress, responsive
+ global progress, responsive, statusmsg
########################################################################
## Setup
RPCUpdate(persistent.serverlist[idx]["Name"], persistent.serverlist[idx]["Back"])
@@ -41,17 +41,37 @@ init 2 python:
PWD=""
try:
r=vault.post(VAULT_HOST+"/world_pass", json=auth, timeout=15.0)
+ ## We got the access credentials
if r.status_code == 200:
auth2=r.json()
PWD=" -U %s -P %s" % (auth2["user"], auth2["pass"])
+ ## We were refused by Vault
elif r.status_code == 403:
stdout("Warning: Connection was refused (Vault logout?)")
+ statusmsg=_("You're not logged in.")
responsive = False
return
+ ## We are rate-limited, try again
+ elif r.status_code == 429:
+ statusmsg=_("Rate limited, we'll try again...")
+ time.sleep(15.0)
+ r=vault.post(VAULT_HOST+"/world_pass", json=auth, timeout=15.0)
+ ## Only accept OK this time
+ if r.status_code != 200:
+ stdout("Get World Auth - Returned error %d" % r.status_code)
+ raise Exception("Vault returned error %d" % r.status_code)
+ auth2=r.json()
+ PWD=" -U %s -P %s" % (auth2["user"], auth2["pass"])
+ ## Internal error, maybe?
else:
stdout("Get World Auth - Returned error code %d" % r.status_code)
+ raise Exception("Vault returned error %d" % r.status_code)
except:
- pass
+ traceback.print_exc()
+ statusmsg=_("TMW Vault Error.")
+ #time.sleep(2.5)
+ progress = 100
+ return
########################################################################
## Loop
diff --git a/game/renpy.rpy b/game/renpy.rpy
index 88df51b..2a23125 100644
--- a/game/renpy.rpy
+++ b/game/renpy.rpy
@@ -110,7 +110,8 @@ label start_loop:
scene black
# FIXME: Improve this waiting screen
# Possibly retrieve messages from the thread
- show expression Text("{color=#FFF}"+_("Game in session:\n%s" % (persistent.serverlist[_return]["Name"]))+"{/color}") at truecenter
+ $ statusmsg=""
+ show expression Text("{color=#FFF}"+_("Game in session:\n%s\n\n%s" % (persistent.serverlist[_return]["Name"], statusmsg))+"{/color}") at truecenter
with None
pause 0.01
python: