diff --git a/disk/Onedrive.php b/disk/Onedrive.php index 578b80b..ab8ce45 100644 --- a/disk/Onedrive.php +++ b/disk/Onedrive.php @@ -514,11 +514,11 @@ class Onedrive { } $api = $this->api_url . '/sites/root'; - $arr = curl('GET', $api, '', [ 'Authorization' => 'Bearer ' . $this->access_token ]); + $arr = $this->MSAPI('GET', $api); $Tenant = json_decode($arr['body'], true)['webUrl']; $api = $this->api_url . '/me/followedSites'; - $arr = curl('GET', $api, '', [ 'Authorization' => 'Bearer ' . $this->access_token ]); + $arr = $this->MSAPI('GET', $api); if (!($arr['stat']==200||$arr['stat']==403||$arr['stat']==400||$arr['stat']==404)) return message($arr['stat'] . json_encode(json_decode($arr['body']), JSON_PRETTY_PRINT), 'Get followedSites', $arr['stat']); error_log1($arr['body']); $sites = json_decode($arr['body'], true)['value']; @@ -812,7 +812,7 @@ class Onedrive { $i=0; $response = []; while ($url!=''&&$response['stat']!=200&&$i<4) { - $response = curl('GET', $url, false, ['Authorization' => 'Bearer ' . $this->access_token]); + $response = $this->MSAPI('GET', $url); $i++; } if ($response['stat']!=200) { @@ -990,7 +990,11 @@ class Onedrive { if ($response['stat']==429) { $res = json_decode($response['body'], true); $retryAfter = $res['error']['retryAfterSeconds']; - setConfig(['activeLimit' => time()+$retryAfter], $this->disktag); + $retryAfter_n = (int)$retryAfter; + if ($retryAfter_n>0) { + $tmp1['activeLimit'] = $retryAfter_n + time(); + setConfig($tmp1, $this->disktag); + } } curl_close($ch); error_log1($response['stat'].'