提交 bdfee2c8 编写于 作者: R root

fix error in wait function

上级 b6860e37
......@@ -837,7 +837,7 @@ function message($message, $title = 'Message', $statusCode = 200, $wainstat = 0)
x += ".";
min++;
var xhr = new XMLHttpRequest();
var url = "?WaitFunction" + (status!=""?"=" + status:"");
var url = "?WaitFunction=" + (status!=""?status:"1");
xhr.open("GET", url);
//xhr.setRequestHeader("Authorization", "Bearer ");
xhr.onload = function(e) {
......@@ -862,7 +862,6 @@ function message($message, $title = 'Message', $statusCode = 200, $wainstat = 0)
xhr.send(null);
}
getStatus();
//setTimeout(function() { getStatus() }, 3000);
</script>';
} else {
$html .= '
......@@ -1167,7 +1166,7 @@ function EnvOpt($needUpdate = 0)
return message($html, $title, 400);
} else {
//WaitSCFStat();
$html .= getconstStr('UpdateSuccess') . '<br><a href="">' . getconstStr('Back') . '</a><script>var status = "' . $response['status'] . '";</script>';
$html .= getconstStr('UpdateSuccess') . '<br><a href="">' . getconstStr('Back') . '</a><script>var status = "' . $response['DplStatus'] . '";</script>';
$title = getconstStr('Setup');
return message($html, $title, 202, 1);
}
......@@ -1217,7 +1216,7 @@ function EnvOpt($needUpdate = 0)
$html .= getconstStr('Success') . '!<br>
<a href="">' . getconstStr('Back') . '</a>
<script>
var status = "' . $response['status'] . '";
var status = "' . $response['DplStatus'] . '";
</script>';
$title = getconstStr('Setup');
return message($html, $title, 200, 1);
......@@ -1293,7 +1292,7 @@ function EnvOpt($needUpdate = 0)
if (api_error($response)) {
return message(api_error_msg($response) . "<a href=\"\">" . getconstStr('Back') . "</a>", "Error", 403);
} else {
return message("Success<a href=\"\">" . getconstStr('Back') . "</a><script>var status = \"" . $response['status'] . "\";</script>", "Success", 200, 1);
return message("Success<a href=\"\">" . getconstStr('Back') . "</a><script>var status = \"" . $response['DplStatus'] . "\";</script>", "Success", 200, 1);
}
} else {
return message("Old pass error<a href=\"\">" . getconstStr('Back') . "</a>", "Error", 403);
......
......@@ -631,7 +631,7 @@ class Aliyundrive {
} else {
$str .= '
<script>
var status = "' . $response['status'] . '";
var status = "' . $response['DplStatus'] . '";
var uploadList = setInterval(function(){
if (document.getElementById("dis").style.display=="none") {
console.log(min++);
......@@ -702,7 +702,7 @@ class Aliyundrive {
</form>
</div>
<script>
var status = "' . $response['status'] . '";
var status = "' . $response['DplStatus'] . '";
function notnull(t)
{
if (t.driveId.value==\'\') {
......@@ -768,7 +768,7 @@ class Aliyundrive {
}
return true;
}
var status = "' . $response['status'] . '";
var status = "' . $response['DplStatus'] . '";
</script>
';
return message($html, $title, 201, 1);
......
......@@ -510,7 +510,7 @@ class Onedrive {
var expires = "expires="+expd.toGMTString();
document.cookie=\'disktag=; path=/; \'+expires;
var i = 0;
var status = "' . $response['status'] . '";
var status = "' . $response['DplStatus'] . '";
var uploadList = setInterval(function(){
if (document.getElementById("dis").style.display=="none") {
console.log(i++);
......@@ -618,7 +618,7 @@ class Onedrive {
savecache('access_token', $ret['access_token'], $this->disktag, $ret['expires_in'] - 60);
$html .= '<script>
var i = 0;
var status = "' . $response['status'] . '";
var status = "' . $response['DplStatus'] . '";
var uploadList = setInterval(function(){
if (document.getElementById("dis").style.display=="none") {
console.log(i++);
......@@ -699,7 +699,7 @@ class Onedrive {
if ($_POST['Drive_ver']!='Sharelink') $url .= '?install1&disktag=' . $_GET['disktag'] . '&AddDisk=' . $_POST['Drive_ver'];
$html .= '<script>
var i = 0;
var status = "' . $response['status'] . '";
var status = "' . $response['DplStatus'] . '";
var uploadList = setInterval(function(){
if (document.getElementById("dis").style.display=="none") {
console.log(i++);
......
......@@ -315,7 +315,7 @@ function updateHerokuapp($HerokuappId, $apikey, $source)
$data = json_encode($tmp);
$response = HerokuAPI('POST', 'https://api.heroku.com/apps/' . $HerokuappId . '/builds', $data, $apikey);
$result = json_decode( $response['body'], true );
$result['status'] = $result['id'];
$result['DplStatus'] = $result['id'];
$response['body'] = json_encode($result);
return $response;
}
......@@ -345,8 +345,9 @@ function setConfigResponse($response)
return json_decode( $response['body'], true );
}
function WaitFunction($buildId) {
function WaitFunction($buildId = '') {
// GET /apps/{app_id_or_name}/builds/{build_id}
if ($buildId=='1') return true;
$response = HerokuAPI('GET', 'https://api.heroku.com/apps/' . getConfig('HerokuappId') . '/builds/' . $buildId, '', getConfig('APIKey'));
if ($response['stat']==200) {
$result = json_decode($response['body'], true);
......
......@@ -187,14 +187,14 @@ function install()
return message($html, $title, 400);
} else {
/*$html = '<script>
var status = "' . $response['status'] . '";
var status = "' . $response['DplStatus'] . '";
var expd = new Date();
expd.setTime(expd.getTime()+1000);
var expires = "expires="+expd.toGMTString();
document.cookie=\'language=; path=/; \'+expires;
</script>';
return message($html, $title, 201, 1);*/
$data["dplId"] = $response['status'];
$data["dplId"] = $response['DplStatus'];
return output(json_encode($data), 201);
}
}
......@@ -362,7 +362,7 @@ function VercelUpdate($appId, $token, $sourcePath = "")
$response = curl("POST", $url, json_encode($data), $header);
//echo json_encode($response, JSON_PRETTY_PRINT) . " ,res<br>";
$result = json_decode($response["body"], true);
$result['status'] = $result['id'];
$result['DplStatus'] = $result['id'];
return json_encode($result);
}
......@@ -444,7 +444,12 @@ function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch =
return VercelUpdate(getConfig('HerokuappId'), getConfig('APIKey'), $outPath);
}
function WaitFunction($deployid) {
function WaitFunction($deployid = '') {
if ($buildId=='1') {
$tmp['stat'] = 400;
$tmp['body'] = 'id must provided.';
return $tmp;
}
$header["Authorization"] = "Bearer " . getConfig('APIKey');
$header["Content-Type"] = "application/json";
$url = "https://api.vercel.com/v11/now/deployments/" . $deployid;
......
......@@ -185,14 +185,14 @@ function install()
return message($html, $title, 400);
} else {
/*$html = '<script>
var status = "' . $response['status'] . '";
var status = "' . $response['DplStatus'] . '";
var expd = new Date();
expd.setTime(expd.getTime()+1000);
var expires = "expires="+expd.toGMTString();
document.cookie=\'language=; path=/; \'+expires;
</script>';
return message($html, $title, 201, 1);*/
$data["dplId"] = $response['status'];
$data["dplId"] = $response['DplStatus'];
return output(json_encode($data), 201);
}
}
......@@ -353,7 +353,7 @@ function VercelUpdate($appId, $token, $sourcePath = "")
$response = curl("POST", $url, json_encode($data), $header);
//echo json_encode($response, JSON_PRETTY_PRINT) . " ,res<br>";
$result = json_decode($response["body"], true);
$result['status'] = $result['id'];
$result['DplStatus'] = $result['id'];
return json_encode($result);
}
......@@ -431,6 +431,11 @@ function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch =
}
function WaitFunction($deployid) {
if ($buildId=='1') {
$tmp['stat'] = 400;
$tmp['body'] = 'id must provided.';
return $tmp;
}
$header["Authorization"] = "Bearer " . getConfig('APIKey');
$header["Content-Type"] = "application/json";
$url = "https://api.vercel.com/v11/now/deployments/" . $deployid;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册