global-functions: $FetchUserAgentStr: add commit info in user agent string

This commit is contained in:
Christian Hesse 2025-11-13 15:30:30 +01:00
parent 83ed893565
commit 394cf53fff

View file

@ -539,10 +539,16 @@
:set FetchUserAgentStr do={
:local Caller [ :tostr $1 ];
:global CommitId;
:global CommitInfo;
:global IfThenElse;
:local Resource [ /system/resource/get ];
:return ("User-Agent: Mikrotik/" . $Resource->"version" . " " . \
$Resource->"architecture-name" . " " . $Caller . "/Fetch (https://rsc.eworm.de/)");
:return ("User-Agent: Mikrotik/" . $Resource->"version" . " " . $Resource->"architecture-name" . \
" " . $Caller . "/Fetch (https://rsc.eworm.de/" . [ $IfThenElse ($CommitId != "unknown") \
("; " . $CommitInfo . "/" . [ :pick $CommitId 0 8 ]) ] . ")");
}
# check for existence of file, optionally with type