Commit
·
b160d23
1
Parent(s):
a698fba
update by branch
Browse files
app/components/settings/debug/DebugTab.tsx
CHANGED
@@ -36,7 +36,7 @@ const versionHash = commit.commit;
|
|
36 |
const GITHUB_URLS = {
|
37 |
original: 'https://api.github.com/repos/stackblitz-labs/bolt.diy/commits/main',
|
38 |
fork: 'https://api.github.com/repos/Stijnus/bolt.new-any-llm/commits/main',
|
39 |
-
commitJson:
|
40 |
};
|
41 |
|
42 |
function getSystemInfo(): SystemInfo {
|
@@ -260,8 +260,11 @@ export default function DebugTab() {
|
|
260 |
setIsCheckingUpdate(true);
|
261 |
setUpdateMessage('Checking for updates...');
|
262 |
|
263 |
-
//
|
264 |
-
const
|
|
|
|
|
|
|
265 |
if (!localCommitResponse.ok) {
|
266 |
throw new Error('Failed to fetch repository information');
|
267 |
}
|
@@ -269,21 +272,22 @@ export default function DebugTab() {
|
|
269 |
// Define the expected structure of the commit data
|
270 |
interface CommitData {
|
271 |
commit: string;
|
|
|
272 |
}
|
273 |
|
274 |
-
const localCommitData: CommitData = await localCommitResponse.json();
|
275 |
-
const originalCommitHash = localCommitData.commit;
|
276 |
|
277 |
-
const currentLocalCommitHash = commit.commit;
|
278 |
|
279 |
if (originalCommitHash !== currentLocalCommitHash) {
|
280 |
setUpdateMessage(
|
281 |
-
`Update available from original repository!\n` +
|
282 |
`Current: ${currentLocalCommitHash.slice(0, 7)}\n` +
|
283 |
`Latest: ${originalCommitHash.slice(0, 7)}`
|
284 |
);
|
285 |
} else {
|
286 |
-
setUpdateMessage(
|
287 |
}
|
288 |
} catch (error) {
|
289 |
setUpdateMessage('Failed to check for updates');
|
|
|
36 |
const GITHUB_URLS = {
|
37 |
original: 'https://api.github.com/repos/stackblitz-labs/bolt.diy/commits/main',
|
38 |
fork: 'https://api.github.com/repos/Stijnus/bolt.new-any-llm/commits/main',
|
39 |
+
commitJson: (branch: string) => `https://raw.githubusercontent.com/stackblitz-labs/bolt.diy/${branch}/app/commit.json`,
|
40 |
};
|
41 |
|
42 |
function getSystemInfo(): SystemInfo {
|
|
|
260 |
setIsCheckingUpdate(true);
|
261 |
setUpdateMessage('Checking for updates...');
|
262 |
|
263 |
+
// Get current branch from commit.json
|
264 |
+
const currentBranch = commit.branch || 'main';
|
265 |
+
|
266 |
+
// Fetch the commit data from the specified URL for the current branch
|
267 |
+
const localCommitResponse = await fetch(GITHUB_URLS.commitJson(currentBranch));
|
268 |
if (!localCommitResponse.ok) {
|
269 |
throw new Error('Failed to fetch repository information');
|
270 |
}
|
|
|
272 |
// Define the expected structure of the commit data
|
273 |
interface CommitData {
|
274 |
commit: string;
|
275 |
+
branch: string;
|
276 |
}
|
277 |
|
278 |
+
const localCommitData: CommitData = await localCommitResponse.json();
|
279 |
+
const originalCommitHash = localCommitData.commit;
|
280 |
|
281 |
+
const currentLocalCommitHash = commit.commit;
|
282 |
|
283 |
if (originalCommitHash !== currentLocalCommitHash) {
|
284 |
setUpdateMessage(
|
285 |
+
`Update available from original repository (${currentBranch} branch)!\n` +
|
286 |
`Current: ${currentLocalCommitHash.slice(0, 7)}\n` +
|
287 |
`Latest: ${originalCommitHash.slice(0, 7)}`
|
288 |
);
|
289 |
} else {
|
290 |
+
setUpdateMessage(`You are on the latest version from the original repository (${currentBranch} branch)`);
|
291 |
}
|
292 |
} catch (error) {
|
293 |
setUpdateMessage('Failed to check for updates');
|