1
0
mirror of git://f0xx.org/android_cast synced 2026-07-29 06:58:51 +03:00
This commit is contained in:
Anton Afanasyeu
2026-06-04 17:27:19 +02:00
parent a29d84038e
commit 7b1311c78e
20 changed files with 665 additions and 35 deletions

View File

@@ -31,14 +31,30 @@
fetch(base + '/api/build_trigger.php', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
credentials: 'same-origin',
body: JSON.stringify(payload)
}).then(function (r) { return r.json(); }).then(function (j) {
}).then(function (r) {
return r.text().then(function (text) {
var j = null;
try {
j = JSON.parse(text);
} catch (e) {
throw new Error(r.status + ': ' + (text.slice(0, 120) || r.statusText));
}
if (!r.ok) {
throw new Error((j && j.error) || ('HTTP ' + r.status));
}
return j;
});
}).then(function (j) {
if (j.ok && j.build && j.build.id) {
window.location.href = base + '/?view=build&id=' + j.build.id;
} else {
status.textContent = j.error || 'Failed';
}
}).catch(function () { status.textContent = 'Network error'; });
}).catch(function (err) {
status.textContent = err && err.message ? err.message : 'Network error';
});
});
}