From a539cfea0a6ea7f4c1485bb1046c7d6a30523c95 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Mon, 25 Dec 2023 20:05:56 +0800 Subject: [PATCH] Don't link to github if fake commit hash --- src/pages/settings.jsx | 24 +++++++++++++----------- vite.config.js | 3 +++ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/pages/settings.jsx b/src/pages/settings.jsx index cf2acfe5..c26412e6 100644 --- a/src/pages/settings.jsx +++ b/src/pages/settings.jsx @@ -576,17 +576,19 @@ function Settings({ onClose }) { } }} />{' '} - - ( - - - - ) - + {!__FAKE_COMMIT_HASH__ && ( + + ( + + + + ) + + )}

)} diff --git a/vite.config.js b/vite.config.js index 6ba13609..d2ce17d1 100644 --- a/vite.config.js +++ b/vite.config.js @@ -17,12 +17,14 @@ const { const now = new Date(); let commitHash; +let fakeCommitHash = false; try { commitHash = execSync('git rev-parse --short HEAD').toString().trim(); } catch (error) { // If error, means git is not installed or not a git repo (could be downloaded instead of git cloned) // Fallback to random hash which should be different on every build run 🤞 commitHash = uid(); + fakeCommitHash = true; } const rollbarCode = fs.readFileSync( @@ -38,6 +40,7 @@ export default defineConfig({ define: { __BUILD_TIME__: JSON.stringify(now), __COMMIT_HASH__: JSON.stringify(commitHash), + __FAKE_COMMIT_HASH__: fakeCommitHash, }, server: { host: true,