From 4630971e5cf69131fc19d094e5ec634578500377 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 11 Mar 2020 14:05:21 +0800 Subject: [PATCH 1/3] cache 30m, refresh token 7d --- function/common.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/function/common.php b/function/common.php index 35b7672..813eb83 100644 --- a/function/common.php +++ b/function/common.php @@ -91,7 +91,7 @@ function getcache($str) return $cache->fetch($str); } -function savecache($key, $value, $exp = 3300) +function savecache($key, $value, $exp = 1800) { $cache = null; $cache = new \Doctrine\Common\Cache\FilesystemCache(sys_get_temp_dir(), __DIR__.'/Onedrive/'.$_SERVER['disktag']); @@ -566,7 +566,7 @@ function main($path) error_log('Get access token:'.json_encode($ret, JSON_PRETTY_PRINT)); $_SERVER['access_token'] = $ret['access_token']; savecache('access_token', $_SERVER['access_token'], $ret['expires_in'] - 300); - if (time()>getConfig('token_expires')) setConfig([ 'refresh_token' => $ret['refresh_token'], 'token_expires' => time()+30*24*60*60 ]); + if (time()>getConfig('token_expires')) setConfig([ 'refresh_token' => $ret['refresh_token'], 'token_expires' => time()+7*24*60*60 ]); } $_SERVER['retry'] = 0; From a39089355aa17d1464407355adb60470395361b6 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 11 Mar 2020 14:16:01 +0800 Subject: [PATCH 2/3] Update common.php --- function/common.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/function/common.php b/function/common.php index 813eb83..393f994 100644 --- a/function/common.php +++ b/function/common.php @@ -624,8 +624,10 @@ function main($path) if (strtolower(splitlast($filename,'.')[1])==strtolower($_GET['random'])) $tmp[$filename] = $files['children'][$filename]['@microsoft.graph.downloadUrl']; } $tmp = array_values($tmp); - if (count($tmp)>0) return output('', 302, [ 'Location' => $tmp[rand(0,count($tmp)-1)] ]); - else return output('',404); + if (count($tmp)>0) { + if (isset($_GET['url'])) return output($tmp[rand(0,count($tmp)-1)], 200); + return output('', 302, [ 'Location' => $tmp[rand(0,count($tmp)-1)] ]); + } else return output('',404); } else return output('',401); } if (isset($files['file']) && !$_GET['preview']) { From f0e25b9ef5174bfeafcbde51cc80280bfbec9301 Mon Sep 17 00:00:00 2001 From: qkqpttgf <45693631+qkqpttgf@users.noreply.github.com> Date: Wed, 11 Mar 2020 18:42:47 +0800 Subject: [PATCH 3/3] Update conststr.php --- conststr.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conststr.php b/conststr.php index 2be8e31..550bc65 100644 --- a/conststr.php +++ b/conststr.php @@ -13,7 +13,7 @@ $constStr = [ 'zh-cn' => '中文', 'ja' => '日本語', 'ko-kr' => '한국어', - 'fa' => 'Persian', + 'fa' => 'فارسی', ], 'Week' => [ 'en-us' => [