From aba444ec8b6e8215a9c5fb958cebde858a64fb7c Mon Sep 17 00:00:00 2001 From: wukko Date: Sun, 4 Aug 2024 00:43:24 +0600 Subject: [PATCH] web: updated api endpoint & params, default instance override - dialogs can be undismissable now (impossible to click away by pressing the bg behind it) - added security warning about api override - moved default api url to env - added new processing settings page --- web/i18n/en/dialog.json | 6 +- web/i18n/en/settings.json | 7 +- .../components/dialog/DialogContainer.svelte | 3 +- web/src/components/dialog/PickerDialog.svelte | 3 +- web/src/components/dialog/SavingDialog.svelte | 3 +- web/src/components/dialog/SmallDialog.svelte | 3 +- web/src/lib/api.ts | 85 ++++++++++++++++--- web/src/lib/download.ts | 2 +- web/src/lib/env.ts | 5 +- web/src/lib/settings/defaults.ts | 6 +- web/src/lib/types/dialog.ts | 1 + web/src/lib/types/settings.ts | 10 ++- web/src/routes/settings/+layout.svelte | 8 ++ .../routes/settings/processing/+page.svelte | 15 ++++ 14 files changed, 134 insertions(+), 23 deletions(-) create mode 100644 web/src/routes/settings/processing/+page.svelte diff --git a/web/i18n/en/dialog.json b/web/i18n/en/dialog.json index 13b5cf3e..6e9bb72e 100644 --- a/web/i18n/en/dialog.json +++ b/web/i18n/en/dialog.json @@ -8,6 +8,7 @@ "button.share": "share", "button.copy": "copy", "button.import": "import", + "button.continue": "continue", "reset.title": "reset all settings?", "reset.body": "are you sure you want to reset all settings? this action is immediate and irreversible.", @@ -22,5 +23,8 @@ "safety.title": "important safety notice", - "import.body": "importing unknown or corrupted files may unexpectedly alter or break cobalt functionality. only import files that you've personally exported and haven't modified. if you were asked to import this file by someone - don't do it.\n\nwe are not responsible for any harm caused by importing unknown setting files." + "import.body": "importing unknown or corrupted files may unexpectedly alter or break cobalt functionality. only import files that you've personally exported and haven't modified. if you were asked to import this file by someone - don't do it.\n\nwe are not responsible for any harm caused by importing unknown setting files.", + + "api.override.title": "processing instance override", + "api.override.body": "{{ value }} is now the processing instance. if you don't trust it, press \"cancel\" and it'll be ignored.\n\nyou can change your choice later in processing settings." } diff --git a/web/i18n/en/settings.json b/web/i18n/en/settings.json index 4fc304af..fd38252f 100644 --- a/web/i18n/en/settings.json +++ b/web/i18n/en/settings.json @@ -6,6 +6,7 @@ "page.download": "downloading", "page.advanced": "advanced", "page.debug": "debug information", + "page.processing": "processing", "section.general": "general", "section.save": "save", @@ -103,5 +104,9 @@ "advanced.data": "settings data", "advanced.reset": "reset all settings", "advanced.import": "import", - "advanced.export": "export" + "advanced.export": "export", + + "processing.override": "default instance override", + "processing.override.title": "use instance-provided processing server", + "processing.override.description": "cobalt will use the processing server from DEFAULT_API when this is enabled." } diff --git a/web/src/components/dialog/DialogContainer.svelte b/web/src/components/dialog/DialogContainer.svelte index 3bb682e6..993efd7c 100644 --- a/web/src/components/dialog/DialogContainer.svelte +++ b/web/src/components/dialog/DialogContainer.svelte @@ -5,6 +5,7 @@ import DialogBackdropClose from "$components/dialog/DialogBackdropClose.svelte"; export let id: string; + export let dismissable = true; let dialogParent: HTMLDialogElement; @@ -32,5 +33,5 @@ - + {}} /> diff --git a/web/src/components/dialog/PickerDialog.svelte b/web/src/components/dialog/PickerDialog.svelte index 0f75f989..1fa5f5f5 100644 --- a/web/src/components/dialog/PickerDialog.svelte +++ b/web/src/components/dialog/PickerDialog.svelte @@ -16,6 +16,7 @@ export let id: string; export let items: Optional = undefined; export let buttons: Optional = undefined; + export let dismissable = true; let dialogDescription = "dialog.picker.description."; @@ -30,7 +31,7 @@ let close: () => void; - +
void; @@ -31,7 +32,7 @@ } - +