From 8a4341cbd28b58794ce1a9c0bf794bce1e72ef72 Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Mon, 23 Aug 2021 10:40:00 +0800
Subject: [PATCH 1/4] fix : cant find lower readme.md in Aliyundrive
---
common.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/common.php b/common.php
index 6a93acd..67e854a 100644
--- a/common.php
+++ b/common.php
@@ -2586,7 +2586,7 @@ function render_list($path = '', $files = [])
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '');
if (isset($files['list']['head.omf'])) {
- $headomf = str_replace('', get_content(spurlencode(path_format($path . '/head.omf'), '/'))['content']['body'], $tmp[0]);
+ $headomf = str_replace('', get_content(spurlencode(path_format($path . '/' . $files['list']['head.omf']['name']), '/'))['content']['body'], $tmp[0]);
}
$html .= $headomf . $tmp[1];
@@ -2594,7 +2594,7 @@ function render_list($path = '', $files = [])
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '');
if (isset($files['list']['head.md'])) {
- $headmd = str_replace('', get_content(spurlencode(path_format($path . '/head.md'), '/'))['content']['body'], $tmp[0]);
+ $headmd = str_replace('', get_content(spurlencode(path_format($path . '/' . $files['list']['head.md']['name']), '/'))['content']['body'], $tmp[0]);
$html .= $headmd . $tmp[1];
while (strpos($html, '')) {
$html = str_replace('', '', $html);
@@ -2627,7 +2627,7 @@ function render_list($path = '', $files = [])
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '');
if (isset($files['list']['readme.md'])) {
- $Readmemd = str_replace('', get_content(spurlencode(path_format($path . '/readme.md'),'/'))['content']['body'], $tmp[0]);
+ $Readmemd = str_replace('', get_content(spurlencode(path_format($path . '/' . $files['list']['readme.md']['name']),'/'))['content']['body'], $tmp[0]);
$html .= $Readmemd . $tmp[1];
while (strpos($html, '')) {
$html = str_replace('', '', $html);
@@ -2649,7 +2649,7 @@ function render_list($path = '', $files = [])
$html = $tmp[0];
$tmp = splitfirst($tmp[1], '');
if (isset($files['list']['foot.omf'])) {
- $Footomf = str_replace('', get_content(spurlencode(path_format($path . '/foot.omf'),'/'))['content']['body'], $tmp[0]);
+ $Footomf = str_replace('', get_content(spurlencode(path_format($path . '/' . $files['list']['foot.omf']['name']),'/'))['content']['body'], $tmp[0]);
}
$html .= $Footomf . $tmp[1];
From f81284b3f9e3b8ca749778bed7a54109d2913fdf Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Mon, 23 Aug 2021 13:18:54 +0800
Subject: [PATCH 2/4] wait app build in heroku
---
platform/Heroku.php | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/platform/Heroku.php b/platform/Heroku.php
index a096efa..7d30fd6 100644
--- a/platform/Heroku.php
+++ b/platform/Heroku.php
@@ -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['status'] = $result['id'];
+ $response['body'] = json_encode($result);
+ return $response;
}
function api_error($response)
@@ -341,6 +345,15 @@ 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}
+ $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;
+ }
}
From b6860e373a1027c8be1bf390632f8d37b2eab205 Mon Sep 17 00:00:00 2001
From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com>
Date: Tue, 24 Aug 2021 03:31:59 +0000
Subject: [PATCH 3/4] move BackHome up Title
---
common.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common.php b/common.php
index 67e854a..dd93a91 100644
--- a/common.php
+++ b/common.php
@@ -816,8 +816,8 @@ function message($message, $title = 'Message', $statusCode = 200, $wainstat = 0)
- ' . $title . '
' . getconstStr('Back') . getconstStr('Home') . '
+ ' . $title . '
' . $message . '
From bdfee2c81bb19409e4a6bec1c8e55169d80238bf Mon Sep 17 00:00:00 2001
From: root
Date: Thu, 26 Aug 2021 10:09:57 +0000
Subject: [PATCH 4/4] 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;