mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-21 01:57:41 +02:00
Added update module
This commit is contained in:
@@ -153,6 +153,7 @@ export interface AppSettings {
|
||||
currency: string;
|
||||
energy_cost_per_kwh: number;
|
||||
energy_tracking_mode: 'print' | 'total';
|
||||
check_updates: boolean;
|
||||
}
|
||||
|
||||
export type AppSettingsUpdate = Partial<AppSettings>;
|
||||
@@ -492,6 +493,31 @@ export interface SpoolmanSyncResult {
|
||||
errors: string[];
|
||||
}
|
||||
|
||||
// Update types
|
||||
export interface VersionInfo {
|
||||
version: string;
|
||||
repo: string;
|
||||
}
|
||||
|
||||
export interface UpdateCheckResult {
|
||||
update_available: boolean;
|
||||
current_version: string;
|
||||
latest_version: string | null;
|
||||
release_name?: string;
|
||||
release_notes?: string;
|
||||
release_url?: string;
|
||||
published_at?: string;
|
||||
error?: string;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
export interface UpdateStatus {
|
||||
status: 'idle' | 'checking' | 'downloading' | 'installing' | 'complete' | 'error';
|
||||
progress: number;
|
||||
message: string;
|
||||
error: string | null;
|
||||
}
|
||||
|
||||
// API functions
|
||||
export const api = {
|
||||
// Printers
|
||||
@@ -906,4 +932,13 @@ export const api = {
|
||||
request<{ spools: unknown[] }>('/spoolman/spools'),
|
||||
getSpoolmanFilaments: () =>
|
||||
request<{ filaments: unknown[] }>('/spoolman/filaments'),
|
||||
|
||||
// Updates
|
||||
getVersion: () => request<VersionInfo>('/updates/version'),
|
||||
checkForUpdates: () => request<UpdateCheckResult>('/updates/check'),
|
||||
applyUpdate: () =>
|
||||
request<{ success: boolean; message: string; status: UpdateStatus }>('/updates/apply', {
|
||||
method: 'POST',
|
||||
}),
|
||||
getUpdateStatus: () => request<UpdateStatus>('/updates/status'),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user