Add auth-key for node registration
This commit is contained in:
@@ -9,8 +9,13 @@ func InitWebsocket():
|
|||||||
while socket.get_ready_state() != WebSocketPeer.STATE_OPEN:
|
while socket.get_ready_state() != WebSocketPeer.STATE_OPEN:
|
||||||
socket.poll()
|
socket.poll()
|
||||||
|
|
||||||
|
var init_message = {
|
||||||
socket.send_text(str({"register": 1}))
|
"register": {
|
||||||
|
"version": 1,
|
||||||
|
"auth_key": $"/root/Main".auth_key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
socket.send_text(str(init_message))
|
||||||
print("Connected")
|
print("Connected")
|
||||||
while true:
|
while true:
|
||||||
await PollWebsocket()
|
await PollWebsocket()
|
||||||
|
|||||||
2
Main.gd
2
Main.gd
@@ -5,6 +5,7 @@ var config = ConfigFile.new()
|
|||||||
var websocket_url
|
var websocket_url
|
||||||
var public_path
|
var public_path
|
||||||
var output_dir
|
var output_dir
|
||||||
|
var auth_key
|
||||||
var rendering = false
|
var rendering = false
|
||||||
signal finished_rendering
|
signal finished_rendering
|
||||||
|
|
||||||
@@ -14,6 +15,7 @@ func _ready():
|
|||||||
websocket_url = config.get_value("core", "websocket_url")
|
websocket_url = config.get_value("core", "websocket_url")
|
||||||
public_path = config.get_value("core", "public_path")
|
public_path = config.get_value("core", "public_path")
|
||||||
output_dir = config.get_value("core", "output_dir")
|
output_dir = config.get_value("core", "output_dir")
|
||||||
|
auth_key = config.get_value("core", "auth_key")
|
||||||
print("Starting render node")
|
print("Starting render node")
|
||||||
|
|
||||||
var directory = DirAccess.open(".")
|
var directory = DirAccess.open(".")
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
[core]
|
[core]
|
||||||
|
auth_key=ay1234
|
||||||
websocket_url="ws://localhost:6980"
|
websocket_url="ws://localhost:6980"
|
||||||
public_path="http://localhost:8899/"
|
public_path="http://localhost:8899/"
|
||||||
output_dir="./output"
|
output_dir="./output"
|
||||||
|
|||||||
Reference in New Issue
Block a user