v1.3.49: edit modal — remove mode toggle, show archive name, timeout-only save; add PUT /functions/:name/timeout

This commit is contained in:
“Naeel”
2026-05-04 07:03:43 +04:00
parent 6ac22d5f55
commit f97fd8a744
4 changed files with 61 additions and 7 deletions
+9
View File
@@ -149,6 +149,10 @@ async function openEdit(name) {
// Сбрасываем режим: source_type из API (code / archive)
if (fn.source_type === 'archive') {
setCodeMode('e', 'archive');
var archiveNameEl = document.getElementById('e-archive-name');
if (archiveNameEl) archiveNameEl.textContent = fn.package || 'архив';
var archiveFile = document.getElementById('e-archive-file');
if (archiveFile) archiveFile.value = '';
} else {
setCodeMode('e', 'code');
}
@@ -205,6 +209,11 @@ async function submitEdit() {
var resp = await fetch(API_BASE + '/functions/' + encodeURIComponent(name) + '/archive',
{ method: 'PUT', headers: authHeaders(), body: fd });
if (!resp.ok) { var e = await resp.json().catch(() => ({})); throw new Error(e.error || resp.statusText); }
} else if (isArchiveMode) {
// Архив не заменяется — обновляем только timeout
await requestJSON(API_BASE + '/functions/' + encodeURIComponent(name) + '/timeout', 'PUT', {
timeout: parseTimeout(document.getElementById('e-timeout').value)
});
} else {
await requestJSON(API_BASE + '/functions/' + encodeURIComponent(name) + '/code', 'PUT', {
code: document.getElementById('e-code').value,