Spaces:
Paused
Paused
Upload 20 files
Browse files- static/app.js +69 -68
static/app.js
CHANGED
|
@@ -88,63 +88,63 @@
|
|
| 88 |
}
|
| 89 |
|
| 90 |
function statusTone(torrent) {
|
| 91 |
-
if (torrent.gofile_uploading) {
|
| 92 |
-
return {
|
| 93 |
-
dot: "bg-violet/80",
|
| 94 |
-
text: "text-violet",
|
| 95 |
-
pill: "
|
| 96 |
-
label: torrent.upload_provider || torrent.state_label || "Uploading",
|
| 97 |
-
};
|
| 98 |
-
}
|
| 99 |
|
| 100 |
const label = normalizeStateLabel(torrent.state_label);
|
| 101 |
-
if (label.includes("download")) {
|
| 102 |
-
return {
|
| 103 |
-
dot: "bg-neon",
|
| 104 |
-
text: "text-neon",
|
| 105 |
-
pill: "
|
| 106 |
-
label: torrent.state_label || "Downloading",
|
| 107 |
-
};
|
| 108 |
-
}
|
| 109 |
-
if (label.includes("seed") || label.includes("upload")) {
|
| 110 |
-
return {
|
| 111 |
-
dot: "bg-lime",
|
| 112 |
-
text: "text-lime",
|
| 113 |
-
pill: "
|
| 114 |
-
label: torrent.state_label || "Seeding",
|
| 115 |
-
};
|
| 116 |
-
}
|
| 117 |
-
if (label.includes("pause")) {
|
| 118 |
-
return {
|
| 119 |
-
dot: "bg-stone-400",
|
| 120 |
-
text: "text-stone-300",
|
| 121 |
-
pill: "
|
| 122 |
-
label: torrent.state_label || "Paused",
|
| 123 |
-
};
|
| 124 |
-
}
|
| 125 |
-
if (label.includes("complete")) {
|
| 126 |
-
return {
|
| 127 |
-
dot: "bg-emerald-300",
|
| 128 |
-
text: "text-emerald-300",
|
| 129 |
-
pill: "
|
| 130 |
-
label: torrent.state_label || "Complete",
|
| 131 |
-
};
|
| 132 |
-
}
|
| 133 |
-
if (label.includes("error") || label.includes("stalled") || label.includes("missing")) {
|
| 134 |
-
return {
|
| 135 |
-
dot: "bg-rose",
|
| 136 |
-
text: "text-rose",
|
| 137 |
-
pill: "
|
| 138 |
-
label: torrent.state_label || "Attention",
|
| 139 |
-
};
|
| 140 |
-
}
|
| 141 |
-
return {
|
| 142 |
-
dot: "bg-amber/80",
|
| 143 |
-
text: "text-amber",
|
| 144 |
-
pill: "
|
| 145 |
-
label: torrent.state_label || "Idle",
|
| 146 |
-
};
|
| 147 |
-
}
|
| 148 |
|
| 149 |
function formatMetricValue(value) {
|
| 150 |
return escapeHtml(value || "-");
|
|
@@ -152,21 +152,21 @@
|
|
| 152 |
|
| 153 |
function metricBadge({ icon, label, value, tone = "default", span = "normal" }) {
|
| 154 |
const toneClasses = {
|
| 155 |
-
default: "
|
| 156 |
-
muted: "
|
| 157 |
-
down: "
|
| 158 |
-
up: "
|
| 159 |
};
|
| 160 |
const classes = toneClasses[tone] || toneClasses.default;
|
| 161 |
-
const spanClass = span === "full" ? "
|
| 162 |
return `
|
| 163 |
-
<div class="min-w-0 rounded-2xl
|
| 164 |
-
<div class="flex items-center justify-between gap-
|
| 165 |
<span class="inline-flex min-w-0 items-center gap-2">
|
| 166 |
<i class="fa-solid ${icon} shrink-0 text-[11px]"></i>
|
| 167 |
<span class="truncate text-stone-400">${escapeHtml(label)}</span>
|
| 168 |
</span>
|
| 169 |
-
<span class="min-w-0 truncate text-right font-mono font-medium">${escapeHtml(value)}</span>
|
| 170 |
</div>
|
| 171 |
</div>
|
| 172 |
`;
|
|
@@ -443,10 +443,11 @@
|
|
| 443 |
<div class="min-w-0">
|
| 444 |
<h3 class="break-words text-[15px] font-semibold leading-6 text-white">${escapeHtml(torrent.name)}</h3>
|
| 445 |
<div class="mt-2 flex flex-wrap items-center gap-x-3 gap-y-2">
|
| 446 |
-
<span class="inline-flex items-center gap-2 rounded-full
|
| 447 |
-
<span class="h-2 w-2 rounded-full ${tone.dot}"></span>
|
|
|
|
| 448 |
</span>
|
| 449 |
-
${activeSpeed ? `<span class="inline-flex items-center rounded-full
|
| 450 |
${endpointMeta}
|
| 451 |
</div>
|
| 452 |
</div>
|
|
@@ -466,11 +467,11 @@
|
|
| 466 |
|
| 467 |
<div class="mt-4 h-px bg-gradient-to-r from-transparent via-white/12 to-transparent"></div>
|
| 468 |
|
| 469 |
-
<div class="mt-4 grid grid-cols-
|
| 470 |
${primaryBadges}
|
| 471 |
</div>
|
| 472 |
|
| 473 |
-
<div class="mt-3 grid grid-cols-
|
| 474 |
${peerBadges}
|
| 475 |
</div>
|
| 476 |
|
|
|
|
| 88 |
}
|
| 89 |
|
| 90 |
function statusTone(torrent) {
|
| 91 |
+
if (torrent.gofile_uploading) {
|
| 92 |
+
return {
|
| 93 |
+
dot: "bg-violet/80",
|
| 94 |
+
text: "text-violet",
|
| 95 |
+
pill: "bg-violet/14 text-violet",
|
| 96 |
+
label: torrent.upload_provider || torrent.state_label || "Uploading",
|
| 97 |
+
};
|
| 98 |
+
}
|
| 99 |
|
| 100 |
const label = normalizeStateLabel(torrent.state_label);
|
| 101 |
+
if (label.includes("download")) {
|
| 102 |
+
return {
|
| 103 |
+
dot: "bg-neon",
|
| 104 |
+
text: "text-neon",
|
| 105 |
+
pill: "bg-neon/14 text-neon",
|
| 106 |
+
label: torrent.state_label || "Downloading",
|
| 107 |
+
};
|
| 108 |
+
}
|
| 109 |
+
if (label.includes("seed") || label.includes("upload")) {
|
| 110 |
+
return {
|
| 111 |
+
dot: "bg-lime",
|
| 112 |
+
text: "text-lime",
|
| 113 |
+
pill: "bg-lime/14 text-lime",
|
| 114 |
+
label: torrent.state_label || "Seeding",
|
| 115 |
+
};
|
| 116 |
+
}
|
| 117 |
+
if (label.includes("pause")) {
|
| 118 |
+
return {
|
| 119 |
+
dot: "bg-stone-400",
|
| 120 |
+
text: "text-stone-300",
|
| 121 |
+
pill: "bg-white/[0.05] text-stone-300",
|
| 122 |
+
label: torrent.state_label || "Paused",
|
| 123 |
+
};
|
| 124 |
+
}
|
| 125 |
+
if (label.includes("complete")) {
|
| 126 |
+
return {
|
| 127 |
+
dot: "bg-emerald-300",
|
| 128 |
+
text: "text-emerald-300",
|
| 129 |
+
pill: "bg-emerald-300/14 text-emerald-200",
|
| 130 |
+
label: torrent.state_label || "Complete",
|
| 131 |
+
};
|
| 132 |
+
}
|
| 133 |
+
if (label.includes("error") || label.includes("stalled") || label.includes("missing")) {
|
| 134 |
+
return {
|
| 135 |
+
dot: "bg-rose",
|
| 136 |
+
text: "text-rose",
|
| 137 |
+
pill: "bg-rose/14 text-rose-200",
|
| 138 |
+
label: torrent.state_label || "Attention",
|
| 139 |
+
};
|
| 140 |
+
}
|
| 141 |
+
return {
|
| 142 |
+
dot: "bg-amber/80",
|
| 143 |
+
text: "text-amber",
|
| 144 |
+
pill: "bg-amber/14 text-amber-100",
|
| 145 |
+
label: torrent.state_label || "Idle",
|
| 146 |
+
};
|
| 147 |
+
}
|
| 148 |
|
| 149 |
function formatMetricValue(value) {
|
| 150 |
return escapeHtml(value || "-");
|
|
|
|
| 152 |
|
| 153 |
function metricBadge({ icon, label, value, tone = "default", span = "normal" }) {
|
| 154 |
const toneClasses = {
|
| 155 |
+
default: "bg-white/[0.04] text-stone-200",
|
| 156 |
+
muted: "bg-black/20 text-stone-300",
|
| 157 |
+
down: "bg-neon/10 text-neon",
|
| 158 |
+
up: "bg-lime/10 text-lime",
|
| 159 |
};
|
| 160 |
const classes = toneClasses[tone] || toneClasses.default;
|
| 161 |
+
const spanClass = span === "full" ? "col-span-2" : "";
|
| 162 |
return `
|
| 163 |
+
<div class="min-w-0 rounded-2xl px-3 py-2.5 text-xs ${classes} ${spanClass}">
|
| 164 |
+
<div class="flex items-center justify-between gap-2">
|
| 165 |
<span class="inline-flex min-w-0 items-center gap-2">
|
| 166 |
<i class="fa-solid ${icon} shrink-0 text-[11px]"></i>
|
| 167 |
<span class="truncate text-stone-400">${escapeHtml(label)}</span>
|
| 168 |
</span>
|
| 169 |
+
<span class="min-w-0 shrink-0 truncate text-right font-mono font-medium">${escapeHtml(value)}</span>
|
| 170 |
</div>
|
| 171 |
</div>
|
| 172 |
`;
|
|
|
|
| 443 |
<div class="min-w-0">
|
| 444 |
<h3 class="break-words text-[15px] font-semibold leading-6 text-white">${escapeHtml(torrent.name)}</h3>
|
| 445 |
<div class="mt-2 flex flex-wrap items-center gap-x-3 gap-y-2">
|
| 446 |
+
<span class="inline-flex min-h-[2.25rem] items-center justify-center gap-2 rounded-full px-3 py-1.5 text-xs font-medium ${tone.pill}">
|
| 447 |
+
<span class="h-2 w-2 shrink-0 rounded-full ${tone.dot}"></span>
|
| 448 |
+
<span class="leading-none">${escapeHtml(tone.label)}</span>
|
| 449 |
</span>
|
| 450 |
+
${activeSpeed ? `<span class="inline-flex min-h-[2.25rem] items-center justify-center rounded-full bg-white/[0.04] px-3 py-1.5 text-xs text-stone-200">${activeSpeed}</span>` : ""}
|
| 451 |
${endpointMeta}
|
| 452 |
</div>
|
| 453 |
</div>
|
|
|
|
| 467 |
|
| 468 |
<div class="mt-4 h-px bg-gradient-to-r from-transparent via-white/12 to-transparent"></div>
|
| 469 |
|
| 470 |
+
<div class="mt-4 grid grid-cols-2 gap-2">
|
| 471 |
${primaryBadges}
|
| 472 |
</div>
|
| 473 |
|
| 474 |
+
<div class="mt-3 grid grid-cols-2 gap-2">
|
| 475 |
${peerBadges}
|
| 476 |
</div>
|
| 477 |
|