summaryrefslogtreecommitdiff
path: root/frontend/src/updater.ts
blob: edc9eeb38766e87aa7ca6303423ba88b935b33fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
export enum Branches {
  Release,
  Prerelease,
  // Testing,
}

export interface RemoteVerInfo {
  assets: {
    browser_download_url: string;
    created_at: string;
  }[];
  name: string;
  body: string;
  prerelease: boolean;
  published_at: string;
  tag_name: string;
}

export interface VerInfo {
  current: string;
  remote: RemoteVerInfo | null;
  all: RemoteVerInfo[] | null;
  updatable: boolean;
}

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();
});