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 07bc46f17d
commit 7b07dd86de

View file

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