Improve downloading progress

This commit is contained in:
bohwaz 2022-11-22 03:55:13 +01:00
parent ea3510e3df
commit fd043b72c1
1 changed files with 25 additions and 9 deletions

View File

@ -1842,7 +1842,7 @@ RewriteRule ^.*$ /index.php [END]
header('Content-Type: text/css', true); header('Content-Type: text/css', true);
} }
$seconds_to_cache = 3600 * 24 * 365; $seconds_to_cache = 3600 * 24 * 5;
$ts = gmdate("D, d M Y H:i:s", time() + $seconds_to_cache) . " GMT"; $ts = gmdate("D, d M Y H:i:s", time() + $seconds_to_cache) . " GMT";
header("Expires: " . $ts); header("Expires: " . $ts);
header("Pragma: cache"); header("Pragma: cache");
@ -1851,12 +1851,12 @@ RewriteRule ^.*$ /index.php [END]
$fp = fopen(__FILE__, 'r'); $fp = fopen(__FILE__, 'r');
if ($relative_uri == '.webdav/webdav.js') { if ($relative_uri == '.webdav/webdav.js') {
fseek($fp, 49805, SEEK_SET); fseek($fp, 49803, SEEK_SET);
echo fread($fp, 27579); echo fread($fp, 27769);
} }
else { else {
fseek($fp, 49805 + 27579, SEEK_SET); fseek($fp, 49803 + 27769, SEEK_SET);
echo fread($fp, 6801); echo fread($fp, 6988);
} }
fclose($fp); fclose($fp);
@ -2082,8 +2082,9 @@ const WebDAVNavigator = (url, options) => {
const get_url = async (url) => { const get_url = async (url) => {
var progress = (e) => { var progress = (e) => {
var p = $('progress'); var p = $('progress');
if (!p) return; if (!p || e.loaded <= 0) return;
p.value = e.loaded; p.value = e.loaded;
$('.progress_bytes').innerHTML = formatBytes(e.loaded);
}; };
if (temp_object_url) { if (temp_object_url) {
@ -2224,7 +2225,10 @@ const WebDAVNavigator = (url, options) => {
return true; return true;
}; };
openDialog(`<h3>${html(name)}</h3><progress max="${size}"></progress>`, false); openDialog(`<p class="spinner"><span></span></p>
<h3>${html(name)}</h3>
<progress max="${size}"></progress>
<p><span class="progress_bytes"></span> / ${formatBytes(size)}</p>`, false);
await get_url(url); await get_url(url);
const a = document.createElement('a'); const a = document.createElement('a');
@ -3121,11 +3125,12 @@ input[name=rename], input[name=paste_name] {
width: 0; width: 0;
height: 0; height: 0;
border: none; border: none;
display: flex; align-items: center;
justify-content: center;
opacity: 0; opacity: 0;
} }
.loading .bg::after { .loading .bg::after, .spinner span::after {
display: block; display: block;
content: " "; content: " ";
width: 70px; width: 70px;
@ -3148,6 +3153,17 @@ input[name=rename], input[name=paste_name] {
position: absolute; position: absolute;
} }
.spinner {
align-items: center;
justify-content: center;
display: flex;
}
.spinner span::after {
width: 30px;
height: 30px;
}
.loading .bg, .dragging .bg, .dialog .bg { .loading .bg, .dragging .bg, .dialog .bg {
backdrop-filter: blur(5px); backdrop-filter: blur(5px);
background: rgba(0, 0, 0, 0.5); background: rgba(0, 0, 0, 0.5);