mirror of
https://github.com/coleam00/Archon.git
synced 2025-12-24 02:39:17 -05:00
* Preparing migration folder for the migration alert implementation * Migrations and version APIs initial * Touching up update instructions in README and UI * Unit tests for migrations and version APIs * Splitting up the Ollama migration scripts * Removing temporary PRPs --------- Co-authored-by: Rasmus Widing <rasmus.widing@gmail.com>
50 lines
1.4 KiB
TypeScript
50 lines
1.4 KiB
TypeScript
/**
|
|
* Service for version checking and update management
|
|
*/
|
|
|
|
import { callAPIWithETag } from "@/features/shared/apiWithEtag";
|
|
import type { CurrentVersionResponse, VersionCheckResponse } from "../types";
|
|
|
|
export const versionService = {
|
|
/**
|
|
* Check for available Archon updates
|
|
*/
|
|
async checkVersion(): Promise<VersionCheckResponse> {
|
|
try {
|
|
const response = await callAPIWithETag("/api/version/check");
|
|
return response as VersionCheckResponse;
|
|
} catch (error) {
|
|
console.error("Error checking version:", error);
|
|
throw error;
|
|
}
|
|
},
|
|
|
|
/**
|
|
* Get current Archon version without checking for updates
|
|
*/
|
|
async getCurrentVersion(): Promise<CurrentVersionResponse> {
|
|
try {
|
|
const response = await callAPIWithETag("/api/version/current");
|
|
return response as CurrentVersionResponse;
|
|
} catch (error) {
|
|
console.error("Error getting current version:", error);
|
|
throw error;
|
|
}
|
|
},
|
|
|
|
/**
|
|
* Clear version cache to force fresh check
|
|
*/
|
|
async clearCache(): Promise<{ message: string; success: boolean }> {
|
|
try {
|
|
const response = await callAPIWithETag("/api/version/clear-cache", {
|
|
method: "POST",
|
|
});
|
|
return response as { message: string; success: boolean };
|
|
} catch (error) {
|
|
console.error("Error clearing version cache:", error);
|
|
throw error;
|
|
}
|
|
},
|
|
};
|