summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Schulthess2017-02-09 11:35:36 +0100
committerChristoph Schulthess2017-02-09 11:35:36 +0100
commit8b692f1f336e89a3dc480b9681868389373d1ed3 (patch)
tree441b4e153982c327dc78cf87501fee864caf44bf
parentfinished config module (diff)
downloadslx-admin-8b692f1f336e89a3dc480b9681868389373d1ed3.tar.gz
slx-admin-8b692f1f336e89a3dc480b9681868389373d1ed3.tar.xz
slx-admin-8b692f1f336e89a3dc480b9681868389373d1ed3.zip
adapted debugrequest.php
-rw-r--r--apis/debugrequest.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/apis/debugrequest.php b/apis/debugrequest.php
index 4449e6eb..f8e728e7 100644
--- a/apis/debugrequest.php
+++ b/apis/debugrequest.php
@@ -1,19 +1,23 @@
<?php
-/*$debug_settings = Property::getRemoteDebuggingConfig();
-if ($debug_settings["status"] !== "enabled") {
+$debug_settings = Property::getRemoteDebuggingConfig();
+if ($debug_settings["enabled"] !== true) {
http_response_code(403);
exit;
-}*/
+}
+
$debug_request = split(":", file_get_contents("php://input"), 2);
+
$uuid = $debug_request[0];
$port = 5900 + $debug_request[1];
+
$validclient = Database::queryFirst("SELECT machineuuid, clientip FROM machine WHERE machineuuid = :uuid AND clientip = :ip", array(":uuid" => "$debug_request[0]", ":ip" => $_SERVER["REMOTE_ADDR"]));
-//$validclient = Database::simpleQuery("SELECT machineuuid, clientip FROM machine LIMIT 1;");
+
if ($validclient == false) {
http_response_code(400);
} else {
http_response_code(200);
- $data = json_encode(array("ip" => $_SERVER["REMOTE_ADDR"], "port" => 5900 + $debug_request["display"]));
- Taskmanager::submit('relay', $data, true);
+ $data = json_encode(array("hosts" => array($_SERVER["REMOTE_ADDR"], $debug_settings["debugServer"]),
+ "ports" => array($port, $debug_settings["port"])));
+ Taskmanager::submit('DispatchRelay', $data, true);
}