LlamaFinetuneGGUF commited on
Commit
bb03c30
·
1 Parent(s): 9efc709

Update DebugTab.tsx

Browse files

Fixed Check for Update not getting the correct commit

app/components/settings/debug/DebugTab.tsx CHANGED
@@ -35,6 +35,7 @@ const versionHash = commit.commit;
35
  const GITHUB_URLS = {
36
  original: 'https://api.github.com/repos/stackblitz-labs/bolt.diy/commits/main',
37
  fork: 'https://api.github.com/repos/Stijnus/bolt.new-any-llm/commits/main',
 
38
  };
39
 
40
  function getSystemInfo(): SystemInfo {
@@ -257,29 +258,22 @@ export default function DebugTab() {
257
  setIsCheckingUpdate(true);
258
  setUpdateMessage('Checking for updates...');
259
 
260
- const [originalResponse, forkResponse] = await Promise.all([
261
- fetch(GITHUB_URLS.original),
262
- fetch(GITHUB_URLS.fork),
263
- ]);
264
-
265
- if (!originalResponse.ok || !forkResponse.ok) {
266
  throw new Error('Failed to fetch repository information');
267
  }
268
 
269
- const [originalData, forkData] = await Promise.all([
270
- originalResponse.json() as Promise<{ sha: string }>,
271
- forkResponse.json() as Promise<{ sha: string }>,
272
- ]);
273
 
274
- const originalCommitHash = originalData.sha;
275
- const forkCommitHash = forkData.sha;
276
- const isForked = versionHash === forkCommitHash && forkCommitHash !== originalCommitHash;
277
 
278
- if (originalCommitHash !== versionHash) {
279
  setUpdateMessage(
280
  `Update available from original repository!\n` +
281
- `Current: ${versionHash.slice(0, 7)}${isForked ? ' (forked)' : ''}\n` +
282
- `Latest: ${originalCommitHash.slice(0, 7)}`,
283
  );
284
  } else {
285
  setUpdateMessage('You are on the latest version from the original repository');
 
35
  const GITHUB_URLS = {
36
  original: 'https://api.github.com/repos/stackblitz-labs/bolt.diy/commits/main',
37
  fork: 'https://api.github.com/repos/Stijnus/bolt.new-any-llm/commits/main',
38
+ commitJson: 'https://raw.githubusercontent.com/stackblitz-labs/bolt.diy/main/app/commit.json',
39
  };
40
 
41
  function getSystemInfo(): SystemInfo {
 
258
  setIsCheckingUpdate(true);
259
  setUpdateMessage('Checking for updates...');
260
 
261
+ // Fetch the commit data from the specified URL
262
+ const localCommitResponse = await fetch(GITHUB_URLS.commitJson);
263
+ if (!localCommitResponse.ok) {
 
 
 
264
  throw new Error('Failed to fetch repository information');
265
  }
266
 
267
+ const localCommitData = await localCommitResponse.json();
268
+ const originalCommitHash = localCommitData.commit; // Use the fetched commit hash
 
 
269
 
270
+ const currentLocalCommitHash = commit.commit; // Your current local commit hash
 
 
271
 
272
+ if (originalCommitHash !== currentLocalCommitHash) {
273
  setUpdateMessage(
274
  `Update available from original repository!\n` +
275
+ `Current: ${currentLocalCommitHash.slice(0, 7)}\n` +
276
+ `Latest: ${originalCommitHash.slice(0, 7)}`
277
  );
278
  } else {
279
  setUpdateMessage('You are on the latest version from the original repository');