Explain rate limits on download page
This commit is contained in:
@@ -21,7 +21,11 @@ export const set_file = async file => {
|
||||
return
|
||||
} else if (file.abuse_type !== "") {
|
||||
viewer_type = "abuse"
|
||||
} else if (file.availability === "file_rate_limited_captcha_required") {
|
||||
} else if (
|
||||
file.availability !== "file_rate_limited_captcha_required" ||
|
||||
file.availability !== "ip_download_limited_captcha_required" ||
|
||||
file.availability !== "ip_transfer_limited_captcha_required"
|
||||
) {
|
||||
viewer_type = "rate_limit"
|
||||
} else {
|
||||
viewer_type = file_type(file)
|
||||
|
@@ -1,5 +1,6 @@
|
||||
<script>
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import { createEventDispatcher, onMount } from "svelte";
|
||||
import { formatDataVolume } from "../../util/Formatting.svelte";
|
||||
import LargeFileMessage from "./LargeFileMessage.svelte";
|
||||
import TextBlock from "./TextBlock.svelte";
|
||||
let dispatch = createEventDispatcher()
|
||||
@@ -8,24 +9,65 @@ export const set_file = f => file = f
|
||||
let file = {
|
||||
name: "",
|
||||
mime_type: "",
|
||||
availability: "",
|
||||
}
|
||||
|
||||
let limits = {
|
||||
download_limit: 1000,
|
||||
download_limit_used: 0,
|
||||
transfer_limit: 50e9,
|
||||
transfer_limit_used: 0,
|
||||
}
|
||||
onMount(async () => {
|
||||
try {
|
||||
let resp = await fetch(window.api_endpoint+"/misc/rate_limits")
|
||||
if(resp.status >= 400) {
|
||||
throw new Error(await resp.text())
|
||||
}
|
||||
limits = await resp.json()
|
||||
} catch (err) {
|
||||
alert("Failed to get rate limits: "+err)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<TextBlock width="800px">
|
||||
<h1>
|
||||
<i class="icon">file_download_off</i>
|
||||
Hotlink protection enabled
|
||||
</h1>
|
||||
|
||||
<p>
|
||||
Hotlinking protection has been enabled for this file. This happens when
|
||||
a file is downloaded many times outside of our file viewer page (this
|
||||
page). Usually this means people are using download managers like
|
||||
JDownloader 2, Aria2 or wget. Using a download manager circumvents
|
||||
pixeldrain's advertisements and we lose money because of that. More
|
||||
information about this protection mechanism can be found on <a
|
||||
href="/#hotlinking">the home page</a>.
|
||||
</p>
|
||||
{#if file.availability === "file_rate_limited_captcha_required"}
|
||||
<h1>
|
||||
<i class="icon">file_download_off</i>
|
||||
Hotlink protection enabled
|
||||
</h1>
|
||||
<p>
|
||||
Hotlinking protection has been enabled for this file. This happens when
|
||||
a file is downloaded many times outside of our file viewer page (this
|
||||
page). Usually this means people are using download managers like
|
||||
JDownloader 2, Aria2 or wget. Using a download manager circumvents
|
||||
pixeldrain's advertisements and we lose money because of that. More
|
||||
information about this protection mechanism can be found on <a
|
||||
href="/#hotlinking">the home page</a>.
|
||||
</p>
|
||||
{:else if
|
||||
file.availability === "ip_download_limited_captcha_required" ||
|
||||
file.availability === "ip_transfer_limited_captcha_required"
|
||||
}
|
||||
<h1>
|
||||
<i class="icon">file_download_off</i>
|
||||
Download limit reached
|
||||
</h1>
|
||||
<p>
|
||||
You have reached your download limit for today. People without a
|
||||
pixeldrain account are limited to downloading
|
||||
{limits.download_limit} files or
|
||||
{formatDataVolume(limits.transfer_limit, 3)} per day. This limit is
|
||||
counted per IP address, so if you're on a shared network it's
|
||||
possible that others have also contributed to this limit.
|
||||
</p>
|
||||
<p>
|
||||
In the last 24 hours you have downloaded
|
||||
{limits.download_limit_used} files and used
|
||||
{formatDataVolume(limits.transfer_limit_used, 3)} bandwidth.
|
||||
</p>
|
||||
{/if}
|
||||
<p>
|
||||
This warning disappears when the you are a
|
||||
<a href="https://www.patreon.com/join/pixeldrain/checkout?rid=5291427&cadence=12" target="_blank">Patreon supporter</a>,
|
||||
|
Reference in New Issue
Block a user