From 40c7c1b515abf4abcecd6480afb28f27fb71d0f0 Mon Sep 17 00:00:00 2001 From: AAGaming Date: Sat, 30 Dec 2023 21:32:23 -0500 Subject: port updater to ws, also small refactoring --- frontend/src/updater.ts | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'frontend/src/updater.ts') diff --git a/frontend/src/updater.ts b/frontend/src/updater.ts index 339b2b72..d6c23832 100644 --- a/frontend/src/updater.ts +++ b/frontend/src/updater.ts @@ -28,20 +28,7 @@ export interface VerInfo { updatable: boolean; } -export async function callUpdaterMethod(methodName: string, args = {}) { - const response = await fetch(`http://127.0.0.1:1337/updater/${methodName}`, { - method: 'POST', - credentials: 'include', - headers: { - 'Content-Type': 'application/json', - Authentication: window.deckyAuthToken, - }, - body: JSON.stringify(args), - }); - - return response.json(); -} - -export async function finishUpdate() { - callUpdaterMethod('do_restart'); -} +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'); -- cgit v1.2.3