2022-02-05 15:54:14 +00:00
|
|
|
// GridTracker Copyright © 2022 GridTracker.org
|
|
|
|
// All rights reserved.
|
|
|
|
// See LICENSE for more information.
|
|
|
|
|
2022-02-05 17:36:52 +00:00
|
|
|
var g_potaPlaces = null;
|
|
|
|
var g_potaSpots = null;
|
2022-02-05 15:54:14 +00:00
|
|
|
|
2022-02-20 15:56:25 +00:00
|
|
|
function ingestPotaPlaces(buffer)
|
2022-02-05 21:55:25 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
g_potaPlaces = JSON.parse(buffer);
|
|
|
|
}
|
|
|
|
catch (e)
|
|
|
|
{
|
|
|
|
// can't write, somethings broke
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-20 15:56:25 +00:00
|
|
|
function getPotaPlaces()
|
2022-02-05 15:54:14 +00:00
|
|
|
{
|
2022-02-05 21:55:25 +00:00
|
|
|
if (g_mapSettings.offlineMode == false)
|
|
|
|
{
|
|
|
|
getBuffer(
|
2022-05-18 01:38:39 +00:00
|
|
|
"https://storage.googleapis.com/gt_app/pota.json",
|
2022-02-20 15:56:25 +00:00
|
|
|
ingestPotaPlaces,
|
2022-02-05 21:55:25 +00:00
|
|
|
null,
|
2022-05-18 01:47:35 +00:00
|
|
|
"https",
|
|
|
|
443
|
2022-02-05 21:55:25 +00:00
|
|
|
);
|
|
|
|
|
2022-02-20 15:56:25 +00:00
|
|
|
setTimeout(getPotaPlaces, 86400000)
|
2022-02-05 21:55:25 +00:00
|
|
|
}
|
2022-02-05 15:54:14 +00:00
|
|
|
}
|
|
|
|
|
2022-02-20 15:56:25 +00:00
|
|
|
function ingestPotaSpots(buffer)
|
2022-02-05 17:36:52 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
g_potaSpots = JSON.parse(buffer);
|
|
|
|
}
|
|
|
|
catch (e)
|
|
|
|
{
|
|
|
|
// can't write, somethings broke
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-20 15:56:25 +00:00
|
|
|
function getPotaSpots()
|
2022-02-05 15:54:14 +00:00
|
|
|
{
|
2022-02-20 17:12:26 +00:00
|
|
|
if (g_mapSettings.offlineMode == false && g_spotsEnabled == 1)
|
2022-02-05 17:36:52 +00:00
|
|
|
{
|
|
|
|
getBuffer(
|
|
|
|
"https://api.pota.app/spot/activator",
|
2022-02-20 15:56:25 +00:00
|
|
|
ingestPotaSpots,
|
2022-02-05 17:36:52 +00:00
|
|
|
null,
|
2022-02-05 18:08:25 +00:00
|
|
|
"https",
|
|
|
|
443
|
2022-02-05 17:36:52 +00:00
|
|
|
);
|
|
|
|
|
2022-02-20 15:56:25 +00:00
|
|
|
setTimeout(getPotaSpots, 300000);
|
2022-02-05 17:36:52 +00:00
|
|
|
}
|
2022-02-05 15:54:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function g_sendPotaSpot()
|
|
|
|
{
|
|
|
|
// if Pota spotting enabled, and we have enough info, send a spot to Pota
|
|
|
|
}
|