mirror of
https://github.com/stackblitz-labs/bolt.diy
synced 2025-01-22 19:06:12 +00:00
fix: check for updates does not look for commit.json now (#861)
This commit is contained in:
parent
d673206952
commit
8185fd56ca
@ -56,8 +56,25 @@ const versionTag = connitJson.version;
|
|||||||
const GITHUB_URLS = {
|
const GITHUB_URLS = {
|
||||||
original: 'https://api.github.com/repos/stackblitz-labs/bolt.diy/commits/main',
|
original: 'https://api.github.com/repos/stackblitz-labs/bolt.diy/commits/main',
|
||||||
fork: 'https://api.github.com/repos/Stijnus/bolt.new-any-llm/commits/main',
|
fork: 'https://api.github.com/repos/Stijnus/bolt.new-any-llm/commits/main',
|
||||||
commitJson: (branch: string) =>
|
commitJson: async (branch: string) => {
|
||||||
`https://raw.githubusercontent.com/stackblitz-labs/bolt.diy/${branch}/app/commit.json`,
|
try {
|
||||||
|
const response = await fetch(`https://api.github.com/repos/stackblitz-labs/bolt.diy/commits/${branch}`);
|
||||||
|
const data: { sha: string } = await response.json();
|
||||||
|
|
||||||
|
const packageJsonResp = await fetch(
|
||||||
|
`https://raw.githubusercontent.com/stackblitz-labs/bolt.diy/${branch}/package.json`,
|
||||||
|
);
|
||||||
|
const packageJson: { version: string } = await packageJsonResp.json();
|
||||||
|
|
||||||
|
return {
|
||||||
|
commit: data.sha.slice(0, 7),
|
||||||
|
version: packageJson.version,
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
console.log('Failed to fetch local commit info:', error);
|
||||||
|
throw new Error('Failed to fetch local commit info');
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
function getSystemInfo(): SystemInfo {
|
function getSystemInfo(): SystemInfo {
|
||||||
@ -373,14 +390,9 @@ export default function DebugTab() {
|
|||||||
const branchToCheck = isLatestBranch ? 'main' : 'stable';
|
const branchToCheck = isLatestBranch ? 'main' : 'stable';
|
||||||
console.log(`[Debug] Checking for updates against ${branchToCheck} branch`);
|
console.log(`[Debug] Checking for updates against ${branchToCheck} branch`);
|
||||||
|
|
||||||
const localCommitResponse = await fetch(GITHUB_URLS.commitJson(branchToCheck));
|
const latestCommitResp = await GITHUB_URLS.commitJson(branchToCheck);
|
||||||
|
|
||||||
if (!localCommitResponse.ok) {
|
const remoteCommitHash = latestCommitResp.commit;
|
||||||
throw new Error('Failed to fetch local commit info');
|
|
||||||
}
|
|
||||||
|
|
||||||
const localCommitData = (await localCommitResponse.json()) as CommitData;
|
|
||||||
const remoteCommitHash = localCommitData.commit;
|
|
||||||
const currentCommitHash = versionHash;
|
const currentCommitHash = versionHash;
|
||||||
|
|
||||||
if (remoteCommitHash !== currentCommitHash) {
|
if (remoteCommitHash !== currentCommitHash) {
|
||||||
|
@ -35,18 +35,12 @@ export function useSettings() {
|
|||||||
// Function to check if we're on stable version
|
// Function to check if we're on stable version
|
||||||
const checkIsStableVersion = async () => {
|
const checkIsStableVersion = async () => {
|
||||||
try {
|
try {
|
||||||
const stableResponse = await fetch(
|
const response = await fetch(
|
||||||
`https://raw.githubusercontent.com/stackblitz-labs/bolt.diy/refs/tags/v${versionData.version}/app/commit.json`,
|
`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) {
|
return versionData.commit.slice(0, 7) === data.object.sha.slice(0, 7);
|
||||||
console.warn('Failed to fetch stable commit info');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const stableData = (await stableResponse.json()) as CommitData;
|
|
||||||
|
|
||||||
return versionData.commit === stableData.commit;
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn('Error checking stable version:', error);
|
console.warn('Error checking stable version:', error);
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user