feat: Настройки › Автообновление - clients compare their version with the server's every N and update themselves; the server looks at GitLab every N and, when a newer release is out, offers it to an administrator at login (after the PIN) with «Обновить» and «Отказаться»; the words of a made picture's result are the model's only

This commit is contained in:
redtea committed 2026-10-18 12:33:24 +03:00
1 parent 916a49958b
commit 3d2f886f04
22 files changed
+1074 -7

No files matched your search

+24
View File
@@ -23,6 +23,30 @@
}, e => alert('Не скопировалось: ' + e.message));
});
if (window.UsersTable) window.UsersTable.mount(root);
// Автообновление: look at GitLab now, and update now.
const au = root.querySelector('#autoupdate .auto-check');
if (au) {
const st = root.querySelector('#autoupdate .auto-status'), run = root.querySelector('#autoupdate .auto-run');
const post = u => fetch(u, {method: 'POST', credentials: 'same-origin'}).then(r => r.json()).catch(() => ({ok: false, error: 'нет связи с сервером'}));
const say = (text, bad) => { st.textContent = ''; const s = document.createElement('span'); s.textContent = text; if (bad) s.className = 'bad'; st.appendChild(s); };
au.onclick = async () => {
au.disabled = true; say('Проверяю…');
const r = await post('/api/panel/update/check');
au.disabled = false;
if (!r.ok) { say(r.error, true); return; }
say('Версия сервера: ' + r.current + ' · на GitLab: ' + r.latest + (r.newer ? ' - вышла новая' : ' - это последняя'));
run.hidden = !r.newer;
};
run.onclick = async () => {
if (!await UI.confirm('Обновить сервер сейчас? Панель будет недоступна около минуты.', {ok: 'Обновить'})) return;
run.disabled = true; say('Запускаю обновление…');
const r = await post('/api/panel/update/run');
run.disabled = false;
if (!r.ok) { say(r.error, true); return; }
run.hidden = true;
say('Обновление до ' + r.latest + ' запущено: сервер перезапустится в течение минуты - потом обновите страницу.');
};
}
// ИИ-ассистент: a card per model, added from the blank one and taken
// away by its «Удалить» (the last one stays).
const list = root.querySelector('.ai-models'), blank = root.querySelector('template.ai-model-new');