mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-24 10:15:37 +03:00
Don't link to github if fake commit hash
This commit is contained in:
parent
976f0a5592
commit
a539cfea0a
2 changed files with 16 additions and 11 deletions
|
@ -576,17 +576,19 @@ function Settings({ onClose }) {
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
/>{' '}
|
/>{' '}
|
||||||
<span class="ib insignificant">
|
{!__FAKE_COMMIT_HASH__ && (
|
||||||
(
|
<span class="ib insignificant">
|
||||||
<a
|
(
|
||||||
href={`https://github.com/cheeaun/phanpy/commit/${__COMMIT_HASH__}`}
|
<a
|
||||||
target="_blank"
|
href={`https://github.com/cheeaun/phanpy/commit/${__COMMIT_HASH__}`}
|
||||||
rel="noopener noreferrer"
|
target="_blank"
|
||||||
>
|
rel="noopener noreferrer"
|
||||||
<RelativeTime datetime={new Date(__BUILD_TIME__)} />
|
>
|
||||||
</a>
|
<RelativeTime datetime={new Date(__BUILD_TIME__)} />
|
||||||
)
|
</a>
|
||||||
</span>
|
)
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -17,12 +17,14 @@ const {
|
||||||
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
let commitHash;
|
let commitHash;
|
||||||
|
let fakeCommitHash = false;
|
||||||
try {
|
try {
|
||||||
commitHash = execSync('git rev-parse --short HEAD').toString().trim();
|
commitHash = execSync('git rev-parse --short HEAD').toString().trim();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// If error, means git is not installed or not a git repo (could be downloaded instead of git cloned)
|
// 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 🤞
|
// Fallback to random hash which should be different on every build run 🤞
|
||||||
commitHash = uid();
|
commitHash = uid();
|
||||||
|
fakeCommitHash = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const rollbarCode = fs.readFileSync(
|
const rollbarCode = fs.readFileSync(
|
||||||
|
@ -38,6 +40,7 @@ export default defineConfig({
|
||||||
define: {
|
define: {
|
||||||
__BUILD_TIME__: JSON.stringify(now),
|
__BUILD_TIME__: JSON.stringify(now),
|
||||||
__COMMIT_HASH__: JSON.stringify(commitHash),
|
__COMMIT_HASH__: JSON.stringify(commitHash),
|
||||||
|
__FAKE_COMMIT_HASH__: fakeCommitHash,
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
host: true,
|
host: true,
|
||||||
|
|
Loading…
Reference in a new issue