Merge branch 'qkqpttgf:master' into master
commit
9eae40831c
19
common.php
19
common.php
|
@ -816,8 +816,8 @@ function message($message, $title = 'Message', $statusCode = 200, $wainstat = 0)
|
||||||
<meta charset=utf-8>
|
<meta charset=utf-8>
|
||||||
<meta name=viewport content="width=device-width,initial-scale=1">
|
<meta name=viewport content="width=device-width,initial-scale=1">
|
||||||
<body>
|
<body>
|
||||||
<h1>' . $title . '</h1>
|
|
||||||
<a href="' . $_SERVER['base_path'] . '">' . getconstStr('Back') . getconstStr('Home') . '</a>
|
<a href="' . $_SERVER['base_path'] . '">' . getconstStr('Back') . getconstStr('Home') . '</a>
|
||||||
|
<h1>' . $title . '</h1>
|
||||||
<div id="dis" style="display: none;">
|
<div id="dis" style="display: none;">
|
||||||
|
|
||||||
' . $message . '
|
' . $message . '
|
||||||
|
@ -837,7 +837,7 @@ function message($message, $title = 'Message', $statusCode = 200, $wainstat = 0)
|
||||||
x += ".";
|
x += ".";
|
||||||
min++;
|
min++;
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
var url = "?WaitFunction" + (status!=""?"=" + status:"");
|
var url = "?WaitFunction=" + (status!=""?status:"1");
|
||||||
xhr.open("GET", url);
|
xhr.open("GET", url);
|
||||||
//xhr.setRequestHeader("Authorization", "Bearer ");
|
//xhr.setRequestHeader("Authorization", "Bearer ");
|
||||||
xhr.onload = function(e) {
|
xhr.onload = function(e) {
|
||||||
|
@ -862,7 +862,6 @@ function message($message, $title = 'Message', $statusCode = 200, $wainstat = 0)
|
||||||
xhr.send(null);
|
xhr.send(null);
|
||||||
}
|
}
|
||||||
getStatus();
|
getStatus();
|
||||||
//setTimeout(function() { getStatus() }, 3000);
|
|
||||||
</script>';
|
</script>';
|
||||||
} else {
|
} else {
|
||||||
$html .= '
|
$html .= '
|
||||||
|
@ -1167,7 +1166,7 @@ function EnvOpt($needUpdate = 0)
|
||||||
return message($html, $title, 400);
|
return message($html, $title, 400);
|
||||||
} else {
|
} else {
|
||||||
//WaitSCFStat();
|
//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');
|
$title = getconstStr('Setup');
|
||||||
return message($html, $title, 202, 1);
|
return message($html, $title, 202, 1);
|
||||||
}
|
}
|
||||||
|
@ -1217,7 +1216,7 @@ function EnvOpt($needUpdate = 0)
|
||||||
$html .= getconstStr('Success') . '!<br>
|
$html .= getconstStr('Success') . '!<br>
|
||||||
<a href="">' . getconstStr('Back') . '</a>
|
<a href="">' . getconstStr('Back') . '</a>
|
||||||
<script>
|
<script>
|
||||||
var status = "' . $response['status'] . '";
|
var status = "' . $response['DplStatus'] . '";
|
||||||
</script>';
|
</script>';
|
||||||
$title = getconstStr('Setup');
|
$title = getconstStr('Setup');
|
||||||
return message($html, $title, 200, 1);
|
return message($html, $title, 200, 1);
|
||||||
|
@ -1293,7 +1292,7 @@ function EnvOpt($needUpdate = 0)
|
||||||
if (api_error($response)) {
|
if (api_error($response)) {
|
||||||
return message(api_error_msg($response) . "<a href=\"\">" . getconstStr('Back') . "</a>", "Error", 403);
|
return message(api_error_msg($response) . "<a href=\"\">" . getconstStr('Back') . "</a>", "Error", 403);
|
||||||
} else {
|
} 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 {
|
} else {
|
||||||
return message("Old pass error<a href=\"\">" . getconstStr('Back') . "</a>", "Error", 403);
|
return message("Old pass error<a href=\"\">" . getconstStr('Back') . "</a>", "Error", 403);
|
||||||
|
@ -2586,7 +2585,7 @@ function render_list($path = '', $files = [])
|
||||||
$html = $tmp[0];
|
$html = $tmp[0];
|
||||||
$tmp = splitfirst($tmp[1], '<!--HeadomfEnd-->');
|
$tmp = splitfirst($tmp[1], '<!--HeadomfEnd-->');
|
||||||
if (isset($files['list']['head.omf'])) {
|
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];
|
$html .= $headomf . $tmp[1];
|
||||||
|
|
||||||
|
@ -2594,7 +2593,7 @@ function render_list($path = '', $files = [])
|
||||||
$html = $tmp[0];
|
$html = $tmp[0];
|
||||||
$tmp = splitfirst($tmp[1], '<!--HeadmdEnd-->');
|
$tmp = splitfirst($tmp[1], '<!--HeadmdEnd-->');
|
||||||
if (isset($files['list']['head.md'])) {
|
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];
|
$html .= $headmd . $tmp[1];
|
||||||
while (strpos($html, '<!--HeadmdStart-->')) {
|
while (strpos($html, '<!--HeadmdStart-->')) {
|
||||||
$html = str_replace('<!--HeadmdStart-->', '', $html);
|
$html = str_replace('<!--HeadmdStart-->', '', $html);
|
||||||
|
@ -2627,7 +2626,7 @@ function render_list($path = '', $files = [])
|
||||||
$html = $tmp[0];
|
$html = $tmp[0];
|
||||||
$tmp = splitfirst($tmp[1], '<!--ReadmemdEnd-->');
|
$tmp = splitfirst($tmp[1], '<!--ReadmemdEnd-->');
|
||||||
if (isset($files['list']['readme.md'])) {
|
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];
|
$html .= $Readmemd . $tmp[1];
|
||||||
while (strpos($html, '<!--ReadmemdStart-->')) {
|
while (strpos($html, '<!--ReadmemdStart-->')) {
|
||||||
$html = str_replace('<!--ReadmemdStart-->', '', $html);
|
$html = str_replace('<!--ReadmemdStart-->', '', $html);
|
||||||
|
@ -2649,7 +2648,7 @@ function render_list($path = '', $files = [])
|
||||||
$html = $tmp[0];
|
$html = $tmp[0];
|
||||||
$tmp = splitfirst($tmp[1], '<!--FootomfEnd-->');
|
$tmp = splitfirst($tmp[1], '<!--FootomfEnd-->');
|
||||||
if (isset($files['list']['foot.omf'])) {
|
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];
|
$html .= $Footomf . $tmp[1];
|
||||||
|
|
||||||
|
|
|
@ -631,7 +631,7 @@ class Aliyundrive {
|
||||||
} else {
|
} else {
|
||||||
$str .= '
|
$str .= '
|
||||||
<script>
|
<script>
|
||||||
var status = "' . $response['status'] . '";
|
var status = "' . $response['DplStatus'] . '";
|
||||||
var uploadList = setInterval(function(){
|
var uploadList = setInterval(function(){
|
||||||
if (document.getElementById("dis").style.display=="none") {
|
if (document.getElementById("dis").style.display=="none") {
|
||||||
console.log(min++);
|
console.log(min++);
|
||||||
|
@ -702,7 +702,7 @@ class Aliyundrive {
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
var status = "' . $response['status'] . '";
|
var status = "' . $response['DplStatus'] . '";
|
||||||
function notnull(t)
|
function notnull(t)
|
||||||
{
|
{
|
||||||
if (t.driveId.value==\'\') {
|
if (t.driveId.value==\'\') {
|
||||||
|
@ -768,7 +768,7 @@ class Aliyundrive {
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
var status = "' . $response['status'] . '";
|
var status = "' . $response['DplStatus'] . '";
|
||||||
</script>
|
</script>
|
||||||
';
|
';
|
||||||
return message($html, $title, 201, 1);
|
return message($html, $title, 201, 1);
|
||||||
|
|
|
@ -510,7 +510,7 @@ class Onedrive {
|
||||||
var expires = "expires="+expd.toGMTString();
|
var expires = "expires="+expd.toGMTString();
|
||||||
document.cookie=\'disktag=; path=/; \'+expires;
|
document.cookie=\'disktag=; path=/; \'+expires;
|
||||||
var i = 0;
|
var i = 0;
|
||||||
var status = "' . $response['status'] . '";
|
var status = "' . $response['DplStatus'] . '";
|
||||||
var uploadList = setInterval(function(){
|
var uploadList = setInterval(function(){
|
||||||
if (document.getElementById("dis").style.display=="none") {
|
if (document.getElementById("dis").style.display=="none") {
|
||||||
console.log(i++);
|
console.log(i++);
|
||||||
|
@ -618,7 +618,7 @@ class Onedrive {
|
||||||
savecache('access_token', $ret['access_token'], $this->disktag, $ret['expires_in'] - 60);
|
savecache('access_token', $ret['access_token'], $this->disktag, $ret['expires_in'] - 60);
|
||||||
$html .= '<script>
|
$html .= '<script>
|
||||||
var i = 0;
|
var i = 0;
|
||||||
var status = "' . $response['status'] . '";
|
var status = "' . $response['DplStatus'] . '";
|
||||||
var uploadList = setInterval(function(){
|
var uploadList = setInterval(function(){
|
||||||
if (document.getElementById("dis").style.display=="none") {
|
if (document.getElementById("dis").style.display=="none") {
|
||||||
console.log(i++);
|
console.log(i++);
|
||||||
|
@ -699,7 +699,7 @@ class Onedrive {
|
||||||
if ($_POST['Drive_ver']!='Sharelink') $url .= '?install1&disktag=' . $_GET['disktag'] . '&AddDisk=' . $_POST['Drive_ver'];
|
if ($_POST['Drive_ver']!='Sharelink') $url .= '?install1&disktag=' . $_GET['disktag'] . '&AddDisk=' . $_POST['Drive_ver'];
|
||||||
$html .= '<script>
|
$html .= '<script>
|
||||||
var i = 0;
|
var i = 0;
|
||||||
var status = "' . $response['status'] . '";
|
var status = "' . $response['DplStatus'] . '";
|
||||||
var uploadList = setInterval(function(){
|
var uploadList = setInterval(function(){
|
||||||
if (document.getElementById("dis").style.display=="none") {
|
if (document.getElementById("dis").style.display=="none") {
|
||||||
console.log(i++);
|
console.log(i++);
|
||||||
|
|
|
@ -313,7 +313,11 @@ function updateHerokuapp($HerokuappId, $apikey, $source)
|
||||||
{
|
{
|
||||||
$tmp['source_blob']['url'] = $source;
|
$tmp['source_blob']['url'] = $source;
|
||||||
$data = json_encode($tmp);
|
$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)
|
function api_error($response)
|
||||||
|
@ -341,6 +345,16 @@ function setConfigResponse($response)
|
||||||
return json_decode( $response['body'], true );
|
return json_decode( $response['body'], true );
|
||||||
}
|
}
|
||||||
|
|
||||||
function WaitFunction() {
|
function WaitFunction($buildId = '') {
|
||||||
return true;
|
// 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,14 +187,14 @@ function install()
|
||||||
return message($html, $title, 400);
|
return message($html, $title, 400);
|
||||||
} else {
|
} else {
|
||||||
/*$html = '<script>
|
/*$html = '<script>
|
||||||
var status = "' . $response['status'] . '";
|
var status = "' . $response['DplStatus'] . '";
|
||||||
var expd = new Date();
|
var expd = new Date();
|
||||||
expd.setTime(expd.getTime()+1000);
|
expd.setTime(expd.getTime()+1000);
|
||||||
var expires = "expires="+expd.toGMTString();
|
var expires = "expires="+expd.toGMTString();
|
||||||
document.cookie=\'language=; path=/; \'+expires;
|
document.cookie=\'language=; path=/; \'+expires;
|
||||||
</script>';
|
</script>';
|
||||||
return message($html, $title, 201, 1);*/
|
return message($html, $title, 201, 1);*/
|
||||||
$data["dplId"] = $response['status'];
|
$data["dplId"] = $response['DplStatus'];
|
||||||
return output(json_encode($data), 201);
|
return output(json_encode($data), 201);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -362,7 +362,7 @@ function VercelUpdate($appId, $token, $sourcePath = "")
|
||||||
$response = curl("POST", $url, json_encode($data), $header);
|
$response = curl("POST", $url, json_encode($data), $header);
|
||||||
//echo json_encode($response, JSON_PRETTY_PRINT) . " ,res<br>";
|
//echo json_encode($response, JSON_PRETTY_PRINT) . " ,res<br>";
|
||||||
$result = json_decode($response["body"], true);
|
$result = json_decode($response["body"], true);
|
||||||
$result['status'] = $result['id'];
|
$result['DplStatus'] = $result['id'];
|
||||||
return json_encode($result);
|
return json_encode($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,7 +444,12 @@ function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch =
|
||||||
return VercelUpdate(getConfig('HerokuappId'), getConfig('APIKey'), $outPath);
|
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["Authorization"] = "Bearer " . getConfig('APIKey');
|
||||||
$header["Content-Type"] = "application/json";
|
$header["Content-Type"] = "application/json";
|
||||||
$url = "https://api.vercel.com/v11/now/deployments/" . $deployid;
|
$url = "https://api.vercel.com/v11/now/deployments/" . $deployid;
|
||||||
|
|
|
@ -185,14 +185,14 @@ function install()
|
||||||
return message($html, $title, 400);
|
return message($html, $title, 400);
|
||||||
} else {
|
} else {
|
||||||
/*$html = '<script>
|
/*$html = '<script>
|
||||||
var status = "' . $response['status'] . '";
|
var status = "' . $response['DplStatus'] . '";
|
||||||
var expd = new Date();
|
var expd = new Date();
|
||||||
expd.setTime(expd.getTime()+1000);
|
expd.setTime(expd.getTime()+1000);
|
||||||
var expires = "expires="+expd.toGMTString();
|
var expires = "expires="+expd.toGMTString();
|
||||||
document.cookie=\'language=; path=/; \'+expires;
|
document.cookie=\'language=; path=/; \'+expires;
|
||||||
</script>';
|
</script>';
|
||||||
return message($html, $title, 201, 1);*/
|
return message($html, $title, 201, 1);*/
|
||||||
$data["dplId"] = $response['status'];
|
$data["dplId"] = $response['DplStatus'];
|
||||||
return output(json_encode($data), 201);
|
return output(json_encode($data), 201);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -353,7 +353,7 @@ function VercelUpdate($appId, $token, $sourcePath = "")
|
||||||
$response = curl("POST", $url, json_encode($data), $header);
|
$response = curl("POST", $url, json_encode($data), $header);
|
||||||
//echo json_encode($response, JSON_PRETTY_PRINT) . " ,res<br>";
|
//echo json_encode($response, JSON_PRETTY_PRINT) . " ,res<br>";
|
||||||
$result = json_decode($response["body"], true);
|
$result = json_decode($response["body"], true);
|
||||||
$result['status'] = $result['id'];
|
$result['DplStatus'] = $result['id'];
|
||||||
return json_encode($result);
|
return json_encode($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,6 +431,11 @@ function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch =
|
||||||
}
|
}
|
||||||
|
|
||||||
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["Authorization"] = "Bearer " . getConfig('APIKey');
|
||||||
$header["Content-Type"] = "application/json";
|
$header["Content-Type"] = "application/json";
|
||||||
$url = "https://api.vercel.com/v11/now/deployments/" . $deployid;
|
$url = "https://api.vercel.com/v11/now/deployments/" . $deployid;
|
||||||
|
|
Loading…
Reference in New Issue