Merge pull request #1 from qkqpttgf/master

1
pull/610/head
gd1214b 2021-09-10 18:04:56 +08:00 committed by GitHub
commit adf31f9e44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 5 deletions

View File

@ -59,6 +59,8 @@ $EnvConfigs = [
'guestup_path' => 0b111,
'domainforproxy' => 0b111,
'public_path' => 0b111,
'fileConduitSize' => 0b110,
'fileConduitCacheTime' => 0b110,
];
$timezones = array(
@ -392,6 +394,20 @@ function main($path)
$url = $files['url'];
if ( strtolower(splitlast($files['name'], '.')[1])=='html' ) return output($files['content']['body'], $files['content']['stat']);
else {
$fileConduitSize = getConfig('fileConduitSize', $_SERVER['disktag']);
$fileConduitCacheTime = getConfig('fileConduitCacheTime', $_SERVER['disktag']);
if (!!$fileConduitSize || !!$fileConduitCacheTime) {
if ($fileConduitSize>1) $fileConduitSize *= 1024*1024;
else $fileConduitSize = 1024*1024;
if ($fileConduitCacheTime>1) $fileConduitCacheTime *= 3600;
else $fileConduitCacheTime = 3600;
if ($files['size']<$fileConduitSize) return output(
base64_encode(file_get_contents($files['url'])),
200,
['Content-Type' => $files['mime'], 'Cache-Control' => 'max-age=' . $fileConduitCacheTime],
true
);
}
if ($_SERVER['HTTP_RANGE']!='') $header['Range'] = $_SERVER['HTTP_RANGE'];
$header['Location'] = $url;
$domainforproxy = '';

View File

@ -30,7 +30,8 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
header($headerName . ': ' . $headerVal, true);
}
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') {
if (getenv('ONEMANAGER_CONFIG_SAVE')=='env') include 'platform/Vercel_env.php';
else include 'platform/Vercel.php';
@ -44,7 +45,8 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
header($headerName . ': ' . $headerVal, true);
}
http_response_code($re['statusCode']);
echo $re['body'];
if ($re['isBase64Encoded']) echo base64_decode($re['body']);
else echo $re['body'];
} else {
include 'platform/Normal.php';
$path = getpath();
@ -58,7 +60,8 @@ if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
header($headerName . ': ' . $headerVal, true);
}
http_response_code($re['statusCode']);
echo $re['body'];
if ($re['isBase64Encoded']) echo base64_decode($re['body']);
else echo $re['body'];
}
// Tencent SCF

View File

@ -601,12 +601,12 @@
});
}
}
addVideos(['<!--FileEncodeUrl-->']);
addVideos(["<!--FileEncodeUrl-->"]);
<!--IsvideoFileEnd-->
<!--IspdfFileStart-->
pdfjsLib.GlobalWorkerOptions.workerSrc = '//cdn.bootcss.com/pdf.js/2.3.200/pdf.worker.min.js';
var loadingTask = pdfjsLib.getDocument({
url: '<!--FileDownUrl-->',
url: "<!--FileDownUrl-->",
cMapUrl: "//cdn.jsdelivr.net/npm/pdfjs-dist@2.2.228/cmaps/",
cMapPacked: true,
rangeChunkSize: 65535