Skip to content

Commit

Permalink
fix unminify mode (in preparation for new)
Browse files Browse the repository at this point in the history
  • Loading branch information
beebls committed Feb 1, 2025
1 parent 7ea4370 commit 7bab6ea
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ async def save_mappings(self, val: str) -> dict:
util_save_mappings(val)
return Result(True).to_dict()

async def get_webpack_mappigns(self) -> dict:
async def get_webpack_mappings(self) -> dict:
return generate_webpack_id_name_list_from_local_file()

async def exit(self):
Expand Down
3 changes: 3 additions & 0 deletions src/backend/services/backend-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ export class Backend {
) {
return Backend.repository.fetch<Return>(url, request, mode);
}
async getMappings() {
return Backend.repository.call<[], object>("get_webpack_mappings", []);
}

toast(title: string, body?: string) {
Backend.repository.toast(title, body);
Expand Down
16 changes: 9 additions & 7 deletions src/backend/state/theme-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export const createCSSLoaderStore = (backend: Backend) =>
async function getPatrons() {
try {
const data = await apiFetch<string>(
`${apiUrl}/patrons`,
"/patrons",
{},
{
responseMode: "text",
Expand All @@ -137,7 +137,7 @@ export const createCSSLoaderStore = (backend: Backend) =>
return data.split("\n");
}
} catch (error) {
console.error(error);
console.error("CSSLoader - Error Fetching Patrons", error);
}
return [];
}
Expand Down Expand Up @@ -191,6 +191,8 @@ export const createCSSLoaderStore = (backend: Backend) =>
const themePath = await backend.fetchThemePath();
set({ themeRootPath: themePath });

console.log("HELLO TEST", await backend.getMappings());

const unpinnedThemesStr = await backend.storeRead("unpinnedThemes");
const unpinnedThemes: string[] = unpinnedThemesStr ? JSON.parse(unpinnedThemesStr) : [];
const allThemeIds = themes.map((e) => e.id);
Expand Down Expand Up @@ -230,7 +232,7 @@ export const createCSSLoaderStore = (backend: Backend) =>
const patrons = await getPatrons();
set({ patrons });
} catch (error) {
console.log("Error During Initialzation", error);
console.log("CSSLoader - Error During Initialzation", error);
}
},
deactivate: () => {
Expand Down Expand Up @@ -264,7 +266,7 @@ export const createCSSLoaderStore = (backend: Backend) =>
await backend.reset();
await get().getThemes();
} catch (error) {
console.error("Error Reloading Themes", error);
console.error("CSSLoader - Error Reloading Themes", error);
}
},
logInWithShortToken: async (newToken?: string) => {
Expand Down Expand Up @@ -356,7 +358,7 @@ export const createCSSLoaderStore = (backend: Backend) =>
selectedPreset: themes.find((e) => e.flags.includes(Flags.isPreset) && e.enabled),
});
} catch (error) {
console.error("Error Fetching Themes", error);
console.error("CSSLoader - Error Fetching Themes", error);
}
},
changePreset: async (presetName: string) => {
Expand Down Expand Up @@ -436,7 +438,7 @@ export const createCSSLoaderStore = (backend: Backend) =>

set({ nextUpdateCheckTime: new Date().valueOf() + 24 * 60 * 60 * 1000 });
} catch (err) {
console.log("Error Checking For Theme Updates", err);
console.log("CSSLoader - Error Checking For Theme Updates", err);
}
recursiveCheck();
}, 5 * 60 * 1000);
Expand Down Expand Up @@ -542,7 +544,7 @@ export const createCSSLoaderStore = (backend: Backend) =>
await get().getThemes();
}
} catch (error) {
console.error(error);
console.error("CSSLoader - Error Toggling Theme", error);
}
},
pinTheme: async (themeId: string) => {
Expand Down
1 change: 0 additions & 1 deletion src/decky-patches/decky-patch-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const createDeckyPatchStore = (backend: Backend) =>
initializeStore: async () => {
try {
const shouldEnable = await backend.storeRead("enableNavPatch");
return;
if (shouldEnable) {
const patch = enableNavPatch();
set({ navPatchInstance: patch });
Expand Down
8 changes: 4 additions & 4 deletions src/decky-patches/unminify-mode/steam-tab-elements-finder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import { getGamepadNavigationTrees } from "@decky/ui";
export function getElementFromNavID(navID: string) {
const all = getGamepadNavigationTrees();
if (!all) return null;
const tree = all?.find((e: any) => e.m_ID == navID);
const tree = all?.find((e: any) => e.m_ID.includes(navID));
if (!tree) return null;
return tree.Root.Element;
}
export function getSP() {
return getElementFromNavID("root_1_");
return getElementFromNavID("GamepadUI");
}
export function getQAM() {
return getElementFromNavID("QuickAccess-NA");
return getElementFromNavID("QuickAccess");
}
export function getMainMenu() {
return getElementFromNavID("MainNavMenuContainer");
return getElementFromNavID("MainNavMenu");
}
export function getRootElements() {
return [getSP(), getQAM(), getMainMenu()].filter(Boolean);
Expand Down
2 changes: 1 addition & 1 deletion src/modules/expanded-view/context/ExpandedViewStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const expandedViewStore = createStore<IExpandedViewStore>((set, get) => {
},
});
} catch (error) {
console.error(error);
console.error("CSSLoader - Error Starring Theme", error);
const { toast } = getCSSLoaderState();
toast("Error starring theme!");
}
Expand Down
1 change: 0 additions & 1 deletion src/modules/theme-store/pages/ThemeStoreRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ export function ThemeStoreRouter() {
<Tabs
activeTab={currentTab}
onShowTab={(tab: string) => {
console.log("Setting tab", tab);
setCurrentTab(tab);
}}
tabs={tabs}
Expand Down

0 comments on commit 7bab6ea

Please sign in to comment.