• Checks for updates by comparing the current version with the latest GitHub release.

    Returns Promise<UpdateInfo>

    A promise that resolves to an UpdateInfo object.

    If the GitHub API request fails.

    const update = await checkForUpdates();
    if (update.hasUpdate) {
    // Notify user
    }
    export async function checkForUpdates(): Promise<UpdateInfo> {
    try {
    const response = await fetch(
    "https://api.github.com/repos/RLAlpha49/kenmei-to-anilist/releases/latest",
    );

    if (!response.ok) {
    return {
    hasUpdate: false,
    latestVersion: "",
    releaseUrl: "",
    };
    }

    const data = await response.json();
    const latestVersion = data.tag_name?.replace(/^v/, "") || "";
    const currentVersion = getAppVersion();

    // Simple version comparison (this could be more sophisticated)
    const hasUpdate =
    latestVersion &&
    currentVersion &&
    compareVersions(latestVersion, currentVersion) > 0;

    return {
    hasUpdate,
    latestVersion,
    releaseUrl: data.html_url || "",
    };
    } catch (error) {
    console.error("Error checking for updates:", error);
    return {
    hasUpdate: false,
    latestVersion: "",
    releaseUrl: "",
    };
    }
    }