diff --git a/svelte/src/lib/NovaAPI.ts b/svelte/src/lib/NovaAPI.ts index 7e66458..c1ca9e6 100644 --- a/svelte/src/lib/NovaAPI.ts +++ b/svelte/src/lib/NovaAPI.ts @@ -11,6 +11,7 @@ export type GenericResponse = { } export type User = { + id: string, username: string, email: string, otp_enabled: boolean, @@ -20,12 +21,10 @@ export type User = { filesystem_node_count: number, is_admin: boolean, balance_micro_eur: number, - hotlinking_enabled: boolean, monthly_transfer_cap: number, monthly_transfer_used: number, file_viewer_branding: Map, - file_embed_domains: string, - skip_file_viewer: boolean, + embed_domains: string, affiliate_user_name: string, checkout_country: string, checkout_name: string, @@ -158,10 +157,12 @@ export const put_user = async (data: Object) => { )) // Update the user store - for (let key of Object.keys(data)) { - cached_user[key] = data[key] - } - user.set(cached_user) + user.update((user: User) => { + for (let key of Object.keys(data)) { + user[key] = data[key] + } + return user + }) } export const logout_user = async (redirect_path: string) => { diff --git a/svelte/src/user_home/BandwidthSharing.svelte b/svelte/src/user_home/BandwidthSharing.svelte deleted file mode 100644 index 567cfaa..0000000 --- a/svelte/src/user_home/BandwidthSharing.svelte +++ /dev/null @@ -1,148 +0,0 @@ - - -
-

Hotlinking (bandwidth sharing)

- - - -

- When hotlinking is enabled all the bandwidth that your files use will be - subtracted from your data cap. Advertisements will be disabled on the - download pages for your files and download speed will be unlimited. The - rate limiting captcha for files is also disabled when hotlinking is on. - You can directly embed your file's download link anywhere, you don't - need to use the file viewer page. -

- -

Bill shock limit

-

- Billshock limit in terabytes per month (1 TB = 1000 GB). Set to 0 to - disable. -

-
- -
TB
- -
- -

- Bandwidth used in the last 30 days: {formatDataVolume(transfer_used, 3)}, - new limit: {formatDataVolume(transfer_cap*1e12, 3)} -

- -

- The billshock limit limits how much bandwidth your account can use in a - 30 day window. When this limit is reached hotlinking will be disabled - and you will no longer be charged for bandwidth usage. This is mostly - useful for the Prepaid subscription, but it works for Patreon plans too. - Set to 0 to disable the limit. -

- -

Skip download page

- -

- This setting only applies to your account, others will still see the - download page when visiting your files. When this is enabled you will be - redirected to the file download API when clicking a Nova link. - This means that images, videos and PDF files will be opened directly in - your browser, and other files are immediately downloaded to your device. - This only works for single file links, not albums. You will need a Pro - subscription to use this feature. -

-
- - diff --git a/svelte/src/user_home/EmbeddingControls.svelte b/svelte/src/user_home/EmbeddingControls.svelte deleted file mode 100644 index 8891151..0000000 --- a/svelte/src/user_home/EmbeddingControls.svelte +++ /dev/null @@ -1,118 +0,0 @@ - - -
-

Embedding controls

- - {#if user !== undefined && !user.hotlinking_enabled} -
- To use embedding restrictions hotlinking needs to be enabled. - Enable hotlinking on the - sharing settings page. -
- {/if} -

- 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. This applies to both - hotlink and iframe embeds. If the list is empty, all domains are allowed - to embed your files. -

-
-
add()}> -
- Add domain name - - -
-
-
- {#if embed_domains.length === 0} - - No domains specified. All websites are allowed to embed your files - - {/if} - {#each embed_domains as domain, index} -
- -
{domain}
-
- {/each} -
-
- - diff --git a/svelte/src/user_home/Router.svelte b/svelte/src/user_home/Router.svelte index e0690b7..d7d4bd8 100644 --- a/svelte/src/user_home/Router.svelte +++ b/svelte/src/user_home/Router.svelte @@ -7,12 +7,11 @@ import ConnectApp from "./ConnectApp.svelte"; import ActivityLog from "./ActivityLog.svelte"; import DepositCredit from "./DepositCredit.svelte"; import TabMenu, { type Tab } from "util/TabMenu.svelte"; -import BandwidthSharing from "./BandwidthSharing.svelte"; -import EmbeddingControls from "./EmbeddingControls.svelte"; import Dashboard from "./dashboard/Dashboard.svelte"; import AffiliatePrompt from "./AffiliatePrompt.svelte"; import { onMount } from "svelte"; import { get_user, type User } from "lib/NovaAPI"; +import SharingSettings from "./SharingSettings.svelte"; let pages: Tab[] = [ { @@ -50,21 +49,9 @@ let pages: Tab[] = [ ], }, { path: "/user/sharing", - title: "Sharing", + title: "Sharing settings", icon: "share", - subpages: [ - { - path: "/user/sharing/bandwidth", - title: "Sharing settings", - icon: "share", - component: BandwidthSharing, - }, { - path: "/user/sharing/embedding", - title: "Embedding Controls", - icon: "code", - component: EmbeddingControls, - }, - ], + component: SharingSettings, }, { path: "/user/connect_app", title: "Apps", diff --git a/svelte/src/user_home/SharingSettings.svelte b/svelte/src/user_home/SharingSettings.svelte new file mode 100644 index 0000000..ca9bcdf --- /dev/null +++ b/svelte/src/user_home/SharingSettings.svelte @@ -0,0 +1,160 @@ + + +
+ + +

Bill shock limit

+

+ Billshock limit in terabytes per month (1 TB = 1000 GB). Set to 0 to + disable. +

+
+ +
TB
+ +
+ +

+ Bandwidth used in the last 30 days: {formatDataVolume(transfer_used, 3)}, + new limit: {formatDataVolume(transfer_cap*1e12, 3)} +

+ +

+ The billshock limit limits how much bandwidth your account can use in a + 30 day window. When this limit is reached hotlinking will be disabled + and you will no longer be charged for bandwidth usage. This is mostly + useful for the Prepaid subscription, but it works for Patreon plans too. + Set to 0 to disable the limit. +

+ +

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. This applies to both + hotlink and iframe embeds. If the list is empty, all domains are allowed + to embed your files. +

+
+
+
+ Add domain name + + +
+
+
+ {#if embed_domains.length === 0} + + No domains specified. All websites are allowed to embed your files + + {/if} + {#each embed_domains as domain, index} +
+ +
{domain}
+
+ {/each} +
+
+ +