Make copyrighted files available to the uploader

This commit is contained in:
2023-04-04 16:00:14 +02:00
parent e5fa6cfc88
commit 782492de35
7 changed files with 41 additions and 33 deletions

View File

@@ -29,6 +29,10 @@ export const download_file = () => {
download_frame.src = file.download_href
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")

View File

@@ -13,6 +13,7 @@ export const file_struct = {
hash_sha256: "",
show_ads: false,
can_edit: false,
can_download: false,
get_href: "",
info_href: "",
download_href: "",

View File

@@ -425,7 +425,7 @@ const keyboard_event = evt => {
<div class="separator"></div>
{#if file.abuse_type === "" && view === "file"}
{#if view === "file" && file.can_download}
<button
on:click={downloader.download_file}
class="toolbar_button"
@@ -435,7 +435,7 @@ const keyboard_event = evt => {
</button>
{/if}
{#if file.abuse_type === "" && is_list}
{#if is_list && file.can_download}
<button
on:click={downloader.download_list}
class="toolbar_button"

View File

@@ -24,12 +24,12 @@ $: downloads = list.files.reduce(
<div>
<div class="label">Files</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="stat">{formatThousands(views)}</div>
<div class="label">Downloads</div>
<div class="stat">{formatThousands(downloads)}</div>
<div class="label">Size</div>
<div class="stat">{formatDataVolume(size, 3)}</div>
</div>
<style>

View File

@@ -1,12 +1,18 @@
<script>
import { createEventDispatcher } from "svelte";
import IconBlock from "./IconBlock.svelte"
import TextBlock from "./TextBlock.svelte"
let dispatch = createEventDispatcher()
export const set_file = f => file = f
let file = {
id: "",
name: "",
abuse_type: "",
abuse_reporter_name: "",
can_download: false,
icon_href: "",
}
</script>
@@ -36,3 +42,16 @@ let file = {
pixeldrain.
</p>
</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}

View File

@@ -55,7 +55,7 @@ export const set_file = async file => {
<Spinner></Spinner>
</div>
{:else if viewer_type === "abuse"}
<Abuse bind:this={viewer}></Abuse>
<Abuse bind:this={viewer} on:download></Abuse>
{:else if viewer_type === "rate_limit"}
<RateLimit bind:this={viewer} on:download></RateLimit>
{:else if viewer_type === "image"}

View File

@@ -2,6 +2,7 @@
import { createEventDispatcher, onMount } from "svelte";
import { formatDataVolume } from "../../util/Formatting.svelte";
import { download_limits } from "../DownloadLimitStore";
import IconBlock from "./IconBlock.svelte";
import TextBlock from "./TextBlock.svelte";
let dispatch = createEventDispatcher()
@@ -47,7 +48,7 @@ let file = {
</p>
{/if}
<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>,
or when the uploader of the file enables
<a href="/user/subscription">bandwidth sharing</a> on their Pro account
@@ -63,32 +64,15 @@ let file = {
You will have to complete a CAPTCHA test to prove that you're not a
robot.
</p>
<img src={file.icon_href} alt="File icon" class="file_thumbnail">
<div class="file_description">
Name: {file.name}<br/>
Type: {file.mime_type}<br/>
<button on:click={() => {dispatch("download")}}>
<i class="icon">download</i> Download
</button>
<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
</a>
</div>
</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>
<IconBlock icon_href={file.icon_href}>
Name: {file.name}<br/>
Type: {file.mime_type}<br/>
<button on:click={() => {dispatch("download")}}>
<i class="icon">download</i> Download
</button>
<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
</a>
</IconBlock>