mirror of
https://github.com/nikdoof/pocket-id.git
synced 2025-12-22 05:49:23 +00:00
24 lines
790 B
TypeScript
24 lines
790 B
TypeScript
import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment";
|
|
|
|
if (ExecutionEnvironment.canUseDOM) {
|
|
function readVersionFile() {
|
|
return fetch(
|
|
"https://raw.githubusercontent.com/pocket-id/pocket-id/refs/heads/main/.version"
|
|
)
|
|
.then((response) => response.text())
|
|
.catch((error) => `Error reading version file: ${error}`);
|
|
}
|
|
|
|
function getVersion() {
|
|
readVersionFile()
|
|
.then((version) => {
|
|
const versionLabels = document.querySelectorAll('[href="#version"]');
|
|
versionLabels.forEach((label) => {
|
|
(label as HTMLElement).innerText = `v${version}`;
|
|
});
|
|
})
|
|
.catch((error) => console.error("Error fetching version:", error));
|
|
}
|
|
window.addEventListener("load", getVersion);
|
|
}
|