Increase upload timeout and other fixes

This commit is contained in:
2021-09-27 14:57:00 +02:00
parent 85a4ca2c9d
commit 268ca6c818
9 changed files with 22 additions and 13 deletions

View File

@@ -86,12 +86,13 @@ instead of inline rendering, which causes the browser to show a 'Save File'
dialog. dialog.
Warning: If a file is using too much bandwidth it can be rate limited. The rate Warning: If a file is using too much bandwidth it can be rate limited. The rate
limit will be enabled if a file has ten times more downloads than views. The limit will be enabled if a file has three times more downloads than views. The
owner of a file can always download it. When a file is rate limited the user owner of a file can always download it. When a file is rate limited the user
will need to fill out a captcha in order to continue downloading the file. The will need to fill out a captcha in order to continue downloading the file. The
captcha will only appear on the file viewer page (pixeldrain.com/u/{id}). Rate captcha will only appear on the file viewer page (pixeldrain.com/u/{id}). Rate
limiting has been added to prevent the spread of viruses and to stop direct limiting has been added to prevent the spread of viruses and to stop direct
linking. linking. Direct linking is only allowed when files are uploaded using a Pro
account.
Pixeldrain also includes a virus scanner. If a virus has been detected in a file Pixeldrain also includes a virus scanner. If a virus has been detected in a file
the user will also have to fill in a captcha to download it. the user will also have to fill in a captcha to download it.

View File

@@ -8,6 +8,7 @@ function VideoViewer(viewer, file, next) {
this.vidElement = document.createElement("video") this.vidElement = document.createElement("video")
this.vidElement.controls = "controls" this.vidElement.controls = "controls"
this.vidElement.playsInline = "playsInline"
this.vidElement.classList = "center drop_shadow" this.vidElement.classList = "center drop_shadow"
this.vidElement.addEventListener("ended", () => { this.next() }, false) this.vidElement.addEventListener("ended", () => { this.next() }, false)
if (!embeddedViewer) { if (!embeddedViewer) {
@@ -16,6 +17,7 @@ function VideoViewer(viewer, file, next) {
this.videoSource = document.createElement("source") this.videoSource = document.createElement("source")
this.videoSource.src = this.file.get_href this.videoSource.src = this.file.get_href
this.videoSource.type = this.file.mime_type
this.vidElement.appendChild(this.videoSource) this.vidElement.appendChild(this.videoSource)
this.vidContainer.appendChild(this.vidElement) this.vidContainer.appendChild(this.vidElement)

View File

@@ -305,7 +305,7 @@ p, .indent {
} }
li { li {
margin-bottom: 0.5em; margin-bottom: 0.3em;
} }
hr{ hr{

View File

@@ -88,8 +88,8 @@
window.api_endpoint = '{{.APIEndpoint}}'; window.api_endpoint = '{{.APIEndpoint}}';
window.user_subscription = {{.User.Subscription}}; window.user_subscription = {{.User.Subscription}};
</script> </script>
<link rel='stylesheet' href='/res/svelte/home_page.css?v1'> <link rel='stylesheet' href='/res/svelte/home_page.css?v2'>
<script defer src='/res/svelte/home_page.js?v1'></script> <script defer src='/res/svelte/home_page.js?v2'></script>
</head> </head>
<body> <body>
{{template "page_top" .}} {{template "page_top" .}}
@@ -135,10 +135,10 @@
</p> </p>
<p> <p>
Pixeldrain uses Pixeldrain uses
<a <a href="https://en.wikipedia.org/wiki/Byte#Multiple-byte_units"
href="https://en.wikipedia.org/wiki/Byte#Multiple-byte_units" target="_blank">SI target="_blank">SI standard units</a> for measuring file sizes.
standard units</a> for measuring file sizes. If you are using If you are using Microsoft Windows your files may appear smaller
Windows your files may appear smaller than they actually are. than they actually are.
</p> </p>
<br/> <br/>
<div class="feat_table"> <div class="feat_table">

View File

@@ -52,7 +52,7 @@ onMount(() => {
href="/admin/abuse_reporters" href="/admin/abuse_reporters"
class:button_highlight={page === "abuse_reporters"} class:button_highlight={page === "abuse_reporters"}
on:click|preventDefault={() => {navigate("abuse_reporters", "Abuse reporters")}}> on:click|preventDefault={() => {navigate("abuse_reporters", "Abuse reporters")}}>
<i class="icon">report</i> <i class="icon">email</i>
E-mail abuse reporters E-mail abuse reporters
</a> </a>
<a class="button" <a class="button"

View File

@@ -138,7 +138,10 @@ const stats_update = () => {
remaining_time = (elapsed_time/total_progress) - elapsed_time remaining_time = (elapsed_time/total_progress) - elapsed_time
// Calculate the rate by comparing the current progress with the last iteration // Calculate the rate by comparing the current progress with the last iteration
total_rate = (1000 / stats_interval_ms) * (total_loaded - last_total_loaded) total_rate = Math.floor(
(total_rate * 0.8) +
(((1000 / stats_interval_ms) * (total_loaded - last_total_loaded)) * 0.2)
)
last_total_loaded = total_loaded last_total_loaded = total_loaded
progress_bar_inner.style.width = (total_progress * 100) + "%" progress_bar_inner.style.width = (total_progress * 100) + "%"

View File

@@ -99,7 +99,7 @@ export const start = () => {
let xhr = new XMLHttpRequest(); let xhr = new XMLHttpRequest();
xhr.open("POST", window.api_endpoint+"/file", true); xhr.open("POST", window.api_endpoint+"/file", true);
xhr.timeout = 21600000; // 6 hours, to account for slow connections xhr.timeout = 86400000; // 24 hours, to account for slow connections
xhr.upload.addEventListener("progress", evt => { xhr.upload.addEventListener("progress", evt => {
if (evt.lengthComputable) { if (evt.lengthComputable) {

View File

@@ -126,6 +126,9 @@ onDestroy(() => {
(<a href="https://www.patreon.com/join/pixeldrain/checkout?edit=1">Manage subscription</a>) (<a href="https://www.patreon.com/join/pixeldrain/checkout?edit=1">Manage subscription</a>)
{/if} {/if}
<ul> <ul>
<li>
Max file size: {formatDataVolume(window.user.subscription.file_size_limit, 3)}
</li>
<li> <li>
Advertisements when viewing files: Advertisements when viewing files:
{#if window.user.subscription.disable_ad_display}No{:else}Yes{/if} {#if window.user.subscription.disable_ad_display}No{:else}Yes{/if}

View File

@@ -226,7 +226,7 @@ func (tm *TemplateManager) bgPattern() template.URL {
file = "checker_developers.png" file = "checker_developers.png"
} else if month == time.October && day == 31 { } else if month == time.October && day == 31 {
file = "checker_halloween.png" file = "checker_halloween.png"
} else if month == time.December && day == 25 || day == 26 || day == 27 { } else if month == time.December && (day == 25 || day == 26 || day == 27) {
file = "checker_christmas.png" file = "checker_christmas.png"
} else { } else {
file = fmt.Sprintf("checker%d.png", now.UnixNano()%18) file = fmt.Sprintf("checker%d.png", now.UnixNano()%18)