fix: check for updates does not look for commit.json now (#861)

This commit is contained in:
Anirban Kar
2024-12-24 13:34:46 +05:30
committed by GitHub
parent d673206952
commit 8185fd56ca
2 changed files with 25 additions and 19 deletions

View File

@@ -35,18 +35,12 @@ export function useSettings() {
// Function to check if we're on stable version
const checkIsStableVersion = async () => {
try {
const stableResponse = await fetch(
`https://raw.githubusercontent.com/stackblitz-labs/bolt.diy/refs/tags/v${versionData.version}/app/commit.json`,
const response = await fetch(
`https://api.github.com/repos/stackblitz-labs/bolt.diy/git/refs/tags/v${versionData.version}`,
);
const data: { object: { sha: string } } = await response.json();
if (!stableResponse.ok) {
console.warn('Failed to fetch stable commit info');
return false;
}
const stableData = (await stableResponse.json()) as CommitData;
return versionData.commit === stableData.commit;
return versionData.commit.slice(0, 7) === data.object.sha.slice(0, 7);
} catch (error) {
console.warn('Error checking stable version:', error);
return false;