Skip to content
Snippets Groups Projects
Commit 88459007 authored by insert's avatar insert
Browse files

More version information in settings.

parent 29bb93f3
Branches
No related merge requests found
...@@ -20,7 +20,7 @@ import { ...@@ -20,7 +20,7 @@ import {
User User
} from "@styled-icons/feather"; } from "@styled-icons/feather";
import { Megaphone } from "@styled-icons/bootstrap"; import { Megaphone } from "@styled-icons/bootstrap";
import { GIT_REVISION, REPO_URL } from "../../revision"; import { GIT_BRANCH, GIT_REVISION, REPO_URL } from "../../revision";
import LineDivider from "../../components/ui/LineDivider"; import LineDivider from "../../components/ui/LineDivider";
import RequiresOnline from "../../context/revoltjs/RequiresOnline"; import RequiresOnline from "../../context/revoltjs/RequiresOnline";
import ButtonItem from "../../components/navigation/items/ButtonItem"; import ButtonItem from "../../components/navigation/items/ButtonItem";
...@@ -147,8 +147,12 @@ export default function Settings() { ...@@ -147,8 +147,12 @@ export default function Settings() {
<a href={`${REPO_URL}/${GIT_REVISION}`} target="_blank"> <a href={`${REPO_URL}/${GIT_REVISION}`} target="_blank">
{ GIT_REVISION.substr(0, 7) } { GIT_REVISION.substr(0, 7) }
</a> </a>
{` `}
<a href={GIT_BRANCH !== 'DETACHED' ? `https://gitlab.insrt.uk/revolt/client/-/tree/${GIT_BRANCH}` : undefined} target="_blank">
({ GIT_BRANCH })
</a>
</span> </span>
<span>Stable {APP_VERSION}</span> <span>{ GIT_BRANCH === 'production' ? 'Stable' : 'Nightly' } {APP_VERSION}</span>
<span>API: {client.configuration?.revolt ?? "N/A"}</span> <span>API: {client.configuration?.revolt ?? "N/A"}</span>
<span>revolt.js: {LIBRARY_VERSION}</span> <span>revolt.js: {LIBRARY_VERSION}</span>
</div> </div>
......
export const GIT_REVISION = '__GIT_REVISION__';
export const REPO_URL = 'https://gitlab.insrt.uk/revolt/revite/-/commit'; export const REPO_URL = 'https://gitlab.insrt.uk/revolt/revite/-/commit';
export const GIT_REVISION = '__GIT_REVISION__';
export const GIT_BRANCH: string = '__GIT_BRANCH__';
...@@ -19,6 +19,20 @@ function getGitRevision() { ...@@ -19,6 +19,20 @@ function getGitRevision() {
} }
} }
function getGitBranch() {
try {
const rev = readFileSync('.git/HEAD').toString().trim();
if (rev.indexOf(':') === -1) {
return 'DETACHED';
} else {
return rev.split('/').pop();
}
} catch (err) {
console.error('Failed to get Git branch.');
return '?';
}
}
function getVersion() { function getVersion() {
return readFileSync('VERSION').toString(); return readFileSync('VERSION').toString();
} }
...@@ -55,6 +69,7 @@ export default defineConfig({ ...@@ -55,6 +69,7 @@ export default defineConfig({
}), }),
replace({ replace({
__GIT_REVISION__: getGitRevision(), __GIT_REVISION__: getGitRevision(),
__GIT_BRANCH__: getGitBranch(),
__APP_VERSION__: getVersion(), __APP_VERSION__: getVersion(),
preventAssignment: true preventAssignment: true
}) })
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment