Skip to content

Commit

Permalink
Merge branch 'fix-latest-device-status-recording' of https://github.c…
Browse files Browse the repository at this point in the history
  • Loading branch information
hardiesoft committed Nov 19, 2024
2 parents dd6ee7a + d7d294b commit dacd32b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions api/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ const checkS3Connection = async (): Promise<void> => {
"Access-Control-Allow-Headers",
"where, offset, limit, Authorization, Origin, X-Requested-With, Content-Type, Accept, Viewport, if-none-match, cache-control"
);

// NOTE: We've seen an instance where the HOST request header is rewritten by the client, which would otherwise break
// some things. If the host is unknown, default to browse-next.
if (!request.headers.host.includes("cacophony.org.nz")) {
request.headers.host = "https://browse-next.cacophony.org.nz";
}
next();
});
await initialiseApi(app);
Expand Down
9 changes: 6 additions & 3 deletions browse-next/src/views/DevicesView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,10 @@ const deviceRecordingMode = computed<"cameras" | "audio">(() => {
return "cameras";
});
const cacophonyEpoch = new Date();
cacophonyEpoch.setFullYear(2010, 0, 0);
cacophonyEpoch.setHours(0, 0, 0);
const isDevicesRoot = computed(() => {
return route.name === "devices";
});
Expand Down Expand Up @@ -538,14 +542,13 @@ const isDevicesRoot = computed(() => {
<b-button
class="ms-4 align-items-center d-none d-md-flex"
variant="outline-secondary"
v-if="deviceLocation"
:to="{
name: 'activity',
query: {
devices: [selectedDevice.id],
//locations: [deviceLocation.id],
until: (selectedDeviceLatestRecordingDateTime as Date).toISOString(),
from: (selectedDeviceActiveFrom as Date).toISOString(),
until: ((selectedDeviceLatestRecordingDateTime || new Date()) as Date).toISOString(),
from: ((selectedDeviceActiveFrom || cacophonyEpoch) as Date).toISOString(),
'display-mode': 'recordings',
'recording-mode': deviceRecordingMode
},
Expand Down

0 comments on commit dacd32b

Please sign in to comment.