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 // If the usage has not changed we increase the timeout with one second. If
// it did change we halve the timeout // it did change we halve the timeout
if (new_limits.transfer_limit_used === limits.transfer_limit_used) { if (
timeout_ms += 1000 new_limits.transfer_limit_used === limits.transfer_limit_used &&
new_limits.transfer_limit === limits.transfer_limit
) {
timeout_ms += 2000
if (timeout_ms > 60000) { if (timeout_ms > 60000) {
timeout_ms = 60000 timeout_ms = 60000
} }

View File

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

View File

@@ -94,7 +94,7 @@ onMount(() => {
<p> <p>
Here is a log of all transactions on your account balance. Usage is 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 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>
<p> <p>
Example: If you have 2 TB stored on your pixeldrain account at €4 per TB Example: If you have 2 TB stored on your pixeldrain account at €4 per TB