mirror of
https://codeberg.org/StreamGraph/StreamGraph.git
synced 2024-11-13 19:49:55 +01:00
make twitch actually work frfr no cap
This commit is contained in:
parent
2bd48d993b
commit
e0239dcae0
2 changed files with 12 additions and 4 deletions
|
@ -10,7 +10,7 @@ signal token_received(token : String)
|
||||||
@export var client_id := "qyjg1mtby1ycs5scm1pvctos7yvyc1"
|
@export var client_id := "qyjg1mtby1ycs5scm1pvctos7yvyc1"
|
||||||
@export var redirect_uri := "http://localhost"
|
@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
|
## 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&"
|
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 += " " + all
|
||||||
str_scopes = str_scopes.strip_edges()
|
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
|
return url
|
||||||
|
|
||||||
|
@ -104,7 +108,12 @@ func check_auth_peer(peer : StreamPeerTCP):
|
||||||
var info = peer.get_utf8_string(peer.get_available_bytes())
|
var info = peer.get_utf8_string(peer.get_available_bytes())
|
||||||
printraw(info)
|
printraw(info)
|
||||||
|
|
||||||
var script = "<script>fetch('http://localhost/' + window.location.hash.substr(1))</script>"
|
var root := redirect_uri
|
||||||
|
if !redirect_port.is_empty():
|
||||||
|
root += ":" + redirect_port
|
||||||
|
root += "/"
|
||||||
|
|
||||||
|
var script = "<script>fetch('" + root + "' + window.location.hash.substr(1))</script>"
|
||||||
|
|
||||||
peer.put_data(str("HTTP/1.1 200\n\n" + script).to_utf8_buffer())
|
peer.put_data(str("HTTP/1.1 200\n\n" + script).to_utf8_buffer())
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,6 @@ unique_name_in_owner = true
|
||||||
script = ExtResource("5_3n36q")
|
script = ExtResource("5_3n36q")
|
||||||
|
|
||||||
[node name="OBSWebsocketSetupDialog" parent="." instance=ExtResource("5_uo2gj")]
|
[node name="OBSWebsocketSetupDialog" parent="." instance=ExtResource("5_uo2gj")]
|
||||||
visible = false
|
|
||||||
|
|
||||||
[node name="Twitch_Setup_Dialog" parent="." instance=ExtResource("7_7rhap")]
|
[node name="Twitch_Setup_Dialog" parent="." instance=ExtResource("7_7rhap")]
|
||||||
visible = false
|
visible = false
|
||||||
|
|
Loading…
Reference in a new issue