2024-09-03 23:06:15 +02:00
|
|
|
<!DOCTYPE html>
|
2024-09-06 18:31:42 +02:00
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>Processing {{.Filename}}</title>
|
|
|
|
<style>
|
|
|
|
body {
|
|
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
|
|
|
background-color: #1e1e1e;
|
|
|
|
color: #d4d4d4;
|
|
|
|
line-height: 1.6;
|
|
|
|
padding: 20px;
|
|
|
|
max-width: 800px;
|
|
|
|
margin: 0 auto;
|
|
|
|
box-sizing: border-box;
|
|
|
|
}
|
|
|
|
h1 {
|
|
|
|
border-bottom: 1px solid #333;
|
|
|
|
padding-bottom: 10px;
|
|
|
|
word-wrap: break-word;
|
|
|
|
}
|
|
|
|
#progress-container {
|
|
|
|
background-color: #2d2d2d;
|
|
|
|
border-radius: 4px;
|
|
|
|
margin-bottom: 20px;
|
|
|
|
padding: 20px;
|
|
|
|
}
|
|
|
|
#progress-bar-container {
|
|
|
|
background-color: #444;
|
|
|
|
height: 20px;
|
|
|
|
border-radius: 10px;
|
|
|
|
overflow: hidden;
|
|
|
|
margin-bottom: 10px;
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
#progress-bar {
|
|
|
|
background-color: #4CAF50;
|
|
|
|
height: 100%;
|
|
|
|
width: 0;
|
|
|
|
transition: width 0.5s ease-in-out;
|
|
|
|
}
|
|
|
|
#progress-text {
|
|
|
|
position: absolute;
|
|
|
|
top: 50%;
|
|
|
|
left: 0;
|
|
|
|
right: 0;
|
|
|
|
transform: translateY(-50%);
|
|
|
|
text-align: center;
|
|
|
|
color: #fff;
|
|
|
|
font-weight: bold;
|
|
|
|
text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
|
|
|
|
line-height: 20px;
|
|
|
|
}
|
|
|
|
#currentFile {
|
|
|
|
margin-top: 10px;
|
|
|
|
word-wrap: break-word;
|
|
|
|
}
|
2024-09-13 22:15:20 +02:00
|
|
|
#abort-button {
|
|
|
|
background-color: #f44336;
|
|
|
|
color: white;
|
|
|
|
border: none;
|
|
|
|
padding: 10px 15px;
|
|
|
|
margin-top: 10px;
|
|
|
|
border-radius: 4px;
|
|
|
|
cursor: pointer;
|
|
|
|
}
|
|
|
|
#abort-button:hover {
|
|
|
|
background-color: #d32f2f;
|
|
|
|
}
|
2024-09-06 18:31:42 +02:00
|
|
|
@media (max-width: 600px) {
|
|
|
|
body {
|
|
|
|
padding: 10px;
|
|
|
|
}
|
|
|
|
h1 {
|
|
|
|
font-size: 1.5em;
|
|
|
|
}
|
|
|
|
#progress-container {
|
|
|
|
padding: 10px;
|
|
|
|
}
|
|
|
|
#progress-bar-container {
|
|
|
|
height: 15px;
|
|
|
|
}
|
|
|
|
#progress-text {
|
|
|
|
font-size: 0.9em;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
2024-09-03 23:06:15 +02:00
|
|
|
<body>
|
|
|
|
<h1>Processing {{.Filename}}</h1>
|
2024-09-06 18:31:42 +02:00
|
|
|
<div id="progress-container">
|
|
|
|
<div id="progress-bar-container">
|
|
|
|
<div id="progress-bar"></div>
|
|
|
|
<div id="progress-text">0%</div>
|
|
|
|
</div>
|
|
|
|
<div id="currentFile"></div>
|
|
|
|
</div>
|
2024-09-13 22:15:20 +02:00
|
|
|
<button id="abort-button" onclick="abortDownload()">Abort Download</button>
|
2024-09-03 23:06:15 +02:00
|
|
|
<script>
|
|
|
|
function updateProgress() {
|
|
|
|
fetch('/progress?filename={{.Filename}}', {
|
|
|
|
headers: {
|
|
|
|
'Accept': 'application/json'
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.then(response => response.json())
|
|
|
|
.then(data => {
|
|
|
|
const progress = Math.round(data.Percentage);
|
2024-09-06 18:31:42 +02:00
|
|
|
document.getElementById('progress-bar').style.width = progress + '%';
|
|
|
|
document.getElementById('progress-text').innerText = progress + '%';
|
2024-09-03 23:06:15 +02:00
|
|
|
document.getElementById('currentFile').innerText = 'Current file: ' + (data.CurrentFile || 'None');
|
|
|
|
if (progress < 100) {
|
|
|
|
setTimeout(updateProgress, 1000);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
updateProgress();
|
2024-09-13 22:15:20 +02:00
|
|
|
|
|
|
|
function abortDownload() {
|
|
|
|
fetch('/abort?filename={{.Filename}}', { method: 'POST' })
|
|
|
|
.then(response => {
|
|
|
|
if (response.ok) {
|
|
|
|
alert('Abort signal sent. The download will stop soon.');
|
|
|
|
} else {
|
|
|
|
alert('Failed to abort the download.');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2024-09-03 23:06:15 +02:00
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|