From c4cd2e1ee57c773440cb7175932eb8e2696b04d0 Mon Sep 17 00:00:00 2001 From: Fornax Date: Tue, 16 May 2023 14:18:44 +0200 Subject: [PATCH] Add branding options to disable toolbar and toolbar buttons --- svelte/src/file_viewer/FileViewer.svelte | 71 ++++++++++++------- .../filesystem/filemanager/ListView.svelte | 2 +- svelte/src/home_page/FeatureTable.svelte | 2 +- svelte/src/user_home/PageBranding.svelte | 53 ++++++++++++++ 4 files changed, 101 insertions(+), 27 deletions(-) diff --git a/svelte/src/file_viewer/FileViewer.svelte b/svelte/src/file_viewer/FileViewer.svelte index e5a27d2..f848082 100644 --- a/svelte/src/file_viewer/FileViewer.svelte +++ b/svelte/src/file_viewer/FileViewer.svelte @@ -241,6 +241,9 @@ let custom_header_link = "" let custom_background = "" let custom_footer = "" let custom_footer_link = "" +let disable_download_button = false +let disable_share_button = false +let disable_menu = false const apply_customizations = file => { if (!file.branding) { return @@ -257,6 +260,18 @@ const apply_customizations = file => { if (file.branding.footer_link) { custom_footer_link = file.branding.footer_link } + if (file.branding.disable_download_button && !file.can_edit) { + disable_download_button = true + } + if (file.branding.disable_share_button && !file.can_edit) { + disable_share_button = true + } + if (file.branding.disable_menu && !file.can_edit) { + disable_menu = true + if (toolbar_visible) { + toolbar_toggle() + } + } if (file.branding.background_image) { custom_background = window.api_endpoint+"/file/"+file.branding.background_image @@ -380,13 +395,15 @@ const keyboard_event = evt => {
- Download limit of 20 GB per day + Download limit of 10 GB per day (24 hours). When this threshold is reached your download speed will be reduced to 1 MiB/s
diff --git a/svelte/src/user_home/PageBranding.svelte b/svelte/src/user_home/PageBranding.svelte index e10bba2..ebdb94a 100644 --- a/svelte/src/user_home/PageBranding.svelte +++ b/svelte/src/user_home/PageBranding.svelte @@ -19,6 +19,9 @@ let header_link = "" let background_image = "" let footer_image = "" let footer_link = "" +let disable_download_button = false +let disable_share_button = false +let disable_menu = false let select_file = t => { currently_selecting = t @@ -55,6 +58,9 @@ let save = async () => { form.append("background_image", background_image) form.append("footer_image", footer_image) form.append("footer_link", footer_link) + form.append("disable_download_button", disable_download_button) + form.append("disable_share_button", disable_share_button) + form.append("disable_menu", disable_menu) try { const resp = await fetch( @@ -86,6 +92,9 @@ onMount(() => { background_image = b.background_image ? b.background_image : "" footer_image = b.footer_image ? b.footer_image : "" footer_link = b.footer_link ? b.footer_link : "" + disable_download_button = b.disable_download_button ? b.disable_download_button : false + disable_share_button = b.disable_share_button ? b.disable_share_button : false + disable_menu = b.disable_menu ? b.disable_menu : false } }) @@ -202,6 +211,50 @@ onMount(() => { {/if} + +

Toolbar buttons

+

+ If you don't want to make it obvious that your files can be downloaded + or shared while still allowing people to view them through the site you + can use these options. +

+

+ The buttons will be hidden, however your files can still be downloaded + and shared through the API. The changes are purely cosmetic. +

+

+ For convenience these options only apply when other people view your + files. The buttons are still available to you. If you want to see the + effects you can open your file in an incognito window. +

+ Disable download button: + +
+ Disable share button: + +

+ You can also choose the hide the menu bar altogether +

+ Disable menu: +