Add auto updates and tighten reply feeds

This commit is contained in:
cyph3rasi
2026-03-08 19:22:18 -07:00
parent 5f21ea8e5d
commit 044196cfa7
7 changed files with 281 additions and 41 deletions
+14 -1
View File
@@ -12,6 +12,11 @@ export interface HostUpdaterStatus {
lastExitCode?: number | null;
lastError?: string | null;
pid?: number | null;
trigger?: 'manual' | 'auto' | null;
config?: {
autoUpdateEnabled: boolean;
intervalMinutes: number;
};
}
function getUpdaterConfig() {
@@ -25,7 +30,7 @@ function getUpdaterConfig() {
};
}
function requestUpdater<T>(method: 'GET' | 'POST', path: string, body?: unknown): Promise<T> {
function requestUpdater<T>(method: 'GET' | 'POST' | 'PATCH', path: string, body?: unknown): Promise<T> {
const { socketPath, token, enabled } = getUpdaterConfig();
if (!enabled) {
@@ -114,3 +119,11 @@ export async function getHostUpdaterStatus(): Promise<HostUpdaterStatus> {
export async function triggerHostUpdate() {
return requestUpdater<{ ok: boolean; status: string; message?: string }>('POST', '/update');
}
export async function updateHostUpdaterConfig(autoUpdateEnabled: boolean) {
return requestUpdater<{ ok: boolean; config: { autoUpdateEnabled: boolean; intervalMinutes: number } }>(
'PATCH',
'/config',
{ autoUpdateEnabled }
);
}