summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--game/defs.rpy12
-rw-r--r--game/misc.rpy1
-rw-r--r--game/screens.rpy2
-rw-r--r--game/script.rpy13
4 files changed, 19 insertions, 9 deletions
diff --git a/game/defs.rpy b/game/defs.rpy
index fed7788..30402ec 100644
--- a/game/defs.rpy
+++ b/game/defs.rpy
@@ -49,7 +49,7 @@ init -3 python:
persistent.allfiles=[]
allfiles=[]
HOST=str(persistent.host)
- PORT=10301
+ PORT=str(persistent.port)
UPDP=10302
FAILUREMSG="Request failed, Please try again"
OFFLINEMSG="401 Unauthorized"
@@ -57,6 +57,7 @@ init -3 python:
TIMEOUT_INTERVAL=3.0
MAX_IRC_BUFFER=50
SSL_IS_BROKEN=False
+ CERT_NONE=0
debug=copy.copy(config.developer)
# Error Codes
@@ -334,14 +335,15 @@ init -3 python:
############################################################################
init -1 python:
- import socket, sys, time, json
+ import socket, time, json
+ # Android might have special SSL problems
if renpy.android:
try:
- import androidssl as ssl
- except:
+ import _openssl as ssl
+ except ImportError:
SSL_IS_BROKEN=True
import ssl
- stdout("Broken Android SSL detected, FALLING BACK")
+ stdout("Android SSL misbehavior detected, trying system-wide SSL...")
else:
import ssl
print("Using system-wide SSL implementation...")
diff --git a/game/misc.rpy b/game/misc.rpy
index f8b377e..da7c95b 100644
--- a/game/misc.rpy
+++ b/game/misc.rpy
@@ -208,6 +208,7 @@ label clear_all:
# Update host and delete password
HOST=persistent.host
+ PORT=persistent.port
renpy.notify("Deleting password: %s" % persistent.password)
persistent.password=None
diff --git a/game/screens.rpy b/game/screens.rpy
index 086ebfa..d168304 100644
--- a/game/screens.rpy
+++ b/game/screens.rpy
@@ -784,10 +784,12 @@ screen preferences():
textbutton _("Localhost"):
action [
SetVariable("persistent.host", "localhost"),
+ SetVariable("persistent.port", "61000"),
Jump("clear_all")]
textbutton _("TMW2"):
action [
SetVariable("persistent.host", "spheres.tmw2.org"),
+ SetVariable("persistent.port", "61000"),
Jump("clear_all")]
vbox:
style_prefix "check"
diff --git a/game/script.rpy b/game/script.rpy
index e33e082..80d369a 100644
--- a/game/script.rpy
+++ b/game/script.rpy
@@ -99,12 +99,17 @@ label start:
# on_open=None, on_message=None, on_error=None,
# on_close=None, on_ping=None, on_pong=None,
# on_data=None):
- ws = wsock.WebSocketApp("wss://"+HOST+":61000",
- on_data=ondata, on_error=onerror, on_open=onopen,
- on_message=onmsg)
+ if (persistent.ssl_enabled):
+ ws = wsock.WebSocketApp("wss://"+HOST+":61000",
+ on_data=ondata, on_error=onerror, on_open=onopen,
+ on_message=onmsg)
+ else:
+ ws = wsock.WebSocketApp("ws://"+HOST+":61000",
+ on_data=ondata, on_error=onerror, on_open=onopen,
+ on_message=onmsg)
print repr(ws)
ws.on_open = onopen
- renpy.invoke_in_thread(ws.run_forever, sslopt={"cert_reqs": ssl.CERT_NONE})
+ renpy.invoke_in_thread(ws.run_forever, sslopt={"cert_reqs": CERT_NONE})
#ws.connect("wss://localhost:61000")
while not tr_load: