Code refactoring after #1063
This commit is contained in:
+10
-14
@@ -4,11 +4,8 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1, maximum-scale=1">
|
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1, maximum-scale=1">
|
||||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||||
|
|
||||||
<title>go2rtc</title>
|
<title>go2rtc</title>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
@@ -86,25 +83,24 @@
|
|||||||
|
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
|
||||||
const url = new URL('api/streams', location.href);
|
|
||||||
const src = decodeURIComponent(ev.target.dataset.name);
|
const src = decodeURIComponent(ev.target.dataset.name);
|
||||||
url.searchParams.set('src', src);
|
|
||||||
const message = `Please type the name of the stream "${src}" to confirm its stop and deletion from the configuration. This action is irreversible.`;
|
const message = `Please type the name of the stream "${src}" to confirm its deletion from the configuration. This action is irreversible.`;
|
||||||
|
if (prompt(message) !== src) {
|
||||||
const userInput = prompt(message);
|
alert('Stream name does not match. Deletion cancelled.');
|
||||||
if (userInput !== src) {
|
|
||||||
alert("Stream name does not match. Deletion cancelled.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
const url = new URL('api/streams', location.href);
|
||||||
await fetch(url, { method: 'DELETE' });
|
url.searchParams.set('src', src);
|
||||||
|
|
||||||
|
try {
|
||||||
|
await fetch(url, {method: 'DELETE'});
|
||||||
reload();
|
reload();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to delete the stream:', error);
|
console.error('Failed to delete the stream:', error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
document.getElementById('selectall').addEventListener('change', ev => {
|
document.getElementById('selectall').addEventListener('change', ev => {
|
||||||
document.querySelectorAll('#streams input').forEach(el => {
|
document.querySelectorAll('#streams input').forEach(el => {
|
||||||
|
|||||||
Reference in New Issue
Block a user