169 lines
4.7 KiB
HTML
169 lines
4.7 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>Download Manager</title>
|
|
<meta charset="UTF-8">
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
min-height: 100vh;
|
|
padding: 40px 20px;
|
|
}
|
|
.container {
|
|
max-width: 800px;
|
|
margin: 0 auto;
|
|
}
|
|
.card {
|
|
background: white;
|
|
border-radius: 24px;
|
|
padding: 40px;
|
|
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
|
|
}
|
|
h1 {
|
|
font-size: 28px;
|
|
color: #1a1a2e;
|
|
margin-bottom: 8px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
}
|
|
.sub {
|
|
color: #666;
|
|
margin-bottom: 32px;
|
|
font-size: 14px;
|
|
}
|
|
.input-group {
|
|
margin-bottom: 20px;
|
|
}
|
|
label {
|
|
display: block;
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
color: #333;
|
|
margin-bottom: 8px;
|
|
}
|
|
input {
|
|
width: 100%;
|
|
padding: 14px 16px;
|
|
font-size: 14px;
|
|
border: 2px solid #e1e8ed;
|
|
border-radius: 12px;
|
|
background: white;
|
|
transition: 0.2s;
|
|
}
|
|
input:focus {
|
|
outline: none;
|
|
border-color: #667eea;
|
|
}
|
|
.row {
|
|
display: flex;
|
|
gap: 16px;
|
|
margin-bottom: 20px;
|
|
}
|
|
.row .input-group {
|
|
flex: 1;
|
|
margin-bottom: 0;
|
|
}
|
|
button {
|
|
width: 100%;
|
|
padding: 16px;
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
border: none;
|
|
border-radius: 12px;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
color: white;
|
|
cursor: pointer;
|
|
transition: 0.2s;
|
|
margin-top: 8px;
|
|
}
|
|
button:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 5px 20px rgba(102,126,234,0.4);
|
|
}
|
|
iframe {
|
|
background: #1e1e2e;
|
|
width: 100%;
|
|
height: 400px;
|
|
border: none;
|
|
border-radius: 12px;
|
|
margin-top: 32px;
|
|
font-family: monospace;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<div class="card">
|
|
<h1>
|
|
<span>⬇️</span>
|
|
<span>Download Manager</span>
|
|
</h1>
|
|
<div class="sub">Download files directly to your SD card</div>
|
|
|
|
<div class="input-group">
|
|
<label>URL</label>
|
|
<input type="text" id="url" placeholder="example.com/file.zip or http://..." autofocus>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="input-group">
|
|
<label>Filename (optional)</label>
|
|
<input type="text" id="filename" placeholder="Auto from URL">
|
|
</div>
|
|
<div class="input-group">
|
|
<label>Save to</label>
|
|
<input type="text" id="dir" value="/media/card/download">
|
|
</div>
|
|
</div>
|
|
|
|
<button onclick="download()">Start Download</button>
|
|
|
|
<iframe id="log" style="display:none"></iframe>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
function download() {
|
|
let url = document.getElementById('url').value.trim();
|
|
const filename = document.getElementById('filename').value.trim();
|
|
const dir = document.getElementById('dir').value.trim();
|
|
|
|
if (!url) {
|
|
alert('Please enter a URL');
|
|
return;
|
|
}
|
|
|
|
// Add http:// if missing
|
|
if (!url.startsWith('http://') && !url.startsWith('https://')) {
|
|
url = 'http://' + url;
|
|
}
|
|
|
|
// Get the current script path
|
|
const currentPath = window.location.pathname;
|
|
const basePath = currentPath.substring(0, currentPath.lastIndexOf('/'));
|
|
const shPath = basePath + '/downloader.sh';
|
|
|
|
const params = new URLSearchParams();
|
|
params.append('url', url);
|
|
if (filename) params.append('filename', filename);
|
|
params.append('dir', dir);
|
|
|
|
const iframe = document.getElementById('log');
|
|
iframe.style.display = 'block';
|
|
iframe.src = `/card/ext/cgi-bin/exec.sh?script=${encodeURIComponent(shPath)}&${params.toString()}`;
|
|
}
|
|
|
|
document.getElementById('url').addEventListener('keypress', (e) => {
|
|
if (e.key === 'Enter') download();
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|