add WaitFunction in operate

This commit is contained in:
root
2021-08-17 11:51:17 +00:00
parent 729e1e1176
commit f2ee21b683
13 changed files with 340 additions and 138 deletions
+26 -13
View File
@@ -629,8 +629,19 @@ class Aliyundrive {
$title = 'Error';
return message($html, $title, 201);
} else {
$str .= '<meta http-equiv="refresh" content="5;URL=' . $url . '">';
return message($str, getconstStr('WaitJumpIndex'), 201);
$str .= '
<script>
var status = "' . $response['status'] . '";
var uploadList = setInterval(function(){
if (document.getElementById("dis").style.display=="none") {
console.log(min++);
} else {
clearInterval(uploadList);
location.href = "' . $url . '";
}
}, 1000);
</script>';
return message($str, getconstStr('WaitJumpIndex'), 201, 1);
}
}
if (isset($_GET['SelectDrive'])) {
@@ -691,17 +702,18 @@ class Aliyundrive {
</form>
</div>
<script>
function notnull(t)
{
if (t.driveId.value==\'\') {
alert(\'Select a Disk\');
return false;
}
return true;
var status = "' . $response['status'] . '";
function notnull(t)
{
if (t.driveId.value==\'\') {
alert(\'Select a Disk\');
return false;
}
</script>
return true;
}
</script>
';
return message($html, $title, 201);
return message($html, $title, 201, 1);
}
if (isset($_GET['install0']) && $_POST['disktag_add']!='') {
$_POST['disktag_add'] = preg_replace('/[^0-9a-zA-Z|_]/i', '', $_POST['disktag_add']);
@@ -737,7 +749,7 @@ class Aliyundrive {
if (api_error($response)) {
$html = api_error_msg($response);
$title = 'Error';
return message($html, $title, 201);
return message($html, $title, 400);
} else {
$title = 'Refresh token';
$html = '
@@ -756,9 +768,10 @@ class Aliyundrive {
}
return true;
}
var status = "' . $response['status'] . '";
</script>
';
return message($html, $title, 201);
return message($html, $title, 201, 1);
}
}
+44 -11
View File
@@ -504,14 +504,23 @@ class Onedrive {
$title = 'Error';
return message($html, $title, 201);
} else {
$str .= '<meta http-equiv="refresh" content="5;URL=' . $url . '">
<script>
$html .= '<script>
var expd = new Date();
expd.setTime(expd.getTime()+1);
var expires = "expires="+expd.toGMTString();
document.cookie=\'disktag=; path=/; \'+expires;
var i = 0;
var status = "' . $response['status'] . '";
var uploadList = setInterval(function(){
if (document.getElementById("dis").style.display=="none") {
console.log(i++);
} else {
clearInterval(uploadList);
location.href = "' . $url . '";
}
}, 1000);
</script>';
return message($str, getconstStr('WaitJumpIndex'), 201);
return message($html, getconstStr('WaitJumpIndex'), 201, 1);
}
}
@@ -607,9 +616,19 @@ class Onedrive {
return message($html, $title, 201);
} else {
savecache('access_token', $ret['access_token'], $this->disktag, $ret['expires_in'] - 60);
$str .= '
<meta http-equiv="refresh" content="3;URL=' . $url . '?AddDisk=' . get_class($this) . '&disktag=' . $_GET['disktag'] . '&SelectDrive">';
return message($str, getconstStr('Wait') . ' 3s', 201);
$html .= '<script>
var i = 0;
var status = "' . $response['status'] . '";
var uploadList = setInterval(function(){
if (document.getElementById("dis").style.display=="none") {
console.log(i++);
} else {
clearInterval(uploadList);
location.href = "' . $url . '?AddDisk=' . get_class($this) . '&disktag=' . $_GET['disktag'] . '&SelectDrive";
}
}, 1000);
</script>';
return message($html, getconstStr('Wait') . ' 3s', 201, 1);
}
}
return message('<pre>' . json_encode(json_decode($tmp['body']), JSON_PRETTY_PRINT) . '</pre>', $tmp['stat']);
@@ -639,7 +658,7 @@ class Onedrive {
$f = substr($_POST['disktag_add'], 0, 1);
if (strlen($_POST['disktag_add'])==1) $_POST['disktag_add'] .= '_';
if (isCommonEnv($_POST['disktag_add'])) {
return message('Do not input ' . $envs . '<br><button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>', 'Error', 201);
return message('Do not input ' . $envs . '<br><button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>', 'Error', 400);
} elseif (!(('a'<=$f && $f<='z') || ('A'<=$f && $f<='Z'))) {
return message('Please start with letters<br><button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>
<script>
@@ -647,7 +666,7 @@ class Onedrive {
expd.setTime(expd.getTime()+1);
var expires = "expires="+expd.toGMTString();
document.cookie=\'disktag=; path=/; \'+expires;
</script>', 'Error', 201);
</script>', 'Error', 400);
}
$tmp = null;
@@ -673,12 +692,26 @@ class Onedrive {
if (api_error($response)) {
$html = api_error_msg($response);
$title = 'Error';
return message($html, $title, 400);
} else {
$title = getconstStr('MayinEnv');
$html = getconstStr('Wait') . ' 3s<meta http-equiv="refresh" content="3;URL=' . $url . '?install1&disktag=' . $_GET['disktag'] . '&AddDisk=' . $_POST['Drive_ver'] . '">';
if ($_POST['Drive_ver']=='Sharelink') $html = getconstStr('Wait') . ' 3s<meta http-equiv="refresh" content="3;URL=' . $url . '">';
$html = getconstStr('Wait');
if ($_POST['Drive_ver']!='Sharelink') $url .= '?install1&disktag=' . $_GET['disktag'] . '&AddDisk=' . $_POST['Drive_ver'];
$html .= '<script>
var i = 0;
var status = "' . $response['status'] . '";
var uploadList = setInterval(function(){
if (document.getElementById("dis").style.display=="none") {
console.log(i++);
} else {
clearInterval(uploadList);
location.href = "' . $url . '";
}
}, 1000);
</script>';
return message($html, $title, 201, 1);
}
return message($html, $title, 201);
}
}