Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into audio-mode-settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Zainrax committed Nov 25, 2024
2 parents 64013d5 + 53c9c75 commit 2e7bf39
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 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
6 changes: 3 additions & 3 deletions browse-next/src/api/Device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import type {
GroupId as ProjectId,
IsoFormattedDateString,
LatLng,
ScheduleId,
} from "@typedefs/api/common";
import type {
ApiDeviceHistorySettings,
ApiDeviceResponse,
ApiMaskRegionsData,
} from "@typedefs/api/device";
import type { ScheduleId } from "@typedefs/api/common";
import type {
DeviceConfigDetail,
DeviceEvent,
Expand All @@ -24,6 +24,7 @@ import type { DeviceEventType } from "@typedefs/api/consts";
import type { ApiStationResponse as ApiLocationResponse } from "@typedefs/api/station";
import type { ApiRecordingResponse } from "@typedefs/api/recording";
import type { ApiTrackResponse } from "@typedefs/api/track";

export const createProxyDevice = (
projectNameOrId: string,
deviceName: string
Expand Down Expand Up @@ -678,7 +679,7 @@ export const getDeviceModel = async (deviceId: DeviceId) => {
return model;
}
}
const model = await getLatestEventsByDeviceId(deviceId, {
return await getLatestEventsByDeviceId(deviceId, {
type: "versionData",
limit: 1,
}).then((response) => {
Expand All @@ -690,7 +691,6 @@ export const getDeviceModel = async (deviceId: DeviceId) => {
return null;
}
});
return model;
} catch (e) {
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion browse-next/src/components/DeviceRecordingSetup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -667,10 +667,10 @@ watch(customRecordingWindowStop, async () => {
<div
class="position-relative flex-fill rounded bg-light p-0"
:style="{ height: '1em' }"
v-if="audioMode !== 'AudioOnly'"
>
<!-- Thermal Recording Windows -->
<div
v-if="audioMode !== 'AudioOnly'"
v-for="(style, index) in thermalBarStyles"
:key="'thermal-' + index"
class="position-absolute h-100 bg-success p-0"
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 2e7bf39

Please sign in to comment.