diff options
| -rw-r--r-- | frontend/package.json | 2 | ||||
| -rw-r--r-- | frontend/pnpm-lock.yaml | 8 | ||||
| -rw-r--r-- | frontend/src/index.tsx | 26 |
3 files changed, 31 insertions, 5 deletions
diff --git a/frontend/package.json b/frontend/package.json index bea4d8b8..d7005d23 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -37,7 +37,7 @@ } }, "dependencies": { - "decky-frontend-lib": "^1.6.2", + "decky-frontend-lib": "^1.7.4", "react-icons": "^4.4.0" } } diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index 587ca4aa..b85ed804 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -9,7 +9,7 @@ specifiers: '@types/react': 16.14.0 '@types/react-router': 5.1.18 '@types/webpack': ^5.28.0 - decky-frontend-lib: ^1.6.2 + decky-frontend-lib: ^1.7.4 husky: ^8.0.1 import-sort-style-module: ^6.0.0 inquirer: ^8.2.4 @@ -23,7 +23,7 @@ specifiers: typescript: ^4.7.4 dependencies: - decky-frontend-lib: 1.6.2 + decky-frontend-lib: 1.7.4 react-icons: 4.4.0_react@16.14.0 devDependencies: @@ -806,8 +806,8 @@ packages: ms: 2.1.2 dev: true - /decky-frontend-lib/1.6.2: - resolution: {integrity: sha512-O34rHg6BWYP99jxlosAl0hUfo+SmOyjN+TtcyutdIjvPkg/FgHwahTd+SMujTpZemV31c4JX8hdGnN/Z7tjL9g==} + /decky-frontend-lib/1.7.4: + resolution: {integrity: sha512-ewaAXP/2Q5zC8/+/bOo406aDxL/LW7p3PbkbXq8DEP933geU9lF238YCQOhZtDX7Bcpb5K1N7VqkL7L/bnEzdw==} dependencies: minimist: 1.2.6 dev: false diff --git a/frontend/src/index.tsx b/frontend/src/index.tsx index b6c4e3aa..96c3306c 100644 --- a/frontend/src/index.tsx +++ b/frontend/src/index.tsx @@ -1,3 +1,6 @@ +import { ButtonItem, CommonUIModule, webpackCache } from 'decky-frontend-lib'; +import { forwardRef } from 'react'; + import PluginLoader from './plugin-loader'; import { DeckyUpdater } from './updater'; @@ -9,8 +12,31 @@ declare global { syncDeckyPlugins: Function; deckyHasLoaded: boolean; deckyAuthToken: string; + webpackJsonp: any; } } + +// HACK to fix plugins using webpack v4 push + +const v4Cache = {}; +for (let m of Object.keys(webpackCache)) { + v4Cache[m] = { exports: webpackCache[m] }; +} + +if (!window.webpackJsonp || window.webpackJsonp.deckyShimmed) { + window.webpackJsonp = { + deckyShimmed: true, + push: (mod: any): any => { + if (mod[1].get_require) return { c: v4Cache }; + }, + }; +} +CommonUIModule.__deckyButtonItemShim = forwardRef((props: any, ref: any) => { + // tricks the old filter into working + const dummy = `childrenContainerWidth:"min"`; + return <ButtonItem ref={ref} _shim={dummy} {...props} />; +}); + (async () => { window.deckyHasLoaded = true; window.deckyAuthToken = await fetch('http://127.0.0.1:1337/auth/token').then((r) => r.text()); |
