feat: add read-only mode to API and UI, disable write actions

This commit is contained in:
Sergey Krashevich
2026-02-01 04:13:43 +03:00
parent 6085c8aabe
commit cc453dd9ed
24 changed files with 438 additions and 8 deletions
+14 -1
View File
@@ -1182,7 +1182,20 @@
let dump;
document.getElementById('save').addEventListener('click', async () => {
const saveButton = document.getElementById('save');
const applyReadOnly = () => {
saveButton.disabled = true;
saveButton.title = 'Read-only mode';
editor.updateOptions({readOnly: true});
};
if (window.go2rtcReady) {
window.go2rtcReady.then(data => {
if (data && data.read_only) applyReadOnly();
});
}
saveButton.addEventListener('click', async () => {
let r = await fetch('api/config', {cache: 'no-cache'});
if (r.ok && dump !== await r.text()) {
alert('Config was changed from another place. Refresh the page and make changes again');