add littleFileCacheTime
parent
ee23cd636f
commit
8dea16da78
12
common.php
12
common.php
|
@ -38,6 +38,7 @@ $EnvConfigs = [
|
||||||
'useBasicAuth' => 0b010,
|
'useBasicAuth' => 0b010,
|
||||||
'referrer' => 0b011,
|
'referrer' => 0b011,
|
||||||
'forceHttps' => 0b010,
|
'forceHttps' => 0b010,
|
||||||
|
'littleFileCacheTime' => 0b010,
|
||||||
|
|
||||||
'Driver' => 0b100,
|
'Driver' => 0b100,
|
||||||
'client_id' => 0b100,
|
'client_id' => 0b100,
|
||||||
|
@ -392,6 +393,17 @@ function main($path)
|
||||||
$url = $files['url'];
|
$url = $files['url'];
|
||||||
if ( strtolower(splitlast($files['name'], '.')[1])=='html' ) return output($files['content']['body'], $files['content']['stat']);
|
if ( strtolower(splitlast($files['name'], '.')[1])=='html' ) return output($files['content']['body'], $files['content']['stat']);
|
||||||
else {
|
else {
|
||||||
|
$littleFileCacheTime = getConfig('littleFileCacheTime');
|
||||||
|
if ($files['size']<1024*1024 && !!$littleFileCacheTime) {
|
||||||
|
if ($littleFileCacheTime>1) $littleFileCacheTime *= 3600;
|
||||||
|
else $littleFileCacheTime = 3600;
|
||||||
|
return output(
|
||||||
|
base64_encode(file_get_contents($files['url'])),
|
||||||
|
200,
|
||||||
|
['Content-Type' => $files['mime'], 'Cache-Control' => 'max-age=' . $littleFileCacheTime],
|
||||||
|
true
|
||||||
|
);
|
||||||
|
}
|
||||||
if ($_SERVER['HTTP_RANGE']!='') $header['Range'] = $_SERVER['HTTP_RANGE'];
|
if ($_SERVER['HTTP_RANGE']!='') $header['Range'] = $_SERVER['HTTP_RANGE'];
|
||||||
$header['Location'] = $url;
|
$header['Location'] = $url;
|
||||||
$domainforproxy = '';
|
$domainforproxy = '';
|
||||||
|
|
|
@ -105,6 +105,7 @@ $constStr = [
|
||||||
'background' => 'Set an url as background photo.',
|
'background' => 'Set an url as background photo.',
|
||||||
'backgroundm' => 'Set an url as background in mobile phone.',
|
'backgroundm' => 'Set an url as background in mobile phone.',
|
||||||
'forceHttps' => 'if 1, force to redirect to https when visit via http.',
|
'forceHttps' => 'if 1, force to redirect to https when visit via http.',
|
||||||
|
'littleFileCacheTime' => 'Unit is hour, if set this, little file<1M will through program and cache in explorer, otherwise, default 302 to Microsoft',
|
||||||
'theme' => 'Select theme for guest.',
|
'theme' => 'Select theme for guest.',
|
||||||
'timezone' => 'Set default timezone.',
|
'timezone' => 'Set default timezone.',
|
||||||
'guestup_path' => 'Set guest upload dir, before set this, the files in this dir will show as normal.',
|
'guestup_path' => 'Set guest upload dir, before set this, the files in this dir will show as normal.',
|
||||||
|
@ -133,6 +134,7 @@ $constStr = [
|
||||||
'background' => '设置一个url作为背景。',
|
'background' => '设置一个url作为背景。',
|
||||||
'backgroundm' => '设置一个url作为手机端用的背景。',
|
'backgroundm' => '设置一个url作为手机端用的背景。',
|
||||||
'forceHttps' => '0或1。如果设置为1,会强制跳https',
|
'forceHttps' => '0或1。如果设置为1,会强制跳https',
|
||||||
|
'littleFileCacheTime' => '单位是小时,如果设置,小于1M的小文件会从程序通过然后缓存在浏览器,不然,默认302跳微软',
|
||||||
'theme' => '为游客选择一个主题。',
|
'theme' => '为游客选择一个主题。',
|
||||||
'timezone' => '设置默认时区。',
|
'timezone' => '设置默认时区。',
|
||||||
'guestup_path' => '设置游客上传路径(图床路径),不设置这个值时该目录内容会正常列文件出来,设置后只有上传界面,不显示其中文件(登录后显示)。',
|
'guestup_path' => '设置游客上传路径(图床路径),不设置这个值时该目录内容会正常列文件出来,设置后只有上传界面,不显示其中文件(登录后显示)。',
|
||||||
|
|
|
@ -30,7 +30,8 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
|
||||||
header($headerName . ': ' . $headerVal, true);
|
header($headerName . ': ' . $headerVal, true);
|
||||||
}
|
}
|
||||||
http_response_code($re['statusCode']);
|
http_response_code($re['statusCode']);
|
||||||
echo $re['body'];
|
if ($re['isBase64Encoded']) echo base64_decode($re['body']);
|
||||||
|
else echo $re['body'];
|
||||||
} elseif (isset($_SERVER['DOCUMENT_ROOT'])&&$_SERVER['DOCUMENT_ROOT']==='/var/task/user') {
|
} elseif (isset($_SERVER['DOCUMENT_ROOT'])&&$_SERVER['DOCUMENT_ROOT']==='/var/task/user') {
|
||||||
if (getenv('ONEMANAGER_CONFIG_SAVE')=='env') include 'platform/Vercel_env.php';
|
if (getenv('ONEMANAGER_CONFIG_SAVE')=='env') include 'platform/Vercel_env.php';
|
||||||
else include 'platform/Vercel.php';
|
else include 'platform/Vercel.php';
|
||||||
|
@ -44,7 +45,8 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
|
||||||
header($headerName . ': ' . $headerVal, true);
|
header($headerName . ': ' . $headerVal, true);
|
||||||
}
|
}
|
||||||
http_response_code($re['statusCode']);
|
http_response_code($re['statusCode']);
|
||||||
echo $re['body'];
|
if ($re['isBase64Encoded']) echo base64_decode($re['body']);
|
||||||
|
else echo $re['body'];
|
||||||
} else {
|
} else {
|
||||||
include 'platform/Normal.php';
|
include 'platform/Normal.php';
|
||||||
$path = getpath();
|
$path = getpath();
|
||||||
|
@ -58,7 +60,8 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
|
||||||
header($headerName . ': ' . $headerVal, true);
|
header($headerName . ': ' . $headerVal, true);
|
||||||
}
|
}
|
||||||
http_response_code($re['statusCode']);
|
http_response_code($re['statusCode']);
|
||||||
echo $re['body'];
|
if ($re['isBase64Encoded']) echo base64_decode($re['body']);
|
||||||
|
else echo $re['body'];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tencent SCF
|
// Tencent SCF
|
||||||
|
|
Loading…
Reference in New Issue