From 42a4a11c493749423c881ce9f8bf8a4c83618748 Mon Sep 17 00:00:00 2001 From: Raymond <101374892+raymonable@users.noreply.github.com> Date: Sat, 4 Jan 2025 18:18:37 -0500 Subject: [PATCH] fix: :sparkles: fixes / extra documentation texts --- .../components/settings/ChuniSettings.svelte | 107 ++++++++++-------- AquaNet/src/libs/config.ts | 3 +- AquaNet/src/libs/i18n/en_ref.ts | 4 +- AquaNet/src/libs/userbox/ddsCache.ts | 3 +- 4 files changed, 64 insertions(+), 53 deletions(-) diff --git a/AquaNet/src/components/settings/ChuniSettings.svelte b/AquaNet/src/components/settings/ChuniSettings.svelte index 10675f9c..927afdf0 100644 --- a/AquaNet/src/components/settings/ChuniSettings.svelte +++ b/AquaNet/src/components/settings/ChuniSettings.svelte @@ -8,7 +8,7 @@ } from "../../libs/generalTypes"; import { DATA, USER, USERBOX } from "../../libs/sdk"; import { t, ts } from "../../libs/i18n"; - import { DATA_HOST, FADE_IN, FADE_OUT, HAS_USERBOX_ASSETS } from "../../libs/config"; + import { DATA_HOST, FADE_IN, FADE_OUT, USERBOX_DEFAULT_URL } from "../../libs/config"; import { fade, slide } from "svelte/transition"; import StatusOverlays from "../StatusOverlays.svelte"; import Icon from "@iconify/svelte"; @@ -118,27 +118,35 @@ }) ?? ""; } + let USERBOX_URL_STATE = useLocalStorage("userboxURL", USERBOX_DEFAULT_URL); function userboxHandleInput(e: KeyboardEvent) { if (e.key != "Enter") return; let baseURL = (e.target as HTMLInputElement).value; - try { - // validate url - new URL(baseURL); - } catch(err) { - return error = t("userbox.new.error.invalidUrl") - } - useLocalStorage("userboxURL", "").value = baseURL; + if (baseURL != "") + try { + // validate url + new URL(baseURL); + } catch(err) { + return error = t("userbox.new.error.invalidUrl") + } + USERBOX_URL_STATE.value = baseURL; + USERBOX_ENABLED.value = true; + USERBOX_PROFILE_ENABLED.value = true; location.reload(); } + if (USERBOX_DEFAULT_URL) + USERBOX_URL_STATE.value = USERBOX_DEFAULT_URL; + indexedDB.databases().then(async (dbi) => { let databaseExists = dbi.some(db => db.name == "userboxChusanDDS"); if (databaseExists) { await initializeDb(); DDSreader = new DDS(ddsDB); USERBOX_INSTALLED = databaseExists; - } + } else if (USERBOX_URL_STATE.value) + USERBOX_INSTALLED = true; }) @@ -225,45 +233,43 @@ {/each} {/if} - {#if HAS_USERBOX_ASSETS} - {#if USERBOX_INSTALLED} - -
- - -
-
- - + {#if USERBOX_INSTALLED} + +
+ + +
+
+ + +
+ {/if} + {#if USERBOX_SUPPORT} +

+ +

+ {/if} + - {/if} + {/if}-->
{/if} @@ -271,11 +277,14 @@

{t('userbox.new.name')}

- {USERBOX_SETUP_MODE ? t('userbox.preview.notice') + " " + t('userbox.new.url_warning') : USERBOX_SETUP_TEXT} + {USERBOX_SETUP_MODE ? t('userbox.new.url_warning') : USERBOX_SETUP_TEXT}
{#if USERBOX_SETUP_MODE} - + {:else} +

+ {t('userbox.new.setup.notice')} +

{#if USERBOX_PROGRESS != 0}
@@ -326,7 +335,7 @@ p.notice border-radius: 25px -.base-url-text, .drop-btn +.add-margin, .drop-btn margin-bottom: 1em .drop-btn diff --git a/AquaNet/src/libs/config.ts b/AquaNet/src/libs/config.ts index 8162b443..5131457a 100644 --- a/AquaNet/src/libs/config.ts +++ b/AquaNet/src/libs/config.ts @@ -16,4 +16,5 @@ export const FADE_IN = { delay: 400 } export const DEFAULT_PFP = '/assets/imgs/no_profile.png' // USERBOX_ASSETS -export const HAS_USERBOX_ASSETS = true +// Please note that if this is set, it must be manually unset by users in Chuni Settings -> Update Userbox -> Switch to URL mode -> (empty value) -> Enter key +export const USERBOX_DEFAULT_URL = "" \ No newline at end of file diff --git a/AquaNet/src/libs/i18n/en_ref.ts b/AquaNet/src/libs/i18n/en_ref.ts index d55159ca..0a298b69 100644 --- a/AquaNet/src/libs/i18n/en_ref.ts +++ b/AquaNet/src/libs/i18n/en_ref.ts @@ -176,7 +176,6 @@ export const EN_REF_USERBOX = { 'userbox.avatarItem': 'Avatar Item', 'userbox.avatarFront': 'Avatar Front', 'userbox.avatarBack': 'Avatar Back', - 'userbox.preview.notice': 'To honor the copyright, we cannot host the images of the userbox items. However, if someone else is willing to provide the images, you can enter their URL here and it will be displayed.', 'userbox.preview.url': 'Image URL', 'userbox.error.nodata': 'Chuni data not found', @@ -190,12 +189,13 @@ export const EN_REF_USERBOX = { 'userbox.new.name': 'AquaBox', 'userbox.new.setup': 'Drag and drop your Chuni game folder (Lumi or newer) into the box below to display UserBoxes with their nameplate & avatar. All files are handled in-browser.', + 'userbox.new.setup.notice': 'This tool assumes your files to be in "bin/option" and "data/A000".', 'userbox.new.setup.processing_file': 'Processing', 'userbox.new.setup.finalizing': 'Saving to internal storage', 'userbox.new.drop': 'Drop game folder here', 'userbox.new.switch.to_url': 'Switch to URL mode', 'userbox.new.switch.to_drop': 'Switch to drop mode', - 'userbox.new.url_warning': 'You are responsible for the results in this state. Please read the documentation.', + 'userbox.new.url_warning': 'Enter in the path to access Userbox assets. You are responsible for any results in this state. Please read the documentation. Don\'t expect support for this mode.', 'userbox.new.activate_first': 'Enable AquaBox (game files required)', 'userbox.new.activate_update': 'Update AquaBox (game files required)', 'userbox.new.activate': 'Use AquaBox', diff --git a/AquaNet/src/libs/userbox/ddsCache.ts b/AquaNet/src/libs/userbox/ddsCache.ts index d8170f72..8bdfcfa1 100644 --- a/AquaNet/src/libs/userbox/ddsCache.ts +++ b/AquaNet/src/libs/userbox/ddsCache.ts @@ -1,4 +1,5 @@ import useLocalStorage from "../hooks/useLocalStorage.svelte"; +import { USERBOX_DEFAULT_URL } from "../config"; export default class DDSCache { constructor(db: IDBDatabase | undefined) { @@ -69,5 +70,5 @@ export default class DDSCache { private urlCache: {scale: number, path: string, url: string}[] = []; private db: IDBDatabase | undefined; - private userboxURL = useLocalStorage("userboxURL", ""); + userboxURL = useLocalStorage("userboxURL", USERBOX_DEFAULT_URL); } \ No newline at end of file