Added torrent file upload support

This commit is contained in:
2025-10-31 13:53:07 +03:30
parent 616614cf30
commit 906eb10eb2
8 changed files with 378 additions and 85 deletions
+13
View File
@@ -0,0 +1,13 @@
<template>
<div class="hero">
<div class="hero-content text-center">
<div class="max-w-md">
<h1 class="text-5xl font-bold drop-shadow-xl">TorrentMax</h1>
<p class="py-6">
Paste a magnet link below and TorrentMax will enrich it with
additional trackers
</p>
</div>
</div>
</div>
</template>
+25
View File
@@ -0,0 +1,25 @@
<script setup lang="ts">
const emit = defineEmits(["submit"]);
function handleFileChange(e: Event) {
const target = e.target as HTMLInputElement;
// TODO: add file size verification
if (target.files?.length) {
emit("submit", target.files[0]);
}
}
</script>
<template>
<div class="flex justify-center">
<fieldset class="fieldset w-full max-w-2/3">
<legend class="fieldset-legend">Pick a file</legend>
<input
type="file"
class="file-input file-input-bordered w-full border-primary bg-base-100 file-input-md"
accept=".torrent,application/x-bittorrent"
@change="handleFileChange"
/>
<label class="label">Max size 1MB</label>
</fieldset>
</div>
</template>
+21
View File
@@ -0,0 +1,21 @@
<script setup lang="ts">
const props = defineProps<{ message: string }>()
</script>
<template>
<div role="alert" class="alert alert-error mt-3">
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6 shrink-0 stroke-current"
fill="none"
viewBox="0 0 24 24"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"
/>
</svg>
<span>Error! {{ props.message }}</span>
</div>
</template>