mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
[CodeFactor] Apply fixes
This commit is contained in:
parent
4f98929446
commit
ac9c46680d
5 changed files with 46 additions and 31 deletions
|
@ -18,8 +18,7 @@ function transmitPing() {
|
|||
function startStopBeacon() {
|
||||
if (state.beacon_state === true) {
|
||||
setModemBeacon(false);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
setModemBeacon(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
import { settingsStore as settings } from "../store/settingsStore.js";
|
||||
import { validateCallsignWithSSID,validateCallsignWithoutSSID } from "./freedata";
|
||||
import {
|
||||
validateCallsignWithSSID,
|
||||
validateCallsignWithoutSSID,
|
||||
} from "./freedata";
|
||||
|
||||
function buildURL(params, endpoint) {
|
||||
const url = "http://" + params.host + ":" + params.port + endpoint;
|
||||
|
@ -73,15 +76,16 @@ export function sendModemCQ() {
|
|||
}
|
||||
|
||||
export function sendModemPing(dxcall) {
|
||||
if (validateCallsignWithSSID(dxcall) === false && validateCallsignWithoutSSID(dxcall) === true) {
|
||||
if (
|
||||
validateCallsignWithSSID(dxcall) === false &&
|
||||
validateCallsignWithoutSSID(dxcall) === true
|
||||
) {
|
||||
dxcall = String(dxcall).toUpperCase().trim();
|
||||
dxcall = dxcall + "-0";
|
||||
|
||||
}
|
||||
dxcall = String(dxcall).toUpperCase().trim();
|
||||
if (validateCallsignWithSSID(dxcall))
|
||||
return apiPost("/modem/ping_ping", { dxcall: dxcall });
|
||||
|
||||
}
|
||||
|
||||
export function sendModemARQRaw(mycall, dxcall, data, uuid) {
|
||||
|
|
|
@ -63,13 +63,19 @@ export function sortByPropertyDesc(property) {
|
|||
export function validateCallsignWithSSID(callsign: string) {
|
||||
var patt = new RegExp("^[A-Z,a-z]+[0-9][A-Z,a-z]*-(1[0-5]|[0-9])$");
|
||||
|
||||
if (callsign === undefined || callsign==="" || patt.test(callsign) === false)
|
||||
{
|
||||
console.error("Call sign given is not in correct format or missing; callsign passed is: " + callsign);
|
||||
if (
|
||||
callsign === undefined ||
|
||||
callsign === "" ||
|
||||
patt.test(callsign) === false
|
||||
) {
|
||||
console.error(
|
||||
"Call sign given is not in correct format or missing; callsign passed is: " +
|
||||
callsign,
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Validate/check if a call sign has an SSID
|
||||
* @param {string} callsign callsign to check
|
||||
|
@ -78,10 +84,16 @@ export function validateCallsignWithSSID(callsign :string) {
|
|||
export function validateCallsignWithoutSSID(callsign: string) {
|
||||
var patt = new RegExp("^[A-Za-z]+[0-9][A-Za-z]+$");
|
||||
|
||||
if (callsign === undefined || callsign==="" || patt.test(callsign) === false)
|
||||
{
|
||||
console.error("Call sign given is not in correct format or missing; callsign passed is: " + callsign);
|
||||
if (
|
||||
callsign === undefined ||
|
||||
callsign === "" ||
|
||||
patt.test(callsign) === false
|
||||
) {
|
||||
console.error(
|
||||
"Call sign given is not in correct format or missing; callsign passed is: " +
|
||||
callsign,
|
||||
);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue