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')
|
||||
.filter((line) => line !== '')
|
||||
.forEach((line) => ws.send(line));
|
||||
ws.send("FINISHED REPLAY");
|
||||
}
|
||||
});
|
||||
|
@ -30,12 +30,15 @@ const props = defineProps({
|
||||
tactical: String,
|
||||
timeoutLength: Number,
|
||||
lowVoltage: Number,
|
||||
finishedReplay: Boolean,
|
||||
messages: Array,
|
||||
now: Date,
|
||||
});
|
||||
|
||||
function notify(title, body) {
|
||||
if (props.finishedReplay) {
|
||||
return new Notification(title, { body: body, requireInteraction: true });
|
||||
}
|
||||
}
|
||||
|
||||
function formatTime(time, isDuration = false) {
|
||||
|
@ -27,6 +27,7 @@
|
||||
:tactical="tactical"
|
||||
:lowVoltage="config.lowVoltage"
|
||||
:timeoutLength="parseDuration(config.timeoutLength)"
|
||||
:finishedReplay="finishedReplay"
|
||||
:messages="messagesFromStation[callsign] || []"
|
||||
:now="now"
|
||||
>
|
||||
@ -45,6 +46,7 @@ import config from './status_config.yaml';
|
||||
|
||||
const parser = new APRSParser();
|
||||
let aprsStream = null;
|
||||
const finishedReplay = ref(false);
|
||||
const messages = ref([]);
|
||||
const messagesFromStation = ref({});
|
||||
const now = ref(new Date());
|
||||
@ -69,7 +71,9 @@ function connectToStream() {
|
||||
}, 5000);
|
||||
};
|
||||
aprsStream.onmessage = (event) => {
|
||||
if (event.data !== '') {
|
||||
if (event.data === 'FINISHED REPLAY') {
|
||||
finishedReplay.value = true;
|
||||
} else if (event.data !== '') {
|
||||
handleMessage(JSON.parse(event.data));
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user