Subscription management and bandwidth accounting
This commit is contained in:
@@ -45,6 +45,9 @@ let update_charts = () => {
|
||||
resp.bandwidth.amounts.forEach((val, idx) => {
|
||||
resp.bandwidth.amounts[idx] = Math.round(val / file.size);
|
||||
});
|
||||
resp.bandwidth_paid.amounts.forEach((val, idx) => {
|
||||
resp.bandwidth.amounts[idx] += Math.round(val / file.size);
|
||||
});
|
||||
download_chart.chart().data.labels = resp.views.timestamps
|
||||
view_chart.chart().data.labels = resp.views.timestamps
|
||||
download_chart.chart().data.datasets[0].data = resp.bandwidth.amounts
|
||||
@@ -78,8 +81,20 @@ let update_charts = () => {
|
||||
<td>{formatDataVolume(file.size, 4)} ( {formatThousands(file.size)} B )</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Bandwidth</td>
|
||||
<td>{formatDataVolume(file.bandwidth_used, 4)} ( {formatThousands(file.bandwidth_used)} B )</td>
|
||||
<td>Free bandwidth used</td>
|
||||
<td>
|
||||
{formatDataVolume(file.bandwidth_used, 4)}
|
||||
( {formatThousands(file.bandwidth_used)} B ),
|
||||
{(file.bandwidth_used/file.size).toFixed(1)}x file size
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Premium bandwidth used</td>
|
||||
<td>
|
||||
{formatDataVolume(file.bandwidth_used_paid, 4)}
|
||||
( {formatThousands(file.bandwidth_used_paid)} B ),
|
||||
{(file.bandwidth_used_paid/file.size).toFixed(1)}x file size
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="border-bottom: none">
|
||||
<td>Unique downloads</td>
|
||||
|
@@ -50,7 +50,7 @@ let update_stats = (id) => {
|
||||
if (file.size === 0) {
|
||||
downloads = j.downloads
|
||||
} else {
|
||||
downloads = Math.round(j.bandwidth / file.size)
|
||||
downloads = Math.round((j.bandwidth + j.bandwidth_paid) / file.size)
|
||||
}
|
||||
}
|
||||
socket.onerror = err => {
|
||||
|
@@ -437,7 +437,7 @@ const keyboard_event = evt => {
|
||||
</FilePreview>
|
||||
</div>
|
||||
|
||||
{#if current_file.show_ads && window.viewer_data.user_ads_enabled}
|
||||
{#if current_file.show_ads}
|
||||
<AdSkyscraper on:visibility={e => {skyscraper_visible = e.detail}}></AdSkyscraper>
|
||||
{/if}
|
||||
|
||||
|
Reference in New Issue
Block a user