]> Git [git.vados.ru] :: Repos - Mikrotiks/ros.vados.ru.git/commitdiff
Autocommit in repo: ros.vados.ru, generated by owner: root, in 18:55:02 04.05.2026.
authorvados-dev <192440777+vados-dev@users.noreply.github.com>
Mon, 4 May 2026 15:55:03 +0000 (18:55 +0300)
committervados-dev <192440777+vados-dev@users.noreply.github.com>
Mon, 4 May 2026 15:55:03 +0000 (18:55 +0300)
html/AM-GlobalFunc.rsc

index 1b2580ce95c3472964845f19d8093057fe1e0f42..13542e18039ff0015084e0739a7353dc8ab2196c 100644 (file)
@@ -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;
 :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 ];