From d376e295560d250a6a4401cfd30b61417fe0aedb Mon Sep 17 00:00:00 2001 From: vados-dev <192440777+vados-dev@users.noreply.github.com> Date: Mon, 4 May 2026 18:55:03 +0300 Subject: [PATCH] Autocommit in repo: ros.vados.ru, generated by owner: root, in 18:55:02 04.05.2026. --- html/AM-GlobalFunc.rsc | 41 ++++++++++++++--------------------------- 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/html/AM-GlobalFunc.rsc b/html/AM-GlobalFunc.rsc index 1b2580ce9..13542e180 100644 --- a/html/AM-GlobalFunc.rsc +++ b/html/AM-GlobalFunc.rsc @@ -17,9 +17,9 @@ :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; @@ -137,6 +137,7 @@ :global FetchLargeFiles; :global FetchHugeFiles; :global FetchUserAgentStr; +:global FileExists; :global CertificateAvailable; :global CertificateDownload; :global CertificateNameByCN; @@ -449,31 +450,6 @@ :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; @@ -750,6 +726,17 @@ " " . $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 ]; -- 2.52.0