Create index.html
Browse files- index.html +72 -0
index.html
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
| 6 |
+
<title>AIO Downloader</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
</head>
|
| 9 |
+
<body class="min-h-screen bg-gray-100 flex items-center justify-center p-4">
|
| 10 |
+
<div class="w-full max-w-lg bg-white rounded-2xl shadow-lg p-6">
|
| 11 |
+
<h1 class="text-2xl font-bold text-gray-800 mb-4">✨ AIO Downloader</h1>
|
| 12 |
+
<form id="downloadForm" class="space-y-4">
|
| 13 |
+
<div>
|
| 14 |
+
<label for="url" class="block text-gray-700 mb-1">Target URL</label>
|
| 15 |
+
<input type="url" id="url" placeholder="https://example.com/video.mp4" required
|
| 16 |
+
class="w-full p-3 border border-gray-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-blue-400" />
|
| 17 |
+
</div>
|
| 18 |
+
<div>
|
| 19 |
+
<label for="ttl" class="block text-gray-700 mb-1">TTL (seconds) <span class="text-sm text-gray-500">optional</span></label>
|
| 20 |
+
<input type="number" id="ttl" placeholder="3600"
|
| 21 |
+
class="w-full p-3 border border-gray-300 rounded-xl focus:outline-none focus:ring-2 focus:ring-blue-400" />
|
| 22 |
+
</div>
|
| 23 |
+
<button type="submit"
|
| 24 |
+
class="w-full py-3 bg-blue-600 text-white font-semibold rounded-xl shadow hover:bg-blue-700 transition">Generate Short URL</button>
|
| 25 |
+
</form>
|
| 26 |
+
<div id="result" class="mt-6 hidden">
|
| 27 |
+
<p class="text-gray-800">Your short URL:</p>
|
| 28 |
+
<div class="mt-2 flex items-center space-x-2">
|
| 29 |
+
<input type="text" id="shortUrl" readonly
|
| 30 |
+
class="flex-1 p-3 border border-gray-300 rounded-xl bg-gray-100" />
|
| 31 |
+
<button id="copyBtn" class="px-4 py-2 bg-green-500 text-white rounded-xl hover:bg-green-600 transition">Copy</button>
|
| 32 |
+
</div>
|
| 33 |
+
<a id="downloadLink" href="#" target="_blank"
|
| 34 |
+
class="block mt-4 text-center text-white bg-indigo-600 py-3 rounded-xl hover:bg-indigo-700 transition">Download Now</a>
|
| 35 |
+
</div>
|
| 36 |
+
|
| 37 |
+
<script>
|
| 38 |
+
const form = document.getElementById('downloadForm');
|
| 39 |
+
const resultBox = document.getElementById('result');
|
| 40 |
+
const shortUrlInput = document.getElementById('shortUrl');
|
| 41 |
+
const copyBtn = document.getElementById('copyBtn');
|
| 42 |
+
const downloadLink = document.getElementById('downloadLink');
|
| 43 |
+
|
| 44 |
+
form.addEventListener('submit', async (e) => {
|
| 45 |
+
e.preventDefault();
|
| 46 |
+
const url = document.getElementById('url').value;
|
| 47 |
+
const ttl = document.getElementById('ttl').value;
|
| 48 |
+
const params = new URLSearchParams({ url });
|
| 49 |
+
if (ttl) params.append('ttlSeconds', ttl);
|
| 50 |
+
|
| 51 |
+
try {
|
| 52 |
+
const res = await fetch(`/proxy-url?${params.toString()}`);
|
| 53 |
+
if (!res.ok) throw new Error('Failed to generate');
|
| 54 |
+
const { shortUrl } = await res.json();
|
| 55 |
+
|
| 56 |
+
shortUrlInput.value = shortUrl;
|
| 57 |
+
downloadLink.href = shortUrl;
|
| 58 |
+
resultBox.classList.remove('hidden');
|
| 59 |
+
} catch (err) {
|
| 60 |
+
alert(err.message);
|
| 61 |
+
}
|
| 62 |
+
});
|
| 63 |
+
|
| 64 |
+
copyBtn.addEventListener('click', () => {
|
| 65 |
+
navigator.clipboard.writeText(shortUrlInput.value);
|
| 66 |
+
copyBtn.textContent = 'Copied!';
|
| 67 |
+
setTimeout(() => copyBtn.textContent = 'Copy', 2000);
|
| 68 |
+
});
|
| 69 |
+
</script>
|
| 70 |
+
</div>
|
| 71 |
+
</body>
|
| 72 |
+
</html>
|