summaryrefslogtreecommitdiff
path: root/Game/Lobby
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2024-12-21 14:15:11 +0100
committerDaniel Weipert <git@mail.dweipert.de>2024-12-21 14:15:11 +0100
commit5b35174ffab42f0331f1a6527ef6bbab7a3dbdcb (patch)
tree071530353b02f45fffc26aa4b0f43f7b901b3046 /Game/Lobby
parenta854a1862a30632e49520f6e1e11333d5c8ff241 (diff)
next commitHEADmain
Diffstat (limited to 'Game/Lobby')
-rw-r--r--Game/Lobby/Server/index.php7
-rw-r--r--Game/Lobby/game_lobby.gd5
2 files changed, 8 insertions, 4 deletions
diff --git a/Game/Lobby/Server/index.php b/Game/Lobby/Server/index.php
index ae734a6..1086d24 100644
--- a/Game/Lobby/Server/index.php
+++ b/Game/Lobby/Server/index.php
@@ -36,7 +36,7 @@ if (php_sapi_name() == 'cli') {
return;
}
-$url = parse_url("$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]");
+$url = parse_url("http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]");
$method = $_SERVER['REQUEST_METHOD'];
if ($method == 'POST') {
@@ -49,7 +49,10 @@ if ($method == 'POST') {
$response = [];
if ($method == 'POST' && $url['path'] == '/host') {
- $ip = filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP);
+ $ip = filter_var(
+ $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'],
+ FILTER_VALIDATE_IP
+ );
if ($ip === false) {
$response = [
diff --git a/Game/Lobby/game_lobby.gd b/Game/Lobby/game_lobby.gd
index 6bfa8be..ffc66f3 100644
--- a/Game/Lobby/game_lobby.gd
+++ b/Game/Lobby/game_lobby.gd
@@ -42,8 +42,8 @@ func request(
get_tree().root.add_child(config.node)
if config.method == HTTPClient.METHOD_POST:
- config.set("id", current_game_id)
- config.set("secret", current_secret)
+ config.data["id"] = current_game_id
+ config.data["secret"] = current_secret
var response = HTTPResponse.new()
config.node.request_completed.connect(
@@ -60,6 +60,7 @@ func request(
get_tree().root.remove_child(config.node)
)
+
config.node.request(
"%s%s" % [server_base_url, url],
config.headers,