merge-requests/203/head
Tag 2022-09-10 18:05:25 -07:00
rodzic a57dd0ba3f
commit fdf3238074
6 zmienionych plików z 154 dodań i 24 usunięć

Wyświetl plik

@ -26,6 +26,7 @@ module.exports = {
semi: 0,
"space-before-function-paren": 0,
"one-var": 0,
no-trailing-spaces: ["error", { "skipBlankLines": true, "ignoreComments": true }],
/* ESLint checks we should consider fixing in the future */
eqeqeq: 0,

Wyświetl plik

@ -695,6 +695,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<div id="radarButton" onclick="toggleNexrad()" class="iconButton" title="Toggle US Nexrad">
<img src="./img/radar-button.png" class="buttonImg" />
</div>
<div id="potaButton" onClick="togglePota();" class="iconButton" title="Parks On The Air">
<img id="potaImg" src="./img/pota.png" class="buttonImg" />
</div>
<div id="gridOverlayButton" onclick="toggleAllGrids()" class="iconButton" title="Toggle All Grid Overlay">
<img src="./img/grid-overlay.png" class="buttonImg" />
</div>

Wyświetl plik

@ -47,6 +47,7 @@ var def_appSettings = {
gtPropFilter: "mixed",
gtMsgEnable: true,
gtShareEnable: true,
gtSpotEnable: true,
heatEnabled: 0,
loadAdifAtStartup: false,
lookupLoginCq: "",
@ -74,6 +75,7 @@ var def_appSettings = {
myRawFreq: "",
myRawGrid: "",
pathWidthWeight: 1.0,
potaEnabled: 0,
pushPinMode: false,
qrzPathWidthWeight: 1.2,
sixWideMode: 0,
@ -90,8 +92,7 @@ var def_appSettings = {
workingCallsignEnable: false,
workingCallsigns: {},
workingDateEnable: false,
workingDate: 0,
gtSpotEnable: true
workingDate: 0
};
var def_mapSettings = {
@ -210,32 +211,38 @@ var def_N1MMSettings = {
port: 2333,
ip: "127.0.0.1"
};
var def_log4OMSettings = {
enable: false,
port: 2236,
ip: "127.0.0.1"
};
var def_dxkLogSettings = {
enable: false,
port: 52000,
ip: "127.0.0.1"
};
var def_HRDLogbookLogSettings = {
enable: false,
port: 7826,
ip: "127.0.0.1"
};
var def_acLogSettings = {
enable: false,
port: 1100,
ip: "127.0.0.1"
};
var def_trustedQslSettings = {
stationFile: "",
stationFileValid: false,
binaryFile: "",
binaryFileValid: false
};
var def_callsignLookups = {
lotwUseEnable: true,
lotwWeeklyEnable: true,

Wyświetl plik

@ -171,6 +171,7 @@ var g_flightDuration = 30;
var g_crScript = g_appSettings.crScript;
var g_spotsEnabled = g_appSettings.spotsEnabled;
var g_potaEnabled = g_appSettings.potaEnabled;
var g_heatEnabled = g_appSettings.heatEnabled;
var g_myLat = g_mapSettings.latitude;
@ -796,7 +797,8 @@ function toggleOffline()
buttonStrikesDiv.style.display = "inline-block";
buttonPSKSpotsBoxDiv.style.display = "inline-block";
donateButton.style.display = "inline-block";
potaButton.style.display = "inline-block";
if (g_appSettings.gtShareEnable == true)
{
gtFlagButton.style.display = "inline-block";
@ -840,6 +842,7 @@ function toggleOffline()
gtShareButton.style.display = "none";
msgButton.style.display = "none";
donateButton.style.display = "none";
potaButton.style.display = "none";
buttonStrikesDiv.style.display = "none";
buttonPSKSpotsBoxDiv.style.display = "none";
setGtShareButtons();
@ -6906,7 +6909,7 @@ function handleWsjtxDecode(newMessage)
msgDEcallsign = decodeWords[1];
}
if (g_callRosterWindowHandle.window.g_rosterSettings.wanted.huntRR73 && decodeWords[2] == "RR73")
if (decodeWords[2] == "RR73" && g_callRosterWindowHandle.window.g_rosterSettings.wanted.huntRR73)
{
CQ = true;
msgDXcallsign = "RR73";
@ -7111,9 +7114,25 @@ function handleWsjtxDecode(newMessage)
}
}
if (g_potaSpots && g_potaSpots.some(item => item.activator === callsign.DEcall))
if (g_potaEnabled == 1 && (callsign.DEcall in g_pota.spots || callsign.DEcall in g_pota.schedule))
{
callsign.pota = g_potaSpots.filter(item => item.activator === callsign.DEcall)[0];
let now = Date.now();
callsign.pota = [];
if (callsign.DEcall in g_pota.spots)
{
// copies the entire array
callsign.pota = g_pota.spots[callsign.DEcall];
}
if (callsign.DEcall in g_pota.schedule)
{
for (let i in g_pota.schedule[callsign.DEcall])
{
if (now < g_pota.schedule[callsign.DEcall][i].end && now >= g_pota.schedule[callsign.DEcall][i].start && !callsign.pota.includes(g_pota.schedule[callsign.DEcall][i].id))
{
callsign.pota.push(g_pota.schedule[callsign.DEcall][i].id);
}
}
}
}
if (newMessage.NW)
@ -12851,7 +12870,7 @@ function loadMapSettings()
trafficDecode.checked = g_mapSettings.trafficDecode;
pskSpotsImg.style.filter = g_spotsEnabled == 1 ? "" : "grayscale(1);";
pskSpotsImg.style.filter = g_spotsEnabled == 1 ? "" : "grayscale(1)";
g_bandToColor = JSON.parse(JSON.stringify(g_pskColors));
@ -13355,6 +13374,7 @@ function loadMsgSettings()
pskSpotsImg.style.filter = g_spotsEnabled == 1 ? "" : "grayscale(1)";
for (var key in g_msgSettings)
{
document.getElementById(key).value = g_msgSettings[key];
@ -13649,8 +13669,7 @@ var g_startupTable = [
[startupEventsAndTimers, "Set Events and Timers"],
[registerHotKeys, "Registered Hotkeys"],
[gtChatSystemInit, "Chat System Initialized"],
[getPotaPlaces, "Loading POTA Database"],
[getPotaSpots, "Starting POTA Spots Pump"],
[initPota, "POTA Initialized"],
[downloadAcknowledgements, "Contributor Acknowledgements Loaded"],
[postInit, "Finalizing System"]
];

Wyświetl plik

@ -2,14 +2,49 @@
// All rights reserved.
// See LICENSE for more information.
var g_potaPlaces = null;
var g_potaSpots = null;
var g_pota = {
places: {},
placesTimeout: null,
schedule: {},
scheduleTimeout: null,
spots: {},
spotsTimeout: null
};
function ingestPotaPlaces(buffer)
function initPota()
{
potaImg.style.filter = g_potaEnabled == 1 ? "" : "grayscale(1)";
getPotaPlaces();
getPotaSchedule();
getPotaSpots();
}
function togglePota()
{
g_potaEnabled ^= 1;
g_appSettings.potaEnabled = g_potaEnabled;
potaImg.style.filter = g_potaEnabled == 1 ? "" : "grayscale(1)";
saveAppSettings();
if (g_potaEnabled == 1)
{
// Only get if empty, let the timer do its job
if (Object.keys(g_pota.places).length == 0)
{
getPotaPlaces();
}
getPotaSchedule();
getPotaSpots();
}
}
function processPotaPlaces(buffer)
{
try
{
g_potaPlaces = JSON.parse(buffer);
g_pota.places = JSON.parse(buffer);
}
catch (e)
{
@ -19,25 +54,36 @@ function ingestPotaPlaces(buffer)
function getPotaPlaces()
{
if (g_mapSettings.offlineMode == false)
if (g_pota.placesTimeout)
{
clearTimeout(g_pota.placesTimeout);
g_pota.spotsTimeout = null;
}
if (g_mapSettings.offlineMode == false && g_potaEnabled == 1)
{
getBuffer(
"https://storage.googleapis.com/gt_app/pota.json",
ingestPotaPlaces,
processPotaPlaces,
null,
"https",
443
);
setTimeout(getPotaPlaces, 86400000)
}
g_pota.placesTimeout = setTimeout(getPotaPlaces, 86400000)
}
function ingestPotaSpots(buffer)
function processPotaSpots(buffer)
{
try
{
g_potaSpots = JSON.parse(buffer);
let spots = JSON.parse(buffer);
g_pota.spots = {};
for (let spot in spots)
{
(g_pota.spots[spots[spot].activator] = g_pota.spots[spots[spot].activator] || []).push(spots[spot].reference);
}
}
catch (e)
{
@ -47,21 +93,75 @@ function ingestPotaSpots(buffer)
function getPotaSpots()
{
if (g_mapSettings.offlineMode == false && g_spotsEnabled == 1)
if (g_pota.spotsTimeout)
{
clearTimeout(g_pota.spotsTimeout);
g_pota.spotsTimeout = null;
}
if (g_mapSettings.offlineMode == false && g_potaEnabled == 1)
{
getBuffer(
"https://api.pota.app/spot/activator",
ingestPotaSpots,
processPotaSpots,
null,
"https",
443
);
}
g_pota.spotsTimeout = setTimeout(getPotaSpots, 300000);
}
setTimeout(getPotaSpots, 300000);
function processPotaSchedule(buffer)
{
try
{
let schedules = JSON.parse(buffer);
g_pota.schedule = {};
for (let i in schedules)
{
let newObj = {};
newObj.id = schedules[i].reference;
newObj.start = Date.parse(schedules[i].startDate + "T" + schedules[i].startTime);
newObj.end = Date.parse(schedules[i].endDate + "T" + schedules[i].endTime);
if (Date.now() < newObj.end)
{
(g_pota.schedule[schedules[i].activator] = g_pota.schedule[schedules[i].activator] || []).push(newObj);
}
// else it is expired and no longer relevant
}
}
catch (e)
{
// can't write, somethings broke
}
}
function g_sendPotaSpot()
function getPotaSchedule()
{
if (g_pota.scheduleTimeout)
{
clearTimeout(g_pota.scheduleTimeout);
g_pota.scheduleTimeout = null;
}
if (g_mapSettings.offlineMode == false && g_potaEnabled == 1)
{
getBuffer(
"https://api.pota.app/activation",
processPotaSchedule,
null,
"https",
443
);
}
g_pota.scheduleTimeout = setTimeout(getPotaSchedule, 900000);
}
function sendPotaSpot()
{
// if Pota spotting enabled, and we have enough info, send a spot to Pota
}

Wyświetl plik

@ -492,7 +492,7 @@ function processRosterHunting(callRoster, rosterSettings, awardTracker)
}
// Hunting for POTAs
if (huntPOTA.checked == true && window.opener.g_mapSettings.offlineMode == false && callObj.pota != null)
if (huntPOTA.checked == true && callObj.pota != null)
{
let huntTotal = callObj.pota.length;
let huntFound = 0, layeredFound = 0, workedFound = 0, layeredWorkedFound = 0;