Correctly split console for each process
This commit is contained in:
@@ -145,9 +145,10 @@
|
||||
<div style="display: none;" id="console"></div>
|
||||
<script>
|
||||
let isPaused = false;
|
||||
const filename = "{{.Filename}}";
|
||||
|
||||
function updateProgress() {
|
||||
fetch('/progress?filename={{.Filename}}', {
|
||||
fetch(`/progress?filename=${filename}`, {
|
||||
headers: {
|
||||
'Accept': 'application/json'
|
||||
}
|
||||
@@ -179,7 +180,7 @@
|
||||
}
|
||||
|
||||
function abortDownload() {
|
||||
fetch('/abort?filename={{.Filename}}', { method: 'POST' })
|
||||
fetch(`/abort?filename=${filename}`, { method: 'POST' })
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
console.log('Abort signal sent. The download will stop soon.');
|
||||
@@ -190,7 +191,7 @@
|
||||
}
|
||||
|
||||
function pauseDownload() {
|
||||
fetch('/pause?filename={{.Filename}}', { method: 'POST' })
|
||||
fetch(`/pause?filename=${filename}`, { method: 'POST' })
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
console.log('Pause signal sent. The download will pause soon.');
|
||||
@@ -203,7 +204,7 @@
|
||||
}
|
||||
|
||||
function resumeDownload() {
|
||||
fetch('/resume?filename={{.Filename}}', { method: 'POST' })
|
||||
fetch(`/resume?filename=${filename}`, { method: 'POST' })
|
||||
.then(response => {
|
||||
if (response.ok) {
|
||||
console.log('Resume signal sent. The download will resume soon.');
|
||||
@@ -217,7 +218,7 @@
|
||||
}
|
||||
|
||||
const consoleDiv = document.getElementById('console');
|
||||
const ws = new WebSocket(`ws://${window.location.host}/ws`);
|
||||
const ws = new WebSocket(`ws://${window.location.host}/ws?filename=${filename}`);
|
||||
|
||||
ws.onmessage = function(event) {
|
||||
consoleDiv.textContent += event.data;
|
||||
|
Reference in New Issue
Block a user