@@ -1,65 +1,63 @@ | |||||
//****************************************************************************** | //****************************************************************************** | ||||
// LAYERS parameter: config_a_b_c | // LAYERS parameter: config_a_b_c | ||||
// a = 1 for depth in meters, 2 for depth in feet, 3 for fathoms | // 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) | |||||
// b = 1 for 1 m safety depth (beginning of blue coloring) (unit equal to that set by a) | |||||
// c = 0 for pristine Navionics charts, 1 for Sonar Charts | // c = 0 for pristine Navionics charts, 1 for Sonar Charts | ||||
// | // | ||||
// TRANSPARENT parameter: | // TRANSPARENT parameter: | ||||
// FALSE for non-layer | // FALSE for non-layer | ||||
// TRUE for layer | // TRUE for layer | ||||
// | |||||
// UGC parameter: | |||||
// FALSE for pristine Navionics charts | |||||
// TRUE for additinal user-generated content icons | |||||
// | |||||
//****************************************************************************** | //****************************************************************************** | ||||
const | const | ||||
cReqParams = 'LAYERS=config_1_10.00_1&TRANSPARENT=TRUE&UGC=FALSE'; | |||||
cReqParams = 'LAYERS=config_1_1_1&TRANSPARENT=TRUE&theme=0'; | |||||
//****************************************************************************** | //****************************************************************************** | ||||
const | const | ||||
cTTL = 24*60*60; // 24 hour | |||||
cNavTokenKey = 'NavToken='; | |||||
cTimeStampKey = 'TimeStamp='; | |||||
cTTL = 24*60*60; // 24 hour | |||||
function CheckTTL(const ATimeStamp: AnsiString): Boolean; | |||||
function CheckTTL(const ATimeStamp: Integer): Boolean; | |||||
begin | begin | ||||
Result := ( (cTTL div 2) > GetUnixTime - StrToInt64Def(ATimeStamp, 0) ); | |||||
Result := (cTTL div 2) > GetUnixTime - ATimeStamp; | |||||
end; | end; | ||||
function GetNavToken: AnsiString; | function GetNavToken: AnsiString; | ||||
var | var | ||||
VNavToken: AnsiString; | VNavToken: AnsiString; | ||||
VTimeStamp: AnsiString; | |||||
VTimeStamp: Integer; | |||||
VResponseCode: Cardinal; | VResponseCode: Cardinal; | ||||
VResponseHeader, VResponseData: AnsiString; | VResponseHeader, VResponseData: AnsiString; | ||||
VRequestUrl, VRequestHeader: AnsiString; | VRequestUrl, VRequestHeader: AnsiString; | ||||
begin | begin | ||||
Result := ''; | Result := ''; | ||||
if ScriptBuffer <> '' then begin | |||||
VNavToken := GetBetween(ScriptBuffer, cNavTokenKey, ';'); | |||||
VTimeStamp := GetBetween(ScriptBuffer, cTimeStampKey, ';'); | |||||
if (VNavToken <> '') and (VTimeStamp <> '') and CheckTTL(VTimeStamp) then begin | |||||
Result := VNavToken; | |||||
end else begin | |||||
ScriptBuffer := ''; | |||||
Global.Lock; | |||||
try | |||||
if Global.Exists(0) and Global.Exists(1) then begin | |||||
VNavToken := Global.GetVar(0); | |||||
VTimeStamp := Global.GetVar(1); | |||||
if (VNavToken <> '') and (VTimeStamp <> 0) and CheckTTL(VTimeStamp) then begin | |||||
Result := VNavToken; | |||||
end; | |||||
end; | end; | ||||
end; | |||||
if (Result = '') and Assigned(Downloader) then begin | |||||
VTimeStamp := IntToStr(GetUnixTime); | |||||
VRequestUrl := 'https://backend.navionics.com/tile/get_key/NAVIONICS_WEBAPP_P01/webapp.navionics.com?_=' + VTimeStamp + '123'; | |||||
VRequestHeader := 'Origin: https://webapp.navionics.com' + #13#10 + 'Referer: https://webapp.navionics.com/'; | |||||
VResponseHeader := ''; | |||||
VResponseData := ''; | |||||
VResponseCode := Downloader.DoHttpRequest(VRequestUrl, VRequestHeader, '', VResponseHeader, VResponseData); | |||||
if VResponseCode = 200 then begin | |||||
Result := VResponseData; | |||||
ScriptBuffer := cNavTokenKey + Result + ';' + cTimeStampKey + VTimeStamp + ';'; | |||||
end; | |||||
if (Result = '') and Assigned(Downloader) then begin | |||||
VRequestUrl := 'https://tile1.navionics.com/tile/get_key/Navionics_webapi_04041/maps.garmin.com'; | |||||
VRequestHeader := 'Origin: https://maps.garmin.com' + #13#10 + 'Referer: https://maps.garmin.com/'; | |||||
VResponseHeader := ''; | |||||
VResponseData := ''; | |||||
VResponseCode := Downloader.DoHttpRequest(VRequestUrl, VRequestHeader, '', VResponseHeader, VResponseData); | |||||
if VResponseCode = 200 then begin | |||||
Result := VResponseData; | |||||
Global.SetVar(0, Result); | |||||
Global.SetVar(1, GetUnixTime); | |||||
end; | |||||
end; | |||||
finally | |||||
Global.Unlock; | |||||
end; | end; | ||||
end; | end; | ||||
@@ -70,8 +68,7 @@ var | |||||
begin | begin | ||||
VNavToken := GetNavToken; | VNavToken := GetNavToken; | ||||
if VNavToken <> '' then begin | if VNavToken <> '' then begin | ||||
ResultURL := GetURLBase + IntToStr(GetZ-1) + '/' + IntToStr(GetX) + '/' + | |||||
IntToStr(GetY) + '?' + cReqParams + '&' + 'navtoken=' + VNavToken; | |||||
ResultURL := TemplateToUrl(GetURLBase) + '?' + cReqParams + '&' + 'navtoken=' + VNavToken; | |||||
end else begin | end else begin | ||||
ResultURL := ''; | ResultURL := ''; | ||||
end; | end; | ||||
@@ -5,7 +5,8 @@ ParentSubMenu_ru=Водные карты | |||||
ParentSubMenu_uk=Водні карти | ParentSubMenu_uk=Водні карти | ||||
ParentSubMenu=Water maps | ParentSubMenu=Water maps | ||||
asLayer=1 | asLayer=1 | ||||
DefURLBase=https://backend.navionics.com/tile/ | |||||
DefURLBase=https://tile{s}.navionics.com/tile/{z}/{x}/{y} | |||||
ServerNames=1,2,3,4,5 | |||||
NameInCache=navionics_sonarchart_layer | NameInCache=navionics_sonarchart_layer | ||||
Ext=.png | Ext=.png | ||||
ContentType=image/png | ContentType=image/png | ||||
@@ -13,4 +14,4 @@ projection=1 | |||||
sradiusa=6378137 | sradiusa=6378137 | ||||
sradiusb=6378137 | sradiusb=6378137 | ||||
IsUseDownloaderInScript=1 | IsUseDownloaderInScript=1 | ||||
RequestHead=Referer: http://webapp.navionics.com/ | |||||
RequestHead=Referer: https://maps.garmin.com/ |
@@ -1,65 +1,63 @@ | |||||
//****************************************************************************** | //****************************************************************************** | ||||
// LAYERS parameter: config_a_b_c | // LAYERS parameter: config_a_b_c | ||||
// a = 1 for depth in meters, 2 for depth in feet, 3 for fathoms | // 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) | |||||
// b = 1 for 1 m safety depth (beginning of blue coloring) (unit equal to that set by a) | |||||
// c = 0 for pristine Navionics charts, 1 for Sonar Charts | // c = 0 for pristine Navionics charts, 1 for Sonar Charts | ||||
// | // | ||||
// TRANSPARENT parameter: | // TRANSPARENT parameter: | ||||
// FALSE for non-layer | // FALSE for non-layer | ||||
// TRUE for layer | // TRUE for layer | ||||
// | |||||
// UGC parameter: | |||||
// FALSE for pristine Navionics charts | |||||
// TRUE for additinal user-generated content icons | |||||
// | |||||
//****************************************************************************** | //****************************************************************************** | ||||
const | const | ||||
cReqParams = 'LAYERS=config_1_10.00_1&TRANSPARENT=FALSE&UGC=FALSE'; | |||||
cReqParams = 'LAYERS=config_1_1_1&TRANSPARENT=FALSE&theme=0'; | |||||
//****************************************************************************** | //****************************************************************************** | ||||
const | const | ||||
cTTL = 24*60*60; // 24 hour | |||||
cNavTokenKey = 'NavToken='; | |||||
cTimeStampKey = 'TimeStamp='; | |||||
cTTL = 24*60*60; // 24 hour | |||||
function CheckTTL(const ATimeStamp: AnsiString): Boolean; | |||||
function CheckTTL(const ATimeStamp: Integer): Boolean; | |||||
begin | begin | ||||
Result := ( (cTTL div 2) > GetUnixTime - StrToInt64Def(ATimeStamp, 0) ); | |||||
Result := (cTTL div 2) > GetUnixTime - ATimeStamp; | |||||
end; | end; | ||||
function GetNavToken: AnsiString; | function GetNavToken: AnsiString; | ||||
var | var | ||||
VNavToken: AnsiString; | VNavToken: AnsiString; | ||||
VTimeStamp: AnsiString; | |||||
VTimeStamp: Integer; | |||||
VResponseCode: Cardinal; | VResponseCode: Cardinal; | ||||
VResponseHeader, VResponseData: AnsiString; | VResponseHeader, VResponseData: AnsiString; | ||||
VRequestUrl, VRequestHeader: AnsiString; | VRequestUrl, VRequestHeader: AnsiString; | ||||
begin | begin | ||||
Result := ''; | Result := ''; | ||||
if ScriptBuffer <> '' then begin | |||||
VNavToken := GetBetween(ScriptBuffer, cNavTokenKey, ';'); | |||||
VTimeStamp := GetBetween(ScriptBuffer, cTimeStampKey, ';'); | |||||
if (VNavToken <> '') and (VTimeStamp <> '') and CheckTTL(VTimeStamp) then begin | |||||
Result := VNavToken; | |||||
end else begin | |||||
ScriptBuffer := ''; | |||||
Global.Lock; | |||||
try | |||||
if Global.Exists(0) and Global.Exists(1) then begin | |||||
VNavToken := Global.GetVar(0); | |||||
VTimeStamp := Global.GetVar(1); | |||||
if (VNavToken <> '') and (VTimeStamp <> 0) and CheckTTL(VTimeStamp) then begin | |||||
Result := VNavToken; | |||||
end; | |||||
end; | end; | ||||
end; | |||||
if (Result = '') and Assigned(Downloader) then begin | |||||
VTimeStamp := IntToStr(GetUnixTime); | |||||
VRequestUrl := 'https://backend.navionics.com/tile/get_key/NAVIONICS_WEBAPP_P01/webapp.navionics.com?_=' + VTimeStamp + '123'; | |||||
VRequestHeader := 'Origin: https://webapp.navionics.com' + #13#10 + 'Referer: https://webapp.navionics.com/'; | |||||
VResponseHeader := ''; | |||||
VResponseData := ''; | |||||
VResponseCode := Downloader.DoHttpRequest(VRequestUrl, VRequestHeader, '', VResponseHeader, VResponseData); | |||||
if VResponseCode = 200 then begin | |||||
Result := VResponseData; | |||||
ScriptBuffer := cNavTokenKey + Result + ';' + cTimeStampKey + VTimeStamp + ';'; | |||||
end; | |||||
if (Result = '') and Assigned(Downloader) then begin | |||||
VRequestUrl := 'https://tile1.navionics.com/tile/get_key/Navionics_webapi_04041/maps.garmin.com'; | |||||
VRequestHeader := 'Origin: https://maps.garmin.com' + #13#10 + 'Referer: https://maps.garmin.com/'; | |||||
VResponseHeader := ''; | |||||
VResponseData := ''; | |||||
VResponseCode := Downloader.DoHttpRequest(VRequestUrl, VRequestHeader, '', VResponseHeader, VResponseData); | |||||
if VResponseCode = 200 then begin | |||||
Result := VResponseData; | |||||
Global.SetVar(0, Result); | |||||
Global.SetVar(1, GetUnixTime); | |||||
end; | |||||
end; | |||||
finally | |||||
Global.Unlock; | |||||
end; | end; | ||||
end; | end; | ||||
@@ -70,8 +68,7 @@ var | |||||
begin | begin | ||||
VNavToken := GetNavToken; | VNavToken := GetNavToken; | ||||
if VNavToken <> '' then begin | if VNavToken <> '' then begin | ||||
ResultURL := GetURLBase + IntToStr(GetZ-1) + '/' + IntToStr(GetX) + '/' + | |||||
IntToStr(GetY) + '?' + cReqParams + '&' + 'navtoken=' + VNavToken; | |||||
ResultURL := TemplateToUrl(GetURLBase) + '?' + cReqParams + '&' + 'navtoken=' + VNavToken; | |||||
end else begin | end else begin | ||||
ResultURL := ''; | ResultURL := ''; | ||||
end; | end; | ||||
@@ -4,7 +4,8 @@ name=Navionics SonarChart(TM) | |||||
ParentSubMenu_ru=Водные карты | ParentSubMenu_ru=Водные карты | ||||
ParentSubMenu_uk=Водні карти | ParentSubMenu_uk=Водні карти | ||||
ParentSubMenu=Water maps | ParentSubMenu=Water maps | ||||
DefURLBase=https://backend.navionics.com/tile/ | |||||
DefURLBase=https://tile{s}.navionics.com/tile/{z}/{x}/{y} | |||||
ServerNames=1,2,3,4,5 | |||||
NameInCache=navionics_sonarchart | NameInCache=navionics_sonarchart | ||||
Ext=.png | Ext=.png | ||||
ContentType=image/png | ContentType=image/png | ||||
@@ -12,4 +13,4 @@ projection=1 | |||||
sradiusa=6378137 | sradiusa=6378137 | ||||
sradiusb=6378137 | sradiusb=6378137 | ||||
IsUseDownloaderInScript=1 | IsUseDownloaderInScript=1 | ||||
RequestHead=Referer: http://webapp.navionics.com/ | |||||
RequestHead=Referer: https://maps.garmin.com/ |
@@ -1,65 +1,63 @@ | |||||
//****************************************************************************** | //****************************************************************************** | ||||
// LAYERS parameter: config_a_b_c | // LAYERS parameter: config_a_b_c | ||||
// a = 1 for depth in meters, 2 for depth in feet, 3 for fathoms | // 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) | |||||
// b = 1 for 1 m safety depth (beginning of blue coloring) (unit equal to that set by a) | |||||
// c = 0 for pristine Navionics charts, 1 for Sonar Charts | // c = 0 for pristine Navionics charts, 1 for Sonar Charts | ||||
// | // | ||||
// TRANSPARENT parameter: | // TRANSPARENT parameter: | ||||
// FALSE for non-layer | // FALSE for non-layer | ||||
// TRUE for layer | // TRUE for layer | ||||
// | |||||
// UGC parameter: | |||||
// FALSE for pristine Navionics charts | |||||
// TRUE for additinal user-generated content icons | |||||
// | |||||
//****************************************************************************** | //****************************************************************************** | ||||
const | const | ||||
cReqParams = 'LAYERS=config_1_10.00_0&TRANSPARENT=TRUE&UGC=FALSE'; | |||||
cReqParams = 'LAYERS=config_1_1_0&TRANSPARENT=TRUE&theme=0'; | |||||
//****************************************************************************** | //****************************************************************************** | ||||
const | const | ||||
cTTL = 24*60*60; // 24 hour | |||||
cNavTokenKey = 'NavToken='; | |||||
cTimeStampKey = 'TimeStamp='; | |||||
cTTL = 24*60*60; // 24 hour | |||||
function CheckTTL(const ATimeStamp: AnsiString): Boolean; | |||||
function CheckTTL(const ATimeStamp: Integer): Boolean; | |||||
begin | begin | ||||
Result := ( (cTTL div 2) > GetUnixTime - StrToInt64Def(ATimeStamp, 0) ); | |||||
Result := (cTTL div 2) > GetUnixTime - ATimeStamp; | |||||
end; | end; | ||||
function GetNavToken: AnsiString; | function GetNavToken: AnsiString; | ||||
var | var | ||||
VNavToken: AnsiString; | VNavToken: AnsiString; | ||||
VTimeStamp: AnsiString; | |||||
VTimeStamp: Integer; | |||||
VResponseCode: Cardinal; | VResponseCode: Cardinal; | ||||
VResponseHeader, VResponseData: AnsiString; | VResponseHeader, VResponseData: AnsiString; | ||||
VRequestUrl, VRequestHeader: AnsiString; | VRequestUrl, VRequestHeader: AnsiString; | ||||
begin | begin | ||||
Result := ''; | Result := ''; | ||||
if ScriptBuffer <> '' then begin | |||||
VNavToken := GetBetween(ScriptBuffer, cNavTokenKey, ';'); | |||||
VTimeStamp := GetBetween(ScriptBuffer, cTimeStampKey, ';'); | |||||
if (VNavToken <> '') and (VTimeStamp <> '') and CheckTTL(VTimeStamp) then begin | |||||
Result := VNavToken; | |||||
end else begin | |||||
ScriptBuffer := ''; | |||||
Global.Lock; | |||||
try | |||||
if Global.Exists(0) and Global.Exists(1) then begin | |||||
VNavToken := Global.GetVar(0); | |||||
VTimeStamp := Global.GetVar(1); | |||||
if (VNavToken <> '') and (VTimeStamp <> 0) and CheckTTL(VTimeStamp) then begin | |||||
Result := VNavToken; | |||||
end; | |||||
end; | end; | ||||
end; | |||||
if (Result = '') and Assigned(Downloader) then begin | |||||
VTimeStamp := IntToStr(GetUnixTime); | |||||
VRequestUrl := 'https://backend.navionics.com/tile/get_key/NAVIONICS_WEBAPP_P01/webapp.navionics.com?_=' + VTimeStamp + '123'; | |||||
VRequestHeader := 'Origin: https://webapp.navionics.com' + #13#10 + 'Referer: https://webapp.navionics.com/'; | |||||
VResponseHeader := ''; | |||||
VResponseData := ''; | |||||
VResponseCode := Downloader.DoHttpRequest(VRequestUrl, VRequestHeader, '', VResponseHeader, VResponseData); | |||||
if VResponseCode = 200 then begin | |||||
Result := VResponseData; | |||||
ScriptBuffer := cNavTokenKey + Result + ';' + cTimeStampKey + VTimeStamp + ';'; | |||||
end; | |||||
if (Result = '') and Assigned(Downloader) then begin | |||||
VRequestUrl := 'https://tile1.navionics.com/tile/get_key/Navionics_webapi_04041/maps.garmin.com'; | |||||
VRequestHeader := 'Origin: https://maps.garmin.com' + #13#10 + 'Referer: https://maps.garmin.com/'; | |||||
VResponseHeader := ''; | |||||
VResponseData := ''; | |||||
VResponseCode := Downloader.DoHttpRequest(VRequestUrl, VRequestHeader, '', VResponseHeader, VResponseData); | |||||
if VResponseCode = 200 then begin | |||||
Result := VResponseData; | |||||
Global.SetVar(0, Result); | |||||
Global.SetVar(1, GetUnixTime); | |||||
end; | |||||
end; | |||||
finally | |||||
Global.Unlock; | |||||
end; | end; | ||||
end; | end; | ||||
@@ -70,8 +68,7 @@ var | |||||
begin | begin | ||||
VNavToken := GetNavToken; | VNavToken := GetNavToken; | ||||
if VNavToken <> '' then begin | if VNavToken <> '' then begin | ||||
ResultURL := GetURLBase + IntToStr(GetZ-1) + '/' + IntToStr(GetX) + '/' + | |||||
IntToStr(GetY) + '?' + cReqParams + '&' + 'navtoken=' + VNavToken; | |||||
ResultURL := TemplateToUrl(GetURLBase) + '?' + cReqParams + '&' + 'navtoken=' + VNavToken; | |||||
end else begin | end else begin | ||||
ResultURL := ''; | ResultURL := ''; | ||||
end; | end; | ||||
@@ -5,7 +5,8 @@ ParentSubMenu_uk=Водні карти | |||||
ParentSubMenu=Water maps | ParentSubMenu=Water maps | ||||
name=Navionics Marine Charts | name=Navionics Marine Charts | ||||
asLayer=1 | asLayer=1 | ||||
DefURLBase=https://backend.navionics.com/tile/ | |||||
DefURLBase=https://tile{s}.navionics.com/tile/{z}/{x}/{y} | |||||
ServerNames=1,2,3,4,5 | |||||
NameInCache=navionics_layer | NameInCache=navionics_layer | ||||
Ext=.png | Ext=.png | ||||
ContentType=image/png | ContentType=image/png | ||||
@@ -13,4 +14,4 @@ projection=1 | |||||
sradiusa=6378137 | sradiusa=6378137 | ||||
sradiusb=6378137 | sradiusb=6378137 | ||||
IsUseDownloaderInScript=1 | IsUseDownloaderInScript=1 | ||||
RequestHead=Referer: http://webapp.navionics.com/ | |||||
RequestHead=Referer: https://maps.garmin.com/ |
@@ -1,65 +1,63 @@ | |||||
//****************************************************************************** | //****************************************************************************** | ||||
// LAYERS parameter: config_a_b_c | // LAYERS parameter: config_a_b_c | ||||
// a = 1 for depth in meters, 2 for depth in feet, 3 for fathoms | // 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) | |||||
// b = 1 for 1 m safety depth (beginning of blue coloring) (unit equal to that set by a) | |||||
// c = 0 for pristine Navionics charts, 1 for Sonar Charts | // c = 0 for pristine Navionics charts, 1 for Sonar Charts | ||||
// | // | ||||
// TRANSPARENT parameter: | // TRANSPARENT parameter: | ||||
// FALSE for non-layer | // FALSE for non-layer | ||||
// TRUE for layer | // TRUE for layer | ||||
// | |||||
// UGC parameter: | |||||
// FALSE for pristine Navionics charts | |||||
// TRUE for additinal user-generated content icons | |||||
// | |||||
//****************************************************************************** | //****************************************************************************** | ||||
const | const | ||||
cReqParams = 'LAYERS=config_1_10.00_0&TRANSPARENT=FALSE&UGC=FALSE'; | |||||
cReqParams = 'LAYERS=config_1_1_0&TRANSPARENT=FALSE&theme=0'; | |||||
//****************************************************************************** | //****************************************************************************** | ||||
const | const | ||||
cTTL = 24*60*60; // 24 hour | |||||
cNavTokenKey = 'NavToken='; | |||||
cTimeStampKey = 'TimeStamp='; | |||||
cTTL = 24*60*60; // 24 hour | |||||
function CheckTTL(const ATimeStamp: AnsiString): Boolean; | |||||
function CheckTTL(const ATimeStamp: Integer): Boolean; | |||||
begin | begin | ||||
Result := ( (cTTL div 2) > GetUnixTime - StrToInt64Def(ATimeStamp, 0) ); | |||||
Result := (cTTL div 2) > GetUnixTime - ATimeStamp; | |||||
end; | end; | ||||
function GetNavToken: AnsiString; | function GetNavToken: AnsiString; | ||||
var | var | ||||
VNavToken: AnsiString; | VNavToken: AnsiString; | ||||
VTimeStamp: AnsiString; | |||||
VTimeStamp: Integer; | |||||
VResponseCode: Cardinal; | VResponseCode: Cardinal; | ||||
VResponseHeader, VResponseData: AnsiString; | VResponseHeader, VResponseData: AnsiString; | ||||
VRequestUrl, VRequestHeader: AnsiString; | VRequestUrl, VRequestHeader: AnsiString; | ||||
begin | begin | ||||
Result := ''; | Result := ''; | ||||
if ScriptBuffer <> '' then begin | |||||
VNavToken := GetBetween(ScriptBuffer, cNavTokenKey, ';'); | |||||
VTimeStamp := GetBetween(ScriptBuffer, cTimeStampKey, ';'); | |||||
if (VNavToken <> '') and (VTimeStamp <> '') and CheckTTL(VTimeStamp) then begin | |||||
Result := VNavToken; | |||||
end else begin | |||||
ScriptBuffer := ''; | |||||
Global.Lock; | |||||
try | |||||
if Global.Exists(0) and Global.Exists(1) then begin | |||||
VNavToken := Global.GetVar(0); | |||||
VTimeStamp := Global.GetVar(1); | |||||
if (VNavToken <> '') and (VTimeStamp <> 0) and CheckTTL(VTimeStamp) then begin | |||||
Result := VNavToken; | |||||
end; | |||||
end; | end; | ||||
end; | |||||
if (Result = '') and Assigned(Downloader) then begin | |||||
VTimeStamp := IntToStr(GetUnixTime); | |||||
VRequestUrl := 'https://backend.navionics.com/tile/get_key/NAVIONICS_WEBAPP_P01/webapp.navionics.com?_=' + VTimeStamp + '123'; | |||||
VRequestHeader := 'Origin: https://webapp.navionics.com' + #13#10 + 'Referer: https://webapp.navionics.com/'; | |||||
VResponseHeader := ''; | |||||
VResponseData := ''; | |||||
VResponseCode := Downloader.DoHttpRequest(VRequestUrl, VRequestHeader, '', VResponseHeader, VResponseData); | |||||
if VResponseCode = 200 then begin | |||||
Result := VResponseData; | |||||
ScriptBuffer := cNavTokenKey + Result + ';' + cTimeStampKey + VTimeStamp + ';'; | |||||
end; | |||||
if (Result = '') and Assigned(Downloader) then begin | |||||
VRequestUrl := 'https://tile1.navionics.com/tile/get_key/Navionics_webapi_04041/maps.garmin.com'; | |||||
VRequestHeader := 'Origin: https://maps.garmin.com' + #13#10 + 'Referer: https://maps.garmin.com/'; | |||||
VResponseHeader := ''; | |||||
VResponseData := ''; | |||||
VResponseCode := Downloader.DoHttpRequest(VRequestUrl, VRequestHeader, '', VResponseHeader, VResponseData); | |||||
if VResponseCode = 200 then begin | |||||
Result := VResponseData; | |||||
Global.SetVar(0, Result); | |||||
Global.SetVar(1, GetUnixTime); | |||||
end; | |||||
end; | |||||
finally | |||||
Global.Unlock; | |||||
end; | end; | ||||
end; | end; | ||||
@@ -70,8 +68,7 @@ var | |||||
begin | begin | ||||
VNavToken := GetNavToken; | VNavToken := GetNavToken; | ||||
if VNavToken <> '' then begin | if VNavToken <> '' then begin | ||||
ResultURL := GetURLBase + IntToStr(GetZ-1) + '/' + IntToStr(GetX) + '/' + | |||||
IntToStr(GetY) + '?' + cReqParams + '&' + 'navtoken=' + VNavToken; | |||||
ResultURL := TemplateToUrl(GetURLBase) + '?' + cReqParams + '&' + 'navtoken=' + VNavToken; | |||||
end else begin | end else begin | ||||
ResultURL := ''; | ResultURL := ''; | ||||
end; | end; | ||||
@@ -0,0 +1 @@ | |||||
https://maps.garmin.com/en-US/marine?maps=another-brand&overlay=false&key=sr2w4buj85bn |
@@ -4,7 +4,8 @@ name=Navionics Marine Charts | |||||
ParentSubMenu_ru=Водные карты | ParentSubMenu_ru=Водные карты | ||||
ParentSubMenu_uk=Водні карти | ParentSubMenu_uk=Водні карти | ||||
ParentSubMenu=Water maps | ParentSubMenu=Water maps | ||||
DefURLBase=https://backend.navionics.com/tile/ | |||||
DefURLBase=https://tile{s}.navionics.com/tile/{z}/{x}/{y} | |||||
ServerNames=1,2,3,4,5 | |||||
NameInCache=navionics | NameInCache=navionics | ||||
Ext=.png | Ext=.png | ||||
ContentType=image/png | ContentType=image/png | ||||
@@ -12,4 +13,4 @@ projection=1 | |||||
sradiusa=6378137 | sradiusa=6378137 | ||||
sradiusb=6378137 | sradiusb=6378137 | ||||
IsUseDownloaderInScript=1 | IsUseDownloaderInScript=1 | ||||
RequestHead=Referer: http://webapp.navionics.com/ | |||||
RequestHead=Referer: https://maps.garmin.com/ |