diff --git a/.gitignore b/.gitignore index 8456d9be0..660a378b0 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ frigate/version.py web/build web/node_modules web/coverage +web/.env core !/web/**/*.ts .idea/* diff --git a/Makefile b/Makefile index 2baac5aad..d1427b6df 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ push-boards: $(BOARDS:%=push-%) version: echo 'VERSION = "$(VERSION)-$(COMMIT_HASH)"' > frigate/version.py + echo 'VITE_GIT_COMMIT_HASH=$(COMMIT_HASH)' > web/.env local: version docker buildx build --target=frigate --file docker/main/Dockerfile . \ diff --git a/docker/main/Dockerfile b/docker/main/Dockerfile index 8dbf5ff86..7cd9c22e1 100644 --- a/docker/main/Dockerfile +++ b/docker/main/Dockerfile @@ -318,6 +318,7 @@ FROM --platform=$BUILDPLATFORM node:20 AS web-build WORKDIR /work COPY web/package.json web/package-lock.json ./ + RUN npm install COPY web/ ./ diff --git a/web/.gitignore b/web/.gitignore index a547bf36d..1cac5597e 100644 --- a/web/.gitignore +++ b/web/.gitignore @@ -22,3 +22,4 @@ dist-ssr *.njsproj *.sln *.sw? +.env \ No newline at end of file diff --git a/web/src/utils/i18n.ts b/web/src/utils/i18n.ts index 1a386ccb3..eba5ff7a5 100644 --- a/web/src/utils/i18n.ts +++ b/web/src/utils/i18n.ts @@ -33,7 +33,7 @@ i18n fallbackLng: "en", // use en if detected lng is not available backend: { - loadPath: "locales/{{lng}}/{{ns}}.json", + loadPath: `locales/{{lng}}/{{ns}}.json?v=${import.meta.env.VITE_GIT_COMMIT_HASH || "unknown"}`, }, ns: [ diff --git a/web/vite.config.ts b/web/vite.config.ts index cb1a580bf..b3a14b4a7 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -5,7 +5,6 @@ import react from "@vitejs/plugin-react-swc"; import monacoEditorPlugin from "vite-plugin-monaco-editor"; const proxyHost = process.env.PROXY_HOST || "localhost:5000"; - // https://vitejs.dev/config/ export default defineConfig({ define: {