Spaces:
Paused
Paused
Upload 20 files
Browse files- app.py +21 -6
- static/app.js +37 -19
app.py
CHANGED
|
@@ -386,6 +386,14 @@ def effective_state_label(torrent, state_entry: dict | None = None) -> str:
|
|
| 386 |
if state_entry and state_entry.get("gofile_uploading"):
|
| 387 |
return "GoFile Upload"
|
| 388 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 389 |
raw_state = getattr(torrent, "state", "")
|
| 390 |
progress = float(getattr(torrent, "progress", 0) or 0)
|
| 391 |
|
|
@@ -398,12 +406,19 @@ def effective_state_label(torrent, state_entry: dict | None = None) -> str:
|
|
| 398 |
return state_label(raw_state)
|
| 399 |
|
| 400 |
|
| 401 |
-
def effective_status_badge(torrent, state_entry: dict | None = None) -> str:
|
| 402 |
-
if state_entry and state_entry.get("gofile_uploading"):
|
| 403 |
-
return "border-sky-500/30 bg-sky-500/10 text-sky-100"
|
| 404 |
-
|
| 405 |
-
|
| 406 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 407 |
upspeed = int(getattr(torrent, "upspeed", 0) or 0)
|
| 408 |
|
| 409 |
if progress >= 1 and raw_state in {"uploading", "stalledUP", "forcedUP", "pausedUP", "queuedUP", "checkingUP"}:
|
|
|
|
| 386 |
if state_entry and state_entry.get("gofile_uploading"):
|
| 387 |
return "GoFile Upload"
|
| 388 |
|
| 389 |
+
if state_entry and state_entry.get("gofile_link"):
|
| 390 |
+
raw_state = getattr(torrent, "state", "")
|
| 391 |
+
progress = float(getattr(torrent, "progress", 0) or 0)
|
| 392 |
+
upspeed = int(getattr(torrent, "upspeed", 0) or 0)
|
| 393 |
+
provider = state_entry.get("gofile_provider", "Remote Upload")
|
| 394 |
+
if progress >= 1 and raw_state in {"uploading", "stalledUP", "pausedUP", "queuedUP", "checkingUP"} and upspeed <= 0:
|
| 395 |
+
return f"{provider} Ready"
|
| 396 |
+
|
| 397 |
raw_state = getattr(torrent, "state", "")
|
| 398 |
progress = float(getattr(torrent, "progress", 0) or 0)
|
| 399 |
|
|
|
|
| 406 |
return state_label(raw_state)
|
| 407 |
|
| 408 |
|
| 409 |
+
def effective_status_badge(torrent, state_entry: dict | None = None) -> str:
|
| 410 |
+
if state_entry and state_entry.get("gofile_uploading"):
|
| 411 |
+
return "border-sky-500/30 bg-sky-500/10 text-sky-100"
|
| 412 |
+
|
| 413 |
+
if state_entry and state_entry.get("gofile_link"):
|
| 414 |
+
raw_state = getattr(torrent, "state", "")
|
| 415 |
+
progress = float(getattr(torrent, "progress", 0) or 0)
|
| 416 |
+
upspeed = int(getattr(torrent, "upspeed", 0) or 0)
|
| 417 |
+
if progress >= 1 and raw_state in {"uploading", "stalledUP", "pausedUP", "queuedUP", "checkingUP"} and upspeed <= 0:
|
| 418 |
+
return "border-sky-500/30 bg-sky-500/10 text-sky-100"
|
| 419 |
+
|
| 420 |
+
raw_state = getattr(torrent, "state", "")
|
| 421 |
+
progress = float(getattr(torrent, "progress", 0) or 0)
|
| 422 |
upspeed = int(getattr(torrent, "upspeed", 0) or 0)
|
| 423 |
|
| 424 |
if progress >= 1 and raw_state in {"uploading", "stalledUP", "forcedUP", "pausedUP", "queuedUP", "checkingUP"}:
|
static/app.js
CHANGED
|
@@ -90,65 +90,83 @@
|
|
| 90 |
function statusTone(torrent) {
|
| 91 |
if (torrent.gofile_uploading) {
|
| 92 |
return {
|
| 93 |
-
|
|
|
|
| 94 |
text: "text-violet",
|
| 95 |
pillClass: "text-violet",
|
| 96 |
-
pillStyle: "background-color: rgba(155, 140, 255, 0.
|
| 97 |
label: torrent.upload_provider || torrent.state_label || "Uploading",
|
| 98 |
};
|
| 99 |
}
|
| 100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
const label = normalizeStateLabel(torrent.state_label);
|
| 102 |
if (label.includes("download")) {
|
| 103 |
return {
|
| 104 |
-
|
|
|
|
| 105 |
text: "text-neon",
|
| 106 |
pillClass: "text-neon",
|
| 107 |
-
pillStyle: "background-color: rgba(32, 230, 192, 0.
|
| 108 |
label: torrent.state_label || "Downloading",
|
| 109 |
};
|
| 110 |
}
|
| 111 |
if (label.includes("seed") || label.includes("upload")) {
|
| 112 |
return {
|
| 113 |
-
|
|
|
|
| 114 |
text: "text-lime",
|
| 115 |
pillClass: "text-lime",
|
| 116 |
-
pillStyle: "background-color: rgba(156, 247, 166, 0.
|
| 117 |
label: torrent.state_label || "Seeding",
|
| 118 |
};
|
| 119 |
}
|
| 120 |
if (label.includes("pause")) {
|
| 121 |
return {
|
| 122 |
-
|
|
|
|
| 123 |
text: "text-stone-300",
|
| 124 |
pillClass: "text-stone-300",
|
| 125 |
-
pillStyle: "background-color: rgba(255, 255, 255, 0.
|
| 126 |
label: torrent.state_label || "Paused",
|
| 127 |
};
|
| 128 |
}
|
| 129 |
if (label.includes("complete")) {
|
| 130 |
return {
|
| 131 |
-
|
|
|
|
| 132 |
text: "text-emerald-300",
|
| 133 |
pillClass: "text-emerald-200",
|
| 134 |
-
pillStyle: "background-color: rgba(110, 231, 183, 0.
|
| 135 |
label: torrent.state_label || "Complete",
|
| 136 |
};
|
| 137 |
}
|
| 138 |
if (label.includes("error") || label.includes("stalled") || label.includes("missing")) {
|
| 139 |
return {
|
| 140 |
-
|
|
|
|
| 141 |
text: "text-rose",
|
| 142 |
pillClass: "text-rose-200",
|
| 143 |
-
pillStyle: "background-color: rgba(255, 107, 157, 0.
|
| 144 |
label: torrent.state_label || "Attention",
|
| 145 |
};
|
| 146 |
}
|
| 147 |
return {
|
| 148 |
-
|
|
|
|
| 149 |
text: "text-amber",
|
| 150 |
pillClass: "text-amber-100",
|
| 151 |
-
pillStyle: "background-color: rgba(247, 200, 75, 0.
|
| 152 |
label: torrent.state_label || "Idle",
|
| 153 |
};
|
| 154 |
}
|
|
@@ -161,19 +179,19 @@
|
|
| 161 |
const toneConfig = {
|
| 162 |
default: {
|
| 163 |
className: "text-stone-200",
|
| 164 |
-
style: "background-color: rgba(255, 255, 255, 0.04);",
|
| 165 |
},
|
| 166 |
muted: {
|
| 167 |
className: "text-stone-300",
|
| 168 |
-
style: "background-color: rgba(
|
| 169 |
},
|
| 170 |
down: {
|
| 171 |
className: "text-neon",
|
| 172 |
-
style: "background-color: rgba(32, 230, 192, 0.
|
| 173 |
},
|
| 174 |
up: {
|
| 175 |
className: "text-lime",
|
| 176 |
-
style: "background-color: rgba(156, 247, 166, 0.
|
| 177 |
},
|
| 178 |
};
|
| 179 |
const config = toneConfig[tone] || toneConfig.default;
|
|
@@ -463,7 +481,7 @@
|
|
| 463 |
<h3 class="break-words text-[15px] font-semibold leading-6 text-white">${escapeHtml(torrent.name)}</h3>
|
| 464 |
<div class="mt-2 flex flex-wrap items-center gap-x-3 gap-y-2">
|
| 465 |
<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.pillClass}" style="${tone.pillStyle}">
|
| 466 |
-
<span class="h-2 w-2 shrink-0 rounded-full ${tone.
|
| 467 |
<span class="leading-none">${escapeHtml(tone.label)}</span>
|
| 468 |
</span>
|
| 469 |
${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>` : ""}
|
|
|
|
| 90 |
function statusTone(torrent) {
|
| 91 |
if (torrent.gofile_uploading) {
|
| 92 |
return {
|
| 93 |
+
dotClass: "bg-violet",
|
| 94 |
+
dotStyle: "background-color: #9b8cff;",
|
| 95 |
text: "text-violet",
|
| 96 |
pillClass: "text-violet",
|
| 97 |
+
pillStyle: "background-color: rgba(155, 140, 255, 0.18); box-shadow: inset 0 0 0 1px rgba(155, 140, 255, 0.22);",
|
| 98 |
label: torrent.upload_provider || torrent.state_label || "Uploading",
|
| 99 |
};
|
| 100 |
}
|
| 101 |
|
| 102 |
+
if (torrent.gofile_link && !torrent.gofile_uploading) {
|
| 103 |
+
return {
|
| 104 |
+
dotClass: "bg-sky-300",
|
| 105 |
+
dotStyle: "background-color: #7dd3fc;",
|
| 106 |
+
text: "text-sky-200",
|
| 107 |
+
pillClass: "text-sky-100",
|
| 108 |
+
pillStyle: "background-color: rgba(56, 189, 248, 0.18); box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.22);",
|
| 109 |
+
label: torrent.state_label || "Remote Ready",
|
| 110 |
+
};
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
const label = normalizeStateLabel(torrent.state_label);
|
| 114 |
if (label.includes("download")) {
|
| 115 |
return {
|
| 116 |
+
dotClass: "bg-neon",
|
| 117 |
+
dotStyle: "background-color: #20e6c0;",
|
| 118 |
text: "text-neon",
|
| 119 |
pillClass: "text-neon",
|
| 120 |
+
pillStyle: "background-color: rgba(32, 230, 192, 0.18); box-shadow: inset 0 0 0 1px rgba(32, 230, 192, 0.22);",
|
| 121 |
label: torrent.state_label || "Downloading",
|
| 122 |
};
|
| 123 |
}
|
| 124 |
if (label.includes("seed") || label.includes("upload")) {
|
| 125 |
return {
|
| 126 |
+
dotClass: "bg-lime",
|
| 127 |
+
dotStyle: "background-color: #9cf7a6;",
|
| 128 |
text: "text-lime",
|
| 129 |
pillClass: "text-lime",
|
| 130 |
+
pillStyle: "background-color: rgba(156, 247, 166, 0.2); box-shadow: inset 0 0 0 1px rgba(156, 247, 166, 0.26);",
|
| 131 |
label: torrent.state_label || "Seeding",
|
| 132 |
};
|
| 133 |
}
|
| 134 |
if (label.includes("pause")) {
|
| 135 |
return {
|
| 136 |
+
dotClass: "bg-stone-400",
|
| 137 |
+
dotStyle: "background-color: #a8a29e;",
|
| 138 |
text: "text-stone-300",
|
| 139 |
pillClass: "text-stone-300",
|
| 140 |
+
pillStyle: "background-color: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);",
|
| 141 |
label: torrent.state_label || "Paused",
|
| 142 |
};
|
| 143 |
}
|
| 144 |
if (label.includes("complete")) {
|
| 145 |
return {
|
| 146 |
+
dotClass: "bg-emerald-300",
|
| 147 |
+
dotStyle: "background-color: #6ee7b7;",
|
| 148 |
text: "text-emerald-300",
|
| 149 |
pillClass: "text-emerald-200",
|
| 150 |
+
pillStyle: "background-color: rgba(110, 231, 183, 0.18); box-shadow: inset 0 0 0 1px rgba(110, 231, 183, 0.22);",
|
| 151 |
label: torrent.state_label || "Complete",
|
| 152 |
};
|
| 153 |
}
|
| 154 |
if (label.includes("error") || label.includes("stalled") || label.includes("missing")) {
|
| 155 |
return {
|
| 156 |
+
dotClass: "bg-rose",
|
| 157 |
+
dotStyle: "background-color: #ff6b9d;",
|
| 158 |
text: "text-rose",
|
| 159 |
pillClass: "text-rose-200",
|
| 160 |
+
pillStyle: "background-color: rgba(255, 107, 157, 0.18); box-shadow: inset 0 0 0 1px rgba(255, 107, 157, 0.22);",
|
| 161 |
label: torrent.state_label || "Attention",
|
| 162 |
};
|
| 163 |
}
|
| 164 |
return {
|
| 165 |
+
dotClass: "bg-amber",
|
| 166 |
+
dotStyle: "background-color: #f7c84b;",
|
| 167 |
text: "text-amber",
|
| 168 |
pillClass: "text-amber-100",
|
| 169 |
+
pillStyle: "background-color: rgba(247, 200, 75, 0.18); box-shadow: inset 0 0 0 1px rgba(247, 200, 75, 0.22);",
|
| 170 |
label: torrent.state_label || "Idle",
|
| 171 |
};
|
| 172 |
}
|
|
|
|
| 179 |
const toneConfig = {
|
| 180 |
default: {
|
| 181 |
className: "text-stone-200",
|
| 182 |
+
style: "background-color: rgba(255, 255, 255, 0.04); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);",
|
| 183 |
},
|
| 184 |
muted: {
|
| 185 |
className: "text-stone-300",
|
| 186 |
+
style: "background-color: rgba(10, 14, 22, 0.62); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);",
|
| 187 |
},
|
| 188 |
down: {
|
| 189 |
className: "text-neon",
|
| 190 |
+
style: "background-color: rgba(32, 230, 192, 0.16); box-shadow: inset 0 0 0 1px rgba(32, 230, 192, 0.22);",
|
| 191 |
},
|
| 192 |
up: {
|
| 193 |
className: "text-lime",
|
| 194 |
+
style: "background-color: rgba(156, 247, 166, 0.16); box-shadow: inset 0 0 0 1px rgba(156, 247, 166, 0.22);",
|
| 195 |
},
|
| 196 |
};
|
| 197 |
const config = toneConfig[tone] || toneConfig.default;
|
|
|
|
| 481 |
<h3 class="break-words text-[15px] font-semibold leading-6 text-white">${escapeHtml(torrent.name)}</h3>
|
| 482 |
<div class="mt-2 flex flex-wrap items-center gap-x-3 gap-y-2">
|
| 483 |
<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.pillClass}" style="${tone.pillStyle}">
|
| 484 |
+
<span class="h-2 w-2 shrink-0 rounded-full ${tone.dotClass || ""}" style="${tone.dotStyle || ""}"></span>
|
| 485 |
<span class="leading-none">${escapeHtml(tone.label)}</span>
|
| 486 |
</span>
|
| 487 |
${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>` : ""}
|