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

index 64cb7f131929bb7a94e76fde3d472c3d5590f02c..e92f73555085d6d14ef1360ffa30eac70b5d5ec9 100644 (file)
@@ -17,9 +17,9 @@
 :global GlobalFuncReady false;
 
 # Git commit id & info, expected configuration version
-:global CommitId "main/576/0cc4cd57";
+:global CommitId "main/577/ab2aad07";
 :global CommitTAG "unknown";
-:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 16:45:02 04.05.2026.";
+:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 17:35:03 04.05.2026.";
 
 # The variables are received right here.
 :global GlobalConfVersion 140;
   }
 }
 
+:set CleanFilePath do={
+  :local Path [ :tostr $1 ];
+  :global CharacterReplace;
+  :while ($Path ~ "//") do={
+    :set $Path [ $CharacterReplace $Path "//" "/" ];
+  }
+  :if ([ :pick $Path 0 ] = "/") do={
+    :set Path [ :pick $Path 1 [ :len $Path ] ];
+  }
+  :if ([ :pick $Path ([ :len $Path ] - 1) ] = "/") do={
+    :set Path [ :pick $Path 0 ([ :len $Path ] - 1) ];
+  }
+  :return $Path;
+}
+
 :set CleanName do={
   :local Input [ :tostr $1 ];
   :local Return "";
   :for I from=0 to=([ :len $Input ] - 1) do={
     :local Char [ :pick $Input $I ];
     :if ([ :typeof [ find "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" $Char ] ] = "nil") do={
-      :do {:if ([ :len $Return ] = 0) do={:error true};
-        :if ([ :pick $Return ([ :len $Return ] - 1) ] = "-") do={:error true}; :set Char "-"} on-error={:set Char ""}; 
-    };
-    :set Return ($Return . $Char)};
+      :do { :if ([ :len $Return ] = 0) do={ :error true; } }
+        :if ([ :pick $Return ([ :len $Return ] - 1) ] = "-") do={ :error true; }
+        :set Char "-";
+      } on-error={
+        :set Char "";
+      }
+    }
+    :set Return ($Return . $Char);
+  }
   :return $Return;
 }
 
 :set CleanFilePath do={
   :local Path [ :tostr $1 ];
   :global CharacterReplace;
-  :while ($Path ~ "//") do={:set $Path [ $CharacterReplace $Path "//" "/" ]};
-  :if ([ :pick $Path 0 ] = "/") do={:set Path [ :pick $Path 1 [ :len $Path ] ]};
-  :if ([ :pick $Path ([ :len $Path ] - 1) ] = "/") do={:set Path [ :pick $Path 0 ([ :len $Path ] - 1) ]};
+  :while ($Path ~ "//") do={ :set $Path [ $CharacterReplace $Path "//" "/" ]; }
+  :if ([ :pick $Path 0 ] = "/") do={ :set Path [ :pick $Path 1 [ :len $Path ] ]; }
+  :if ([ :pick $Path ([ :len $Path ] - 1) ] = "/") do={ :set Path [ :pick $Path 0 ([ :len $Path ] - 1) ]; }
   :return $Path;
 }
 
+:set CleanName do={
+  :local Input [ :tostr $1 ];
+  :local Return "";
+  :for I from=0 to=([ :len $Input ] - 1) do={
+    :local Char [ :pick $Input $I ];
+    :if ([ :typeof [ find "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" $Char ] ] = "nil") do={
+      :do { :if ([ :len $Return ] = 0) do={ :error true; } }
+        :if ([ :pick $Return ([ :len $Return ] - 1) ] = "-") do={ :error true; }
+        :set Char "-";
+      } on-error={
+        :set Char "";
+      }
+    }
+    :set Return ($Return . $Char);
+  }
+  :return $Return;
+}
+
+
 :set IfThenElse do={
   :if ([ :tostr $1 ] = "true" || [ :tobool $1 ] = true) do={:return $2};
   :return $3;