Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite router/tabs/toaster hooks #661

Merged
merged 29 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
28c7254
initial implementation of new router and qam hooks
AAGaming00 Jul 9, 2024
88e7919
implement new toaster hook
AAGaming00 Jul 18, 2024
b93fc8b
feat(toaster): render notifications in the quick access menu
AAGaming00 Jul 26, 2024
df52ebe
feat(toaster): add support for fullTemplateTitle
AAGaming00 Jul 26, 2024
c2443ee
fix(toaster): remove critical toast logic as ProcessNotification hand…
AAGaming00 Jul 26, 2024
7b21e81
inject into desktop ui windows since they don't reload on mode change…
AAGaming00 Jul 28, 2024
4c23549
workaround python throw on webhelper restarts
AAGaming00 Jul 28, 2024
4cf8059
feat(toaster):add support for dismissing toasts and new indicator
AAGaming00 Jul 28, 2024
b8bf9f3
refactor(router): add preliminary support for multiple router hook im…
AAGaming00 Jul 28, 2024
4cde25c
fix(tabshook): remove useless leftover alternate.type set in deinit
AAGaming00 Jul 28, 2024
262b62e
chore(titleview): migrate to Navigation
AAGaming00 Jul 28, 2024
491d298
chore(deps): bump @decky/api, @decky/ui
AAGaming00 Jul 28, 2024
241aec2
chore(toaster): remove log that gets spammed a lot
AAGaming00 Jul 28, 2024
e00d517
fix(DeckyIcon): fix decky icon overflowing in toasts
AAGaming00 Jul 28, 2024
62293d2
fix(webpack): wait for most chunks to load before starting
AAGaming00 Jul 28, 2024
ff856c7
wait a bit before loading plugins to avoid race conditions
AAGaming00 Jul 28, 2024
d9ab176
increase the wait a bit
AAGaming00 Jul 28, 2024
bac1ef5
increase webhelper restart inject delay
AAGaming00 Jul 28, 2024
3cb150b
wait for unlock before showing toasts
AAGaming00 Jul 28, 2024
52b40b7
wait for SP to exist before loading plugins when booted in gamepadui …
AAGaming00 Jul 29, 2024
5e270de
fix game theme music error
AAGaming00 Jul 29, 2024
44be6ba
fix incorrect parameter order
AAGaming00 Jul 29, 2024
599279c
chore: lint
AAGaming00 Jul 29, 2024
2303023
chore: remove outdated TODO
AAGaming00 Jul 29, 2024
9d0dbbb
disable filepicker patches for now
AAGaming00 Jul 29, 2024
8a90605
actually implement timeout in the http_request_legacy handler
AAGaming00 Aug 3, 2024
9570d0b
python moment
AAGaming00 Aug 3, 2024
d444248
hopefully fix bootloops
AAGaming00 Aug 3, 2024
b3a5f96
fix router hook on stable
AAGaming00 Aug 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/decky_loader/injector.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ async def get_tab_lambda(test: Callable[[Tab], bool]) -> Tab:
DO_NOT_CLOSE_URLS = ["Valve Steam Gamepad/default", "Valve%20Steam%20Gamepad"] # Steam Big Picture Mode tab

def tab_is_gamepadui(t: Tab) -> bool:
return "https://steamloopback.host/routes/" in t.url and t.title in SHARED_CTX_NAMES
return ("https://steamloopback.host/routes/" in t.url or "https://steamloopback.host/index.html" in t.url) and t.title in SHARED_CTX_NAMES

async def get_gamepadui_tab() -> Tab:
tabs = await get_tabs()
Expand Down
1 change: 1 addition & 0 deletions backend/decky_loader/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ async def inject_javascript(self, tab: Tab, first: bool=False, request: Request|
await tab.close_websocket()
self.js_ctx_tab = None
await restart_webhelper()
await sleep(1) # To give CEF enough time to close down the websocket
return # We'll catch the next tab in the main loop
await tab.evaluate_js("try{if (window.deckyHasLoaded){setTimeout(() => SteamClient.Browser.RestartJSContext(), 100)}else{window.deckyHasLoaded = true;(async()=>{try{await import('http://localhost:1337/frontend/index.js?v=%s')}catch(e){console.error(e)};})();}}catch(e){console.error(e)}" % (get_loader_version(), ), False, False, False)
except:
Expand Down
4 changes: 2 additions & 2 deletions backend/decky_loader/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ async def http_request(self, req: Request) -> StreamResponse:
self.logger.debug(f"Finished stream for {url}")
return res

async def http_request_legacy(self, method: str, url: str, extra_opts: Any = {}):
async def http_request_legacy(self, method: str, url: str, extra_opts: Any = {}, timeout: int | None = None):
AAGaming00 marked this conversation as resolved.
Show resolved Hide resolved
async with ClientSession() as web:
res = await web.request(method, url, ssl=helpers.get_ssl_context(), **extra_opts)
res = await web.request(method, url, ssl=helpers.get_ssl_context(), timeout=timeout, **extra_opts)
text = await res.text()
return {
"status": res.status,
Expand Down
4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"localize": "i18next"
},
"devDependencies": {
"@decky/api": "^1.1.0",
"@decky/api": "^1.1.1",
"@rollup/plugin-commonjs": "^26.0.1",
"@rollup/plugin-image": "^3.0.3",
"@rollup/plugin-json": "^6.1.0",
Expand Down Expand Up @@ -47,7 +47,7 @@
}
},
"dependencies": {
"@decky/ui": "^4.6.0",
"@decky/ui": "^4.7.0",
"filesize": "^10.1.2",
"i18next": "^23.11.5",
"i18next-http-backend": "^2.5.2",
Expand Down
20 changes: 10 additions & 10 deletions frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

74 changes: 38 additions & 36 deletions frontend/src/components/DeckyIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
export default function DeckyIcon() {
return (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 456" width="512" height="456">
<g>
<path
style={{ fill: 'none' }}
d="M154.33,72.51v49.79c11.78-0.17,23.48,2,34.42,6.39c10.93,4.39,20.89,10.91,29.28,19.18
c8.39,8.27,15.06,18.13,19.61,29c4.55,10.87,6.89,22.54,6.89,34.32c0,11.78-2.34,23.45-6.89,34.32
c-4.55,10.87-11.21,20.73-19.61,29c-8.39,8.27-18.35,14.79-29.28,19.18c-10.94,4.39-22.63,6.56-34.42,6.39v49.77
c36.78,0,72.05-14.61,98.05-40.62c26-26.01,40.61-61.28,40.61-98.05c0-36.78-14.61-72.05-40.61-98.05
C226.38,87.12,191.11,72.51,154.33,72.51z"
/>
import { FC, SVGAttributes } from 'react';

<ellipse
transform="matrix(0.982 -0.1891 0.1891 0.982 -37.1795 32.9988)"
style={{ fill: 'none' }}
cx="154.33"
cy="211.33"
rx="69.33"
ry="69.33"
/>
<path style={{ fill: 'none' }} d="M430,97h-52v187h52c7.18,0,13-5.82,13-13V110C443,102.82,437.18,97,430,97z" />
<path
style={{ fill: 'currentColor' }}
d="M432,27h-54V0H0v361c0,52.47,42.53,95,95,95h188c52.47,0,95-42.53,95-95v-7h54c44.18,0,80-35.82,80-80V107
C512,62.82,476.18,27,432,27z M85,211.33c0-38.29,31.04-69.33,69.33-69.33c38.29,0,69.33,31.04,69.33,69.33
c0,38.29-31.04,69.33-69.33,69.33C116.04,280.67,85,249.62,85,211.33z M252.39,309.23c-26.01,26-61.28,40.62-98.05,40.62v-49.77
c11.78,0.17,23.48-2,34.42-6.39c10.93-4.39,20.89-10.91,29.28-19.18c8.39-8.27,15.06-18.13,19.61-29
c4.55-10.87,6.89-22.53,6.89-34.32c0-11.78-2.34-23.45-6.89-34.32c-4.55-10.87-11.21-20.73-19.61-29
c-8.39-8.27-18.35-14.79-29.28-19.18c-10.94-4.39-22.63-6.56-34.42-6.39V72.51c36.78,0,72.05,14.61,98.05,40.61
c26,26.01,40.61,61.28,40.61,98.05C293,247.96,278.39,283.23,252.39,309.23z M443,271c0,7.18-5.82,13-13,13h-52V97h52
c7.18,0,13,5.82,13,13V271z"
/>
</g>
</svg>
);
}
const DeckyIcon: FC<SVGAttributes<SVGElement>> = (props) => (
<svg xmlns="http://www.w3.org/2000/svg" height="100%" width="100%" viewBox="0 0 512 456" {...props}>
<g>
<path
style={{ fill: 'none' }}
d="M154.33,72.51v49.79c11.78-0.17,23.48,2,34.42,6.39c10.93,4.39,20.89,10.91,29.28,19.18
c8.39,8.27,15.06,18.13,19.61,29c4.55,10.87,6.89,22.54,6.89,34.32c0,11.78-2.34,23.45-6.89,34.32
c-4.55,10.87-11.21,20.73-19.61,29c-8.39,8.27-18.35,14.79-29.28,19.18c-10.94,4.39-22.63,6.56-34.42,6.39v49.77
c36.78,0,72.05-14.61,98.05-40.62c26-26.01,40.61-61.28,40.61-98.05c0-36.78-14.61-72.05-40.61-98.05
C226.38,87.12,191.11,72.51,154.33,72.51z"
/>

<ellipse
transform="matrix(0.982 -0.1891 0.1891 0.982 -37.1795 32.9988)"
style={{ fill: 'none' }}
cx="154.33"
cy="211.33"
rx="69.33"
ry="69.33"
/>
<path style={{ fill: 'none' }} d="M430,97h-52v187h52c7.18,0,13-5.82,13-13V110C443,102.82,437.18,97,430,97z" />
<path
style={{ fill: 'currentColor' }}
d="M432,27h-54V0H0v361c0,52.47,42.53,95,95,95h188c52.47,0,95-42.53,95-95v-7h54c44.18,0,80-35.82,80-80V107
C512,62.82,476.18,27,432,27z M85,211.33c0-38.29,31.04-69.33,69.33-69.33c38.29,0,69.33,31.04,69.33,69.33
c0,38.29-31.04,69.33-69.33,69.33C116.04,280.67,85,249.62,85,211.33z M252.39,309.23c-26.01,26-61.28,40.62-98.05,40.62v-49.77
c11.78,0.17,23.48-2,34.42-6.39c10.93-4.39,20.89-10.91,29.28-19.18c8.39-8.27,15.06-18.13,19.61-29
c4.55-10.87,6.89-22.53,6.89-34.32c0-11.78-2.34-23.45-6.89-34.32c-4.55-10.87-11.21-20.73-19.61-29
c-8.39-8.27-18.35-14.79-29.28-19.18c-10.94-4.39-22.63-6.56-34.42-6.39V72.51c36.78,0,72.05,14.61,98.05,40.61
c26,26.01,40.61,61.28,40.61,98.05C293,247.96,278.39,283.23,252.39,309.23z M443,271c0,7.18-5.82,13-13,13h-52V97h52
c7.18,0,13,5.82,13,13V271z"
/>
</g>
</svg>
);

export default DeckyIcon;
57 changes: 0 additions & 57 deletions frontend/src/components/DeckyToaster.tsx

This file was deleted.

69 changes: 0 additions & 69 deletions frontend/src/components/DeckyToasterState.tsx

This file was deleted.

10 changes: 5 additions & 5 deletions frontend/src/components/TitleView.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DialogButton, Focusable, Router, staticClasses } from '@decky/ui';
import { DialogButton, Focusable, Navigation, staticClasses } from '@decky/ui';
import { CSSProperties, FC } from 'react';
import { useTranslation } from 'react-i18next';
import { BsGearFill } from 'react-icons/bs';
Expand All @@ -19,13 +19,13 @@ const TitleView: FC = () => {
const { t } = useTranslation();

const onSettingsClick = () => {
Router.CloseSideMenus();
Router.Navigate('/decky/settings');
Navigation.Navigate('/decky/settings');
Navigation.CloseSideMenus();
};

const onStoreClick = () => {
Router.CloseSideMenus();
Router.Navigate('/decky/store');
Navigation.Navigate('/decky/store');
Navigation.CloseSideMenus();
};

if (activePlugin === null) {
Expand Down
Loading
Loading