From bd09383d7d46e19aec2a18ec930e3ae292a6e511 Mon Sep 17 00:00:00 2001 From: sasbot <> Date: Sat, 6 Jun 2020 12:00:00 +0000 Subject: [PATCH] update zmp --- .../GetUrlScript.txt | 39 ++++++++++++++++-- .../navionics.SonarChart.layer.zmp/params.txt | 3 +- .../navionics.SonarChart.zmp/GetUrlScript.txt | 39 ++++++++++++++++-- _water/navionics.SonarChart.zmp/params.txt | 3 +- _water/navionics.layer.zmp/GetUrlScript.txt | 39 ++++++++++++++++-- _water/navionics.layer.zmp/params.txt | 1 + _water/navionics.zmp/GetUrlScript.txt | 41 ++++++++++++++++--- _water/navionics.zmp/params.txt | 1 + 8 files changed, 147 insertions(+), 19 deletions(-) diff --git a/_water/navionics.SonarChart.layer.zmp/GetUrlScript.txt b/_water/navionics.SonarChart.layer.zmp/GetUrlScript.txt index 1eaf49fd..fbec165c 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 0f945594..98baf3c1 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 c23be74b..f18360db 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 f2a6b009..140d1e4f 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 04b03d64..e14b27f1 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 0158dedc..6059d59a 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 67f4ba95..1a83a4ef 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 21678a21..3b967601 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