diff --git a/svelte/src/user_home/SharingSettings.svelte b/svelte/src/user_home/SharingSettings.svelte index c82ec15..deedbe6 100644 --- a/svelte/src/user_home/SharingSettings.svelte +++ b/svelte/src/user_home/SharingSettings.svelte @@ -71,7 +71,33 @@ let save = async () => { } finally { loading = false } +} +// Embedding settings +let embed_domains = "" + +const save_embed = async () => { + loading = true + const form = new FormData() + form.append("domains", embed_domains) + + try { + const resp = await fetch( + window.api_endpoint+"/user/file_embed", + { method: "PUT", body: form } + ); + if(resp.status >= 400) { + let json = await resp.json() + console.debug(json) + throw json.message + } + + success_message.set(true, "Changes saved") + } catch(err) { + success_message.set(false, err) + } finally { + loading = false + } } onMount(() => { @@ -86,6 +112,8 @@ onMount(() => { footer_image = b.footer_image ? b.footer_image : "" footer_link = b.footer_link ? b.footer_link : "" } + + embed_domains = window.user.file_embed_domains }) @@ -93,6 +121,7 @@ onMount(() => {
+

Sharing settings

{#if !window.user.subscription.file_viewer_branding}
Sharing settings are not available for your account. Subscribe to @@ -105,7 +134,7 @@ onMount(() => { subscription page.
{/if} -

File viewer branding

+

File viewer branding

You can change the appearance of your file viewer pages. The images you @@ -118,7 +147,7 @@ onMount(() => { should use APNG or WebP. Avoid using animated GIFs as they are very slow to load.

-

Theme

+

Theme

Choose a theme for your download pages. This theme will override the theme preference of the person viewing the file. Set to 'None' to let @@ -129,7 +158,7 @@ onMount(() => { on:theme_change={e => {theme = e.detail; save()}}> -

Header image

+

Header image

Will be shown above the file. Maximum height is 90px. Will be shrunk if larger. You can also add a link to open when the visitor clicks the @@ -144,10 +173,10 @@ onMount(() => { Remove
-

- Header image link: - - + +
Header image link:
+ +
{#if header_image} @@ -162,7 +191,7 @@ onMount(() => { {/if} -

Background image

+

Background image

This image will be shown behind the file which is being viewed. I recommend choosing something dark and not too distracting. Try to keep @@ -183,7 +212,7 @@ onMount(() => { {/if} -

Footer image

+

Footer image

Will be shown below the file. Maximum height is 90px. Will be shrunk if larger. @@ -197,10 +226,10 @@ onMount(() => { Remove
-

- Footer image link: - - + +
Footer image link:
+ +
{#if footer_image}
@@ -214,10 +243,29 @@ onMount(() => {
{/if}
-
+

Embedding controls

+

+ Here you can control which websites are allowed to embed your files in + their web pages. If a website that is not on this list tries to embed + one of your files the request will be blocked. +

+

+ The list should be formatted as a list of domain names separated by a + space. Like this: 'pixeldrain.com google.com twitter.com' +

+
+
Domain names:
+ + +
- {add_file(e.detail)}} multi_select={false} title="Select image file"> + {add_file(e.detail)}} + multi_select={false} + title="Select image file" +/>