From c34cc2c8fac519372f89e0873c94c2a2e70d7d33 Mon Sep 17 00:00:00 2001 From: Beebles <102569435+beebls@users.noreply.github.com> Date: Sat, 16 Dec 2023 14:09:27 -0700 Subject: [PATCH 1/4] fix console error spam on motd --- src/api.ts | 4 +++- src/components/QAMTab/MOTDDisplay.tsx | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/api.ts b/src/api.ts index 2bd8f04..dd2a9d7 100644 --- a/src/api.ts +++ b/src/api.ts @@ -165,7 +165,9 @@ export async function genericGET( throw new Error(`No json returned!`); }) .catch((err) => { - console.error(`Error fetching ${fetchPath}`, err); + if (!failSilently) { + console.error(`Error fetching ${fetchPath}`, err); + } onError(); }); } diff --git a/src/components/QAMTab/MOTDDisplay.tsx b/src/components/QAMTab/MOTDDisplay.tsx index 0ef7953..c586651 100644 --- a/src/components/QAMTab/MOTDDisplay.tsx +++ b/src/components/QAMTab/MOTDDisplay.tsx @@ -11,7 +11,7 @@ export function MOTDDisplay() { const { hiddenMotd, setGlobalState } = useCssLoaderState(); useEffect(() => { async function getMotd() { - const res = await genericGET("/motd", false); + const res = await genericGET("/motd", false, undefined, () => {}, true); setMotd(res); } getMotd(); From 7f625d84a02c4df3a66026860cbadef861e7b9b4 Mon Sep 17 00:00:00 2001 From: Beebles <102569435+beebls@users.noreply.github.com> Date: Sat, 16 Dec 2023 14:11:39 -0700 Subject: [PATCH 2/4] re-add global DFL --- package-lock.json | 18 +++++++++--------- rollup.config.js | 4 ++-- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 90234f4..ffa8336 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,18 +1,18 @@ { "name": "SDH-CssLoader", - "version": "1.8.0", + "version": "2.0.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "SDH-CssLoader", - "version": "1.8.0", + "version": "2.0.2", "license": "GPL-2.0-or-later", "dependencies": { "color": "^4.2.3", "decky-frontend-lib": "^3.22.0", "lodash": "^4.17.21", - "react-icons": "^4.3.1" + "react-icons": "^4.12.0" }, "devDependencies": { "@rollup/plugin-commonjs": "^21.1.0", @@ -2274,9 +2274,9 @@ } }, "node_modules/react-icons": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.4.0.tgz", - "integrity": "sha512-fSbvHeVYo/B5/L4VhB7sBA1i2tS8MkT0Hb9t2H1AVPkwGfVHLJCqyr2Py9dKMxsyM63Eng1GkdZfbWj+Fmv8Rg==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.12.0.tgz", + "integrity": "sha512-IBaDuHiShdZqmfc/TwHu6+d6k2ltNCf3AszxNmjJc1KUfXdEeRJOKyNvLmAHaarhzGmTSVygNdyu8/opXv2gaw==", "peerDependencies": { "react": "*" } @@ -4559,9 +4559,9 @@ } }, "react-icons": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.4.0.tgz", - "integrity": "sha512-fSbvHeVYo/B5/L4VhB7sBA1i2tS8MkT0Hb9t2H1AVPkwGfVHLJCqyr2Py9dKMxsyM63Eng1GkdZfbWj+Fmv8Rg==", + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/react-icons/-/react-icons-4.12.0.tgz", + "integrity": "sha512-IBaDuHiShdZqmfc/TwHu6+d6k2ltNCf3AszxNmjJc1KUfXdEeRJOKyNvLmAHaarhzGmTSVygNdyu8/opXv2gaw==", "requires": {} }, "rechoir": { diff --git a/rollup.config.js b/rollup.config.js index 788620f..a0bcc37 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -26,13 +26,13 @@ export default defineConfig({ }), ], context: "window", - external: ["react", "react-dom"], + external: ["react", "react-dom", "decky-frontend-lib"], output: { file: "dist/index.js", globals: { react: "SP_REACT", "react-dom": "SP_REACTDOM", - // "decky-frontend-lib": "DFL", + "decky-frontend-lib": "DFL", }, format: "iife", exports: "default", From 827e1af39d1e98f37ca7ef5e495ab2a313ddc168 Mon Sep 17 00:00:00 2001 From: Beebles <102569435+beebls@users.noreply.github.com> Date: Sat, 16 Dec 2023 14:11:50 -0700 Subject: [PATCH 3/4] version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ae71b3d..55ddf96 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "SDH-CssLoader", - "version": "2.0.2", + "version": "2.0.3", "description": "A css loader", "scripts": { "build": "shx rm -rf dist && rollup -c", From 22519a18ac136e4dad69260aae32320ddda00ffe Mon Sep 17 00:00:00 2001 From: Beebles <102569435+beebls@users.noreply.github.com> Date: Sat, 23 Dec 2023 14:51:43 -0700 Subject: [PATCH 4/4] fix: themes with no preview image no longer bork --- src/pages/theme-manager/ExpandedView.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/theme-manager/ExpandedView.tsx b/src/pages/theme-manager/ExpandedView.tsx index c4f027c..653b9fb 100644 --- a/src/pages/theme-manager/ExpandedView.tsx +++ b/src/pages/theme-manager/ExpandedView.tsx @@ -255,7 +255,11 @@ export const ExpandedViewPage: VFC = () => { width={selectedImageWidth} height={selectedImageHeight} style={{ objectFit: "contain" }} - src={`https://api.deckthemes.com/blobs/${fullThemeData.images[focusedImage].id}`} + src={ + fullThemeData.images.length > 0 + ? `https://api.deckthemes.com/blobs/${fullThemeData.images?.[focusedImage]?.id}` + : `https://share.deckthemes.com/cssplaceholder.png` + } /> {fullThemeData.images.length > 1 && (