@@ -1,44 +1,77 @@ | |||
//****************************************************************************** | |||
// LAYERS parameter: config_a_b_c | |||
// a = 1 for depth in meters, 2 for depth in feet, 3 for fathoms | |||
// b = 10.00: for 10.00 m safety depth (beginning of blue coloring) (unit equal to that set by a) | |||
// c = 0 for pristine Navionics charts, 1 for Sonar Charts | |||
// TRANSPARENT parameter: FALSE for non-layer, TRUE for layer | |||
// UGC parameter: FALSE for pristine Navionics charts, TRUE for additinal user-generated content icons | |||
// | |||
// TRANSPARENT parameter: | |||
// FALSE for non-layer | |||
// TRUE for layer | |||
// | |||
// UGC parameter: | |||
// FALSE for pristine Navionics charts | |||
// TRUE for additinal user-generated content icons | |||
//****************************************************************************** | |||
const | |||
cReqParams = 'LAYERS=config_1_10.00_1&TRANSPARENT=TRUE&UGC=FALSE'; | |||
//****************************************************************************** | |||
const | |||
cTTL = 24*60*60; // 24 hour | |||
cNavTokenKey = 'NavToken='; | |||
cTimeStampKey = 'TimeStamp='; | |||
function CheckTTL(const ATimeStamp: AnsiString): Boolean; | |||
begin | |||
Result := ( (cTTL div 2) > GetUnixTime - StrToInt64Def(ATimeStamp, 0) ); | |||
end; | |||
function GetNavToken: AnsiString; | |||
var | |||
VTimeStamp: AnsiString; | |||
VNavToken: AnsiString; | |||
VTimeStamp: AnsiString; | |||
VResponseCode: Cardinal; | |||
VResponseHeader, VResponseData: AnsiString; | |||
VRequestUrl, VRequestHeader, VPostData: AnsiString; | |||
VRequestUrl: AnsiString; | |||
begin | |||
Result := 'ERROR_1'; | |||
Result := ''; | |||
if ScriptBuffer <> '' then begin | |||
Result := ScriptBuffer; | |||
Exit; | |||
VNavToken := GetBetween(ScriptBuffer, cNavTokenKey, ';'); | |||
VTimeStamp := GetBetween(ScriptBuffer, cTimeStampKey, ';'); | |||
if (VNavToken <> '') and (VTimeStamp <> '') and CheckTTL(VTimeStamp) then begin | |||
Result := VNavToken; | |||
end else begin | |||
ScriptBuffer := ''; | |||
end; | |||
end; | |||
if Assigned(Downloader) then begin | |||
VTimeStamp := IntToStr(GetUnixTime); | |||
if (Result = '') and Assigned(Downloader) then begin | |||
VTimeStamp := IntToStr(GetUnixTime); | |||
VRequestUrl := 'https://backend.navionics.io/tile/get_key/Navionics_internalpurpose_00001/webapiv2.navionics.com?_=' + VTimeStamp; | |||
VRequestHeader := ''; | |||
VPostData := ''; | |||
VResponseHeader := ''; | |||
VResponseData := ''; | |||
VResponseCode := Downloader.DoHttpRequest(VRequestUrl, VRequestHeader, VPostData, VResponseHeader, VResponseData); | |||
VResponseData := ''; | |||
VResponseCode := Downloader.DoHttpRequest(VRequestUrl, '', '', VResponseHeader, VResponseData); | |||
if VResponseCode = 200 then begin | |||
ScriptBuffer := VResponseData; | |||
Result := ScriptBuffer; | |||
end else begin | |||
ScriptBuffer := 'ERROR_2'; | |||
Result := VResponseData; | |||
ScriptBuffer := cNavTokenKey + Result + ';' + cTimeStampKey + VTimeStamp + ';'; | |||
end; | |||
end; | |||
end; | |||
begin | |||
ResultURL:=GetURLBase+inttostr(GetZ-1)+'/'+inttostr(GetX)+'/'+inttostr(GetY)+'?LAYERS=config_1_10.00_1&TRANSPARENT=TRUE&UGC=FALSE&navtoken='+GetNavToken; | |||
//****************************************************************************** | |||
var | |||
VNavToken: AnsiString; | |||
begin | |||
VNavToken := GetNavToken; | |||
if VNavToken <> '' then begin | |||
ResultURL := GetURLBase + IntToStr(GetZ-1) + '/' + IntToStr(GetX) + '/' + | |||
IntToStr(GetY) + '?' + cReqParams + '&' + 'navtoken=' + VNavToken; | |||
end else begin | |||
ResultURL := ''; | |||
end; | |||
end. |
@@ -1,44 +1,77 @@ | |||
//****************************************************************************** | |||
// LAYERS parameter: config_a_b_c | |||
// a = 1 for depth in meters, 2 for depth in feet, 3 for fathoms | |||
// b = 10.00: for 10.00 m safety depth (beginning of blue coloring) (unit equal to that set by a) | |||
// c = 0 for pristine Navionics charts, 1 for Sonar Charts | |||
// TRANSPARENT parameter: FALSE for non-layer, TRUE for layer | |||
// UGC parameter: FALSE for pristine Navionics charts, TRUE for additinal user-generated content icons | |||
// | |||
// TRANSPARENT parameter: | |||
// FALSE for non-layer | |||
// TRUE for layer | |||
// | |||
// UGC parameter: | |||
// FALSE for pristine Navionics charts | |||
// TRUE for additinal user-generated content icons | |||
//****************************************************************************** | |||
const | |||
cReqParams = 'LAYERS=config_1_10.00_1&TRANSPARENT=FALSE&UGC=FALSE'; | |||
//****************************************************************************** | |||
const | |||
cTTL = 24*60*60; // 24 hour | |||
cNavTokenKey = 'NavToken='; | |||
cTimeStampKey = 'TimeStamp='; | |||
function CheckTTL(const ATimeStamp: AnsiString): Boolean; | |||
begin | |||
Result := ( (cTTL div 2) > GetUnixTime - StrToInt64Def(ATimeStamp, 0) ); | |||
end; | |||
function GetNavToken: AnsiString; | |||
var | |||
VTimeStamp: AnsiString; | |||
VNavToken: AnsiString; | |||
VTimeStamp: AnsiString; | |||
VResponseCode: Cardinal; | |||
VResponseHeader, VResponseData: AnsiString; | |||
VRequestUrl, VRequestHeader, VPostData: AnsiString; | |||
VRequestUrl: AnsiString; | |||
begin | |||
Result := 'ERROR_1'; | |||
Result := ''; | |||
if ScriptBuffer <> '' then begin | |||
Result := ScriptBuffer; | |||
Exit; | |||
VNavToken := GetBetween(ScriptBuffer, cNavTokenKey, ';'); | |||
VTimeStamp := GetBetween(ScriptBuffer, cTimeStampKey, ';'); | |||
if (VNavToken <> '') and (VTimeStamp <> '') and CheckTTL(VTimeStamp) then begin | |||
Result := VNavToken; | |||
end else begin | |||
ScriptBuffer := ''; | |||
end; | |||
end; | |||
if Assigned(Downloader) then begin | |||
VTimeStamp := IntToStr(GetUnixTime); | |||
if (Result = '') and Assigned(Downloader) then begin | |||
VTimeStamp := IntToStr(GetUnixTime); | |||
VRequestUrl := 'https://backend.navionics.io/tile/get_key/Navionics_internalpurpose_00001/webapiv2.navionics.com?_=' + VTimeStamp; | |||
VRequestHeader := ''; | |||
VPostData := ''; | |||
VResponseHeader := ''; | |||
VResponseData := ''; | |||
VResponseCode := Downloader.DoHttpRequest(VRequestUrl, VRequestHeader, VPostData, VResponseHeader, VResponseData); | |||
VResponseData := ''; | |||
VResponseCode := Downloader.DoHttpRequest(VRequestUrl, '', '', VResponseHeader, VResponseData); | |||
if VResponseCode = 200 then begin | |||
ScriptBuffer := VResponseData; | |||
Result := ScriptBuffer; | |||
end else begin | |||
ScriptBuffer := 'ERROR_2'; | |||
Result := VResponseData; | |||
ScriptBuffer := cNavTokenKey + Result + ';' + cTimeStampKey + VTimeStamp + ';'; | |||
end; | |||
end; | |||
end; | |||
begin | |||
ResultURL:=GetURLBase+inttostr(GetZ-1)+'/'+inttostr(GetX)+'/'+inttostr(GetY)+'?LAYERS=config_1_10.00_1&TRANSPARENT=FALSE&UGC=FALSE&navtoken='+GetNavToken; | |||
//****************************************************************************** | |||
var | |||
VNavToken: AnsiString; | |||
begin | |||
VNavToken := GetNavToken; | |||
if VNavToken <> '' then begin | |||
ResultURL := GetURLBase + IntToStr(GetZ-1) + '/' + IntToStr(GetX) + '/' + | |||
IntToStr(GetY) + '?' + cReqParams + '&' + 'navtoken=' + VNavToken; | |||
end else begin | |||
ResultURL := ''; | |||
end; | |||
end. |
@@ -1,44 +1,77 @@ | |||
//****************************************************************************** | |||
// LAYERS parameter: config_a_b_c | |||
// a = 1 for depth in meters, 2 for depth in feet, 3 for fathoms | |||
// b = 10.00: for 10.00 m safety depth (beginning of blue coloring) (unit equal to that set by a) | |||
// c = 0 for pristine Navionics charts, 1 for Sonar Charts | |||
// TRANSPARENT parameter: FALSE for non-layer, TRUE for layer | |||
// UGC parameter: FALSE for pristine Navionics charts, TRUE for additinal user-generated content icons | |||
// | |||
// TRANSPARENT parameter: | |||
// FALSE for non-layer | |||
// TRUE for layer | |||
// | |||
// UGC parameter: | |||
// FALSE for pristine Navionics charts | |||
// TRUE for additinal user-generated content icons | |||
//****************************************************************************** | |||
const | |||
cReqParams = 'LAYERS=config_1_10.00_0&TRANSPARENT=TRUE&UGC=FALSE'; | |||
//****************************************************************************** | |||
const | |||
cTTL = 24*60*60; // 24 hour | |||
cNavTokenKey = 'NavToken='; | |||
cTimeStampKey = 'TimeStamp='; | |||
function CheckTTL(const ATimeStamp: AnsiString): Boolean; | |||
begin | |||
Result := ( (cTTL div 2) > GetUnixTime - StrToInt64Def(ATimeStamp, 0) ); | |||
end; | |||
function GetNavToken: AnsiString; | |||
var | |||
VTimeStamp: AnsiString; | |||
VNavToken: AnsiString; | |||
VTimeStamp: AnsiString; | |||
VResponseCode: Cardinal; | |||
VResponseHeader, VResponseData: AnsiString; | |||
VRequestUrl, VRequestHeader, VPostData: AnsiString; | |||
VRequestUrl: AnsiString; | |||
begin | |||
Result := 'ERROR_1'; | |||
Result := ''; | |||
if ScriptBuffer <> '' then begin | |||
Result := ScriptBuffer; | |||
Exit; | |||
VNavToken := GetBetween(ScriptBuffer, cNavTokenKey, ';'); | |||
VTimeStamp := GetBetween(ScriptBuffer, cTimeStampKey, ';'); | |||
if (VNavToken <> '') and (VTimeStamp <> '') and CheckTTL(VTimeStamp) then begin | |||
Result := VNavToken; | |||
end else begin | |||
ScriptBuffer := ''; | |||
end; | |||
end; | |||
if Assigned(Downloader) then begin | |||
VTimeStamp := IntToStr(GetUnixTime); | |||
if (Result = '') and Assigned(Downloader) then begin | |||
VTimeStamp := IntToStr(GetUnixTime); | |||
VRequestUrl := 'https://backend.navionics.io/tile/get_key/Navionics_internalpurpose_00001/webapiv2.navionics.com?_=' + VTimeStamp; | |||
VRequestHeader := ''; | |||
VPostData := ''; | |||
VResponseHeader := ''; | |||
VResponseData := ''; | |||
VResponseCode := Downloader.DoHttpRequest(VRequestUrl, VRequestHeader, VPostData, VResponseHeader, VResponseData); | |||
VResponseData := ''; | |||
VResponseCode := Downloader.DoHttpRequest(VRequestUrl, '', '', VResponseHeader, VResponseData); | |||
if VResponseCode = 200 then begin | |||
ScriptBuffer := VResponseData; | |||
Result := ScriptBuffer; | |||
end else begin | |||
ScriptBuffer := 'ERROR_2'; | |||
Result := VResponseData; | |||
ScriptBuffer := cNavTokenKey + Result + ';' + cTimeStampKey + VTimeStamp + ';'; | |||
end; | |||
end; | |||
end; | |||
begin | |||
ResultURL:=GetURLBase+inttostr(GetZ-1)+'/'+inttostr(GetX)+'/'+inttostr(GetY)+'?LAYERS=config_1_10.00_0&TRANSPARENT=TRUE&UGC=FALSE&navtoken='+GetNavToken; | |||
//****************************************************************************** | |||
var | |||
VNavToken: AnsiString; | |||
begin | |||
VNavToken := GetNavToken; | |||
if VNavToken <> '' then begin | |||
ResultURL := GetURLBase + IntToStr(GetZ-1) + '/' + IntToStr(GetX) + '/' + | |||
IntToStr(GetY) + '?' + cReqParams + '&' + 'navtoken=' + VNavToken; | |||
end else begin | |||
ResultURL := ''; | |||
end; | |||
end. |
@@ -1,44 +1,77 @@ | |||
//****************************************************************************** | |||
// LAYERS parameter: config_a_b_c | |||
// a = 1 for depth in meters, 2 for depth in feet, 3 for fathoms | |||
// b = 10.00: for 10.00 m safety depth (beginning of blue coloring) (unit equal to that set by a) | |||
// c = 0 for pristine Navionics charts, 1 for Sonar Charts | |||
// TRANSPARENT parameter: FALSE for non-layer, TRUE for layer | |||
// UGC parameter: FALSE for pristine Navionics charts, TRUE for additinal user-generated content icons | |||
// | |||
// TRANSPARENT parameter: | |||
// FALSE for non-layer | |||
// TRUE for layer | |||
// | |||
// UGC parameter: | |||
// FALSE for pristine Navionics charts | |||
// TRUE for additinal user-generated content icons | |||
//****************************************************************************** | |||
const | |||
cReqParams = 'LAYERS=config_1_10.00_0&TRANSPARENT=FALSE&UGC=FALSE'; | |||
//****************************************************************************** | |||
const | |||
cTTL = 24*60*60; // 24 hour | |||
cNavTokenKey = 'NavToken='; | |||
cTimeStampKey = 'TimeStamp='; | |||
function CheckTTL(const ATimeStamp: AnsiString): Boolean; | |||
begin | |||
Result := ( (cTTL div 2) > GetUnixTime - StrToInt64Def(ATimeStamp, 0) ); | |||
end; | |||
function GetNavToken: AnsiString; | |||
var | |||
VTimeStamp: AnsiString; | |||
VNavToken: AnsiString; | |||
VTimeStamp: AnsiString; | |||
VResponseCode: Cardinal; | |||
VResponseHeader, VResponseData: AnsiString; | |||
VRequestUrl, VRequestHeader, VPostData: AnsiString; | |||
VRequestUrl: AnsiString; | |||
begin | |||
Result := 'ERROR_1'; | |||
Result := ''; | |||
if ScriptBuffer <> '' then begin | |||
Result := ScriptBuffer; | |||
Exit; | |||
VNavToken := GetBetween(ScriptBuffer, cNavTokenKey, ';'); | |||
VTimeStamp := GetBetween(ScriptBuffer, cTimeStampKey, ';'); | |||
if (VNavToken <> '') and (VTimeStamp <> '') and CheckTTL(VTimeStamp) then begin | |||
Result := VNavToken; | |||
end else begin | |||
ScriptBuffer := ''; | |||
end; | |||
end; | |||
if Assigned(Downloader) then begin | |||
VTimeStamp := IntToStr(GetUnixTime); | |||
if (Result = '') and Assigned(Downloader) then begin | |||
VTimeStamp := IntToStr(GetUnixTime); | |||
VRequestUrl := 'https://backend.navionics.io/tile/get_key/Navionics_internalpurpose_00001/webapiv2.navionics.com?_=' + VTimeStamp; | |||
VRequestHeader := ''; | |||
VPostData := ''; | |||
VResponseHeader := ''; | |||
VResponseData := ''; | |||
VResponseCode := Downloader.DoHttpRequest(VRequestUrl, VRequestHeader, VPostData, VResponseHeader, VResponseData); | |||
VResponseData := ''; | |||
VResponseCode := Downloader.DoHttpRequest(VRequestUrl, '', '', VResponseHeader, VResponseData); | |||
if VResponseCode = 200 then begin | |||
ScriptBuffer := VResponseData; | |||
Result := ScriptBuffer; | |||
end else begin | |||
ScriptBuffer := 'ERROR_2'; | |||
Result := VResponseData; | |||
ScriptBuffer := cNavTokenKey + Result + ';' + cTimeStampKey + VTimeStamp + ';'; | |||
end; | |||
end; | |||
end; | |||
begin | |||
ResultURL:=GetURLBase + IntToStr(GetZ-1) + '/' + IntToStr(GetX) + '/' + IntToStr(GetY) + '?LAYERS=config_1_10.00_0&TRANSPARENT=FALSE&UGC=FALSE&navtoken=' + GetNavToken; | |||
//****************************************************************************** | |||
var | |||
VNavToken: AnsiString; | |||
begin | |||
VNavToken := GetNavToken; | |||
if VNavToken <> '' then begin | |||
ResultURL := GetURLBase + IntToStr(GetZ-1) + '/' + IntToStr(GetX) + '/' + | |||
IntToStr(GetY) + '?' + cReqParams + '&' + 'navtoken=' + VNavToken; | |||
end else begin | |||
ResultURL := ''; | |||
end; | |||
end. |