mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-12-21 12:36:42 +03:00
Compare commits
4 Commits
67845d647f
...
72c3b02420
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
72c3b02420 | ||
|
|
73f0ca663b | ||
|
|
097673b845 | ||
|
|
d56cf59b9a |
1
.gitignore
vendored
1
.gitignore
vendored
@ -15,6 +15,7 @@ frigate/version.py
|
|||||||
web/build
|
web/build
|
||||||
web/node_modules
|
web/node_modules
|
||||||
web/coverage
|
web/coverage
|
||||||
|
web/.env
|
||||||
core
|
core
|
||||||
!/web/**/*.ts
|
!/web/**/*.ts
|
||||||
.idea/*
|
.idea/*
|
||||||
|
|||||||
1
Makefile
1
Makefile
@ -14,6 +14,7 @@ push-boards: $(BOARDS:%=push-%)
|
|||||||
|
|
||||||
version:
|
version:
|
||||||
echo 'VERSION = "$(VERSION)-$(COMMIT_HASH)"' > frigate/version.py
|
echo 'VERSION = "$(VERSION)-$(COMMIT_HASH)"' > frigate/version.py
|
||||||
|
echo 'VITE_GIT_COMMIT_HASH=$(COMMIT_HASH)' > web/.env
|
||||||
|
|
||||||
local: version
|
local: version
|
||||||
docker buildx build --target=frigate --file docker/main/Dockerfile . \
|
docker buildx build --target=frigate --file docker/main/Dockerfile . \
|
||||||
|
|||||||
1
web/.gitignore
vendored
1
web/.gitignore
vendored
@ -22,3 +22,4 @@ dist-ssr
|
|||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
|
.env
|
||||||
@ -33,7 +33,7 @@ i18n
|
|||||||
fallbackLng: "en", // use en if detected lng is not available
|
fallbackLng: "en", // use en if detected lng is not available
|
||||||
|
|
||||||
backend: {
|
backend: {
|
||||||
loadPath: "locales/{{lng}}/{{ns}}.json",
|
loadPath: `locales/{{lng}}/{{ns}}.json?v=${import.meta.env.VITE_GIT_COMMIT_HASH || "unknown"}`,
|
||||||
},
|
},
|
||||||
|
|
||||||
ns: [
|
ns: [
|
||||||
|
|||||||
@ -850,6 +850,29 @@ function FrigateCameraFeatures({
|
|||||||
}
|
}
|
||||||
}, [activeToastId, t]);
|
}, [activeToastId, t]);
|
||||||
|
|
||||||
|
const endEventViaBeacon = useCallback(() => {
|
||||||
|
if (!recordingEventIdRef.current) return;
|
||||||
|
|
||||||
|
const url = `${window.location.origin}/api/events/${recordingEventIdRef.current}/end`;
|
||||||
|
const payload = JSON.stringify({
|
||||||
|
end_time: Math.ceil(Date.now() / 1000),
|
||||||
|
});
|
||||||
|
|
||||||
|
// this needs to be a synchronous XMLHttpRequest to guarantee the PUT
|
||||||
|
// reaches the server before the browser kills the page
|
||||||
|
const xhr = new XMLHttpRequest();
|
||||||
|
try {
|
||||||
|
xhr.open("PUT", url, false);
|
||||||
|
xhr.setRequestHeader("Content-Type", "application/json");
|
||||||
|
xhr.setRequestHeader("X-CSRF-TOKEN", "1");
|
||||||
|
xhr.setRequestHeader("X-CACHE-BYPASS", "1");
|
||||||
|
xhr.withCredentials = true;
|
||||||
|
xhr.send(payload);
|
||||||
|
} catch (e) {
|
||||||
|
// Silently ignore errors during unload
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
const handleEventButtonClick = useCallback(() => {
|
const handleEventButtonClick = useCallback(() => {
|
||||||
if (isRecording) {
|
if (isRecording) {
|
||||||
endEvent();
|
endEvent();
|
||||||
@ -887,8 +910,19 @@ function FrigateCameraFeatures({
|
|||||||
}, [camera.name, isRestreamed, preferredLiveMode, t]);
|
}, [camera.name, isRestreamed, preferredLiveMode, t]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// Handle page unload/close (browser close, tab close, refresh, navigation to external site)
|
||||||
|
const handleBeforeUnload = () => {
|
||||||
|
if (recordingEventIdRef.current) {
|
||||||
|
endEventViaBeacon();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener("beforeunload", handleBeforeUnload);
|
||||||
|
|
||||||
// ensure manual event is stopped when component unmounts
|
// ensure manual event is stopped when component unmounts
|
||||||
return () => {
|
return () => {
|
||||||
|
window.removeEventListener("beforeunload", handleBeforeUnload);
|
||||||
|
|
||||||
if (recordingEventIdRef.current) {
|
if (recordingEventIdRef.current) {
|
||||||
endEvent();
|
endEvent();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -157,7 +157,7 @@ export default function UiSettingsView() {
|
|||||||
checked={cameraNames}
|
checked={cameraNames}
|
||||||
onCheckedChange={setCameraName}
|
onCheckedChange={setCameraName}
|
||||||
/>
|
/>
|
||||||
<Label className="cursor-pointer" htmlFor="auto-live">
|
<Label className="cursor-pointer" htmlFor="camera-names">
|
||||||
{t("general.liveDashboard.displayCameraNames.label")}
|
{t("general.liveDashboard.displayCameraNames.label")}
|
||||||
</Label>
|
</Label>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user