Code refactoring after #1063
This commit is contained in:
+10
-14
@@ -4,11 +4,8 @@
|
||||
<meta charset="utf-8">
|
||||
<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">
|
||||
|
||||
<title>go2rtc</title>
|
||||
|
||||
<style>
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
@@ -86,25 +83,24 @@
|
||||
|
||||
ev.preventDefault();
|
||||
|
||||
const url = new URL('api/streams', location.href);
|
||||
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 userInput = prompt(message);
|
||||
if (userInput !== src) {
|
||||
alert("Stream name does not match. Deletion cancelled.");
|
||||
|
||||
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) {
|
||||
alert('Stream name does not match. Deletion cancelled.');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await fetch(url, { method: 'DELETE' });
|
||||
|
||||
const url = new URL('api/streams', location.href);
|
||||
url.searchParams.set('src', src);
|
||||
|
||||
try {
|
||||
await fetch(url, {method: 'DELETE'});
|
||||
reload();
|
||||
} catch (error) {
|
||||
console.error('Failed to delete the stream:', error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
document.getElementById('selectall').addEventListener('change', ev => {
|
||||
document.querySelectorAll('#streams input').forEach(el => {
|
||||
|
||||
Reference in New Issue
Block a user