kopia lustrzana https://gitlab.com/gridtracker.org/gridtracker
getting POTA spots and updated the getBuffer() function to add a user-agent and referer.
rodzic
cc7742af3d
commit
ccc3a29f42
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
Ładowanie…
Reference in New Issue