diff --git a/src/lib/global.ts b/src/lib/global.ts index a4eebcd..477130a 100644 --- a/src/lib/global.ts +++ b/src/lib/global.ts @@ -9,6 +9,8 @@ export const currentLoadingInfo = writable('Initializing...'); export const firstStartup = writable(false); +export const launching = writable(false); + export const serverPing = writable(undefined); export const serverConnectionFails = writable(0); @@ -20,20 +22,20 @@ export const skins = writable(undefined); export const osuStream = writable(undefined); export const osuBuild = writable(undefined); +let updateValues = true; +launching.subscribe((val) => (updateValues = !val)); + export const setupValues = () => { updatePing(); - updateFriends(); - updateBeatmapSets(); const pingUpdater = setInterval(updatePing, 5000 * 2); - const friendUpdater = setInterval(updateFriends, 5000 * 2); return () => { clearInterval(pingUpdater); - clearInterval(friendUpdater); }; }; const updatePing = async () => { + if (!updateValues) return; const currentServerPing = await ezppfarm.ping(); if (!currentServerPing) { serverConnectionFails.update((num) => num + 1); @@ -42,11 +44,3 @@ const updatePing = async () => { serverPing.set(currentServerPing); } }; - -const updateFriends = async () => { - await new Promise((res) => setTimeout(res, Math.random() * 300)); - const currentOnlineFriends = Math.round(Math.random() * 10); - onlineFriends.set(currentOnlineFriends); -}; - -const updateBeatmapSets = async () => {}; diff --git a/src/pages/Launch.svelte b/src/pages/Launch.svelte index ec8f622..a406e8c 100644 --- a/src/pages/Launch.svelte +++ b/src/pages/Launch.svelte @@ -7,6 +7,7 @@ import { beatmapSets, currentView, + launching, osuBuild, osuStream, serverConnectionFails, @@ -71,7 +72,6 @@ import { getCurrentWindow } from '@tauri-apps/api/window'; let selectedTab = $state('home'); - let launching = $state(false); let launchInfo = $state(''); let selectedGamemode = $derived( @@ -133,14 +133,14 @@ } const osuPath = $osuInstallationPath; launchInfo = 'Validating osu! installation...'; - launching = true; + launching.set(true); const validFolder: boolean = await invoke('valid_osu_folder', { folder: osuPath }); if (!validFolder) { toast.error('Hmmm...', { description: 'Your selected osu! installation folder is not valid.', }); - launching = false; + launching.set(false); return; } @@ -150,7 +150,7 @@ toast.error('Hmmm...', { description: 'Failed to check for updates.', }); - launching = false; + launching.set(false); return; } @@ -215,6 +215,29 @@ }, ]); } + } else { + await setUserConfigValues(osuPath, [ + { + key: 'Username', + value: '', + }, + { + key: 'Password', + value: '', + }, + { + key: 'SaveUsername', + value: '1', + }, + { + key: 'SavePassword', + value: '0', + }, + { + key: 'CredentialEndpoint', + value: 'ez-pp.farm', + }, + ]); } await new Promise((res) => setTimeout(res, 1500)); launchInfo = 'Launching osu!...'; @@ -243,22 +266,22 @@ }); if (skinCount) skins.set(skinCount); - launching = false; + launching.set(false); } catch (err) { console.log(err); toast.error('Hmmm...', { description: 'Failed to launch.', }); - launching = false; + launching.set(false); } setTimeout(() => { - launching = false; + launching.set(false); }, 5000); }; - +
-
+
osu! Release Stream