mirror of https://github.com/hykilpikonna/AquaDX
fix: 🐛 aquabox
parent
8b9236ae43
commit
d220f369e9
|
@ -141,8 +141,12 @@
|
||||||
|
|
||||||
indexedDB.databases().then(async (dbi) => {
|
indexedDB.databases().then(async (dbi) => {
|
||||||
let databaseExists = dbi.some(db => db.name == "userboxChusanDDS");
|
let databaseExists = dbi.some(db => db.name == "userboxChusanDDS");
|
||||||
if (databaseExists)
|
if (USERBOX_URL_STATE.value && databaseExists) {
|
||||||
|
indexedDB.deleteDatabase("userboxChusanDDS")
|
||||||
|
}
|
||||||
|
if (databaseExists) {
|
||||||
await initializeDb();
|
await initializeDb();
|
||||||
|
}
|
||||||
if (databaseExists || USERBOX_URL_STATE.value) {
|
if (databaseExists || USERBOX_URL_STATE.value) {
|
||||||
DDSreader = new DDS(ddsDB);
|
DDSreader = new DDS(ddsDB);
|
||||||
USERBOX_INSTALLED = databaseExists || USERBOX_URL_STATE.value != "";
|
USERBOX_INSTALLED = databaseExists || USERBOX_URL_STATE.value != "";
|
||||||
|
@ -283,26 +287,28 @@
|
||||||
{#if USERBOX_SETUP_MODE}
|
{#if USERBOX_SETUP_MODE}
|
||||||
<input type="text" on:keyup={e => {if (e.key == "Enter") userboxHandleInput((e.target as HTMLInputElement).value)}} class="add-margin" placeholder="Base URL">
|
<input type="text" on:keyup={e => {if (e.key == "Enter") userboxHandleInput((e.target as HTMLInputElement).value)}} class="add-margin" placeholder="Base URL">
|
||||||
{:else}
|
{:else}
|
||||||
<p class="notice add-margin">
|
|
||||||
{t('userbox.new.setup.notice')}
|
|
||||||
</p>
|
|
||||||
{#if USERBOX_PROGRESS != 0}
|
{#if USERBOX_PROGRESS != 0}
|
||||||
<div class="progress">
|
<div class="progress">
|
||||||
<div class="progress-bar" style="width: {USERBOX_PROGRESS}%"></div>
|
<div class="progress-bar" style="width: {USERBOX_PROGRESS}%"></div>
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
|
<p class="notice add-margin">
|
||||||
|
{t('userbox.new.setup.notice')}
|
||||||
|
</p>
|
||||||
<button class="drop-btn">
|
<button class="drop-btn">
|
||||||
<input type="file" on:input={userboxSafeDrop} on:click={e => e.preventDefault()}>
|
<input type="file" on:input={userboxSafeDrop} on:click={e => e.preventDefault()}>
|
||||||
{t('userbox.new.drop')}
|
{t('userbox.new.drop')}
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
<button on:click={() => USERBOX_SETUP_RUN = false}>
|
{#if USERBOX_PROGRESS == 0}
|
||||||
{t('back')}
|
<button on:click={() => USERBOX_SETUP_RUN = false}>
|
||||||
</button>
|
{t('back')}
|
||||||
<button on:click={() => USERBOX_SETUP_MODE = !USERBOX_SETUP_MODE}>
|
</button>
|
||||||
{t(USERBOX_SETUP_MODE ? 'userbox.new.switch.to_drop' : 'userbox.new.switch.to_url')}
|
<button on:click={() => USERBOX_SETUP_MODE = !USERBOX_SETUP_MODE}>
|
||||||
</button>
|
{t(USERBOX_SETUP_MODE ? 'userbox.new.switch.to_drop' : 'userbox.new.switch.to_url')}
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,6 +11,10 @@
|
||||||
export var chuniCharacter: number = 0
|
export var chuniCharacter: number = 0
|
||||||
export var chuniTrophyName: string = "NEWCOMER"
|
export var chuniTrophyName: string = "NEWCOMER"
|
||||||
export var chuniIsUserbox: boolean = false;
|
export var chuniIsUserbox: boolean = false;
|
||||||
|
|
||||||
|
let ratingToString = (rating: number) => {
|
||||||
|
return rating.toFixed(2)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
{#await DDSreader?.getFile(`nameplate:${chuniNameplate.toString().padStart(8, "0")}`, `nameplate:00000001`) then nameplateURL}
|
{#await DDSreader?.getFile(`nameplate:${chuniNameplate.toString().padStart(8, "0")}`, `nameplate:00000001`) then nameplateURL}
|
||||||
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
||||||
|
@ -40,7 +44,7 @@
|
||||||
<div class="chuni-user-rating">
|
<div class="chuni-user-rating">
|
||||||
RATING
|
RATING
|
||||||
<span class="chuni-user-rating-number">
|
<span class="chuni-user-rating-number">
|
||||||
{chuniRating}
|
{ratingToString(chuniRating)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -47,7 +47,7 @@ export default class DDSCache {
|
||||||
*/
|
*/
|
||||||
getFromDatabase(path: string): Promise<Blob | null> {
|
getFromDatabase(path: string): Promise<Blob | null> {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
if (this.userboxURL.value) {
|
if (this.userboxURL.value != "") {
|
||||||
let targetPath = path.replaceAll(":", "/");
|
let targetPath = path.replaceAll(":", "/");
|
||||||
let response = await fetch(`${this.userboxURL.value}/${targetPath}.chu`).then(b => b.blob()).catch(reject);
|
let response = await fetch(`${this.userboxURL.value}/${targetPath}.chu`).then(b => b.blob()).catch(reject);
|
||||||
if (response)
|
if (response)
|
||||||
|
|
|
@ -173,6 +173,7 @@ export async function userboxFileProcess(folder: FileSystemEntry, progressUpdate
|
||||||
const dataFolder = await getDirectoryFromPath(folder, "data");
|
const dataFolder = await getDirectoryFromPath(folder, "data");
|
||||||
if (dataFolder)
|
if (dataFolder)
|
||||||
await scanOptionFolder(dataFolder, progressUpdate);
|
await scanOptionFolder(dataFolder, progressUpdate);
|
||||||
|
useLocalStorage("userboxURL", "").value = "";
|
||||||
useLocalStorage("userboxNew", false).value = true;
|
useLocalStorage("userboxNew", false).value = true;
|
||||||
useLocalStorage("userboxNewProfile", false).value = true;
|
useLocalStorage("userboxNewProfile", false).value = true;
|
||||||
location.reload();
|
location.reload();
|
||||||
|
|
Loading…
Reference in New Issue