fix: beatmaps, skins and osu info not updating after wizard completed

This commit is contained in:
HorizonCode 2025-07-03 21:31:27 +02:00
parent 75380038ad
commit bd5eb97f6e
2 changed files with 58 additions and 31 deletions

View File

@ -112,6 +112,13 @@
if (beatmapSetCount) { if (beatmapSetCount) {
beatmapSets.set(beatmapSetCount); beatmapSets.set(beatmapSetCount);
} }
const skinsCount: number | null = await invoke('get_skins_count', {
folder: selectedPath,
});
if (skinsCount) {
skins.set(skinsCount);
}
} }
}; };
@ -153,7 +160,7 @@
} else { } else {
launchInfo = 'You are up to date!'; launchInfo = 'You are up to date!';
} }
} catch(err) { } catch (err) {
console.log(err); console.log(err);
toast.error('Hmmm...', { toast.error('Hmmm...', {
description: 'Failed to check for updates.', description: 'Failed to check for updates.',
@ -683,7 +690,7 @@
<Input <Input
class="mt-4 w-full bg-theme-950 border-theme-800 border-r-0 rounded-r-none" class="mt-4 w-full bg-theme-950 border-theme-800 border-r-0 rounded-r-none"
type="text" type="text"
value={$osuInstallationPath} bind:value={$osuInstallationPath}
placeholder="Path to osu! installation" placeholder="Path to osu! installation"
readonly readonly
/> />

View File

@ -9,16 +9,22 @@
import { Check, CheckCircle, CircleOff, Settings2 } from 'lucide-svelte'; import { Check, CheckCircle, CircleOff, Settings2 } from 'lucide-svelte';
import { open } from '@tauri-apps/plugin-dialog'; import { open } from '@tauri-apps/plugin-dialog';
import Checkbox from '@/components/ui/checkbox/checkbox.svelte'; import Checkbox from '@/components/ui/checkbox/checkbox.svelte';
import { cursorSmoothening, customCursor, reduceAnimations, userSettings } from '@/userSettings'; import {
cursorSmoothening,
customCursor,
osuInstallationPath,
reduceAnimations,
userSettings,
} from '@/userSettings';
import Label from '@/components/ui/label/label.svelte'; import Label from '@/components/ui/label/label.svelte';
import { beatmapSets, currentView } from '@/global'; import { beatmapSets, currentView, osuBuild, osuStream, skins } from '@/global';
import Launch from './Launch.svelte'; import Launch from './Launch.svelte';
import Confetti from 'svelte-confetti'; import Confetti from 'svelte-confetti';
let selectedStep = $state(1); let selectedStep = $state(1);
const steps = ['Welcome', 'Locate your osu! Installation', 'Appearance Settings']; const steps = ['Welcome', 'Locate your osu! Installation', 'Appearance Settings'];
let osuInstallationPath = $state(''); let osuInstallPath = $state('');
let manualSelect = $state(false); let manualSelect = $state(false);
let manualSelectValid = $state(false); let manualSelectValid = $state(false);
let autoDetectedOsuPath = $state(false); let autoDetectedOsuPath = $state(false);
@ -58,30 +64,52 @@
manualSelect = true; manualSelect = true;
if (!validFolder) { if (!validFolder) {
manualSelectValid = false; manualSelectValid = false;
osuInstallationPath = ''; osuInstallPath = '';
return; return;
} }
osuInstallationPath = selectedPath; osuInstallPath = selectedPath;
autoDetectedOsuPath = false; autoDetectedOsuPath = false;
manualSelectValid = true; manualSelectValid = true;
$userSettings.value('osu_installation_path').set(osuInstallationPath);
const beatmapSetCount: number | null = await invoke('get_beatmapsets_count', {
folder: osuInstallationPath,
});
if (beatmapSetCount) {
beatmapSets.set(beatmapSetCount);
}
} }
}; };
const saveConfig = async () => {
$userSettings.value('osu_installation_path').set(osuInstallPath);
await $userSettings.save();
osuInstallationPath.set(osuInstallPath);
const beatmapSetCount: number | null = await invoke('get_beatmapsets_count', {
folder: osuInstallPath,
});
if (beatmapSetCount) {
beatmapSets.set(beatmapSetCount);
}
const skinsCount: number | null = await invoke('get_skins_count', {
folder: osuInstallPath,
});
if (skinsCount) {
skins.set(skinsCount);
}
const osuReleaseStream: string = await invoke('get_osu_release_stream', {
folder: $osuInstallationPath,
});
osuStream.set(osuReleaseStream);
const osuVersion: string = await invoke('get_osu_version', {
folder: $osuInstallationPath,
});
osuBuild.set(osuVersion);
currentView.set(Launch);
};
onMount(async () => { onMount(async () => {
const osuInstallPath: string | null = await invoke('find_osu_installation'); const osuPath: string | null = await invoke('find_osu_installation');
console.log('osu install path: ' + osuInstallPath); if (osuPath) {
if (osuInstallPath) { osuInstallPath = osuPath;
osuInstallationPath = osuInstallPath;
autoDetectedOsuPath = true; autoDetectedOsuPath = true;
$userSettings.value('osu_installation_path').set(osuInstallationPath); $userSettings.value('osu_installation_path').set(osuInstallPath);
} }
}); });
</script> </script>
@ -93,15 +121,7 @@
</div> </div>
<h1 class="text-3xl font-semibold">EZPPLauncher Setup completed!</h1> <h1 class="text-3xl font-semibold">EZPPLauncher Setup completed!</h1>
<p class="text-muted-foreground mt-2">You are now ready to farm some maps!</p> <p class="text-muted-foreground mt-2">You are now ready to farm some maps!</p>
<Button <Button class="mt-4" onclick={saveConfig}>Finish</Button>
class="mt-4"
onclick={async () => {
await $userSettings.save();
currentView.set(Launch);
}}
>
Finish
</Button>
</div> </div>
{:else} {:else}
<div class="grid grid-cols-[0.41fr_1fr] mt-[50px] h-[calc(100vh-50px)]"> <div class="grid grid-cols-[0.41fr_1fr] mt-[50px] h-[calc(100vh-50px)]">
@ -172,7 +192,7 @@
class="mt-4 w-full bg-theme-950 border-theme-800 border-r-0 rounded-r-none" class="mt-4 w-full bg-theme-950 border-theme-800 border-r-0 rounded-r-none"
type="text" type="text"
placeholder="Path to osu! installation" placeholder="Path to osu! installation"
value={osuInstallationPath} value={osuInstallPath}
/> />
<Button <Button
class="mt-4 bg-theme-950 border-theme-800 rounded-l-none" class="mt-4 bg-theme-950 border-theme-800 rounded-l-none"
@ -294,7 +314,7 @@
else selectedStep = Math.min(selectedStep + 1, steps.length); else selectedStep = Math.min(selectedStep + 1, steps.length);
}} }}
disabled={selectedStep > steps.length || disabled={selectedStep > steps.length ||
(selectedStep === 2 && osuInstallationPath.length <= 0)} (selectedStep === 2 && osuInstallPath.length <= 0)}
>{selectedStep >= steps.length ? 'Finish' : 'Next'}</Button >{selectedStep >= steps.length ? 'Finish' : 'Next'}</Button
> >
</div> </div>