[CodeFactor] Apply fixes

This commit is contained in:
codefactor-io 2023-11-09 14:48:51 +00:00
parent 165fb9588b
commit 7ee6707047
No known key found for this signature in database
GPG key ID: B66B2D63282C190F
4 changed files with 282 additions and 308 deletions

View file

@ -19,9 +19,8 @@ const stateStore = useStateStore(pinia);
import { useSettingsStore } from "../store/settingsStore.js"; import { useSettingsStore } from "../store/settingsStore.js";
const settings = useSettingsStore(pinia); const settings = useSettingsStore(pinia);
export function eventDispatcher(data) { export function eventDispatcher(data) {
console.log(data) console.log(data);
if (data["command"] == "modem_state") { if (data["command"] == "modem_state") {
//console.log(data) //console.log(data)
@ -104,8 +103,7 @@ if (data["command"] == "modem_state") {
stateStore.arq_state = data["arq_state"]; stateStore.arq_state = data["arq_state"];
stateStore.arq_transmission_percent = data["arq_transmission_percent"]; stateStore.arq_transmission_percent = data["arq_transmission_percent"];
stateStore.arq_seconds_until_finish = data["arq_seconds_until_finish"]; stateStore.arq_seconds_until_finish = data["arq_seconds_until_finish"];
stateStore.arq_seconds_until_timeout = stateStore.arq_seconds_until_timeout = data["arq_seconds_until_timeout"];
data["arq_seconds_until_timeout"];
stateStore.arq_seconds_until_timeout_percent = stateStore.arq_seconds_until_timeout_percent =
(stateStore.arq_seconds_until_timeout / 180) * 100; (stateStore.arq_seconds_until_timeout / 180) * 100;
@ -139,18 +137,13 @@ if (data["command"] == "modem_state") {
//speed_table: [{"bpm" : 5200, "snr": -3, "timestamp":1673555399},{"bpm" : 2315, "snr": 12, "timestamp":1673555500}], //speed_table: [{"bpm" : 5200, "snr": -3, "timestamp":1673555399},{"bpm" : 2315, "snr": 12, "timestamp":1673555500}],
}; };
*/ */
} }
var message = ""; var message = "";
if (data["freedata"] == "modem-message") { if (data["freedata"] == "modem-message") {
// break early if we received a dummy callsign // break early if we received a dummy callsign
// thats a kind of hotfix, as long as the modem isnt handling this better // thats a kind of hotfix, as long as the modem isnt handling this better
if ( if (data["dxcallsign"] == "AA0AA-0" || data["dxcallsign"] == "ZZ9YY-0") {
data["dxcallsign"] == "AA0AA-0" ||
data["dxcallsign"] == "ZZ9YY-0"
) {
return; return;
} }
@ -176,12 +169,7 @@ if (data["command"] == "modem_state") {
switch (data["cq"]) { switch (data["cq"]) {
case "transmitting": case "transmitting":
// CQ TRANSMITTING // CQ TRANSMITTING
displayToast( displayToast("success", "bi-arrow-left-right", "Transmitting CQ", 5000);
"success",
"bi-arrow-left-right",
"Transmitting CQ",
5000,
);
break; break;
case "received": case "received":
@ -224,8 +212,7 @@ if (data["command"] == "modem_state") {
// BEACON RECEIVED // BEACON RECEIVED
newBeaconReceived(data); newBeaconReceived(data);
message = message = "Beacon from " + data["dxcallsign"] + " | " + data["dxgrid"];
"Beacon from " + data["dxcallsign"] + " | " + data["dxgrid"];
displayToast("info", "bi-broadcast", message, 5000); displayToast("info", "bi-broadcast", message, 5000);
break; break;
} }
@ -240,10 +227,7 @@ if (data["command"] == "modem_state") {
case "received": case "received":
// PING RECEIVED // PING RECEIVED
message = message =
"Ping request from " + "Ping request from " + data["dxcallsign"] + " | " + data["dxgrid"];
data["dxcallsign"] +
" | " +
data["dxgrid"];
displayToast("success", "bi-arrow-right-short", message, 5000); displayToast("success", "bi-arrow-right-short", message, 5000);
break; break;
@ -372,7 +356,4 @@ if (data["command"] == "modem_state") {
} }
} }
} }
} }

View file

@ -1,7 +1,4 @@
import { import { eventDispatcher } from "../js/eventHandler.js";
eventDispatcher
} from "../js/eventHandler.js";
let socket; let socket;
let retries = 0; let retries = 0;
@ -19,7 +16,7 @@ function connect() {
// handle data // handle data
socket.addEventListener("message", function (event) { socket.addEventListener("message", function (event) {
console.log("Message from server:", event.data); console.log("Message from server:", event.data);
eventDispatcher(event.data) eventDispatcher(event.data);
}); });
// handle errors // handle errors

View file

@ -9,8 +9,6 @@ import {
getModemConfigAsJSON, getModemConfigAsJSON,
} from "../js/settingsHandler.ts"; } from "../js/settingsHandler.ts";
export async function getFromServer(host, port, endpoint) { export async function getFromServer(host, port, endpoint) {
// our central function for fetching the modems REST API by a specific endpoint // our central function for fetching the modems REST API by a specific endpoint
// TODO make this function using the host and port, specified in settings // TODO make this function using the host and port, specified in settings

View file

@ -733,8 +733,6 @@ export function getRxBuffer() {
writeTncCommand(command); writeTncCommand(command);
} }
// OPEN ARQ SESSION // OPEN ARQ SESSION
export function connectARQ(dxcallsign) { export function connectARQ(dxcallsign) {
var command = var command =