From 4df1468e2569dfc1603876e24a9be933dc8cf8f2 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 29 Mar 2024 11:09:22 +0100 Subject: global-functions: rename $FetchUserAgent -> $FetchUserAgentStr ... to make sure the function does not clash with the variable we had before, as this causes issue with news and changes notification. --- check-certificates.rsc | 4 ++-- check-routeros-update.rsc | 4 ++-- fw-addr-lists.rsc | 4 ++-- global-functions.rsc | 14 +++++++------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/check-certificates.rsc b/check-certificates.rsc index ab78e22..20e2902 100644 --- a/check-certificates.rsc +++ b/check-certificates.rsc @@ -39,7 +39,7 @@ :global CertificateNameByCN; :global EscapeForRegEx; - :global FetchUserAgent; + :global FetchUserAgentStr; :global LogPrint; :global UrlEncode; :global WaitForFile; @@ -49,7 +49,7 @@ :foreach Type in={ ".pem"; ".p12" } do={ :local CertFileName ([ $UrlEncode $Name ] . $Type); :do { - /tool/fetch check-certificate=yes-without-crl http-header-field=({ [ $FetchUserAgent $ScriptName ] }) \ + /tool/fetch check-certificate=yes-without-crl http-header-field=({ [ $FetchUserAgentStr $ScriptName ] }) \ ($CertRenewUrl . $CertFileName) dst-path=$CertFileName as-value; $WaitForFile $CertFileName; diff --git a/check-routeros-update.rsc b/check-routeros-update.rsc index fde7cb5..c9ab93b 100644 --- a/check-routeros-update.rsc +++ b/check-routeros-update.rsc @@ -24,7 +24,7 @@ :global DeviceInfo; :global EscapeForRegEx; - :global FetchUserAgent; + :global FetchUserAgentStr; :global LogPrint; :global ScriptFromTerminal; :global ScriptLock; @@ -109,7 +109,7 @@ :do { :set Result [ /tool/fetch check-certificate=yes-without-crl \ ($SafeUpdateUrl . $Update->"channel" . "?installed=" . $Update->"installed-version" . \ - "&latest=" . $Update->"latest-version") http-header-field=({ [ $FetchUserAgent $ScriptName ] }) \ + "&latest=" . $Update->"latest-version") http-header-field=({ [ $FetchUserAgentStr $ScriptName ] }) \ output=user as-value ]; } on-error={ $LogPrint warning $ScriptName ("Failed receiving safe version for " . $Update->"channel" . "."); diff --git a/fw-addr-lists.rsc b/fw-addr-lists.rsc index 887263e..68775b4 100644 --- a/fw-addr-lists.rsc +++ b/fw-addr-lists.rsc @@ -19,7 +19,7 @@ :global CertificateAvailable; :global EitherOr; - :global FetchUserAgent; + :global FetchUserAgentStr; :global LogPrint; :global LogPrintOnce; :global ScriptLock; @@ -65,7 +65,7 @@ :if ($Data = false) do={ :do { :set Data ([ /tool/fetch check-certificate=$CheckCertificate output=user \ - http-header-field=({ [ $FetchUserAgent $ScriptName ] }) ($List->"url") as-value ]->"data"); + http-header-field=({ [ $FetchUserAgentStr $ScriptName ] }) ($List->"url") as-value ]->"data"); } on-error={ :if ($I < 5) do={ $LogPrint debug $ScriptName ("Failed downloading, " . $I . ". try: " . $List->"url"); diff --git a/global-functions.rsc b/global-functions.rsc index 17ccda8..1e98019 100644 --- a/global-functions.rsc +++ b/global-functions.rsc @@ -32,7 +32,7 @@ :global DownloadPackage; :global EitherOr; :global EscapeForRegEx; -:global FetchUserAgent; +:global FetchUserAgentStr; :global FormatLine; :global FormatMultiLines; :global GetMacVendor; @@ -137,7 +137,7 @@ :global CertificateNameByCN; :global CleanName; - :global FetchUserAgent; + :global FetchUserAgentStr; :global LogPrint; :global WaitForFile; @@ -145,7 +145,7 @@ "CommonName \"" . $CommonName . "\"."); :do { :local FileName ([ $CleanName $CommonName ] . ".pem"); - /tool/fetch check-certificate=yes-without-crl http-header-field=({ [ $FetchUserAgent $0 ] }) \ + /tool/fetch check-certificate=yes-without-crl http-header-field=({ [ $FetchUserAgentStr $0 ] }) \ ($ScriptUpdatesBaseUrl . "certs/" . $FileName . $ScriptUpdatesUrlSuffix) \ dst-path=$FileName as-value; $WaitForFile $FileName; @@ -391,7 +391,7 @@ } # generate user agent string for fetch -:set FetchUserAgent do={ +:set FetchUserAgentStr do={ :local Caller [ :tostr $1 ]; :local Resource [ /system/resource/get ]; @@ -993,7 +993,7 @@ :global CertificateAvailable; :global EitherOr; - :global FetchUserAgent; + :global FetchUserAgentStr; :global Grep; :global IfThenElse; :global LogPrint; @@ -1039,7 +1039,7 @@ :local Url ($BaseUrl . $ScriptVal->"name" . ".rsc" . $UrlSuffix); $LogPrint debug $0 ("Fetching script '" . $ScriptVal->"name" . "' from url: " . $Url); :local Result [ /tool/fetch check-certificate=yes-without-crl \ - http-header-field=({ [ $FetchUserAgent $0 ] }) $Url output=user as-value ]; + http-header-field=({ [ $FetchUserAgentStr $0 ] }) $Url output=user as-value ]; :if ($Result->"status" = "finished") do={ :set SourceNew ($Result->"data"); } @@ -1122,7 +1122,7 @@ :local Url ($ScriptUpdatesBaseUrl . "news-and-changes.rsc" . $ScriptUpdatesUrlSuffix); $LogPrint debug $0 ("Fetching news, changes and migration: " . $Url); :local Result [ /tool/fetch check-certificate=yes-without-crl \ - http-header-field=({ [ $FetchUserAgent $0 ] }) $Url output=user as-value ]; + http-header-field=({ [ $FetchUserAgentStr $0 ] }) $Url output=user as-value ]; :if ($Result->"status" = "finished") do={ :set ChangeLogCode ($Result->"data"); } -- cgit v1.2.3-54-g00ecf