fileConduit
parent
d2909b85bc
commit
369e5c3394
18
common.php
18
common.php
|
@ -38,7 +38,6 @@ $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,
|
||||||
|
@ -60,6 +59,8 @@ $EnvConfigs = [
|
||||||
'guestup_path' => 0b111,
|
'guestup_path' => 0b111,
|
||||||
'domainforproxy' => 0b111,
|
'domainforproxy' => 0b111,
|
||||||
'public_path' => 0b111,
|
'public_path' => 0b111,
|
||||||
|
'fileConduitSize' => 0b110,
|
||||||
|
'fileConduitCacheTime' => 0b110,
|
||||||
];
|
];
|
||||||
|
|
||||||
$timezones = array(
|
$timezones = array(
|
||||||
|
@ -393,14 +394,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');
|
$fileConduitSize = getConfig('fileConduitSize', $_SERVER['disktag']);
|
||||||
if ($files['size']<1024*1024 && !!$littleFileCacheTime) {
|
$fileConduitCacheTime = getConfig('fileConduitCacheTime', $_SERVER['disktag']);
|
||||||
if ($littleFileCacheTime>1) $littleFileCacheTime *= 3600;
|
if (!!$fileConduitSize || !!$fileConduitCacheTime) {
|
||||||
else $littleFileCacheTime = 3600;
|
if ($fileConduitSize>1) $fileConduitSize *= 1024*1024;
|
||||||
return output(
|
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'])),
|
base64_encode(file_get_contents($files['url'])),
|
||||||
200,
|
200,
|
||||||
['Content-Type' => $files['mime'], 'Cache-Control' => 'max-age=' . $littleFileCacheTime],
|
['Content-Type' => $files['mime'], 'Cache-Control' => 'max-age=' . $fileConduitCacheTime],
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue