mirror of
https://git.v0l.io/Kieran/void.cat.git
synced 2025-04-04 04:38:01 +02:00
add transfer stat
This commit is contained in:
parent
e78a2b9130
commit
365cdf4fd2
@ -39,7 +39,9 @@ const API = {
|
||||
const Util = {
|
||||
formatBytes: function (b, f) {
|
||||
f = f === undefined ? 2 : f;
|
||||
if (b >= 1073741824) {
|
||||
if(b >= 1099511627776) {
|
||||
return (b / 1099511627776.0).toFixed(f) + ' TiB';
|
||||
}else if (b >= 1073741824) {
|
||||
return (b / 1073741824.0).toFixed(f) + ' GiB';
|
||||
} else if (b >= 1048576) {
|
||||
return (b / 1048576.0).toFixed(f) + ' MiB';
|
||||
|
@ -39,7 +39,7 @@
|
||||
}
|
||||
|
||||
.stats div {
|
||||
width: 33.333%;
|
||||
width: 25%;
|
||||
float: left;
|
||||
}
|
||||
|
||||
@ -54,6 +54,12 @@
|
||||
line-height: 200px;
|
||||
}
|
||||
}
|
||||
|
||||
@media(max-width: 520px) {
|
||||
.stats b {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<div class="drop-zone">
|
||||
Max size [[formatBytes(maxSize, 0)]]
|
||||
@ -62,6 +68,7 @@
|
||||
<div><b>Files:</b> [[stats.files]]</div>
|
||||
<div><b>Total Size:</b> [[formatBytes(stats.size, 1)]]</div>
|
||||
<div><b>Avg Size:</b> [[formatBytes(stats.avgSize, 1)]]</div>
|
||||
<div><b>Transfer:</b> [[formatBytes(stats.transfer, 1)]]</div>
|
||||
</div>
|
||||
<template is="dom-if" if="[[expire]]">
|
||||
<br/><i class="note">**Expires after [[expire]] days since last view</i>
|
||||
|
@ -16,7 +16,7 @@
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
@media(max-width: 470px) {
|
||||
@media(max-width: 520px) {
|
||||
img {
|
||||
width: 100%;
|
||||
}
|
||||
|
@ -30,16 +30,17 @@
|
||||
{
|
||||
$res = new FileStats();
|
||||
|
||||
$stmt = $this->mysqli->prepare("select count(hash160), sum(size), avg(size) from files");
|
||||
$stmt = $this->mysqli->prepare("select count(hash160), sum(size), avg(size), sum(views * size) from files");
|
||||
if($stmt)
|
||||
{
|
||||
$stmt->execute();
|
||||
$stmt->bind_result($res->files, $res->size, $res->avgSize);
|
||||
$stmt->bind_result($res->files, $res->size, $res->avgSize, $res->transfer);
|
||||
$stmt->fetch();
|
||||
$stmt->close();
|
||||
|
||||
$res->size = floatval($res->size);
|
||||
$res->avgSize = floatval($res->avgSize);
|
||||
$res->transfer = floatval($res->transfer);
|
||||
}
|
||||
|
||||
return $res;
|
||||
|
@ -16,5 +16,6 @@
|
||||
public $files;
|
||||
public $size;
|
||||
public $avgSize;
|
||||
public $transfer;
|
||||
}
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user