summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-12-13 21:44:47 -0300
committerJesusaves <cpntb1@ymail.com>2021-12-13 21:44:47 -0300
commit9e8e0d3ed6913dcda1bb4c7f41c3fe762578861a (patch)
tree5928d795c573d3a72c648d384f3cabebb101ff59
parent8a3b9ef97845ddb51940f7a51f87e8ddca363b66 (diff)
downloadrenpy-9e8e0d3ed6913dcda1bb4c7f41c3fe762578861a.tar.gz
renpy-9e8e0d3ed6913dcda1bb4c7f41c3fe762578861a.tar.bz2
renpy-9e8e0d3ed6913dcda1bb4c7f41c3fe762578861a.tar.xz
renpy-9e8e0d3ed6913dcda1bb4c7f41c3fe762578861a.zip
Remove Google Auth.
-rw-r--r--game/core.rpy8
-rw-r--r--game/python-extra/tmw/google.py80
-rw-r--r--game/screens.rpy16
-rw-r--r--game/update.rpy98
4 files changed, 24 insertions, 178 deletions
diff --git a/game/core.rpy b/game/core.rpy
index cc99da5..ebae01b 100644
--- a/game/core.rpy
+++ b/game/core.rpy
@@ -142,20 +142,12 @@ init -3 python:
persistent.discord = True
if (persistent.steam is None):
persistent.steam = False
- if (persistent.google is None):
- persistent.google = False
if (persistent.evol2cli is None):
persistent.evol2cli = "manaverse"
if (persistent.iconify is None):
persistent.iconify = ifte(renpy.windows, False, True)
#############################################################################
- ## Fail-safe
- if persistent.steam and persistent.google:
- persistent.steam = False
- persistent.google = False
-
- #############################################################################
## Conditional imports
if persistent.steam:
import _renpysteam as steam
diff --git a/game/python-extra/tmw/google.py b/game/python-extra/tmw/google.py
deleted file mode 100644
index 4722a2d..0000000
--- a/game/python-extra/tmw/google.py
+++ /dev/null
@@ -1,80 +0,0 @@
-import BaseHTTPServer, json, webbrowser, threading, time, traceback
-import urlparse as parse
-#from urllib.parse import urlparse
-
-REPLY = False
-CODE = ""
-PORT = 64004 # FIXME ask OS for a random port
-
-class GHandler(BaseHTTPServer.BaseHTTPRequestHandler):
- def _set_headers(self, code=200):
- self.send_response(code)
- self.send_header('Content-type', 'text/html; charset=UTF-8')
- self.end_headers()
-
- # We only need the GET method
- def do_GET(self):
- global REPLY, CODE
- try:
- # Snippet Source: StackOverflow/21584545
- post_data = dict(parse.parse_qsl(parse.urlsplit(self.path).query))
- # End Snippet
- # Handle data...
-
- ## Verify for consent failure
- if "error" in post_data:
- print("ERROR DETECTED")
- REPLY=True
- raise Exception("Declined")
-
- ## Validate UUID
- # assert post_data["uuid"] == UUID
- # assert post_data["token"] == TOKEN
- # FIXME: Unreliable?
- assert post_data["scope"] == "email%20https://www.googleapis.com/auth/userinfo.email%20openid"
- CODE = post_data["code"]
- # We're done
- REPLY = True
- self.send_response(200)
- self.end_headers()
- self.wfile.write("""<!DOCTYPE html><html><head><title>Mana Launcher</title></head><body><h1>Thanks</h1><br/>You can close this window now.</body></html>""")
- except:
- traceback.print_exc()
- # Garbage, disregard
- self.send_error(403)
- return
-
-# Wait for reply
-def __callbacks__():
- global REPLY
- server_address = ('', 64004)
- httpd = BaseHTTPServer.HTTPServer(server_address, GHandler)
- while not REPLY:
- httpd.handle_request()
- # Reply obtained, propagate
- # FIXME
-
-def __request__(UUID, TOKEN, LOGIN):
- global PORT, REPLY, CODE
- # Fire loopback server
- lo=threading.Thread(target=__callbacks__)
- lo.daemon=True
- lo.start()
-
- # OAuth Consent Screen
- webbrowser.open_new("https://accounts.google.com/o/oauth2/v2/auth?scope=email&response_type=code&state=uuid%3D"+str(UUID)+"%26token%3D"+str(TOKEN)+"&redirect_uri=http%3A//127.0.0.1%3A"+str(PORT)+"&client_id=160252006716-mp7sgnncdtd4c9quv9sbtem3bkccn72q.apps.googleusercontent.com&login_hint="+str(LOGIN))
- # TODO: Maybe supply login_hint with the first part of the login (before the "@"). Google may end up doing everything this way?
-
- # Wait until we get a reply
- while not REPLY:
- time.sleep(0.5)
-
- return CODE
-
-def __reset__():
- global REPLY, CODE
- REPLY = False
- CODE = ""
- return
-
-
diff --git a/game/screens.rpy b/game/screens.rpy
index 50225a2..b7dc2be 100644
--- a/game/screens.rpy
+++ b/game/screens.rpy
@@ -671,17 +671,11 @@ screen preferences():
_("Disabled")):
action ToggleVariable("persistent.discord")
null height 10
- label _("Login Method: %s" % ifte(persistent.steam, "Steam", ifte(persistent.google, "Google", "Built-In")))
- textbutton _("Steam") action [SetVariable("persistent.steam", True), SetVariable("persistent.google", False)] selected persistent.steam
- if config.developer:
- textbutton _("Google Auth") action [SetVariable("persistent.steam", False), SetVariable("persistent.google", True)] selected persistent.google
- textbutton _("Built-In") action [SetVariable("persistent.steam", False), SetVariable("persistent.google", False)] selected (not persistent.steam and not persistent.google)
-
- #label _("Steam Login")
- #textbutton ifte(persistent.steam,
- # _("Enabled"),
- # _("Disabled")):
- # action ToggleVariable("persistent.steam")
+ label _("Steam Login")
+ textbutton ifte(persistent.steam,
+ _("Enabled"),
+ _("Disabled")):
+ action ToggleVariable("persistent.steam")
null height 10
label _("Plugins")
null height 7
diff --git a/game/update.rpy b/game/update.rpy
index b0a46a9..3a7e37f 100644
--- a/game/update.rpy
+++ b/game/update.rpy
@@ -184,19 +184,6 @@ init python:
# Before starting, we must check for Vault or Steam credentials
# This block is 1~20%
status_update(_("Verifying credentials..."), 80)
- if persistent.steam:
- auth_steam()
- elif persistent.google:
- auth_google()
- else:
- auth_vault()
-
- return
-
- #############################################################################
- def auth_steam():
- global accId, token, auth, r, responsive, auth2
- global vaultId, vaultToken, has_steam
try:
if not persistent.steam:
raise Exception("Steam login was disabled!")
@@ -253,78 +240,31 @@ init python:
time.sleep(0.25)
except:
# NO FALLBACK: if Steam Login is on, do not try vault (no multiacc)
- traceback.print_exc()
- status_update(_("{color=#f00}{b}STEAM AUTHENTICATION ERROR.\nIf the issue persists, try closing the app and opening again.{/b}{/color}"))
- responsive=False
- return
-
- status_update(pc=100)
- return
-
- #############################################################################
- def auth_vault():
- global vaultId, vaultToken
- # Prepare to do Vault authentication
- status_update(_("Steam auth disabled, logging on Vault..."), 80)
- vaultId = 0
- vaultToken = "MANUAL"
- #########################################
- ####### TODO FIXME
- # Must return and let a prompt for username & password
- # (Or Email, in the case of the modern Vault)
- # If vaultId is zero
- #status_update("{color=#F00}VaultError: Not yet implemented{/color}")
- #responsive = False
- #return
- ####### TODO FIXME
- #########################################
-
+ if persistent.steam:
+ traceback.print_exc()
+ status_update(_("{color=#f00}{b}STEAM AUTHENTICATION ERROR.\nIf the issue persists, try closing the app and opening again.{/b}{/color}"))
+ responsive=False
+ return
- status_update(pc=100)
- return
+ # Prepare to do Vault authentication
+ status_update(_("Steam auth disabled, logging on Vault..."), 80)
+ vaultId = 0
+ vaultToken = "MANUAL"
+ #########################################
+ ####### TODO FIXME
+ # Must return and let a prompt for username & password
+ # (Or Email, in the case of the modern Vault)
+ # If vaultId is zero
+ #status_update("{color=#F00}VaultError: Not yet implemented{/color}")
+ #responsive = False
+ #return
+ ####### TODO FIXME
+ #########################################
- #############################################################################
- def auth_google():
- global vaultId, vaultToken, responsive
- status_update(_("Loading Google Auth..."), 80)
- from tmw import google
- status_update(_("Google Auth loaded."), 81)
- # FIXME
- if persistent.email is None:
- responsive=False
- return
- #renpy.call_in_new_context("gimmemail")
- status_update(_("Requesting OAuth consent..."), 85)
- # FIXME - Generate a Token for cross forgery?
- # FIXME - Try to login first?
- code = google.__request__("UUID", "TOKEN", persistent.email)
- google.__reset__()
- status_update(_("Contacting Vault..."), 90)
- auth = {"mail": persistent.email+"@gmail.com", "oper": code}
- r = vault.post(VAULT_HOST+"/google_auth", json=auth, timeout=15.0)
- ## If unsucessful, give up on Google Auth
- if (r.status_code != 200):
- status_update(_("Vault returned code %d" % r.status_code), 90)
- responsive = False
- return
- status_update(_("Completing login..."), 95)
- auth2 = r.json()
- vaultId = auth2["vaultId"]
- vaultToken = auth2["token"]
status_update(pc=100)
return
-label gimmemail:
- # Request email if not saved
- while persistent.email is None:
- call screen register_input("Please input your Google ID:")
- #persistent.email = renpy.call_screen("register_input", "Please input your Google ID:")
- $ persistent.email = str(_return)
- $ persistent.email = persistent.email.replace("@gmail.com", "")
- if "@" in persistent.email:
- $ persistent.email = None
- return
#################################################################################
screen register_method():