From 407e6479939d02633512785694defd92b1d8b39c Mon Sep 17 00:00:00 2001 From: Party Wumpus <48649272+PartyWumpus@users.noreply.github.com> Date: Tue, 17 Oct 2023 13:44:44 +0100 Subject: [PATCH 1/2] fix logical error when no store was set --- frontend/src/store.tsx | 58 +++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/frontend/src/store.tsx b/frontend/src/store.tsx index 55d1e731..fd194469 100644 --- a/frontend/src/store.tsx +++ b/frontend/src/store.tsx @@ -38,40 +38,34 @@ export async function getStore(): Promise { export async function getPluginList(): Promise { let version = await window.DeckyPluginLoader.updateVersion(); - let store = await getSetting('store', Store.Default); + let store = await getSetting('store', null); let customURL = await getSetting('store-url', 'https://plugins.deckbrew.xyz/plugins'); let storeURL; - if (!store) { - console.log('Could not get a default store, using Default.'); - await setSetting('store-url', Store.Default); - return fetch('https://plugins.deckbrew.xyz/plugins', { - method: 'GET', - headers: { - 'X-Decky-Version': version.current, - }, - }).then((r) => r.json()); - } else { - switch (+store) { - case Store.Default: - storeURL = 'https://plugins.deckbrew.xyz/plugins'; - break; - case Store.Testing: - storeURL = 'https://testing.deckbrew.xyz/plugins'; - break; - case Store.Custom: - storeURL = customURL; - break; - default: - console.error('Somehow you ended up without a standard URL, using the default URL.'); - storeURL = 'https://plugins.deckbrew.xyz/plugins'; - break; - } - return fetch(storeURL, { - method: 'GET', - headers: { - 'X-Decky-Version': version.current, - }, - }).then((r) => r.json()); + if (store === null) { + console.log('Could not get store, using Default.'); + await setSetting('store', Store.Default); + store = Store.Default + } + switch (+store) { + case Store.Default: + storeURL = 'https://plugins.deckbrew.xyz/plugins'; + break; + case Store.Testing: + storeURL = 'https://testing.deckbrew.xyz/plugins'; + break; + case Store.Custom: + storeURL = customURL; + break; + default: + console.error('Somehow you ended up without a standard URL, using the default URL.'); + storeURL = 'https://plugins.deckbrew.xyz/plugins'; + break; + return fetch(storeURL, { + method: 'GET', + headers: { + 'X-Decky-Version': version.current, + }, + }).then((r) => r.json()); } } From f53a3f383da5de483d4f402ed785c8800da60bf0 Mon Sep 17 00:00:00 2001 From: Party Wumpus <48649272+PartyWumpus@users.noreply.github.com> Date: Tue, 17 Oct 2023 13:52:11 +0100 Subject: [PATCH 2/2] fix typo this is what i get for commiting to main :pensive: --- frontend/src/store.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/store.tsx b/frontend/src/store.tsx index fd194469..846c4766 100644 --- a/frontend/src/store.tsx +++ b/frontend/src/store.tsx @@ -44,7 +44,7 @@ export async function getPluginList(): Promise { if (store === null) { console.log('Could not get store, using Default.'); await setSetting('store', Store.Default); - store = Store.Default + store = Store.Default; } switch (+store) { case Store.Default: @@ -60,13 +60,13 @@ export async function getPluginList(): Promise { console.error('Somehow you ended up without a standard URL, using the default URL.'); storeURL = 'https://plugins.deckbrew.xyz/plugins'; break; + } return fetch(storeURL, { method: 'GET', headers: { 'X-Decky-Version': version.current, }, }).then((r) => r.json()); - } } export async function installFromURL(url: string) {