Merge branch 'qkqpttgf:master' into master

pull/610/head
gd1214b 2021-08-28 12:03:36 +08:00 committed by GitHub
commit 9eae40831c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 49 additions and 26 deletions

View File

@ -816,8 +816,8 @@ function message($message, $title = 'Message', $statusCode = 200, $wainstat = 0)
<meta charset=utf-8>
<meta name=viewport content="width=device-width,initial-scale=1">
<body>
<h1>' . $title . '</h1>
<a href="' . $_SERVER['base_path'] . '">' . getconstStr('Back') . getconstStr('Home') . '</a>
<h1>' . $title . '</h1>
<div id="dis" style="display: none;">
' . $message . '
@ -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);
@ -2586,7 +2585,7 @@ function render_list($path = '', $files = [])
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--HeadomfEnd-->');
if (isset($files['list']['head.omf'])) {
$headomf = str_replace('<!--HeadomfContent-->', get_content(spurlencode(path_format($path . '/head.omf'), '/'))['content']['body'], $tmp[0]);
$headomf = str_replace('<!--HeadomfContent-->', get_content(spurlencode(path_format($path . '/' . $files['list']['head.omf']['name']), '/'))['content']['body'], $tmp[0]);
}
$html .= $headomf . $tmp[1];
@ -2594,7 +2593,7 @@ function render_list($path = '', $files = [])
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--HeadmdEnd-->');
if (isset($files['list']['head.md'])) {
$headmd = str_replace('<!--HeadmdContent-->', get_content(spurlencode(path_format($path . '/head.md'), '/'))['content']['body'], $tmp[0]);
$headmd = str_replace('<!--HeadmdContent-->', get_content(spurlencode(path_format($path . '/' . $files['list']['head.md']['name']), '/'))['content']['body'], $tmp[0]);
$html .= $headmd . $tmp[1];
while (strpos($html, '<!--HeadmdStart-->')) {
$html = str_replace('<!--HeadmdStart-->', '', $html);
@ -2627,7 +2626,7 @@ function render_list($path = '', $files = [])
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--ReadmemdEnd-->');
if (isset($files['list']['readme.md'])) {
$Readmemd = str_replace('<!--ReadmemdContent-->', get_content(spurlencode(path_format($path . '/readme.md'),'/'))['content']['body'], $tmp[0]);
$Readmemd = str_replace('<!--ReadmemdContent-->', get_content(spurlencode(path_format($path . '/' . $files['list']['readme.md']['name']),'/'))['content']['body'], $tmp[0]);
$html .= $Readmemd . $tmp[1];
while (strpos($html, '<!--ReadmemdStart-->')) {
$html = str_replace('<!--ReadmemdStart-->', '', $html);
@ -2649,7 +2648,7 @@ function render_list($path = '', $files = [])
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '<!--FootomfEnd-->');
if (isset($files['list']['foot.omf'])) {
$Footomf = str_replace('<!--FootomfContent-->', get_content(spurlencode(path_format($path . '/foot.omf'),'/'))['content']['body'], $tmp[0]);
$Footomf = str_replace('<!--FootomfContent-->', get_content(spurlencode(path_format($path . '/' . $files['list']['foot.omf']['name']),'/'))['content']['body'], $tmp[0]);
}
$html .= $Footomf . $tmp[1];

View File

@ -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);

View File

@ -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++);

View File

@ -313,7 +313,11 @@ function updateHerokuapp($HerokuappId, $apikey, $source)
{
$tmp['source_blob']['url'] = $source;
$data = json_encode($tmp);
return HerokuAPI('POST', 'https://api.heroku.com/apps/' . $HerokuappId . '/builds', $data, $apikey);
$response = HerokuAPI('POST', 'https://api.heroku.com/apps/' . $HerokuappId . '/builds', $data, $apikey);
$result = json_decode( $response['body'], true );
$result['DplStatus'] = $result['id'];
$response['body'] = json_encode($result);
return $response;
}
function api_error($response)
@ -341,6 +345,16 @@ function setConfigResponse($response)
return json_decode( $response['body'], true );
}
function WaitFunction() {
return true;
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);
if ($result['status']=="succeeded") return true;
else return false;
} else {
$response['body'] .= $url;
return $response;
}
}

View File

@ -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;

View File

@ -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;