Add custom port support
This commit is contained in:
@@ -52,6 +52,7 @@ if (isset($_GET["list"])) {
|
|||||||
$list[$id] = [
|
$list[$id] = [
|
||||||
"id" => $lobby["id"],
|
"id" => $lobby["id"],
|
||||||
"host" => $lobby["host"],
|
"host" => $lobby["host"],
|
||||||
|
"port" => $lobby["port"],
|
||||||
"name" => $lobby["name"],
|
"name" => $lobby["name"],
|
||||||
"creator" => $lobby["creator"],
|
"creator" => $lobby["creator"],
|
||||||
"version" => $lobby["version"],
|
"version" => $lobby["version"],
|
||||||
@@ -67,7 +68,11 @@ elseif (isset($_GET["new"])) {
|
|||||||
if (!empty($_GET["host"])) {
|
if (!empty($_GET["host"])) {
|
||||||
$host = $_GET["host"];
|
$host = $_GET["host"];
|
||||||
}
|
}
|
||||||
$reachable = enet_probe($host, 50403);
|
$port = 50403;
|
||||||
|
if (!empty($_GET["port"]) && is_numeric($_GET["port"])) {
|
||||||
|
$port = intval($_GET["port"]);
|
||||||
|
}
|
||||||
|
$reachable = enet_probe($host, $port);
|
||||||
header("Content-Type: application/json");
|
header("Content-Type: application/json");
|
||||||
if ($reachable) {
|
if ($reachable) {
|
||||||
$id = generate_uuid_v4();
|
$id = generate_uuid_v4();
|
||||||
@@ -82,6 +87,7 @@ elseif (isset($_GET["new"])) {
|
|||||||
"id" => $id,
|
"id" => $id,
|
||||||
"secret" => $secret,
|
"secret" => $secret,
|
||||||
"host" => $host,
|
"host" => $host,
|
||||||
|
"port" => $port,
|
||||||
"name" => $name,
|
"name" => $name,
|
||||||
"version" => $version,
|
"version" => $version,
|
||||||
"creator" => $creator,
|
"creator" => $creator,
|
||||||
@@ -93,7 +99,7 @@ elseif (isset($_GET["new"])) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
http_response_code(424);
|
http_response_code(424);
|
||||||
echo json_encode(["error" => "NOT_REACHABLE", "host" => $host]);
|
echo json_encode(["error" => "NOT_REACHABLE", "host" => $host, "port" => $port]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif (isset($_GET["update"])) {
|
elseif (isset($_GET["update"])) {
|
||||||
|
|||||||
Reference in New Issue
Block a user