From e0239dcae09f7cc788dbc2082a671e660d694fd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lera=20Elvo=C3=A9?= Date: Sun, 10 Dec 2023 16:23:50 +0300 Subject: [PATCH] make twitch actually work frfr no cap --- addons/no_twitch/twitch_connection.gd | 15 ++++++++++++--- graph_node_renderer/deck_holder_renderer.tscn | 1 - 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/addons/no_twitch/twitch_connection.gd b/addons/no_twitch/twitch_connection.gd index e7fdb33..2c4abab 100644 --- a/addons/no_twitch/twitch_connection.gd +++ b/addons/no_twitch/twitch_connection.gd @@ -10,7 +10,7 @@ signal token_received(token : String) @export var client_id := "qyjg1mtby1ycs5scm1pvctos7yvyc1" @export var redirect_uri := "http://localhost" ## Port that the redirect_uri will head to on your local system. Defaults to 80 for most cases. Linux tends to prefer 8000 or possibly 1338 -@export var redirect_port := "80" +@export var redirect_port := "8000" var twitch_url := "https://id.twitch.tv/oauth2/authorize?response_type=token&" @@ -86,7 +86,11 @@ func create_auth_url(scopes : Array[String] = ["chat:read", "chat:edit"], port : str_scopes += " " + all str_scopes = str_scopes.strip_edges() - var url = twitch_url + "client_id=" + id + "&redirect_uri=" + redirect + ":" + port + "&scope=" + str_scopes + "&state=" + str(state) + var full_redirect_uri := redirect + if !port.is_empty(): + full_redirect_uri += ":" + port + + var url = twitch_url + "client_id=" + id + "&redirect_uri=" + full_redirect_uri + "&scope=" + str_scopes + "&state=" + str(state) return url @@ -104,7 +108,12 @@ func check_auth_peer(peer : StreamPeerTCP): var info = peer.get_utf8_string(peer.get_available_bytes()) printraw(info) - var script = "" + var root := redirect_uri + if !redirect_port.is_empty(): + root += ":" + redirect_port + root += "/" + + var script = "" peer.put_data(str("HTTP/1.1 200\n\n" + script).to_utf8_buffer()) diff --git a/graph_node_renderer/deck_holder_renderer.tscn b/graph_node_renderer/deck_holder_renderer.tscn index 0b66c03..19cc642 100644 --- a/graph_node_renderer/deck_holder_renderer.tscn +++ b/graph_node_renderer/deck_holder_renderer.tscn @@ -151,7 +151,6 @@ unique_name_in_owner = true script = ExtResource("5_3n36q") [node name="OBSWebsocketSetupDialog" parent="." instance=ExtResource("5_uo2gj")] -visible = false [node name="Twitch_Setup_Dialog" parent="." instance=ExtResource("7_7rhap")] visible = false