|
|
@@ -86,17 +86,27 @@ switch ($endpoint) {
|
|
|
break;
|
|
|
case 'deploy':
|
|
|
error_log("Request deploy from " . get_client_ip());
|
|
|
- if ($requestMethod === 'POST' && !empty($username) && !empty($domain)) {
|
|
|
+ if ($requestMethod == 'POST' && !empty($username) && !empty($domain)) {
|
|
|
if ($GLOBALS['debug'] == true) {
|
|
|
error_log("POST: " . print_r($_POST, true));
|
|
|
}
|
|
|
+ $error = null;
|
|
|
+ $id = md5($id.time());
|
|
|
+ header('Content-Type: application/json; charset=utf-8', true);
|
|
|
+ echo json_encode(array('result' => array('id' => $id, 'error' => $error)));
|
|
|
SiteController::deploy(['zip' => $_POST['zip'], 'username' => $username, 'domain' => $domain]);
|
|
|
}
|
|
|
- if ($requestMethod === 'GET' && !empty($username) && !empty($domain)) {
|
|
|
+ if ($requestMethod == 'GET' && !empty($username) && !empty($domain)) {
|
|
|
if ($GLOBALS['debug'] == true) {
|
|
|
error_log("GET: " . print_r($_GET, true));
|
|
|
}
|
|
|
- SiteController::deploy(['vars' => $_GET, 'username' => $username, 'domain' => $domain]);
|
|
|
+ $uri = $_SERVER['REQUEST_URI'];
|
|
|
+ $parts = explode('/', $uri);
|
|
|
+ $id = $parts[count($parts) - 1];
|
|
|
+ $status = 'FINISHED';
|
|
|
+ $error = null;
|
|
|
+ header('Content-Type: application/json; charset=utf-8', true);
|
|
|
+ echo json_encode(array('result' => array('id' => $id, 'error' => $error)));
|
|
|
}
|
|
|
break;
|
|
|
case 'revert':
|