From 268ca6c818c2a3bc458633a44cc2947bfa3dfc24 Mon Sep 17 00:00:00 2001 From: Wim Brand Date: Mon, 27 Sep 2021 14:57:00 +0200 Subject: [PATCH] Increase upload timeout and other fixes --- res/include/md/api_file.md | 5 +++-- .../script/file_viewer/viewer_scripts/VideoViewer.js | 2 ++ res/include/style/layout.css | 2 +- res/template/home.html | 12 ++++++------ svelte/src/admin_panel/Router.svelte | 2 +- svelte/src/home_page/HomePage.svelte | 5 ++++- svelte/src/home_page/UploadProgressBar.svelte | 2 +- svelte/src/user_home/Home.svelte | 3 +++ webcontroller/templates.go | 2 +- 9 files changed, 22 insertions(+), 13 deletions(-) diff --git a/res/include/md/api_file.md b/res/include/md/api_file.md index f683840..12c69d7 100644 --- a/res/include/md/api_file.md +++ b/res/include/md/api_file.md @@ -86,12 +86,13 @@ instead of inline rendering, which causes the browser to show a 'Save File' dialog. 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 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 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 the user will also have to fill in a captcha to download it. diff --git a/res/include/script/file_viewer/viewer_scripts/VideoViewer.js b/res/include/script/file_viewer/viewer_scripts/VideoViewer.js index 7a0e3f7..10f020b 100644 --- a/res/include/script/file_viewer/viewer_scripts/VideoViewer.js +++ b/res/include/script/file_viewer/viewer_scripts/VideoViewer.js @@ -8,6 +8,7 @@ function VideoViewer(viewer, file, next) { this.vidElement = document.createElement("video") this.vidElement.controls = "controls" + this.vidElement.playsInline = "playsInline" this.vidElement.classList = "center drop_shadow" this.vidElement.addEventListener("ended", () => { this.next() }, false) if (!embeddedViewer) { @@ -16,6 +17,7 @@ function VideoViewer(viewer, file, next) { this.videoSource = document.createElement("source") this.videoSource.src = this.file.get_href + this.videoSource.type = this.file.mime_type this.vidElement.appendChild(this.videoSource) this.vidContainer.appendChild(this.vidElement) diff --git a/res/include/style/layout.css b/res/include/style/layout.css index 186d4fa..f7d833a 100644 --- a/res/include/style/layout.css +++ b/res/include/style/layout.css @@ -305,7 +305,7 @@ p, .indent { } li { - margin-bottom: 0.5em; + margin-bottom: 0.3em; } hr{ diff --git a/res/template/home.html b/res/template/home.html index 79ab99d..83a70db 100644 --- a/res/template/home.html +++ b/res/template/home.html @@ -88,8 +88,8 @@ window.api_endpoint = '{{.APIEndpoint}}'; window.user_subscription = {{.User.Subscription}}; - - + + {{template "page_top" .}} @@ -135,10 +135,10 @@

Pixeldrain uses - SI - standard units for measuring file sizes. If you are using - Windows your files may appear smaller than they actually are. + SI standard units for measuring file sizes. + If you are using Microsoft Windows your files may appear smaller + than they actually are.


diff --git a/svelte/src/admin_panel/Router.svelte b/svelte/src/admin_panel/Router.svelte index 4b4761f..e6fd500 100644 --- a/svelte/src/admin_panel/Router.svelte +++ b/svelte/src/admin_panel/Router.svelte @@ -52,7 +52,7 @@ onMount(() => { href="/admin/abuse_reporters" class:button_highlight={page === "abuse_reporters"} on:click|preventDefault={() => {navigate("abuse_reporters", "Abuse reporters")}}> - report + email E-mail abuse reporters { remaining_time = (elapsed_time/total_progress) - elapsed_time // 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 progress_bar_inner.style.width = (total_progress * 100) + "%" diff --git a/svelte/src/home_page/UploadProgressBar.svelte b/svelte/src/home_page/UploadProgressBar.svelte index ed5578c..1249776 100644 --- a/svelte/src/home_page/UploadProgressBar.svelte +++ b/svelte/src/home_page/UploadProgressBar.svelte @@ -99,7 +99,7 @@ export const start = () => { let xhr = new XMLHttpRequest(); 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 => { if (evt.lengthComputable) { diff --git a/svelte/src/user_home/Home.svelte b/svelte/src/user_home/Home.svelte index c692ac0..d2ee7a1 100644 --- a/svelte/src/user_home/Home.svelte +++ b/svelte/src/user_home/Home.svelte @@ -126,6 +126,9 @@ onDestroy(() => { (Manage subscription) {/if}