mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
global-functions: $ScriptInstallUpdate: add proper version in user agent
This allows me to identify what RouterOS versions are run on devices fetching my scripts, which may helps to decide what incompatible changes to push.
This commit is contained in:
parent
7912091f63
commit
56ae457d77
1 changed files with 5 additions and 2 deletions
|
@ -753,6 +753,7 @@
|
|||
:local ExpectedConfigVersionBefore $ExpectedConfigVersion;
|
||||
:local ReloadGlobalFunctions false;
|
||||
:local ReloadGlobalConfig false;
|
||||
:local UserAgent ("User-Agent: Mikrotik/" . [ /system/resource/get version ] . " Fetch");
|
||||
|
||||
:foreach Script in=[ /system/script/find where source~"^#!rsc by RouterOS\n" ] do={
|
||||
:local ScriptVal [ /system/script/get $Script ];
|
||||
|
@ -782,7 +783,8 @@
|
|||
:local Url ($BaseUrl . $ScriptVal->"name" . ".rsc" . $UrlSuffix);
|
||||
|
||||
$LogPrintExit2 debug $0 ("Fetching script '" . $ScriptVal->"name" . "' from url: " . $Url) false;
|
||||
:local Result [ /tool/fetch check-certificate=yes-without-crl $Url output=user as-value ];
|
||||
:local Result [ /tool/fetch check-certificate=yes-without-crl http-header-field=$UserAgent \
|
||||
$Url output=user as-value ];
|
||||
:if ($Result->"status" = "finished") do={
|
||||
:set SourceNew ($Result->"data");
|
||||
}
|
||||
|
@ -865,7 +867,8 @@
|
|||
:do {
|
||||
:local Url ($ScriptUpdatesBaseUrl . "news-and-changes.rsc" . $ScriptUpdatesUrlSuffix);
|
||||
$LogPrintExit2 debug $0 ("Fetching news, changes and migration: " . $Url) false;
|
||||
:local Result [ /tool/fetch check-certificate=yes-without-crl $Url output=user as-value ];
|
||||
:local Result [ /tool/fetch check-certificate=yes-without-crl http-header-field=$UserAgent \
|
||||
$Url output=user as-value ];
|
||||
:if ($Result->"status" = "finished") do={
|
||||
:set ChangeLogCode ($Result->"data");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue