diff --git a/_water/navionics.SonarChart.layer.zmp/GetUrlScript.txt b/_water/navionics.SonarChart.layer.zmp/GetUrlScript.txt index 1eaf49fdc..fbec165c1 100644 --- a/_water/navionics.SonarChart.layer.zmp/GetUrlScript.txt +++ b/_water/navionics.SonarChart.layer.zmp/GetUrlScript.txt @@ -4,10 +4,41 @@ // 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 -// navtoken: base64 encoded string of either: -// - "Navionics_internalpurpose_00001+webapiv2.navionics.com" (used with Referrer: https://webapiv2.navionics.com/examples/4000_gNavionicsOverlayExample.html) -// - "Navionics_internalpurpose_00001+webapp.navionics.com" (used with Referrer: https://webapp.navionics.com/?lang=en) + +function GetNavToken: AnsiString; +var + VTimeStamp: AnsiString; + VResponseCode: Cardinal; + VResponseHeader, VResponseData: AnsiString; + VRequestUrl, VRequestHeader, VPostData: AnsiString; +begin + Result := 'ERROR_1'; + + if ScriptBuffer <> '' then begin + Result := ScriptBuffer; + Exit; + end; + + if 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); + + if VResponseCode = 200 then begin + ScriptBuffer := VResponseData; + Result := ScriptBuffer; + end else begin + ScriptBuffer := 'ERROR_2'; + end; + end; + +end; begin - ResultURL:=GetURLBase+inttostr(GetZ-1)+'/'+inttostr(GetX)+'/'+inttostr(GetY)+'?LAYERS=config_1_10.00_1&TRANSPARENT=TRUE&UGC=FALSE&navtoken=TmF2aW9uaWNzX2ludGVybmFscHVycG9zZV8wMDAwMSt3ZWJhcGl2Mi5uYXZpb25pY3MuY29t'; + ResultURL:=GetURLBase+inttostr(GetZ-1)+'/'+inttostr(GetX)+'/'+inttostr(GetY)+'?LAYERS=config_1_10.00_1&TRANSPARENT=TRUE&UGC=FALSE&navtoken='+GetNavToken; end. diff --git a/_water/navionics.SonarChart.layer.zmp/params.txt b/_water/navionics.SonarChart.layer.zmp/params.txt index 0f9455949..98baf3c14 100644 --- a/_water/navionics.SonarChart.layer.zmp/params.txt +++ b/_water/navionics.SonarChart.layer.zmp/params.txt @@ -1,7 +1,7 @@ [PARAMS] GUID={2333E9D3-EB95-466D-AC14-2CFFCDB509C2} name=Navionics SonarChart(TM) -ParentSubMenu_ru=Морские карты (SonarChart) +ParentSubMenu_ru=Морские карты ParentSubMenu=Marine maps asLayer=1 DefURLBase=http://backend.navionics.io/tile/ @@ -11,4 +11,5 @@ ContentType=image/png projection=1 sradiusa=6378137 sradiusb=6378137 +IsUseDownloaderInScript=1 RequestHead=Referer: https://webapiv2.navionics.com/examples/4000_gNavionicsOverlayExample.html diff --git a/_water/navionics.SonarChart.zmp/GetUrlScript.txt b/_water/navionics.SonarChart.zmp/GetUrlScript.txt index c23be74b1..f18360db0 100644 --- a/_water/navionics.SonarChart.zmp/GetUrlScript.txt +++ b/_water/navionics.SonarChart.zmp/GetUrlScript.txt @@ -4,10 +4,41 @@ // 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 -// navtoken: base64 encoded string of either: -// - "Navionics_internalpurpose_00001+webapiv2.navionics.com" (used with Referrer: https://webapiv2.navionics.com/examples/4000_gNavionicsOverlayExample.html) -// - "Navionics_internalpurpose_00001+webapp.navionics.com" (used with Referrer: https://webapp.navionics.com/?lang=en) + +function GetNavToken: AnsiString; +var + VTimeStamp: AnsiString; + VResponseCode: Cardinal; + VResponseHeader, VResponseData: AnsiString; + VRequestUrl, VRequestHeader, VPostData: AnsiString; +begin + Result := 'ERROR_1'; + + if ScriptBuffer <> '' then begin + Result := ScriptBuffer; + Exit; + end; + + if 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); + + if VResponseCode = 200 then begin + ScriptBuffer := VResponseData; + Result := ScriptBuffer; + end else begin + ScriptBuffer := 'ERROR_2'; + end; + end; + +end; begin - ResultURL:=GetURLBase+inttostr(GetZ-1)+'/'+inttostr(GetX)+'/'+inttostr(GetY)+'?LAYERS=config_1_10.00_1&TRANSPARENT=FALSE&UGC=FALSE&navtoken=TmF2aW9uaWNzX2ludGVybmFscHVycG9zZV8wMDAwMSt3ZWJhcGl2Mi5uYXZpb25pY3MuY29t'; + ResultURL:=GetURLBase+inttostr(GetZ-1)+'/'+inttostr(GetX)+'/'+inttostr(GetY)+'?LAYERS=config_1_10.00_1&TRANSPARENT=FALSE&UGC=FALSE&navtoken='+GetNavToken; end. diff --git a/_water/navionics.SonarChart.zmp/params.txt b/_water/navionics.SonarChart.zmp/params.txt index f2a6b0099..140d1e4f5 100644 --- a/_water/navionics.SonarChart.zmp/params.txt +++ b/_water/navionics.SonarChart.zmp/params.txt @@ -1,7 +1,7 @@ [PARAMS] GUID={247A02DC-5204-46FC-8D23-828AFC83A434} name=Navionics SonarChart(TM) -ParentSubMenu_ru=Морские карты (SonarChart) +ParentSubMenu_ru=Морские карты ParentSubMenu=Marine maps DefURLBase=http://backend.navionics.io/tile/ NameInCache=navionics_sonarchart @@ -10,4 +10,5 @@ ContentType=image/png projection=1 sradiusa=6378137 sradiusb=6378137 +IsUseDownloaderInScript=1 RequestHead=Referer: https://webapiv2.navionics.com/examples/4000_gNavionicsOverlayExample.html diff --git a/_water/navionics.layer.zmp/GetUrlScript.txt b/_water/navionics.layer.zmp/GetUrlScript.txt index 04b03d640..e14b27f1d 100644 --- a/_water/navionics.layer.zmp/GetUrlScript.txt +++ b/_water/navionics.layer.zmp/GetUrlScript.txt @@ -4,10 +4,41 @@ // 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 -// navtoken: base64 encoded string of either: -// - "Navionics_internalpurpose_00001+webapiv2.navionics.com" (used with Referrer: https://webapiv2.navionics.com/examples/4000_gNavionicsOverlayExample.html) -// - "Navionics_internalpurpose_00001+webapp.navionics.com" (used with Referrer: https://webapp.navionics.com/?lang=en) + +function GetNavToken: AnsiString; +var + VTimeStamp: AnsiString; + VResponseCode: Cardinal; + VResponseHeader, VResponseData: AnsiString; + VRequestUrl, VRequestHeader, VPostData: AnsiString; +begin + Result := 'ERROR_1'; + + if ScriptBuffer <> '' then begin + Result := ScriptBuffer; + Exit; + end; + + if 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); + + if VResponseCode = 200 then begin + ScriptBuffer := VResponseData; + Result := ScriptBuffer; + end else begin + ScriptBuffer := 'ERROR_2'; + end; + end; + +end; begin - ResultURL:=GetURLBase+inttostr(GetZ-1)+'/'+inttostr(GetX)+'/'+inttostr(GetY)+'?LAYERS=config_1_10.00_0&TRANSPARENT=TRUE&UGC=FALSE&navtoken=TmF2aW9uaWNzX2ludGVybmFscHVycG9zZV8wMDAwMSt3ZWJhcGl2Mi5uYXZpb25pY3MuY29t'; + ResultURL:=GetURLBase+inttostr(GetZ-1)+'/'+inttostr(GetX)+'/'+inttostr(GetY)+'?LAYERS=config_1_10.00_0&TRANSPARENT=TRUE&UGC=FALSE&navtoken='+GetNavToken; end. diff --git a/_water/navionics.layer.zmp/params.txt b/_water/navionics.layer.zmp/params.txt index 0158dedcd..6059d59a0 100644 --- a/_water/navionics.layer.zmp/params.txt +++ b/_water/navionics.layer.zmp/params.txt @@ -11,4 +11,5 @@ ContentType=image/png projection=1 sradiusa=6378137 sradiusb=6378137 +IsUseDownloaderInScript=1 RequestHead=Referer: https://webapiv2.navionics.com/examples/4000_gNavionicsOverlayExample.html diff --git a/_water/navionics.zmp/GetUrlScript.txt b/_water/navionics.zmp/GetUrlScript.txt index 67f4ba954..1a83a4ef7 100644 --- a/_water/navionics.zmp/GetUrlScript.txt +++ b/_water/navionics.zmp/GetUrlScript.txt @@ -4,10 +4,41 @@ // 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 -// navtoken: base64 encoded string of either: -// - "Navionics_internalpurpose_00001+webapiv2.navionics.com" (used with Referrer: https://webapiv2.navionics.com/examples/4000_gNavionicsOverlayExample.html) -// - "Navionics_internalpurpose_00001+webapp.navionics.com" (used with Referrer: https://webapp.navionics.com/?lang=en) -begin - ResultURL:=GetURLBase+inttostr(GetZ-1)+'/'+inttostr(GetX)+'/'+inttostr(GetY)+'?LAYERS=config_1_10.00_0&TRANSPARENT=FALSE&UGC=FALSE&navtoken=TmF2aW9uaWNzX2ludGVybmFscHVycG9zZV8wMDAwMSt3ZWJhcGl2Mi5uYXZpb25pY3MuY29t'; +function GetNavToken: AnsiString; +var + VTimeStamp: AnsiString; + VResponseCode: Cardinal; + VResponseHeader, VResponseData: AnsiString; + VRequestUrl, VRequestHeader, VPostData: AnsiString; +begin + Result := 'ERROR_1'; + + if ScriptBuffer <> '' then begin + Result := ScriptBuffer; + Exit; + end; + + if 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); + + if VResponseCode = 200 then begin + ScriptBuffer := VResponseData; + Result := ScriptBuffer; + end else begin + ScriptBuffer := 'ERROR_2'; + 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; end. diff --git a/_water/navionics.zmp/params.txt b/_water/navionics.zmp/params.txt index 21678a21b..3b967601b 100644 --- a/_water/navionics.zmp/params.txt +++ b/_water/navionics.zmp/params.txt @@ -10,4 +10,5 @@ ContentType=image/png projection=1 sradiusa=6378137 sradiusb=6378137 +IsUseDownloaderInScript=1 RequestHead=Referer: https://webapiv2.navionics.com/examples/4000_gNavionicsOverlayExample.html