Don't send notifications until log replay finished
This commit is contained in:
parent
6c015c322c
commit
2feabd4d87
@ -54,5 +54,6 @@ wss.on('connection', (ws) => {
|
|||||||
.split('\n')
|
.split('\n')
|
||||||
.filter((line) => line !== '')
|
.filter((line) => line !== '')
|
||||||
.forEach((line) => ws.send(line));
|
.forEach((line) => ws.send(line));
|
||||||
|
ws.send("FINISHED REPLAY");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -30,12 +30,15 @@ const props = defineProps({
|
|||||||
tactical: String,
|
tactical: String,
|
||||||
timeoutLength: Number,
|
timeoutLength: Number,
|
||||||
lowVoltage: Number,
|
lowVoltage: Number,
|
||||||
|
finishedReplay: Boolean,
|
||||||
messages: Array,
|
messages: Array,
|
||||||
now: Date,
|
now: Date,
|
||||||
});
|
});
|
||||||
|
|
||||||
function notify(title, body) {
|
function notify(title, body) {
|
||||||
return new Notification(title, { body: body, requireInteraction: true });
|
if (props.finishedReplay) {
|
||||||
|
return new Notification(title, { body: body, requireInteraction: true });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatTime(time, isDuration = false) {
|
function formatTime(time, isDuration = false) {
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
:tactical="tactical"
|
:tactical="tactical"
|
||||||
:lowVoltage="config.lowVoltage"
|
:lowVoltage="config.lowVoltage"
|
||||||
:timeoutLength="parseDuration(config.timeoutLength)"
|
:timeoutLength="parseDuration(config.timeoutLength)"
|
||||||
|
:finishedReplay="finishedReplay"
|
||||||
:messages="messagesFromStation[callsign] || []"
|
:messages="messagesFromStation[callsign] || []"
|
||||||
:now="now"
|
:now="now"
|
||||||
>
|
>
|
||||||
@ -45,6 +46,7 @@ import config from './status_config.yaml';
|
|||||||
|
|
||||||
const parser = new APRSParser();
|
const parser = new APRSParser();
|
||||||
let aprsStream = null;
|
let aprsStream = null;
|
||||||
|
const finishedReplay = ref(false);
|
||||||
const messages = ref([]);
|
const messages = ref([]);
|
||||||
const messagesFromStation = ref({});
|
const messagesFromStation = ref({});
|
||||||
const now = ref(new Date());
|
const now = ref(new Date());
|
||||||
@ -69,7 +71,9 @@ function connectToStream() {
|
|||||||
}, 5000);
|
}, 5000);
|
||||||
};
|
};
|
||||||
aprsStream.onmessage = (event) => {
|
aprsStream.onmessage = (event) => {
|
||||||
if (event.data !== '') {
|
if (event.data === 'FINISHED REPLAY') {
|
||||||
|
finishedReplay.value = true;
|
||||||
|
} else if (event.data !== '') {
|
||||||
handleMessage(JSON.parse(event.data));
|
handleMessage(JSON.parse(event.data));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user