From: vados-dev <192440777+vados-dev@users.noreply.github.com> Date: Mon, 4 May 2026 08:25:03 +0000 (+0300) Subject: Autocommit in repo: ros.vados.ru, generated by owner: root, in 11:25:02 04.05.2026. X-Git-Url: https://git.vados.ru/gitweb.cgi?a=commitdiff_plain;h=8641dec0a5b339f0a091716cac0092387f4e6d26;p=Mikrotiks%2Fros.vados.ru.git Autocommit in repo: ros.vados.ru, generated by owner: root, in 11:25:02 04.05.2026. --- diff --git a/html/AM-GlobalFunc.rsc b/html/AM-GlobalFunc.rsc index a183eaf21..772bc459c 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/547/9b892c49"; +:global CommitId "main/548/b82d8221"; :global CommitTAG "unknown"; -:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 11:15:03 04.05.2026."; +:global CommitInfo "Autocommit in repo: ros.vados.ru, generated by owner: root, in 11:25:02 04.05.2026."; # The variables are received right here. :global GlobalConfVersion 140; @@ -1344,6 +1344,8 @@ :local CheckCert [:tostr $3]; :local fetchMode [:tostr $4]; :local fetchMethod [:tostr $5]; + :local FetchString "undefined"; + :global CleanName; :global FetchUserAgentStr; :global GetRandom20CharAlNum; @@ -1355,39 +1357,30 @@ :global WaitForFile; :set CheckCert [ $IfThenElse ($CheckCert = "false") "no" "yes-without-crl" ]; + #:set fetchMode [ $IfThenElse ($fetchMode != "false") [:tostr ("mode=" . $fetchMode)] ]; + #:set fetchMethod [$IfThenElse ($fetchMethod != "false") [:tostr ("http-method=\"" . $fetchMethod . "\"") ]]; + :local DirName ("tmpfs/" . [ $CleanName $FetchLargeScript ]); :if ([ $MkDir $DirName ] = false) do={ - :log error ($FetchLargeScript . " Failed creating directory!"); + $LogPrint error $0 ("Failed creating directory!"); :return false; } - :local FileName ($DirName . "/" . [ $CleanName $fetchUrl ] . "-" . [ $GetRandom20CharAlNum ]); - + :local FileName ($DirName . "/" . [ $CleanName $FetchLargeScript ] . "-" . [ $GetRandom20CharAlNum ]); <-- ИСПРАВЛЕНО :do { - :if ($fetchMethod = "false") do={ - :if ($fetchMode = "false") do={ - /tool/fetch url=($fetchUrl) dst-path=$FileName check-certificate=$CheckCert http-header-field=({ [ $FetchUserAgentStr $FetchLargeScript ] }) as-value; - } else={ - /tool/fetch url=($fetchUrl) dst-path=$FileName check-certificate=$CheckCert http-header-field=({ [ $FetchUserAgentStr $FetchLargeScript ] }) mode=$fetchMode as-value; - } - } else={ - :if ($fetchMode = "false") do={ - /tool/fetch url=($fetchUrl) dst-path=$FileName check-certificate=$CheckCert http-header-field=({ [ $FetchUserAgentStr $FetchLargeScript ] }) http-method=$fetchMethod as-value; - } else={ - /tool/fetch url=($fetchUrl) dst-path=$FileName check-certificate=$CheckCert http-header-field=({ [ $FetchUserAgentStr $FetchLargeScript ] }) http-method=$fetchMethod mode=$fetchMode as-value; - } + /tool/fetch check-certificate=$CheckCert mode=https http-header-field=({ [ $FetchUserAgentStr $FetchLargeScript ] }) \ + url=("\" . $fetchUrl . "\"") dst-path=$FileName as-value; + } onerror Err { + :if ([ $WaitForFile $FileName 500ms ] = true) do={ + $RmFile $FileName; } - } on-error={ - $LogPrint error $0 ("Failed downloading from " . $fetchUrl . " - " . $Err); + $LogPrint debug $0 ("Failed downloading from " . $fetchUrl . " - " . $Err); $RmDir $DirName; :return false; } - :if ([ $WaitForFile $FileName 5s ] = false) do={ - $LogPrint error $0 ("The file downloaded from " . $fetchUrl . " did not show up."); - $RmDir $DirName; + $LogPrint debug $0 ("The file downloaded from " . $fetchUrl . " did not show up."); :return false; } - :local FileSize [ /file/get $FileName size ]; :local Return ""; :local VarSize 0; @@ -1670,9 +1663,12 @@ :if ([ :len [ /system/scheduler/find where name="AM-ScriptInstallUpdate" ] ] = 0) do={ /system/scheduler/add name="AM-ScriptInstallUpdate" comment=$Comment start-time=startup interval=1d on-event=$OnEvent; } +:do={ :log warning ("This script $ScriptName Loaded " . \ [ $IfThenElse ($CommitId != "unknown") ([ $CommitBrief ] . " ") ] . \ "on " . $devBoardName . "\nRouterOS: " . $devCurVersion . "\nArchitecture: " . $devCurArch . "\nIdentity: " . $Identity); - # signal we are ready :set GlobalFuncReady true; +} onerror Err { + :global ExitOnError; $ExitOnError $0 $Err; +}