From 634e2a01e18602f5243e4956ca168063266648a7 Mon Sep 17 00:00:00 2001 From: Davide Marcoli <69892203+davidemarcoli@users.noreply.github.com> Date: Tue, 10 Dec 2024 13:43:14 +0100 Subject: [PATCH] feat: add all backend settings to the forms (#184) --- .gitignore | 5 +- src/lib/forms/content-form.svelte | 11 ++ src/lib/forms/general-form.svelte | 113 ++++++++----- src/lib/forms/helpers.ts | 210 ++++++++++++++++--------- src/lib/forms/media-server-form.svelte | 32 ++++ src/lib/forms/scrapers-form.svelte | 77 ++++----- src/routes/browse/+page.svelte | 2 - 7 files changed, 290 insertions(+), 160 deletions(-) diff --git a/.gitignore b/.gitignore index 6a84f06..b831da4 100644 --- a/.gitignore +++ b/.gitignore @@ -11,5 +11,8 @@ vite.config.ts.timestamp-* .idea /.vs /package-lock.json +bun.lockb .vscode -/config \ No newline at end of file +/config +server-config.json +openapi*.log \ No newline at end of file diff --git a/src/lib/forms/content-form.svelte b/src/lib/forms/content-form.svelte index a2519bd..93a1299 100644 --- a/src/lib/forms/content-form.svelte +++ b/src/lib/forms/content-form.svelte @@ -469,6 +469,17 @@ {/if} + +
+ +
+ + {#if $formData.trakt_fetch_most_watched} +
+ + +
+ {/if} {/if} diff --git a/src/lib/forms/general-form.svelte b/src/lib/forms/general-form.svelte index 639f49b..6305ca7 100644 --- a/src/lib/forms/general-form.svelte +++ b/src/lib/forms/general-form.svelte @@ -50,6 +50,14 @@
+ + + @@ -71,6 +79,53 @@ fieldDescription="In seconds" /> + + {#each $formData.video_extensions as _, i} + + +
+ + +
+ { + removeField('video_extensions', i); + }} + > + + +
+
+
+
+ {/each} + +
+

Add Video Extension

+ { + addField('video_extensions'); + }} + > + + +
+
+ + + - - + + {#if $formData.realdebrid_enabled}
- -
- -
-
- - {#if $formData.realdebrid_proxy_enabled} -
- -
- {/if} {/if} {#if $formData.alldebrid_enabled}
- +
+ {/if} + {#if $formData.torbox_enabled}
-
- - {#if $formData.alldebrid_proxy_enabled} -
- -
- {/if} {/if} - {#if $formData.torbox_enabled} -
- -
- {/if} - {#if $formData.notifications_enabled} diff --git a/src/lib/forms/helpers.ts b/src/lib/forms/helpers.ts index 7e22ba6..0d47e9d 100644 --- a/src/lib/forms/helpers.ts +++ b/src/lib/forms/helpers.ts @@ -4,7 +4,11 @@ import { z } from 'zod'; // General Settings ----------------------------------------------------------------------------------- export const generalSettingsToGet: string[] = [ 'debug', + 'debug_database', 'log', + 'force_refresh', + 'map_metadata', + 'tracemalloc', 'symlink', 'downloaders', 'database', @@ -15,26 +19,28 @@ export const generalSettingsToGet: string[] = [ export const generalSettingsSchema = z.object({ debug: z.boolean().default(true), + debug_database: z.boolean().default(false), log: z.boolean().default(true), + force_refresh: z.boolean().default(false), + map_metadata: z.boolean().default(false), + tracemalloc: z.boolean().default(false), rclone_path: z.string().min(1), library_path: z.string().min(1), separate_anime_dirs: z.boolean().default(false), repair_symlinks: z.boolean().default(false), repair_interval: z.coerce.number().gte(0).int().optional().default(6), + video_extensions: z.string().array().optional().default([]), movie_filesize_mb_min: z.coerce.number().gte(0).int().optional().default(0), movie_filesize_mb_max: z.coerce.number().gte(-1).int().optional().default(-1), episode_filesize_mb_min: z.coerce.number().gte(0).int().optional().default(0), episode_filesize_mb_max: z.coerce.number().gte(-1).int().optional().default(-1), + proxy_url: z.string().optional().default(''), realdebrid_enabled: z.boolean().default(false), realdebrid_api_key: z.string().optional().default(''), - realdebrid_proxy_enabled: z.boolean().default(false), - realdebrid_proxy_url: z.string().optional().default(''), torbox_enabled: z.boolean().default(false), torbox_api_key: z.string().optional().default(''), alldebrid_enabled: z.boolean().default(false), alldebrid_api_key: z.string().optional().default(''), - alldebrid_proxy_enabled: z.boolean().default(false), - alldebrid_proxy_url: z.string().optional().default(''), database_host: z .string() .optional() @@ -59,7 +65,13 @@ export type GeneralSettingsSchema = typeof generalSettingsSchema; export function generalSettingsToPass(data: any) { return { debug: data.debug, + debug_database: data.debug_database, log: data.log, + force_refresh: data.force_refresh, + map_metadata: data.map_metadata, + tracemalloc: data.tracemalloc, + video_extensions: data.downloaders.video_extensions, + prefer_speed_over_quality: data.downloaders.prefer_speed_over_quality, rclone_path: data.symlink.rclone_path, library_path: data.symlink.library_path, separate_anime_dirs: data.symlink.separate_anime_dirs, @@ -69,35 +81,32 @@ export function generalSettingsToPass(data: any) { movie_filesize_mb_max: data.downloaders.movie_filesize_mb_max, episode_filesize_mb_min: data.downloaders.episode_filesize_mb_min, episode_filesize_mb_max: data.downloaders.episode_filesize, + proxy_url: data.downloaders.proxy_url, realdebrid_enabled: data.downloaders.real_debrid.enabled, realdebrid_api_key: data.downloaders.real_debrid?.api_key, - realdebrid_proxy_enabled: data.downloaders.real_debrid?.proxy_enabled, - realdebrid_proxy_url: data.downloaders.real_debrid?.proxy_url, torbox_enabled: data.downloaders.torbox.enabled, - torbox_api_key: data.downloaders.torbox?.api_key, + torbox_api_key: data.downloaders.torbox.api_key, alldebrid_enabled: data.downloaders.all_debrid.enabled, - alldebrid_api_key: data.downloaders.all_debrid?.api_key, - alldebrid_proxy_enabled: data.downloaders.all_debrid?.proxy_enabled, - alldebrid_proxy_url: data.downloaders.all_debrid?.proxy_url, + alldebrid_api_key: data.downloaders.all_debrid.api_key, database_host: data.database.host, notifications_enabled: data.notifications.enabled, notifications_title: data.notifications.title, notifications_on_item_type: data.notifications.on_item_type, notifications_service_urls: data.notifications.service_urls, subliminal_enabled: data.post_processing.subliminal.enabled, - subliminal_languages: data.post_processing.subliminal?.languages, + subliminal_languages: data.post_processing.subliminal.languages, subliminal_providers_opensubtitles_enabled: - data.post_processing.subliminal?.providers.opensubtitles.enabled, + data.post_processing.subliminal.providers.opensubtitles.enabled, subliminal_providers_opensubtitles_username: - data.post_processing.subliminal?.providers.opensubtitles.username, + data.post_processing.subliminal.providers.opensubtitles.username, subliminal_providers_opensubtitles_password: - data.post_processing.subliminal?.providers.opensubtitles.password, + data.post_processing.subliminal.providers.opensubtitles.password, subliminal_providers_opensubtitlescom_enabled: - data.post_processing.subliminal?.providers.opensubtitlescom.enabled, + data.post_processing.subliminal.providers.opensubtitlescom.enabled, subliminal_providers_opensubtitlescom_username: - data.post_processing.subliminal?.providers.opensubtitlescom.username, + data.post_processing.subliminal.providers.opensubtitlescom.username, subliminal_providers_opensubtitlescom_password: - data.post_processing.subliminal?.providers.opensubtitlescom.password, + data.post_processing.subliminal.providers.opensubtitlescom.password, indexer_update_interval: data.indexer.update_interval }; } @@ -108,10 +117,26 @@ export function generalSettingsToSet(form: SuperValidated + + {#if $formData.plex_enabled} @@ -168,6 +176,30 @@ {/if} + {#if $formData.jellyfin_enabled} +
+ +
+
+ +
+ {/if} + + {#if $formData.emby_enabled} +
+ +
+
+ +
+ {/if} +
diff --git a/src/lib/forms/scrapers-form.svelte b/src/lib/forms/scrapers-form.svelte index 54f1a8e..d062436 100644 --- a/src/lib/forms/scrapers-form.svelte +++ b/src/lib/forms/scrapers-form.svelte @@ -71,6 +71,22 @@ fieldDescription="Time to wait after 10 failed attempts in hours" /> + + + +
+
+ +
+ +
+ +
+ +
+ +
+
-
- - {#each $formData.mediafusion_catalogs as _, i} - - -
- - -
- { - removeField('mediafusion_catalogs', i); - }} - > - - -
-
-
-
- {/each} - -
-

Add catalogs

- { - addField('mediafusion_catalogs'); - }} - > - - -
-
-
-
v?.value as keyof typeof states); } catch (error) { - console.error('Error mapping selected states:', error); return []; } } @@ -116,7 +115,6 @@ try { return [...(selectedTypes?.values() ?? [])].map((v) => v?.value as keyof typeof types); } catch (error) { - console.error('Error mapping selected types:', error); return []; } }