From bdfee2c81bb19409e4a6bec1c8e55169d80238bf Mon Sep 17 00:00:00 2001 From: root Date: Thu, 26 Aug 2021 10:09:57 +0000 Subject: [PATCH] fix error in wait function --- common.php | 9 ++++----- disk/Aliyundrive.php | 6 +++--- disk/Onedrive.php | 6 +++--- platform/Heroku.php | 5 +++-- platform/Vercel.php | 13 +++++++++---- platform/Vercel_env.php | 11 ++++++++--- 6 files changed, 30 insertions(+), 20 deletions(-) diff --git a/common.php b/common.php index dd93a91..fd53d9a 100644 --- a/common.php +++ b/common.php @@ -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); '; } else { $html .= ' @@ -1167,7 +1166,7 @@ function EnvOpt($needUpdate = 0) return message($html, $title, 400); } else { //WaitSCFStat(); - $html .= getconstStr('UpdateSuccess') . '
' . getconstStr('Back') . ''; + $html .= getconstStr('UpdateSuccess') . '
' . getconstStr('Back') . ''; $title = getconstStr('Setup'); return message($html, $title, 202, 1); } @@ -1217,7 +1216,7 @@ function EnvOpt($needUpdate = 0) $html .= getconstStr('Success') . '!
' . getconstStr('Back') . ' '; $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) . "" . getconstStr('Back') . "", "Error", 403); } else { - return message("Success" . getconstStr('Back') . "", "Success", 200, 1); + return message("Success" . getconstStr('Back') . "", "Success", 200, 1); } } else { return message("Old pass error" . getconstStr('Back') . "", "Error", 403); diff --git a/disk/Aliyundrive.php b/disk/Aliyundrive.php index 148b375..795fd59 100644 --- a/disk/Aliyundrive.php +++ b/disk/Aliyundrive.php @@ -631,7 +631,7 @@ class Aliyundrive { } else { $str .= ' '; return message($html, $title, 201, 1); diff --git a/disk/Onedrive.php b/disk/Onedrive.php index 2efcfb8..3ffaa72 100644 --- a/disk/Onedrive.php +++ b/disk/Onedrive.php @@ -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 .= ''; 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
"; $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; diff --git a/platform/Vercel_env.php b/platform/Vercel_env.php index 5f440af..4ebd486 100644 --- a/platform/Vercel_env.php +++ b/platform/Vercel_env.php @@ -185,14 +185,14 @@ function install() return message($html, $title, 400); } else { /*$html = ''; 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
"; $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;