feat: add signed launcher updates with native lifecycle recovery
This commit is contained in:
@@ -2,6 +2,7 @@ import { invoke, isTauri } from '@tauri-apps/api/core'
|
||||
import { listen } from '@tauri-apps/api/event'
|
||||
import { getCurrentWindow } from '@tauri-apps/api/window'
|
||||
import { createSerialQueue, createSubscription, singleFlight } from './async'
|
||||
import type { UpdaterStatus } from '../types/updater'
|
||||
import type {
|
||||
GameExitedPayload, InstallProgressPayload, JavaInstallation, LauncherSettings,
|
||||
LinkChallenge, LinkStatus, NativeHost, ProfileInspection, ServerStatus,
|
||||
@@ -15,6 +16,11 @@ const restoreAccount = singleFlight(() => accountRequests.enqueue(() => invoke<S
|
||||
// Keep the IPC contract in one place. UI components never invoke native
|
||||
// commands directly and cannot pass arbitrary URLs or filesystem paths.
|
||||
export const native = {
|
||||
updaterStatus: () => invoke<UpdaterStatus>('updater_status'),
|
||||
checkUpdater: () => invoke<UpdaterStatus>('updater_check'),
|
||||
installUpdater: () => invoke<UpdaterStatus>('updater_download_install'),
|
||||
restartUpdater: () => invoke<void>('updater_restart'),
|
||||
openUpdaterRelease: () => invoke<void>('updater_open_release_page'),
|
||||
host: () => invoke<NativeHost>('native_host'),
|
||||
metadata: (profileId: string) => invoke<ProfileMetadata>('profile_metadata', { profileId }),
|
||||
legacyMods: (profileId: string) => invoke<LegacyMod[]>('legacy_mods', { profileId }),
|
||||
@@ -36,6 +42,12 @@ export const native = {
|
||||
launchOnboarding: (profileId: string, nickname: string) => invoke<PreparationResult>('launch_onboarding', { profileId, nickname }),
|
||||
}
|
||||
|
||||
export function watchUpdater(receive: (status: UpdaterStatus) => void) {
|
||||
return createSubscription([
|
||||
listen<UpdaterStatus>('launcher-update-status', ({ payload }) => receive(payload)),
|
||||
])
|
||||
}
|
||||
|
||||
export const windowControls = {
|
||||
minimize: () => getCurrentWindow().minimize(),
|
||||
toggleMaximize: () => getCurrentWindow().toggleMaximize(),
|
||||
|
||||
Reference in New Issue
Block a user