Make copyrighted files available to the uploader
This commit is contained in:
@@ -29,6 +29,10 @@ export const download_file = () => {
|
|||||||
download_frame.src = file.download_href
|
download_frame.src = file.download_href
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (!file.availability.endsWith("_captcha_required")) {
|
||||||
|
console.debug("File is unavailable, ignoring download request")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
console.debug("File is not readily available, showing captcha dialog")
|
console.debug("File is not readily available, showing captcha dialog")
|
||||||
|
|
||||||
|
@@ -13,6 +13,7 @@ export const file_struct = {
|
|||||||
hash_sha256: "",
|
hash_sha256: "",
|
||||||
show_ads: false,
|
show_ads: false,
|
||||||
can_edit: false,
|
can_edit: false,
|
||||||
|
can_download: false,
|
||||||
get_href: "",
|
get_href: "",
|
||||||
info_href: "",
|
info_href: "",
|
||||||
download_href: "",
|
download_href: "",
|
||||||
|
@@ -425,7 +425,7 @@ const keyboard_event = evt => {
|
|||||||
|
|
||||||
<div class="separator"></div>
|
<div class="separator"></div>
|
||||||
|
|
||||||
{#if file.abuse_type === "" && view === "file"}
|
{#if view === "file" && file.can_download}
|
||||||
<button
|
<button
|
||||||
on:click={downloader.download_file}
|
on:click={downloader.download_file}
|
||||||
class="toolbar_button"
|
class="toolbar_button"
|
||||||
@@ -435,7 +435,7 @@ const keyboard_event = evt => {
|
|||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if file.abuse_type === "" && is_list}
|
{#if is_list && file.can_download}
|
||||||
<button
|
<button
|
||||||
on:click={downloader.download_list}
|
on:click={downloader.download_list}
|
||||||
class="toolbar_button"
|
class="toolbar_button"
|
||||||
|
@@ -24,12 +24,12 @@ $: downloads = list.files.reduce(
|
|||||||
<div>
|
<div>
|
||||||
<div class="label">Files</div>
|
<div class="label">Files</div>
|
||||||
<div class="stat">{list.files.length}</div>
|
<div class="stat">{list.files.length}</div>
|
||||||
<div class="label">Size</div>
|
|
||||||
<div class="stat">{formatDataVolume(size, 3)}</div>
|
|
||||||
<div class="label">Views</div>
|
<div class="label">Views</div>
|
||||||
<div class="stat">{formatThousands(views)}</div>
|
<div class="stat">{formatThousands(views)}</div>
|
||||||
<div class="label">Downloads</div>
|
<div class="label">Downloads</div>
|
||||||
<div class="stat">{formatThousands(downloads)}</div>
|
<div class="stat">{formatThousands(downloads)}</div>
|
||||||
|
<div class="label">Size</div>
|
||||||
|
<div class="stat">{formatDataVolume(size, 3)}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@@ -1,12 +1,18 @@
|
|||||||
<script>
|
<script>
|
||||||
|
import { createEventDispatcher } from "svelte";
|
||||||
|
import IconBlock from "./IconBlock.svelte"
|
||||||
import TextBlock from "./TextBlock.svelte"
|
import TextBlock from "./TextBlock.svelte"
|
||||||
|
|
||||||
|
let dispatch = createEventDispatcher()
|
||||||
|
|
||||||
export const set_file = f => file = f
|
export const set_file = f => file = f
|
||||||
let file = {
|
let file = {
|
||||||
id: "",
|
id: "",
|
||||||
name: "",
|
name: "",
|
||||||
abuse_type: "",
|
abuse_type: "",
|
||||||
abuse_reporter_name: "",
|
abuse_reporter_name: "",
|
||||||
|
can_download: false,
|
||||||
|
icon_href: "",
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -36,3 +42,16 @@ let file = {
|
|||||||
pixeldrain.
|
pixeldrain.
|
||||||
</p>
|
</p>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
|
|
||||||
|
{#if file.can_download}
|
||||||
|
<IconBlock icon_href={file.icon_href}>
|
||||||
|
|
||||||
|
This file cannot be shared, but since you are the uploader of the file
|
||||||
|
you can still download it.
|
||||||
|
<br/>
|
||||||
|
<button class="button_highlight" on:click={() => {dispatch("download")}}>
|
||||||
|
<i class="icon">download</i>
|
||||||
|
<span>Download</span>
|
||||||
|
</button>
|
||||||
|
</IconBlock>
|
||||||
|
{/if}
|
||||||
|
@@ -55,7 +55,7 @@ export const set_file = async file => {
|
|||||||
<Spinner></Spinner>
|
<Spinner></Spinner>
|
||||||
</div>
|
</div>
|
||||||
{:else if viewer_type === "abuse"}
|
{:else if viewer_type === "abuse"}
|
||||||
<Abuse bind:this={viewer}></Abuse>
|
<Abuse bind:this={viewer} on:download></Abuse>
|
||||||
{: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"}
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
import { createEventDispatcher, onMount } from "svelte";
|
import { createEventDispatcher, onMount } from "svelte";
|
||||||
import { formatDataVolume } from "../../util/Formatting.svelte";
|
import { formatDataVolume } from "../../util/Formatting.svelte";
|
||||||
import { download_limits } from "../DownloadLimitStore";
|
import { download_limits } from "../DownloadLimitStore";
|
||||||
|
import IconBlock from "./IconBlock.svelte";
|
||||||
import TextBlock from "./TextBlock.svelte";
|
import TextBlock from "./TextBlock.svelte";
|
||||||
let dispatch = createEventDispatcher()
|
let dispatch = createEventDispatcher()
|
||||||
|
|
||||||
@@ -47,7 +48,7 @@ let file = {
|
|||||||
</p>
|
</p>
|
||||||
{/if}
|
{/if}
|
||||||
<p>
|
<p>
|
||||||
This warning disappears when the you are a
|
This warning disappears when you are a
|
||||||
<a href="https://www.patreon.com/join/pixeldrain/checkout?rid=5736701&cadence=12" target="_blank" rel="noreferrer">Patreon supporter</a>,
|
<a href="https://www.patreon.com/join/pixeldrain/checkout?rid=5736701&cadence=12" target="_blank" rel="noreferrer">Patreon supporter</a>,
|
||||||
or when the uploader of the file enables
|
or when the uploader of the file enables
|
||||||
<a href="/user/subscription">bandwidth sharing</a> on their Pro account
|
<a href="/user/subscription">bandwidth sharing</a> on their Pro account
|
||||||
@@ -63,9 +64,9 @@ let file = {
|
|||||||
You will have to complete a CAPTCHA test to prove that you're not a
|
You will have to complete a CAPTCHA test to prove that you're not a
|
||||||
robot.
|
robot.
|
||||||
</p>
|
</p>
|
||||||
|
</TextBlock>
|
||||||
|
|
||||||
<img src={file.icon_href} alt="File icon" class="file_thumbnail">
|
<IconBlock icon_href={file.icon_href}>
|
||||||
<div class="file_description">
|
|
||||||
Name: {file.name}<br/>
|
Name: {file.name}<br/>
|
||||||
Type: {file.mime_type}<br/>
|
Type: {file.mime_type}<br/>
|
||||||
<button on:click={() => {dispatch("download")}}>
|
<button on:click={() => {dispatch("download")}}>
|
||||||
@@ -74,21 +75,4 @@ let file = {
|
|||||||
<a href="https://www.patreon.com/join/pixeldrain" target="_blank" class="button button_highlight" rel="noreferrer">
|
<a href="https://www.patreon.com/join/pixeldrain" target="_blank" class="button button_highlight" rel="noreferrer">
|
||||||
<i class="icon">bolt</i> Support Pixeldrain on Patreon
|
<i class="icon">bolt</i> Support Pixeldrain on Patreon
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</IconBlock>
|
||||||
</TextBlock>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.file_thumbnail {
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: middle;
|
|
||||||
height: 6em;
|
|
||||||
border-radius: 8px;
|
|
||||||
}
|
|
||||||
.file_description {
|
|
||||||
display: inline-block;
|
|
||||||
text-align: left;
|
|
||||||
padding-left: 8px;
|
|
||||||
vertical-align: middle;
|
|
||||||
max-width: 600px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
Reference in New Issue
Block a user