diff --git a/Dockerfile b/Dockerfile index e6df726..8cc139e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ RUN npm run build # Build server FROM node:22-slim -RUN apt-get update && apt-get install -y ffmpeg curl && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y ffmpeg curl aria2 && rm -rf /var/lib/apt/lists/* RUN curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp \ && chmod a+rx /usr/local/bin/yt-dlp WORKDIR /app/server diff --git a/client/src/routes/Transfers.svelte b/client/src/routes/Transfers.svelte index b6e6c14..b5c7884 100644 --- a/client/src/routes/Transfers.svelte +++ b/client/src/routes/Transfers.svelte @@ -98,8 +98,21 @@ } } + function normalizeMailRuUrl(value) { + if (!value || typeof value !== "string") return null; + try { + const url = new URL(value.trim()); + if (url.protocol !== "https:") return null; + const host = url.hostname.toLowerCase(); + if (!host.endsWith("mail.ru")) return null; + return url.toString(); + } catch { + return null; + } + } + async function handleUrlInput() { - const input = prompt("Magnet veya YouTube URL girin:"); + const input = prompt("Magnet, YouTube veya Mail.ru URL girin:"); if (!input) return; if (isMagnetLink(input)) { await apiFetch("/api/transfer", { @@ -125,8 +138,23 @@ await list(); return; } + const normalizedMailRu = normalizeMailRuUrl(input); + if (normalizedMailRu) { + const resp = await apiFetch("/api/mailru/download", { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ url: normalizedMailRu }) + }); + if (!resp.ok) { + const data = await resp.json().catch(() => null); + alert(data?.error || "Mail.ru indirmesi başlatılamadı"); + return; + } + await list(); + return; + } alert( - "Yalnızca magnet linkleri veya https://www.youtube.com/watch?v=... formatındaki YouTube URL'leri destekleniyor." + "Yalnızca magnet linkleri, https://www.youtube.com/watch?v=... formatındaki YouTube URL'leri veya mail.ru linkleri destekleniyor." ); } @@ -556,7 +584,7 @@ class="thumb" on:load={(e) => e.target.classList.add("loaded")} /> - {:else if t.type === "youtube" && (!t.progress || t.progress <= 0)} + {:else if (t.type === "youtube" || t.type === "mailru") && (!t.progress || t.progress <= 0)}