HUD: повторный запуск подхватывает идущее обновление, успех без красного

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Andrei Leibzon
2026-11-21 18:21:31 +03:00
parent e37f821898
commit c84fcb43f9
2 changed files with 3 additions and 3 deletions

4
app.py
View File

@@ -2675,7 +2675,7 @@ def update_hud():
var k=stages(j.log);$('jlog').textContent=j.log;$('jlog').scrollTop=1e9;
if(sawFail){sawFail=false}
if(j.rc!==null&&j.rc!==undefined){clearInterval(tm);
if(j.rc===0){$('jv').classList.add('done');show(100,MSG.ok+' \u2014 v'+j.version);$('jsub').textContent='v'+j.version;setTimeout(function(){location.reload()},3500)}
if(j.rc===0){$('jv').classList.remove('err');$('jv').classList.add('done');show(100,MSG.ok+' \u2014 v'+j.version);$('jsub').textContent='v'+j.version;setTimeout(function(){location.reload()},3500)}
else{$('jv').classList.add('err');show(Math.max(fake,10),MSG.err+' (code '+j.rc+')');$('jtitle').innerHTML='ERROR'}
return}
fake=Math.min(94,Math.max(fake,6+k*16)+0.6);show(fake,k?ST[k-1][1]+'...':MSG.run)
@@ -2683,7 +2683,7 @@ def update_hud():
window.phobosUpdate=function(arg,title){
var um=$('upd-modal');if(um)um.style.display='none';var v=$('jv');v.className='show';$('jlog').textContent='';$('jtitle').innerHTML=title||'P H O B O S &nbsp;//&nbsp; UPDATE';fake=0;show(2,MSG.start);$('jstages').innerHTML='';$('jsub').textContent='PHOBOS';
fetch('/api/update/start',{method:'POST',credentials:'same-origin',body:new URLSearchParams({arg:arg})}).then(function(r){return r.json()}).then(function(j){
if(!j.ok){v.classList.add('err');show(0,MSG.err+': '+j.msg);return}
if(!j.ok&&!/already running/.test(j.msg)){v.classList.add('err');show(0,MSG.err+': '+j.msg);return}
clearInterval(tm);tm=setInterval(poll,1000)}).catch(function(e){v.classList.add('err');show(0,MSG.err)})};
document.querySelectorAll('form').forEach(function(f){var a=f.querySelector('input[name=action]');if(!a)return;var v=a.value;
if(v!=='update'&&v!=='rollback'&&v!=='check')return;