clean up updater logic

This commit is contained in:
AAGaming
2024-02-19 23:42:24 -05:00
parent 22b732bab4
commit 7e3f9edacf
4 changed files with 8 additions and 7 deletions
@@ -80,10 +80,9 @@ export default function UpdaterSettings() {
setIsLoaderUpdating(true);
});
const b = DeckyBackend.addEventListener('frontend/finish_download', async () => {
const b = DeckyBackend.addEventListener('frontend/finish_download', () => {
setUpdateProgress(0);
setReloading(true);
await doRestart();
});
return () => {
+1 -1
View File
@@ -2,7 +2,7 @@
(async () => {
console.debug('Setting up decky-frontend-lib...');
window.DFL = await import('decky-frontend-lib');
console.debug('Authenticating to Decky backend...');
console.debug('Authenticating with Decky backend...');
window.deckyAuthToken = await fetch('http://127.0.0.1:1337/auth/token').then((r) => r.text());
console.debug('Connecting to Decky backend...');
window.DeckyBackend = new (await import('./wsrouter')).WSRouter();
+4
View File
@@ -27,3 +27,7 @@ export const doUpdate = DeckyBackend.callable('updater/do_update');
export const doRestart = DeckyBackend.callable('updater/do_restart');
export const getVersionInfo = DeckyBackend.callable<[], VerInfo>('updater/get_version_info');
export const checkForUpdates = DeckyBackend.callable<[], VerInfo>('updater/check_for_updates');
DeckyBackend.addEventListener('frontend/finish_download', async () => {
await doRestart();
});
+2 -4
View File
@@ -84,9 +84,7 @@ export class WSRouter extends Logger {
resolver.reject = reject;
});
resolver.promise = promise;
// The promise will always run first
// @ts-expect-error 2454
return resolver;
return resolver as PromiseResolver<T>;
}
async write(data: Message) {
@@ -167,7 +165,7 @@ export class WSRouter extends Logger {
})();
}
} else {
this.debug(`event ${data.event} has no listeners`);
this.warn(`event ${data.event} has no listeners`);
}
break;