Add server overload warning to file preview section
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
import { formatDataVolume } from "../util/Formatting.svelte";
|
|
||||||
import { stats } from "../lib/StatsSocket.js"
|
|
||||||
|
|
||||||
let ad_type = ""
|
let ad_type = ""
|
||||||
|
|
||||||
@@ -21,17 +19,7 @@ onMount(() => {
|
|||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if $stats.limits_init && $stats.limits.server_overload}
|
{#if ad_type === "patreon_support"}
|
||||||
|
|
||||||
<div class="highlight_yellow" style="margin: 3px;">
|
|
||||||
Pixeldrain's servers are currently overloaded. In order to ensure
|
|
||||||
stability for our paying customers the free download limit has been
|
|
||||||
temporarily reduced to {formatDataVolume($stats.limits.transfer_limit,
|
|
||||||
3)}. If you want fast downloads, please return later when peak hours are
|
|
||||||
over.
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{:else if ad_type === "patreon_support"}
|
|
||||||
|
|
||||||
<div class="banner support_banner">
|
<div class="banner support_banner">
|
||||||
<span style="display: block; margin-bottom: 2px;">
|
<span style="display: block; margin-bottom: 2px;">
|
||||||
|
@@ -20,6 +20,8 @@ let file = {
|
|||||||
|
|
||||||
<FileTitle title={file.name}/>
|
<FileTitle title={file.name}/>
|
||||||
|
|
||||||
|
<slot></slot>
|
||||||
|
|
||||||
<IconBlock icon_href={file.icon_href}>
|
<IconBlock icon_href={file.icon_href}>
|
||||||
Type: {file.mime_type}<br/>
|
Type: {file.mime_type}<br/>
|
||||||
Size: {formatDataVolume(file.size, 3)}<br/>
|
Size: {formatDataVolume(file.size, 3)}<br/>
|
||||||
|
@@ -14,6 +14,7 @@ import Torrent from "./Torrent.svelte";
|
|||||||
import { stats } from "../../lib/StatsSocket.js"
|
import { stats } from "../../lib/StatsSocket.js"
|
||||||
import Zip from "./Zip.svelte";
|
import Zip from "./Zip.svelte";
|
||||||
import SlowDown from "../../layout/SlowDown.svelte";
|
import SlowDown from "../../layout/SlowDown.svelte";
|
||||||
|
import TextBlock from "../../layout/TextBlock.svelte";
|
||||||
|
|
||||||
let viewer
|
let viewer
|
||||||
let viewer_type = "loading"
|
let viewer_type = "loading"
|
||||||
@@ -32,6 +33,8 @@ 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.availability === "server_overload_captcha_required") {
|
||||||
|
viewer_type = "overload"
|
||||||
} else {
|
} else {
|
||||||
viewer_type = file_type(file)
|
viewer_type = file_type(file)
|
||||||
}
|
}
|
||||||
@@ -75,6 +78,17 @@ export const seek = delta => {
|
|||||||
file_type={current_file.mime_type}
|
file_type={current_file.mime_type}
|
||||||
icon_href={current_file.icon_href}
|
icon_href={current_file.icon_href}
|
||||||
/>
|
/>
|
||||||
|
{:else if viewer_type === "overload"}
|
||||||
|
<File bind:this={viewer} on:download on:reload>
|
||||||
|
<TextBlock><div class="highlight_yellow">
|
||||||
|
<p>
|
||||||
|
Pixeldrain's servers are currently overloaded. There are too
|
||||||
|
many people downloading too many things. In order to ensure
|
||||||
|
stability for our paying customers, free users are asked to
|
||||||
|
complete a CAPTCHA before starting a new download.
|
||||||
|
</p>
|
||||||
|
</div></TextBlock>
|
||||||
|
</File>
|
||||||
{:else if viewer_type === "rate_limit"}
|
{:else if viewer_type === "rate_limit"}
|
||||||
<RateLimit bind:this={viewer} on:download></RateLimit>
|
<RateLimit bind:this={viewer} on:download></RateLimit>
|
||||||
{:else if viewer_type === "image"}
|
{:else if viewer_type === "image"}
|
||||||
|
Reference in New Issue
Block a user