Prettified Code!

pull/935/head^2 v0.17.0-beta
DJ2LS 2025-04-05 08:04:20 +00:00 committed by GitHub Action
parent c3b4313415
commit 46c9e8e003
12 changed files with 144 additions and 126 deletions

View File

@ -4,9 +4,9 @@ This image was built to allow FreeDATA to be run on MacOS. These instructions ar
## Prerequisites
* An install of Docker (eg. [Docker Desktop for MacOS](https://docs.docker.com/desktop/setup/install/mac-install/)).
* Some familiarity with the command line (eg: via `Terminal.app`).
* [Brew](https://brew.sh/) - I've tried to avoid this as a requirement but it is the easiest way to install `pulseaudio` on MacOS.
- An install of Docker (eg. [Docker Desktop for MacOS](https://docs.docker.com/desktop/setup/install/mac-install/)).
- Some familiarity with the command line (eg: via `Terminal.app`).
- [Brew](https://brew.sh/) - I've tried to avoid this as a requirement but it is the easiest way to install `pulseaudio` on MacOS.
## Setting up
@ -21,31 +21,37 @@ brew install pulseaudio
```
Now run the daemon.
```bash
pulseaudio --load=module-native-protocol-tcp --exit-idle-time=-1 --daemon
```
Confirm it is running.
```bash
pulseaudio --check -v
```
Setup the audio output, this will list your audio output devices. The `*` will show the default output.
```bash
pacmd list-sinks | grep -e 'name:' -e 'index:' -e 'card:'
```
If you need to change your default output then this can be done by specifying the index:
```bash
pacmd set-default-sink 1
```
As will above, setup the the audio source.
```bash
pacmd list-sources | grep -e 'name:' -e 'index:' -e 'card:'
```
Any updates to sources can be triggered with:
```bash
pacmd set-default-source 1
```

View File

@ -1,20 +1,26 @@
import pluginVue from 'eslint-plugin-vue'
import globals from 'globals'
import pluginVue from "eslint-plugin-vue";
import globals from "globals";
export default [
...pluginVue.configs['flat/base'],
//...pluginVue.configs['flat/recommended'], // causes some errors not able to fix, yet. So disabled for now
...pluginVue.configs["flat/base"],
//...pluginVue.configs['flat/recommended'], // causes some errors not able to fix, yet. So disabled for now
{
ignores: ["**/*.config.js", "!**/eslint.config.js", "**/src/locales/**", "**/node_modules/**", "**/dist/**"],
ignores: [
"**/*.config.js",
"!**/eslint.config.js",
"**/src/locales/**",
"**/node_modules/**",
"**/dist/**",
],
rules: {
'vue/no-unused-vars': 'error',
'vue/multi-word-component-names': 'warn',
"vue/no-unused-vars": "error",
"vue/multi-word-component-names": "warn",
},
languageOptions: {
//sourceType: 'module',
globals: {
...globals.browser
}
}
}
]
...globals.browser,
},
},
},
];

View File

@ -59,7 +59,6 @@
window.addEventListener("orientationchange", setAppHeight);
document.addEventListener("DOMContentLoaded", setAppHeight);
</script>
</head>
<body>

View File

@ -8,7 +8,7 @@ import {
} from "./api";
import { processFreedataMessages } from "./messagesHandler";
import { processRadioStatus } from "./radioHandler";
import i18next from './i18n';
import i18next from "./i18n";
// ----------------- init pinia stores -------------
import { setActivePinia } from "pinia";
@ -136,7 +136,7 @@ export function eventDispatcher(data) {
displayToast(
"danger",
"bi-bootstrap-reboot",
i18next.t('popups.startupfailed'),
i18next.t("popups.startupfailed"),
5000,
);
return;
@ -146,7 +146,7 @@ export function eventDispatcher(data) {
console.log(data);
switch (data.type) {
case "hello-client":
message = i18next.t('popups.connectedtoserver');
message = i18next.t("popups.connectedtoserver");
displayToast("success", "bi-ethernet", message, 5000);
stateStore.modem_connection = "connected";
@ -156,23 +156,23 @@ export function eventDispatcher(data) {
case "message-logging":
if (data.endpoint === "wavelog" || data.endpoint === "udp") {
if (data.status === true) {
const message = `
const message = `
<div>
<strong>${i18next.t('popups.adiflogheader')}:</strong>
<span class="badge bg-success">${i18next.t('popups.adiflogtext1')}${data.message}${i18next.t('popups.adiflogtext2')}</span>
<strong>${i18next.t("popups.adiflogheader")}:</strong>
<span class="badge bg-success">${i18next.t("popups.adiflogtext1")}${data.message}${i18next.t("popups.adiflogtext2")}</span>
<div class="mt-2">
<span class="badge bg-secondary">${data.endpoint} ${i18next.t('popups.adiflogheader')}</span>
<span class="badge bg-secondary">${data.endpoint} ${i18next.t("popups.adiflogheader")}</span>
</div>
</div>
`;
displayToast("success", "bi-check-circle", message, 5000);
} else {
const message = `
const message = `
<div>
<strong>${i18next.t('popups.adiflogheader')}:</strong>
<strong>${i18next.t("popups.adiflogheader")}:</strong>
<span class="badge bg-danger">${data.message}</span>
<div class="mt-2">
<span class="badge bg-secondary">${data.endpoint} ${i18next.t('popups.adiflogerror')}</span>
<span class="badge bg-secondary">${data.endpoint} ${i18next.t("popups.adiflogerror")}</span>
</div>
</div>
`;
@ -181,18 +181,16 @@ export function eventDispatcher(data) {
}
return;
case "frame-handler":
switch (data.received) {
case "CQ":
message = `
<div>
<strong>${i18next.t('popups.cqreceived')}:</strong>
<strong>${i18next.t("popups.cqreceived")}:</strong>
<span class="badge bg-info text-dark">${data.dxcallsign}</span>
<div class="mt-2">
<span class="badge bg-secondary">${i18next.t('popups.snr')}: ${data.snr}</span>
<span class="badge bg-warning text-dark">${i18next.t('popups.gridsquare')}: ${data.gridsquare}</span>
<span class="badge bg-secondary">${i18next.t("popups.snr")}: ${data.snr}</span>
<span class="badge bg-warning text-dark">${i18next.t("popups.gridsquare")}: ${data.gridsquare}</span>
</div>
</div>
`;
@ -202,11 +200,11 @@ export function eventDispatcher(data) {
case "QRV":
message = `
<div>
<strong>${i18next.t('popups.qrvreceived')}:</strong>
<strong>${i18next.t("popups.qrvreceived")}:</strong>
<span class="badge bg-info text-dark">${data.dxcallsign}</span>
<div class="mt-2">
<span class="badge bg-secondary">${i18next.t('popups.snr')}: ${data.snr}</span>
<span class="badge bg-warning text-dark">${i18next.t('popups.gridsquare')}: ${data.gridsquare}</span>
<span class="badge bg-secondary">${i18next.t("popups.snr")}: ${data.snr}</span>
<span class="badge bg-warning text-dark">${i18next.t("popups.gridsquare")}: ${data.gridsquare}</span>
</div>
</div>
`;
@ -216,10 +214,10 @@ export function eventDispatcher(data) {
case "PING":
message = `
<div>
<strong>${i18next.t('popups.pingreceived')}:</strong>
<strong>${i18next.t("popups.pingreceived")}:</strong>
<span class="badge bg-info text-dark">${data.dxcallsign}</span>
<div class="mt-2">
<span class="badge bg-secondary">${i18next.t('popups.snr')}: ${data.snr}</span>
<span class="badge bg-secondary">${i18next.t("popups.snr")}: ${data.snr}</span>
</div>
</div>
`;
@ -229,11 +227,11 @@ export function eventDispatcher(data) {
case "PING_ACK":
message = `
<div>
<strong>${i18next.t('popups.pingackreceived')}:</strong>
<strong>${i18next.t("popups.pingackreceived")}:</strong>
<span class="badge bg-info text-dark">${data.dxcallsign}</span>
<div class="mt-2">
<span class="badge bg-secondary">${i18next.t('popups.snr')}: ${data.snr}</span>
<span class="badge bg-warning text-dark">${i18next.t('popups.gridsquare')}: ${data.gridsquare}</span>
<span class="badge bg-secondary">${i18next.t("popups.snr")}: ${data.snr}</span>
<span class="badge bg-warning text-dark">${i18next.t("popups.gridsquare")}: ${data.gridsquare}</span>
</div>
</div>
`;
@ -252,11 +250,11 @@ export function eventDispatcher(data) {
case "NEW":
message = `
<div>
<strong>${i18next.t('popups.newtransmissionwith')}:</strong>
<strong>${i18next.t("popups.newtransmissionwith")}:</strong>
<span class="badge bg-info text-dark">${data["arq-transfer-outbound"].dxcall}</span>
<div class="mt-2">
<span class="badge bg-secondary">${i18next.t('popups.sessionid')}: ${data["arq-transfer-outbound"].session_id}</span>
<span class="badge bg-warning text-dark">${i18next.t('popups.totalbytes')}: ${data["arq-transfer-outbound"].total_bytes}</span>
<span class="badge bg-secondary">${i18next.t("popups.sessionid")}: ${data["arq-transfer-outbound"].session_id}</span>
<span class="badge bg-warning text-dark">${i18next.t("popups.totalbytes")}: ${data["arq-transfer-outbound"].total_bytes}</span>
</div>
</div>
`;
@ -269,11 +267,11 @@ export function eventDispatcher(data) {
case "OPEN_SENT":
message = `
<div>
<strong>${i18next.t('popups.openingtransmissionwith')}:</strong>
<strong>${i18next.t("popups.openingtransmissionwith")}:</strong>
<span class="badge bg-info text-dark">${data["arq-transfer-outbound"].dxcall}</span>
<div class="mt-2">
<span class="badge bg-secondary">${i18next.t('popups.sessionid')}: ${data["arq-transfer-outbound"].session_id}</span>
<span class="badge bg-warning text-dark">${i18next.t('popups.totalbytes')}: ${data["arq-transfer-outbound"].total_bytes}</span>
<span class="badge bg-secondary">${i18next.t("popups.sessionid")}: ${data["arq-transfer-outbound"].session_id}</span>
<span class="badge bg-warning text-dark">${i18next.t("popups.totalbytes")}: ${data["arq-transfer-outbound"].total_bytes}</span>
</div>
</div>
`;
@ -287,12 +285,12 @@ export function eventDispatcher(data) {
case "BURST_SENT":
message = `
<div>
<strong>${i18next.t('popups.ongoingtransmissionwith')}:</strong>
<strong>${i18next.t("popups.ongoingtransmissionwith")}:</strong>
<span class="badge bg-info text-dark">${data["arq-transfer-outbound"].dxcall}</span>
<div class="mt-2">
<span class="badge bg-secondary">${i18next.t('popups.sessionid')}: ${data["arq-transfer-outbound"].session_id}</span>
<span class="badge bg-warning text-dark">${i18next.t('popups.transmittedbytes')}: ${data["arq-transfer-outbound"].received_bytes}</span>
<span class="badge bg-warning text-dark">${i18next.t('popups.totalbytes')}: ${data["arq-transfer-outbound"].total_bytes}</span>
<span class="badge bg-secondary">${i18next.t("popups.sessionid")}: ${data["arq-transfer-outbound"].session_id}</span>
<span class="badge bg-warning text-dark">${i18next.t("popups.transmittedbytes")}: ${data["arq-transfer-outbound"].received_bytes}</span>
<span class="badge bg-warning text-dark">${i18next.t("popups.totalbytes")}: ${data["arq-transfer-outbound"].total_bytes}</span>
</div>
</div>
`;
@ -329,11 +327,11 @@ export function eventDispatcher(data) {
case "ABORTED":
message = `
<div>
<strong>${i18next.t('popups.transmissionabortedwith')}:</strong>
<strong>${i18next.t("popups.transmissionabortedwith")}:</strong>
<span class="badge bg-info text-dark">${data["arq-transfer-outbound"].dxcall}</span>
<div class="mt-2">
<span class="badge bg-primary">${i18next.t('popups.state')}: ${data["arq-transfer-outbound"].state}</span>
<span class="badge bg-secondary">${i18next.t('popups.sessionid')}: ${data["arq-transfer-outbound"].session_id}</span>
<span class="badge bg-primary">${i18next.t("popups.state")}: ${data["arq-transfer-outbound"].state}</span>
<span class="badge bg-secondary">${i18next.t("popups.sessionid")}: ${data["arq-transfer-outbound"].session_id}</span>
</div>
</div>
`;
@ -347,13 +345,13 @@ export function eventDispatcher(data) {
case "ENDED":
message = `
<div>
<strong>${i18next.t('popups.transmissionendedwith')}:</strong>
<strong>${i18next.t("popups.transmissionendedwith")}:</strong>
<span class="badge bg-info text-dark">${data["arq-transfer-outbound"].dxcall}</span>
<div class="mt-2">
<span class="badge bg-primary">${i18next.t('popups.state')}: ${data["arq-transfer-outbound"].state}</span>
<span class="badge bg-secondary">${i18next.t('popups.sessionid')}: ${data["arq-transfer-outbound"].session_id}</span>
<span class="badge bg-warning text-dark">${i18next.t('popups.bytesperminute')}: ${data["arq-transfer-outbound"].statistics.bytes_per_minute}</span>
<span class="badge bg-warning text-dark">${i18next.t('popups.totalbytes')}: ${data["arq-transfer-outbound"].statistics.total_bytes}</span>
<span class="badge bg-primary">${i18next.t("popups.state")}: ${data["arq-transfer-outbound"].state}</span>
<span class="badge bg-secondary">${i18next.t("popups.sessionid")}: ${data["arq-transfer-outbound"].session_id}</span>
<span class="badge bg-warning text-dark">${i18next.t("popups.bytesperminute")}: ${data["arq-transfer-outbound"].statistics.bytes_per_minute}</span>
<span class="badge bg-warning text-dark">${i18next.t("popups.totalbytes")}: ${data["arq-transfer-outbound"].statistics.total_bytes}</span>
</div>
</div>
`;
@ -382,11 +380,11 @@ export function eventDispatcher(data) {
case "FAILED":
message = `
<div>
<strong>${i18next.t('popups.transmissionfailedwith')}:</strong>
<strong>${i18next.t("popups.transmissionfailedwith")}:</strong>
<span class="badge bg-info text-dark">${data["arq-transfer-outbound"].dxcall}</span>
<div class="mt-2">
<span class="badge bg-primary">${i18next.t('popups.state')}: ${data["arq-transfer-outbound"].state}</span>
<span class="badge bg-secondary">${i18next.t('popups.sessionid')}: ${data["arq-transfer-outbound"].session_id}</span>
<span class="badge bg-primary">${i18next.t("popups.state")}: ${data["arq-transfer-outbound"].state}</span>
<span class="badge bg-secondary">${i18next.t("popups.sessionid")}: ${data["arq-transfer-outbound"].session_id}</span>
</div>
</div>
`;
@ -409,11 +407,11 @@ export function eventDispatcher(data) {
case "NEW":
message = `
<div>
<strong>${i18next.t('popups.newtransmissionwith')}:</strong>
<strong>${i18next.t("popups.newtransmissionwith")}:</strong>
<span class="badge bg-info text-dark">${data["arq-transfer-inbound"].dxcall}</span>
<div class="mt-2">
<span class="badge bg-secondary">${i18next.t('popups.sessionid')}: ${data["arq-transfer-inbound"].session_id}</span>
<span class="badge bg-warning text-dark">${i18next.t('popups.totalbytes')}: ${data["arq-transfer-inbound"].total_bytes}</span>
<span class="badge bg-secondary">${i18next.t("popups.sessionid")}: ${data["arq-transfer-inbound"].session_id}</span>
<span class="badge bg-warning text-dark">${i18next.t("popups.totalbytes")}: ${data["arq-transfer-inbound"].total_bytes}</span>
</div>
</div>
`;
@ -427,12 +425,12 @@ export function eventDispatcher(data) {
case "OPEN_ACK_SENT":
message = `
<div>
<strong>${i18next.t('popups.confirmingtransmissionwith')}:${data["arq-transfer-inbound"].dxcall}</strong>
<strong>${i18next.t("popups.confirmingtransmissionwith")}:${data["arq-transfer-inbound"].dxcall}</strong>
<span class="badge bg-info text-dark">${data["arq-transfer-inbound"].dxcall}</span>
<div class="mt-2">
<span class="badge bg-secondary">${i18next.t('popups.sessionid')}: ${data["arq-transfer-inbound"].session_id}</span>
<span class="badge bg-warning text-dark">${i18next.t('popups.receivedbytes')}: ${data["arq-transfer-inbound"].received_bytes}</span>
<span class="badge bg-warning text-dark">${i18next.t('popups.totalbytes')}: ${data["arq-transfer-inbound"].total_bytes}</span>
<span class="badge bg-secondary">${i18next.t("popups.sessionid")}: ${data["arq-transfer-inbound"].session_id}</span>
<span class="badge bg-warning text-dark">${i18next.t("popups.receivedbytes")}: ${data["arq-transfer-inbound"].received_bytes}</span>
<span class="badge bg-warning text-dark">${i18next.t("popups.totalbytes")}: ${data["arq-transfer-inbound"].total_bytes}</span>
</div>
</div>
`;
@ -449,12 +447,12 @@ export function eventDispatcher(data) {
case "INFO_ACK_SENT":
message = `
<div>
<strong>${i18next.t('popups.openingtransmissionwith')}:${data["arq-transfer-inbound"].dxcall}</strong>
<strong>${i18next.t("popups.openingtransmissionwith")}:${data["arq-transfer-inbound"].dxcall}</strong>
<span class="badge bg-info text-dark">${data["arq-transfer-inbound"].dxcall}</span>
<div class="mt-2">
<span class="badge bg-secondary">${i18next.t('popups.sessionid')}: ${data["arq-transfer-inbound"].session_id}</span>
<span class="badge bg-warning text-dark">${i18next.t('popups.receivedbytes')}: ${data["arq-transfer-inbound"].received_bytes}</span>
<span class="badge bg-warning text-dark">${i18next.t('popups.totalbytes')}: ${data["arq-transfer-inbound"].total_bytes}</span>
<span class="badge bg-secondary">${i18next.t("popups.sessionid")}: ${data["arq-transfer-inbound"].session_id}</span>
<span class="badge bg-warning text-dark">${i18next.t("popups.receivedbytes")}: ${data["arq-transfer-inbound"].received_bytes}</span>
<span class="badge bg-warning text-dark">${i18next.t("popups.totalbytes")}: ${data["arq-transfer-inbound"].total_bytes}</span>
</div>
</div>
`;
@ -471,12 +469,12 @@ export function eventDispatcher(data) {
case "BURST_REPLY_SENT":
message = `
<div>
<strong>${i18next.t('popups.ongoingtransmissionwith')}:</strong>
<strong>${i18next.t("popups.ongoingtransmissionwith")}:</strong>
<span class="badge bg-info text-dark">${data["arq-transfer-inbound"].dxcall}</span>
<div class="mt-2">
<span class="badge bg-secondary">${i18next.t('popups.sessionid')}: ${data["arq-transfer-inbound"].session_id}</span>
<span class="badge bg-warning text-dark">${i18next.t('popups.receivedbytes')}: ${data["arq-transfer-inbound"].received_bytes}</span>
<span class="badge bg-warning text-dark">${i18next.t('popups.totalbytes')}: ${data["arq-transfer-inbound"].total_bytes}</span>
<span class="badge bg-secondary">${i18next.t("popups.sessionid")}: ${data["arq-transfer-inbound"].session_id}</span>
<span class="badge bg-warning text-dark">${i18next.t("popups.receivedbytes")}: ${data["arq-transfer-inbound"].received_bytes}</span>
<span class="badge bg-warning text-dark">${i18next.t("popups.totalbytes")}: ${data["arq-transfer-inbound"].total_bytes}</span>
</div>
</div>
`;
@ -509,13 +507,13 @@ export function eventDispatcher(data) {
case "ENDED":
message = `
<div>
<strong>${i18next.t('popups.transmissionendedwith')}:</strong>
<strong>${i18next.t("popups.transmissionendedwith")}:</strong>
<span class="badge bg-info text-dark">${data["arq-transfer-inbound"].dxcall}</span>
<div class="mt-2">
<span class="badge bg-primary">${i18next.t('popups.state')}: ${data["arq-transfer-inbound"].state}</span>
<span class="badge bg-secondary">${i18next.t('popups.sessionid')}: ${data["arq-transfer-inbound"].session_id}</span>
<span class="badge bg-warning text-dark">${i18next.t('popups.bytesperminute')}: ${data["arq-transfer-inbound"].statistics.bytes_per_minute}</span>
<span class="badge bg-warning text-dark">${i18next.t('popups.totalbytes')}: ${data["arq-transfer-inbound"].statistics.total_bytes}</span>
<span class="badge bg-primary">${i18next.t("popups.state")}: ${data["arq-transfer-inbound"].state}</span>
<span class="badge bg-secondary">${i18next.t("popups.sessionid")}: ${data["arq-transfer-inbound"].session_id}</span>
<span class="badge bg-warning text-dark">${i18next.t("popups.bytesperminute")}: ${data["arq-transfer-inbound"].statistics.bytes_per_minute}</span>
<span class="badge bg-warning text-dark">${i18next.t("popups.totalbytes")}: ${data["arq-transfer-inbound"].statistics.total_bytes}</span>
</div>
</div>
`;
@ -551,13 +549,13 @@ export function eventDispatcher(data) {
case "ABORTED":
message = `
<div>
<strong>${i18next.t('popups.transmissionabortedwith')}:</strong>
<strong>${i18next.t("popups.transmissionabortedwith")}:</strong>
<span class="badge bg-info text-dark">${data["arq-transfer-inbound"].dxcall}</span>
<div class="mt-2">
<span class="badge bg-primary">${i18next.t('popups.state')}: ${data["arq-transfer-inbound"].state}</span>
<span class="badge bg-secondary">${i18next.t('popups.sessionid')}: ${data["arq-transfer-inbound"].session_id}</span>
<span class="badge bg-warning text-dark">${i18next.t('popups.receivedbytes')}: ${data["arq-transfer-inbound"].received_bytes}</span>
<span class="badge bg-warning text-dark">${i18next.t('popups.totalbytes')}: ${data["arq-transfer-inbound"].total_bytes}</span>
<span class="badge bg-primary">${i18next.t("popups.state")}: ${data["arq-transfer-inbound"].state}</span>
<span class="badge bg-secondary">${i18next.t("popups.sessionid")}: ${data["arq-transfer-inbound"].session_id}</span>
<span class="badge bg-warning text-dark">${i18next.t("popups.receivedbytes")}: ${data["arq-transfer-inbound"].received_bytes}</span>
<span class="badge bg-warning text-dark">${i18next.t("popups.totalbytes")}: ${data["arq-transfer-inbound"].total_bytes}</span>
</div>
</div>
`;
@ -569,13 +567,13 @@ export function eventDispatcher(data) {
case "FAILED":
message = `
<div>
<strong>${i18next.t('popups.transmissionfailedwith')}:</strong>
<strong>${i18next.t("popups.transmissionfailedwith")}:</strong>
<span class="badge bg-info text-dark">${data["arq-transfer-inbound"].dxcall}</span>
<div class="mt-2">
<span class="badge bg-primary">${i18next.t('popups.state')}: ${data["arq-transfer-inbound"].state}</span>
<span class="badge bg-secondary">${i18next.t('popups.sessionid')}: ${data["arq-transfer-inbound"].session_id}</span>
<span class="badge bg-warning text-dark">${i18next.t('popups.receivedbytes')}: ${data["arq-transfer-inbound"].received_bytes}</span>
<span class="badge bg-warning text-dark">${i18next.t('popups.totalbytes')}: ${data["arq-transfer-inbound"].total_bytes}</span>
<span class="badge bg-primary">${i18next.t("popups.state")}: ${data["arq-transfer-inbound"].state}</span>
<span class="badge bg-secondary">${i18next.t("popups.sessionid")}: ${data["arq-transfer-inbound"].session_id}</span>
<span class="badge bg-warning text-dark">${i18next.t("popups.receivedbytes")}: ${data["arq-transfer-inbound"].received_bytes}</span>
<span class="badge bg-warning text-dark">${i18next.t("popups.totalbytes")}: ${data["arq-transfer-inbound"].total_bytes}</span>
</div>
</div>
`;

View File

@ -127,12 +127,16 @@ export function removeFromLocalStorage(key) {
* Set GUI Color Mode.
* @param {string} colorMOde - The colormode, light, dark, auto.
*/
export function applyColorMode(colorMode){
export function applyColorMode(colorMode) {
// If set to "auto", detect the OS preference using matchMedia
console.log(colorMode);
if (colorMode === "auto") {
colorMode = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
colorMode =
window.matchMedia &&
window.matchMedia("(prefers-color-scheme: dark)").matches
? "dark"
: "light";
}
// If it's an empty string, default to "light"
else if (colorMode === "") {
@ -141,5 +145,4 @@ export function applyColorMode(colorMode){
// Apply the theme by setting the attribute on the document element
document.documentElement.setAttribute("data-bs-theme", colorMode);
}
}

View File

@ -1,14 +1,18 @@
import i18next from 'i18next';
import i18next from "i18next";
// Function to load translation JSON files from the locales folder.
// It expects file names like "en_english.json" or "de_deutsch.json"
function loadLocaleMessages() {
// Automatically load all JSON files in ../locales
const locales = require.context('../locales', true, /[A-Za-z0-9-_,\s]+\.json$/i);
const locales = require.context(
"../locales",
true,
/[A-Za-z0-9-_,\s]+\.json$/i,
);
const resources = {};
const availableLanguages = [];
locales.keys().forEach(key => {
locales.keys().forEach((key) => {
// Use regex to extract the ISO code and language name from the file name.
// For example, "./en_english.json" extracts iso: "en", name: "english"
const matched = key.match(/\.\/([^_]+)_([^.]+)\.json$/i);
@ -28,17 +32,20 @@ function loadLocaleMessages() {
const { resources, availableLanguages } = loadLocaleMessages();
i18next.init({
lng: 'en',
fallbackLng: 'en',
resources,
}, (err) => {
if (err) {
console.error('i18next initialization error:', err);
} else {
console.log('i18next is ready.');
}
});
i18next.init(
{
lng: "en",
fallbackLng: "en",
resources,
},
(err) => {
if (err) {
console.error("i18next initialization error:", err);
} else {
console.log("i18next is ready.");
}
},
);
export default i18next;
export { availableLanguages };

View File

@ -13,7 +13,7 @@ import {
getFreedataMessageById,
postFreedataMessageADIF,
} from "./api";
import {useIsMobile} from "@/js/mobile_devices";
import { useIsMobile } from "@/js/mobile_devices";
const { isMobile } = useIsMobile(768);
/**
@ -28,9 +28,6 @@ export async function processFreedataMessages(data) {
if (!chatStore.selectedCallsign && !isMobile) {
chatStore.selectedCallsign = Object.keys(chatStore.sorted_chat_list)[0];
}
}
}
@ -44,7 +41,8 @@ function createCallsignListFromAPI(data) {
chatStore.totalUnreadMessages = 0;
data.messages.forEach((message) => {
const callsign = message.direction === "receive" ? message.origin : message.destination;
const callsign =
message.direction === "receive" ? message.origin : message.destination;
// Increment global unread count if the message is not read.
if (!message.is_read) {
@ -64,7 +62,9 @@ function createCallsignListFromAPI(data) {
callsignList[callsign].unread_messages++;
}
// Update stored details if this message is newer.
if (new Date(message.timestamp) > new Date(callsignList[callsign].timestamp)) {
if (
new Date(message.timestamp) > new Date(callsignList[callsign].timestamp)
) {
callsignList[callsign].timestamp = message.timestamp;
callsignList[callsign].body = message.body;
}
@ -73,7 +73,8 @@ function createCallsignListFromAPI(data) {
// Get the keys sorted in descending order by timestamp.
const sortedKeys = Object.keys(callsignList).sort(
(a, b) => new Date(callsignList[b].timestamp) - new Date(callsignList[a].timestamp)
(a, b) =>
new Date(callsignList[b].timestamp) - new Date(callsignList[a].timestamp),
);
// Rebuild the object with keys in sorted order.
@ -95,7 +96,8 @@ function createSortedMessagesList(data) {
data.messages.forEach((message) => {
// Determine the callsign based on message direction.
const callsign = message.direction === "receive" ? message.origin : message.destination;
const callsign =
message.direction === "receive" ? message.origin : message.destination;
if (!callsignMessages[callsign]) {
callsignMessages[callsign] = [];

View File

@ -1,4 +1,4 @@
import { ref, computed, onMounted, onUnmounted } from 'vue';
import { ref, computed, onMounted, onUnmounted } from "vue";
export function useIsMobile(breakpoint = 720) {
const windowWidth = ref(window.innerWidth);
@ -7,8 +7,8 @@ export function useIsMobile(breakpoint = 720) {
windowWidth.value = window.innerWidth;
};
onMounted(() => window.addEventListener('resize', updateWidth));
onUnmounted(() => window.removeEventListener('resize', updateWidth));
onMounted(() => window.addEventListener("resize", updateWidth));
onUnmounted(() => window.removeEventListener("resize", updateWidth));
const isMobile = computed(() => windowWidth.value < breakpoint);
return { isMobile, windowWidth };

View File

@ -8,7 +8,7 @@ import { Chart, Filler } from "chart.js";
import { getRemote, settingsStore as settings } from "./store/settingsStore";
import { initConnections } from "./js/event_sock.js";
import { getModemState } from "./js/api";
import {applyColorMode} from './js/freedata.js'
import { applyColorMode } from "./js/freedata.js";
// Register the Filler plugin globally
Chart.register(Filler);
@ -35,5 +35,4 @@ getRemote().then(() => {
//Apply Color Mode to gui
applyColorMode(settings.local.colormode);
});

View File

@ -62,6 +62,6 @@ export const useChatStore = defineStore("chatStore", () => {
arq_speed_list_timestamp,
scrollTrigger,
triggerScrollToBottom,
loading
loading,
};
});

View File

@ -12,8 +12,8 @@ const defaultConfig = {
grid_layout: "[]",
grid_preset: "[]",
grid_enabled: true,
language:"en",
colormode:"light"
language: "en",
colormode: "light",
},
remote: {
AUDIO: {

View File

@ -1,5 +1,3 @@
/* disable scrolling in main window */
body {
padding-right: 0px !important;