Add version info to web app

This commit is contained in:
nimbleghost 2023-06-26 22:05:33 +02:00
parent 5627097a6c
commit 7ac448f78c
4 changed files with 10 additions and 3 deletions

View file

@ -24,7 +24,7 @@ RUN make docs-build
ADD ./web/package.json ./web/package-lock.json ./web/ ADD ./web/package.json ./web/package-lock.json ./web/
RUN make web-deps RUN make web-deps
ADD ./web ./web ADD ./web ./web
RUN make web-build RUN make VERSION=$VERSION COMMIT=$COMMIT web-build
# cli & server # cli & server
ADD go.mod go.sum main.go ./ ADD go.mod go.sum main.go ./

View file

@ -137,7 +137,7 @@ web: web-deps web-build
web-build: web-build:
cd web \ cd web \
&& npm run build \ && VITE_NTFY_VERSION=$(VERSION) VITE_NTFY_COMMIT=$(COMMIT) npm run build \
&& mv build/index.html build/app.html \ && mv build/index.html build/app.html \
&& rm -rf ../server/site \ && rm -rf ../server/site \
&& mv build ../server/site \ && mv build ../server/site \

View file

@ -3,7 +3,7 @@
"version": "1.0.0", "version": "1.0.0",
"private": true, "private": true,
"scripts": { "scripts": {
"start": "NODE_OPTIONS=\"--enable-source-maps\" vite", "start": "VITE_NTFY_COMMIT=$(git rev-parse --short HEAD) NODE_OPTIONS=\"--enable-source-maps\" vite",
"build": "vite build", "build": "vite build",
"serve": "vite preview", "serve": "vite preview",
"format": "prettier . --write", "format": "prettier . --write",

View file

@ -71,6 +71,7 @@ const Preferences = () => (
<Reservations /> <Reservations />
<Users /> <Users />
<Appearance /> <Appearance />
<VersionInfo />
</Stack> </Stack>
</Container> </Container>
); );
@ -491,6 +492,12 @@ const Appearance = () => {
); );
}; };
const VersionInfo = () => (
<Typography textAlign="center">
ntfy {import.meta.env.DEV ? "dev" : import.meta.env.VITE_NTFY_VERSION} ({import.meta.env.VITE_NTFY_COMMIT})
</Typography>
);
const Language = () => { const Language = () => {
const { t, i18n } = useTranslation(); const { t, i18n } = useTranslation();
const labelId = "prefLanguage"; const labelId = "prefLanguage";