mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
Extra fixes to NoTwitch Cache handling (#136)
Reviewed-on: https://codeberg.org/StreamGraph/StreamGraph/pulls/136 Co-authored-by: Eroax <eroaxebusiness@duck.com> Co-committed-by: Eroax <eroaxebusiness@duck.com>
This commit is contained in:
parent
8896fed2f8
commit
82edd774a0
1 changed files with 11 additions and 11 deletions
|
@ -11,10 +11,13 @@ func _ready():
|
|||
#confirmed.connect(connect_to_chat)
|
||||
%Join_Chat.pressed.connect(connect_to_chat)
|
||||
|
||||
func authenticate_twitch():
|
||||
func authenticate_twitch(skip_load = false):
|
||||
|
||||
# Temporary setup for loading credentials
|
||||
var loaded_creds = Connections.load_credentials("twitch")
|
||||
var loaded_creds = null
|
||||
|
||||
if !skip_load:
|
||||
loaded_creds = Connections.load_credentials("twitch")
|
||||
|
||||
if loaded_creds != null:
|
||||
|
||||
|
@ -26,25 +29,22 @@ func authenticate_twitch():
|
|||
|
||||
Connections.twitch.cache_user_data()
|
||||
# Binds invalid auth to call No_Twitch.authenticate_with_twitch, handles if the cache of auth is invalid.
|
||||
Connections.twitch.invalid_auth.connect(func():
|
||||
|
||||
var url = Connections.twitch.authenticate_with_twitch(%Client_ID.text)
|
||||
OS.shell_open(url)
|
||||
)
|
||||
Util.safe_connect(Connections.twitch.invalid_auth,authenticate_twitch.bind(true))
|
||||
|
||||
connect_to_chat()
|
||||
return
|
||||
|
||||
|
||||
# Handles first authentication/invalid cached authentication.
|
||||
Connections.twitch.token_received.connect(func(token):
|
||||
|
||||
Connections.save_credentials({"token" : token}, "twitch")
|
||||
)
|
||||
Util.safe_connect(Connections.twitch.token_received, save_twitch_token)
|
||||
|
||||
var url = Connections.twitch.authenticate_with_twitch(%Client_ID.text)
|
||||
OS.shell_open(url)
|
||||
|
||||
func save_twitch_token(token):
|
||||
|
||||
Connections.save_credentials({"token" : token}, "twitch")
|
||||
|
||||
|
||||
func copy_auth_link():
|
||||
var url = Connections.twitch.authenticate_with_twitch(%Client_ID.text)
|
||||
|
|
Loading…
Reference in a new issue