[CodeFactor] Apply fixes

This commit is contained in:
codefactor-io 2023-12-10 08:01:20 +00:00
parent 4f98929446
commit ac9c46680d
No known key found for this signature in database
GPG key ID: B66B2D63282C190F
5 changed files with 46 additions and 31 deletions

View file

@ -42,7 +42,7 @@ function startStopRecordAudio() {
</ul>
</div>
</div>
<div class="card-body pt-0 pb-0 ">
<div class="card-body pt-0 pb-0">
<div class="container-wide">
<div class="row">
<div class="col-lg-6">

View file

@ -1,10 +1,10 @@
<script setup lang="ts">
import {ref} from "vue";
import { ref } from "vue";
import { setActivePinia } from "pinia";
import pinia from "../../store/index";
setActivePinia(pinia);
import { settingsStore as settings} from "../../store/settingsStore.js";
import { settingsStore as settings } from "../../store/settingsStore.js";
import { useStateStore } from "../../store/stateStore.js";
const state = useStateStore(pinia);
@ -18,8 +18,7 @@ function transmitPing() {
function startStopBeacon() {
if (state.beacon_state === true) {
setModemBeacon(false);
}
else {
} else {
setModemBeacon(true);
}
}
@ -30,14 +29,14 @@ var dxcallPing = ref("");
<div class="card-header p-0">
<div>
<div>
<i class="bi bi-broadcast" style="font-size: 1.2rem"></i>&nbsp;
<strong>Broadcasts</strong>
<i class="bi bi-broadcast" style="font-size: 1.2rem"></i>&nbsp;
<strong>Broadcasts</strong>
</div>
</div>
</div>
<div class="card-body overflow-auto p-0">
<div>
<div >
<div>
<div class="input-group input-group-sm mb-0">
<input
type="text"

View file

@ -1,8 +1,8 @@
<script setup lang="ts">
// @ts-nocheck
// reason for no check is, that we have some mixing of typescript and chart js which seems to be not to be fixed that easy
import {ref, computed, onMounted } from "vue";
import { initWaterfall,setColormap } from "../../js/waterfallHandler.js";
import { ref, computed, onMounted } from "vue";
import { initWaterfall, setColormap } from "../../js/waterfallHandler.js";
import { setActivePinia } from "pinia";
import pinia from "../../store/index";
setActivePinia(pinia);

View file

@ -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) {
dxcall=String(dxcall).toUpperCase().trim();
dxcall=dxcall+"-0";
if (
validateCallsignWithSSID(dxcall) === false &&
validateCallsignWithoutSSID(dxcall) === true
) {
dxcall = String(dxcall).toUpperCase().trim();
dxcall = dxcall + "-0";
}
dxcall=String(dxcall).toUpperCase().trim();
dxcall = String(dxcall).toUpperCase().trim();
if (validateCallsignWithSSID(dxcall))
return apiPost("/modem/ping_ping", { dxcall: dxcall });
}
export function sendModemARQRaw(mycall, dxcall, data, uuid) {

View file

@ -60,28 +60,40 @@ export function sortByPropertyDesc(property) {
* @param {string} callsign callsign to check
* @returns true or false if callsign appears to be valid with an SSID
*/
export function validateCallsignWithSSID(callsign :string) {
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
* @returns true or false if callsign appears to be valid without an SSID
*/
export function validateCallsignWithoutSSID(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;
};
}