Add feed deletion and single video addition features
- Implemented DELETE /api/channels/<id> to remove channels and cleanup downloaded files - Added delete button to channels page with confirmation dialog - Added functionality to add single videos via URL - Updated navigation menu
This commit is contained in:
@@ -29,6 +29,9 @@
|
||||
<button class="btn btn-secondary" onclick="refreshChannel({{ channel.id }})">
|
||||
Refresh Videos
|
||||
</button>
|
||||
<button class="btn btn-danger" onclick="deleteChannel({{ channel.id }}, '{{ channel.title|replace("'", "\\'") }}')">
|
||||
Delete
|
||||
</button>
|
||||
<a href="/?channel={{ channel.id }}" class="btn btn-link">View Videos</a>
|
||||
</div>
|
||||
</div>
|
||||
@@ -71,5 +74,36 @@
|
||||
button.textContent = 'Refresh Videos';
|
||||
});
|
||||
}
|
||||
|
||||
function deleteChannel(channelId, channelTitle) {
|
||||
if (!confirm(`Are you sure you want to delete "${channelTitle}"?\n\nThis will permanently remove:\n- The channel subscription\n- All video history\n- ALL downloaded video files for this channel\n\nThis action cannot be undone.`)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const button = event.target;
|
||||
const originalText = button.textContent;
|
||||
button.disabled = true;
|
||||
button.textContent = 'Deleting...';
|
||||
|
||||
fetch(`/api/channels/${channelId}`, {
|
||||
method: 'DELETE'
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.status === 'success') {
|
||||
alert(data.message);
|
||||
location.reload();
|
||||
} else {
|
||||
alert('Failed to delete: ' + data.message);
|
||||
button.disabled = false;
|
||||
button.textContent = originalText;
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
alert('Error: ' + error);
|
||||
button.disabled = false;
|
||||
button.textContent = originalText;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user