:global GlobalFuncReady false;
# Git commit id & info, expected configuration version
-:global CommitId "main/582/d5d0a707";
+:global CommitId "main/583/f681a0d3";
:global CommitTAG "unknown";
-:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 18:45:03 04.05.2026.";
+:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 18:55:02 04.05.2026.";
# The variables are received right here.
:global GlobalConfVersion 140;
:global FetchLargeFiles;
:global FetchHugeFiles;
:global FetchUserAgentStr;
+:global FileExists;
:global CertificateAvailable;
:global CertificateDownload;
:global CertificateNameByCN;
:return $Return;
}
-# !!! The function is not ready !!!
-:global FetchHttpInfo do={
- :local Mac [ :tostr $1 ];
- :global CertificateAvailable;
- :global IsMacLocallyAdministered;
- :global LogPrint;
- :local Url "https://api.macvendors.com/";
- :if ([ $IsMacLocallyAdministered $Mac ] = true) do={:return "locally administered";}
- :do {
- :if ([ $CertificateAvailable "GTS Root R4" "fetch" ] = false) do={
- $LogPrint warning $0 ("Downloading required certificate failed.");
- :error false;
- }
- :local Vendor ([ /tool/fetch
- ($Url . [ :pick $Mac 0 8 ]) output=user as-value ]->"data");
- :return $Vendor;
- } on-error={
- :onerror Err {
- /tool/fetch check-certificate=yes-without-crl ($Url) output=none as-value;
- $LogPrint debug $0 ("The mac vendor is not known in database.");
- } do={ $LogPrint warning $0 ("Failed getting mac vendor: " . $Err); }
- :return "unknown vendor";
- }
-}
-
:set GetPubIp do={
:global DetectIpAddrDefault;
:global DetectIpAddrFallback;
" " . $Caller . "/Fetch (" . $GlobalScriptsUrl . "; " . [ $CommitBrief ] . ")");
}
+:set FileExists do={
+ :local FileName [ :tostr $1 ];
+ :local Type [ :tostr $2 ];
+ :global FileGet;
+ :local FileVal [ $FileGet $FileName ];
+ :if ($FileVal = false) do={ :return false; }
+ :if ([ :len ($FileVal->"size") ] = 0) do={ :return false; }
+ :if ([ :len $Type ] = 0 || $FileVal->"type" = $Type) do={ :return true; }
+ :return false;
+}
+
:set Grep do={
:local Input ([ :tostr $1 ] . "\n");
:local Pattern [ :tostr $2 ];