Fix download limit trigger

This commit is contained in:
2023-01-30 11:09:16 +01:00
parent 365efe3f9e
commit 3b18934d27
3 changed files with 9 additions and 6 deletions

View File

@@ -42,8 +42,11 @@ const loop = async () => {
// If the usage has not changed we increase the timeout with one second. If
// it did change we halve the timeout
if (new_limits.transfer_limit_used === limits.transfer_limit_used) {
timeout_ms += 1000
if (
new_limits.transfer_limit_used === limits.transfer_limit_used &&
new_limits.transfer_limit === limits.transfer_limit
) {
timeout_ms += 2000
if (timeout_ms > 60000) {
timeout_ms = 60000
}

View File

@@ -19,6 +19,7 @@ let viewer
let viewer_type = "loading"
export let is_list = false
let current_file
let premium_download = false
export const set_file = async file => {
if (file.id === "") {
@@ -31,14 +32,13 @@ export const set_file = async file => {
file.availability === "ip_download_limited_captcha_required"
) {
viewer_type = "rate_limit"
} else if (file.download_speed_limit > 0 && file.download_speed_limit <= 1<<20) {
viewer_type = "speed_limit"
} else {
viewer_type = file_type(file)
}
console.log("opening file", file)
current_file = file
premium_download = !file.show_ads
// Render the viewer component and set the file type
await tick()
@@ -48,7 +48,7 @@ export const set_file = async file => {
}
</script>
{#if $download_limits.transfer_limit_used > $download_limits.transfer_limit}
{#if !premium_download && $download_limits.transfer_limit_used > $download_limits.transfer_limit}
<SpeedLimit file={current_file} on:download></SpeedLimit>
{:else if viewer_type === "loading"}
<div class="center">

View File

@@ -94,7 +94,7 @@ onMount(() => {
<p>
Here is a log of all transactions on your account balance. Usage is
calculated per day. The storage charge is divided by the average number
of months in a day (30.4375).
of days in a month (30.4375).
</p>
<p>
Example: If you have 2 TB stored on your pixeldrain account at €4 per TB