fix: restore full Godot auth in progressive web build
This commit is contained in:
@@ -1,40 +1,9 @@
|
||||
extends Control
|
||||
|
||||
var _auth_manager: Node
|
||||
var _scene_manager: Node
|
||||
var _handled: bool = false
|
||||
|
||||
func _ready() -> void:
|
||||
_auth_manager = get_node_or_null("/root/AuthManager")
|
||||
_scene_manager = get_node_or_null("/root/SceneManager")
|
||||
if OS.get_name() != "Web":
|
||||
_scene_manager.call_deferred("change_scene", "auth", false)
|
||||
if _scene_manager == null:
|
||||
return
|
||||
if _auth_manager == null:
|
||||
return
|
||||
if _auth_manager.has_signal("browser_bootstrap_received"):
|
||||
_auth_manager.connect("browser_bootstrap_received", _on_browser_bootstrap_received)
|
||||
var kind := str(_auth_manager.call("get_browser_bootstrap_kind")) if _auth_manager.has_method("get_browser_bootstrap_kind") else ""
|
||||
if not kind.is_empty():
|
||||
call_deferred("_on_browser_bootstrap_received", kind)
|
||||
|
||||
func _on_browser_bootstrap_received(kind: String) -> void:
|
||||
if _handled or _scene_manager == null:
|
||||
return
|
||||
_handled = true
|
||||
if kind == "register":
|
||||
_scene_manager.call("change_scene", "auth", false)
|
||||
return
|
||||
if _auth_manager.has_method("consume_browser_bootstrap_kind"):
|
||||
_auth_manager.call("consume_browser_bootstrap_kind")
|
||||
var appearanceManager := get_node_or_null("/root/AppearanceManager")
|
||||
if appearanceManager != null and appearanceManager.has_method("apply_account_profile"):
|
||||
appearanceManager.call("apply_account_profile", _auth_manager.call("get_current_profile"))
|
||||
var chatManager := get_node_or_null("/root/ChatManager")
|
||||
var token := str(_auth_manager.call("get_access_token"))
|
||||
if chatManager != null and not token.is_empty():
|
||||
chatManager.call("set_game_token", token)
|
||||
chatManager.call("connect_to_chat_server")
|
||||
if _auth_manager.has_method("fetch_profile"):
|
||||
_auth_manager.call("fetch_profile")
|
||||
_scene_manager.call("change_scene", "square", false)
|
||||
_scene_manager.call_deferred("change_scene", "auth", false)
|
||||
|
||||
Reference in New Issue
Block a user