mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-11 00:03:40 +00:00
8c8cf180fa
* Add an updater in settings for decky-loader * add chmod * remove junk comments
31 lines
628 B
TypeScript
31 lines
628 B
TypeScript
import { sleep } from 'decky-frontend-lib';
|
|
|
|
export enum Branches {
|
|
Release,
|
|
Prerelease,
|
|
Nightly,
|
|
}
|
|
|
|
export interface DeckyUpdater {
|
|
updateProgress: (val: number) => void;
|
|
finish: () => void;
|
|
}
|
|
|
|
export async function callUpdaterMethod(methodName: string, args = {}) {
|
|
const response = await fetch(`http://127.0.0.1:1337/updater/${methodName}`, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
},
|
|
body: JSON.stringify(args),
|
|
});
|
|
|
|
return response.json();
|
|
}
|
|
|
|
export async function finishUpdate() {
|
|
callUpdaterMethod('do_restart');
|
|
await sleep(3000);
|
|
location.reload();
|
|
}
|