From cc7742af3df3be5e4d9804484ee9816f08766314 Mon Sep 17 00:00:00 2001 From: Matthew Chambers Date: Sat, 5 Feb 2022 09:54:14 -0600 Subject: [PATCH 01/46] rough start for pota stuff --- package.nw/lib/pota.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 package.nw/lib/pota.js diff --git a/package.nw/lib/pota.js b/package.nw/lib/pota.js new file mode 100644 index 0000000..5219d1c --- /dev/null +++ b/package.nw/lib/pota.js @@ -0,0 +1,22 @@ +// GridTracker Copyright © 2022 GridTracker.org +// All rights reserved. +// See LICENSE for more information. + +var g_potaPlace = Object; +var g_potaSpot = Object; + +function g_getPotaPlaces() +{ + // get list of all parks + // we need to see if ever run and update 1x a week +} + +function g_getPotaSpots() +{ + // if Pota Spotting enabled, get spots +} + +function g_sendPotaSpot() +{ + // if Pota spotting enabled, and we have enough info, send a spot to Pota +} From ccc3a29f42d97d9bcf85d036313dc1129e53ec7a Mon Sep 17 00:00:00 2001 From: Matthew Chambers Date: Sat, 5 Feb 2022 11:36:52 -0600 Subject: [PATCH 02/46] getting POTA spots and updated the getBuffer() function to add a user-agent and referer. --- package.nw/lib/gt.js | 3 ++- package.nw/lib/pota.js | 29 ++++++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/package.nw/lib/gt.js b/package.nw/lib/gt.js index e005978..a5d92d2 100644 --- a/package.nw/lib/gt.js +++ b/package.nw/lib/gt.js @@ -12781,7 +12781,8 @@ function getBuffer(file_url, callback, flag, mode, port, cache = null) host: url.parse(file_url).host, // eslint-disable-line node/no-deprecated-api port: port, followAllRedirects: true, - path: url.parse(file_url).path // eslint-disable-line node/no-deprecated-api + path: url.parse(file_url).path, // eslint-disable-line node/no-deprecated-api + headers: { "User-Agent": gtVersionString, Referer: "https://gridtracker.org" } }; http.get(options, function (res) diff --git a/package.nw/lib/pota.js b/package.nw/lib/pota.js index 5219d1c..0650079 100644 --- a/package.nw/lib/pota.js +++ b/package.nw/lib/pota.js @@ -2,8 +2,8 @@ // All rights reserved. // See LICENSE for more information. -var g_potaPlace = Object; -var g_potaSpot = Object; +var g_potaPlaces = null; +var g_potaSpots = null; function g_getPotaPlaces() { @@ -11,9 +11,32 @@ function g_getPotaPlaces() // we need to see if ever run and update 1x a week } +function g_ingestPotaSpots() +{ + try + { + g_potaSpots = JSON.parse(buffer); + } + catch (e) + { + // can't write, somethings broke + } +} + function g_getPotaSpots() { - // if Pota Spotting enabled, get spots + if (g_mapSettings.offlineMode == false) + { + getBuffer( + "https://api.pota.app/spot/activator", + g_ingestPotaSpots, + null, + "http", + 80 + ); + + setTimeout(g_getPotaSpots, 300000); + } } function g_sendPotaSpot() From 3712dbb5b939fe7bdea9bc4e3caf422d592969f5 Mon Sep 17 00:00:00 2001 From: Matthew Chambers Date: Sat, 5 Feb 2022 12:08:25 -0600 Subject: [PATCH 03/46] fixed a couple little things that broke --- package.nw/GridTracker.html | 3 ++- package.nw/lib/gt.js | 2 +- package.nw/lib/pota.js | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/package.nw/GridTracker.html b/package.nw/GridTracker.html index 11a4b81..23892d2 100644 --- a/package.nw/GridTracker.html +++ b/package.nw/GridTracker.html @@ -48,8 +48,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + - +
diff --git a/package.nw/lib/gt.js b/package.nw/lib/gt.js index a5d92d2..db9b379 100644 --- a/package.nw/lib/gt.js +++ b/package.nw/lib/gt.js @@ -12782,7 +12782,7 @@ function getBuffer(file_url, callback, flag, mode, port, cache = null) port: port, followAllRedirects: true, path: url.parse(file_url).path, // eslint-disable-line node/no-deprecated-api - headers: { "User-Agent": gtVersionString, Referer: "https://gridtracker.org" } + headers: { "User-Agent": gtVersionString } }; http.get(options, function (res) diff --git a/package.nw/lib/pota.js b/package.nw/lib/pota.js index 0650079..b0c1add 100644 --- a/package.nw/lib/pota.js +++ b/package.nw/lib/pota.js @@ -11,7 +11,7 @@ function g_getPotaPlaces() // we need to see if ever run and update 1x a week } -function g_ingestPotaSpots() +function g_ingestPotaSpots(buffer) { try { @@ -31,8 +31,8 @@ function g_getPotaSpots() "https://api.pota.app/spot/activator", g_ingestPotaSpots, null, - "http", - 80 + "https", + 443 ); setTimeout(g_getPotaSpots, 300000); From ea50ff80027b81b984208ebd6bd3cd8316abbf4b Mon Sep 17 00:00:00 2001 From: Matthew Chambers Date: Sat, 5 Feb 2022 15:55:25 -0600 Subject: [PATCH 04/46] latest fixes - got places now --- package.nw/lib/pota.js | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/package.nw/lib/pota.js b/package.nw/lib/pota.js index b0c1add..89c5410 100644 --- a/package.nw/lib/pota.js +++ b/package.nw/lib/pota.js @@ -5,10 +5,32 @@ var g_potaPlaces = null; var g_potaSpots = null; +function g_ingestPotaPlaces(buffer) +{ + try + { + g_potaPlaces = JSON.parse(buffer); + } + catch (e) + { + // can't write, somethings broke + } +} + function g_getPotaPlaces() { - // get list of all parks - // we need to see if ever run and update 1x a week + if (g_mapSettings.offlineMode == false) + { + getBuffer( + "http://app.gridtracker.org/pota_parks.php", + g_ingestPotaPlaces, + null, + "http", + 80 + ); + + setTimeout(g_getPotaPlaces, 86400000) + } } function g_ingestPotaSpots(buffer) From 14c8c6ed1894f6b36a51f75bd05754fb747e718a Mon Sep 17 00:00:00 2001 From: Matthew Chambers Date: Sun, 20 Feb 2022 09:56:25 -0600 Subject: [PATCH 05/46] POTA places loads at startup and every 86400000 ms --- package.nw/lib/gt.js | 3 ++- package.nw/lib/pota.js | 16 ++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/package.nw/lib/gt.js b/package.nw/lib/gt.js index db9b379..88ade62 100644 --- a/package.nw/lib/gt.js +++ b/package.nw/lib/gt.js @@ -13760,7 +13760,8 @@ var g_startupTable = [ [loadLookupDetails, "Callsign Lookup Details Loaded"], [startupEventsAndTimers, "Set Events and Timers"], [registerHotKeys, "Registered Hotkeys"], - [gtChatSystemInit, "User System Initialized"], + [gtChatSystemInit, "Chat System Initialized"], + [getPotaPlaces, "Loading POTA Database"], [downloadAcknowledgements, "Contributor Acknowledgements Loaded"], [postInit, "Finalizing System"] ]; diff --git a/package.nw/lib/pota.js b/package.nw/lib/pota.js index 89c5410..10b6d6e 100644 --- a/package.nw/lib/pota.js +++ b/package.nw/lib/pota.js @@ -5,7 +5,7 @@ var g_potaPlaces = null; var g_potaSpots = null; -function g_ingestPotaPlaces(buffer) +function ingestPotaPlaces(buffer) { try { @@ -17,23 +17,23 @@ function g_ingestPotaPlaces(buffer) } } -function g_getPotaPlaces() +function getPotaPlaces() { if (g_mapSettings.offlineMode == false) { getBuffer( "http://app.gridtracker.org/pota_parks.php", - g_ingestPotaPlaces, + ingestPotaPlaces, null, "http", 80 ); - setTimeout(g_getPotaPlaces, 86400000) + setTimeout(getPotaPlaces, 86400000) } } -function g_ingestPotaSpots(buffer) +function ingestPotaSpots(buffer) { try { @@ -45,19 +45,19 @@ function g_ingestPotaSpots(buffer) } } -function g_getPotaSpots() +function getPotaSpots() { if (g_mapSettings.offlineMode == false) { getBuffer( "https://api.pota.app/spot/activator", - g_ingestPotaSpots, + ingestPotaSpots, null, "https", 443 ); - setTimeout(g_getPotaSpots, 300000); + setTimeout(getPotaSpots, 300000); } } From aee8c8bb9748a0d898440a7849f5b8269da9f3d6 Mon Sep 17 00:00:00 2001 From: Matthew Chambers Date: Sun, 20 Feb 2022 10:41:21 -0600 Subject: [PATCH 06/46] add POTA checkbox and defaults, empty hunt POTA in processRosterHunting needs fleshed out --- package.nw/gt_roster.html | 5 +++++ package.nw/lib/roster.js | 2 ++ package.nw/lib/roster/processRosterHunting.js | 7 +++++++ 3 files changed, 14 insertions(+) diff --git a/package.nw/gt_roster.html b/package.nw/gt_roster.html index 3909386..28df8ab 100644 --- a/package.nw/gt_roster.html +++ b/package.nw/gt_roster.html @@ -170,6 +170,11 @@
+
+ +