summaryrefslogtreecommitdiff
path: root/api/computer.php
diff options
context:
space:
mode:
Diffstat (limited to 'api/computer.php')
-rw-r--r--api/computer.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/api/computer.php b/api/computer.php
index a4ead80..cd065e7 100644
--- a/api/computer.php
+++ b/api/computer.php
@@ -9,6 +9,14 @@ $json_object = json_decode($request_raw, true);
$host = md5($json_object['host']);
switch ($_GET['type']) {
+ case "heartbeat":
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $_PROFILE['login'] . "-" . $host . ".json")) {
+ $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $_PROFILE['login'] . "-" . $host . ".json"), true);
+ $data["date"] = date('c');
+ file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/computers/metadata/" . $_PROFILE['login'] . "-" . $host . ".json", json_encode($data));
+ }
+ break;
+
case "screenshot":
$id = $json_object['id'];
$data = base64_decode($json_object['data']);