nexus33rd commited on
Commit
37cc9d4
·
verified ·
1 Parent(s): d857ce3

Upload 20 files

Browse files
Files changed (1) hide show
  1. static/app.js +40 -46
static/app.js CHANGED
@@ -341,12 +341,16 @@
341
  function renderTorrent(torrent) {
342
  const tone = statusTone(torrent);
343
  const progress = Math.max(0, Math.min(Number(torrent.progress || 0), 100));
 
 
 
 
344
  const progressClass = torrent.gofile_uploading
345
  ? "h-2 rounded-full bg-[linear-gradient(90deg,rgba(155,140,255,0.95),rgba(32,230,192,0.92))] shadow-[0_0_18px_rgba(155,140,255,0.16)] transition-all duration-700"
346
  : "h-2 rounded-full bg-[linear-gradient(90deg,rgba(32,230,192,0.95),rgba(156,247,166,0.95))] shadow-[0_0_18px_rgba(32,230,192,0.18)] transition-all duration-700";
347
  const downRate = escapeHtml(torrent.dlspeed || "-");
348
  const upRate = escapeHtml(torrent.upspeed || "-");
349
- const statusMessage = torrent.status_message
350
  ? `<div class="mt-3 rounded-2xl border border-amber/20 bg-amber/10 px-3 py-2 text-xs text-amber-100">${escapeHtml(torrent.status_message)}</div>`
351
  : "";
352
  const endpointMeta = torrent.gofile_endpoint
@@ -357,40 +361,49 @@
357
  : "";
358
  const statusIconName = torrent.gofile_uploading
359
  ? "fa-cloud-arrow-up"
360
- : normalizeStateLabel(torrent.state_label).includes("seed")
361
  ? "fa-arrow-up"
362
- : normalizeStateLabel(torrent.state_label).includes("download")
363
  ? "fa-arrow-down"
364
  : "fa-circle";
365
  const statusIconTone = torrent.gofile_uploading
366
  ? "bg-violet/10 text-violet"
367
- : normalizeStateLabel(torrent.state_label).includes("seed")
368
  ? "bg-lime/10 text-lime"
369
- : normalizeStateLabel(torrent.state_label).includes("download")
370
  ? "bg-neon/10 text-neon"
371
  : "bg-white/[0.04] text-stone-300";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
372
 
373
  return `
374
- <article class="rounded-[28px] border border-white/10 bg-[linear-gradient(180deg,rgba(17,20,31,0.94),rgba(10,12,19,0.92))] p-4 shadow-[0_10px_34px_rgba(0,0,0,0.22)] transition duration-300 hover:border-neon/30 hover:shadow-[0_0_0_1px_rgba(32,230,192,0.08),0_18px_45px_rgba(0,0,0,0.28)] sm:p-5">
375
  <div class="flex items-start gap-3">
376
- <div class="mt-1 flex h-12 w-12 shrink-0 items-center justify-center rounded-2xl ${statusIconTone}">
377
  <i class="fa-solid ${statusIconName}"></i>
378
  </div>
379
  <div class="min-w-0 flex-1">
380
- <div class="flex flex-wrap items-start justify-between gap-3">
381
- <div class="min-w-0">
382
- <h3 class="break-words text-base font-semibold leading-6 text-white">${escapeHtml(torrent.name)}</h3>
383
- <div class="mt-2 flex flex-wrap items-center gap-2">
384
- <span class="inline-flex items-center gap-2 rounded-full border px-3 py-1 text-[11px] uppercase tracking-[0.22em] ${tone.pill}">
385
- <span class="h-2 w-2 rounded-full ${tone.dot}"></span>${escapeHtml(tone.label)}
386
- </span>
387
- ${endpointMeta}
388
- ${activeSpeed}
389
- </div>
390
- </div>
391
- <div class="text-right">
392
- <div class="font-mono text-sm text-stone-300">${escapeHtml(torrent.total_size)}</div>
393
- <div class="mt-1 text-xs text-stone-500">${escapeHtml(torrent.eta)}</div>
394
  </div>
395
  </div>
396
  ${statusMessage}
@@ -407,31 +420,12 @@
407
  </div>
408
  </div>
409
 
410
- <div class="mt-4 grid grid-cols-2 gap-3 sm:grid-cols-4 lg:grid-cols-6">
411
- <div class="rounded-2xl border border-white/10 bg-black/20 px-3 py-3">
412
- <div class="text-[11px] uppercase tracking-[0.22em] text-stone-500">Done</div>
413
- <div class="mt-2 text-sm text-white">${escapeHtml(torrent.downloaded)}</div>
414
- </div>
415
- <div class="rounded-2xl border border-white/10 bg-black/20 px-3 py-3">
416
- <div class="text-[11px] uppercase tracking-[0.22em] text-stone-500">Uploaded</div>
417
- <div class="mt-2 text-sm text-white">${escapeHtml(torrent.uploaded || "-")}</div>
418
- </div>
419
- <div class="rounded-2xl border border-white/10 bg-black/20 px-3 py-3">
420
- <div class="text-[11px] uppercase tracking-[0.22em] text-stone-500">Down</div>
421
- <div class="mt-2 font-mono text-sm text-neon">${downRate}</div>
422
- </div>
423
- <div class="rounded-2xl border border-white/10 bg-black/20 px-3 py-3">
424
- <div class="text-[11px] uppercase tracking-[0.22em] text-stone-500">Up</div>
425
- <div class="mt-2 font-mono text-sm text-lime">${upRate}</div>
426
- </div>
427
- <div class="rounded-2xl border border-white/10 bg-black/20 px-3 py-3">
428
- <div class="text-[11px] uppercase tracking-[0.22em] text-stone-500">Seeds</div>
429
- <div class="mt-2 text-sm text-white">${escapeHtml(torrent.num_seeds)}</div>
430
- </div>
431
- <div class="rounded-2xl border border-white/10 bg-black/20 px-3 py-3">
432
- <div class="text-[11px] uppercase tracking-[0.22em] text-stone-500">Ratio</div>
433
- <div class="mt-2 text-sm text-white">${escapeHtml(torrent.ratio || "-")}</div>
434
- </div>
435
  </div>
436
 
437
  <div class="mt-4 flex flex-wrap gap-2">${actionButtons(torrent)}</div>
 
341
  function renderTorrent(torrent) {
342
  const tone = statusTone(torrent);
343
  const progress = Math.max(0, Math.min(Number(torrent.progress || 0), 100));
344
+ const stateLabel = normalizeStateLabel(torrent.state_label);
345
+ const isComplete = progress >= 100 || stateLabel.includes("complete");
346
+ const isDownloading = stateLabel.includes("download");
347
+ const isSeeding = stateLabel.includes("seed");
348
  const progressClass = torrent.gofile_uploading
349
  ? "h-2 rounded-full bg-[linear-gradient(90deg,rgba(155,140,255,0.95),rgba(32,230,192,0.92))] shadow-[0_0_18px_rgba(155,140,255,0.16)] transition-all duration-700"
350
  : "h-2 rounded-full bg-[linear-gradient(90deg,rgba(32,230,192,0.95),rgba(156,247,166,0.95))] shadow-[0_0_18px_rgba(32,230,192,0.18)] transition-all duration-700";
351
  const downRate = escapeHtml(torrent.dlspeed || "-");
352
  const upRate = escapeHtml(torrent.upspeed || "-");
353
+ const statusMessage = torrent.status_message && !isComplete
354
  ? `<div class="mt-3 rounded-2xl border border-amber/20 bg-amber/10 px-3 py-2 text-xs text-amber-100">${escapeHtml(torrent.status_message)}</div>`
355
  : "";
356
  const endpointMeta = torrent.gofile_endpoint
 
361
  : "";
362
  const statusIconName = torrent.gofile_uploading
363
  ? "fa-cloud-arrow-up"
364
+ : isSeeding
365
  ? "fa-arrow-up"
366
+ : isDownloading
367
  ? "fa-arrow-down"
368
  : "fa-circle";
369
  const statusIconTone = torrent.gofile_uploading
370
  ? "bg-violet/10 text-violet"
371
+ : isSeeding
372
  ? "bg-lime/10 text-lime"
373
+ : isDownloading
374
  ? "bg-neon/10 text-neon"
375
  : "bg-white/[0.04] text-stone-300";
376
+ const compactMetrics = [
377
+ { icon: "fa-download", tone: "text-stone-300", label: escapeHtml(torrent.downloaded) },
378
+ { icon: "fa-upload", tone: "text-stone-300", label: escapeHtml(torrent.uploaded || "-") },
379
+ { icon: "fa-arrow-down", tone: "text-neon", label: downRate },
380
+ { icon: "fa-arrow-up", tone: "text-lime", label: upRate },
381
+ { icon: "fa-seedling", tone: "text-stone-300", label: escapeHtml(torrent.num_seeds) },
382
+ { icon: "fa-chart-simple", tone: "text-stone-300", label: escapeHtml(torrent.ratio || "-") },
383
+ ];
384
+ const compactMetricMarkup = compactMetrics.map((metric) => `
385
+ <div class="inline-flex items-center gap-2 text-xs text-stone-400">
386
+ <i class="fa-solid ${metric.icon} ${metric.tone} text-[11px]"></i>
387
+ <span class="font-mono ${metric.tone === "text-stone-300" ? "text-stone-300" : metric.tone}">${metric.label}</span>
388
+ </div>
389
+ `).join("");
390
 
391
  return `
392
+ <article class="rounded-[24px] border border-white/10 bg-[linear-gradient(180deg,rgba(17,20,31,0.94),rgba(10,12,19,0.92))] p-4 shadow-[0_10px_26px_rgba(0,0,0,0.18)] transition duration-300 hover:border-neon/30 hover:shadow-[0_0_0_1px_rgba(32,230,192,0.08),0_16px_38px_rgba(0,0,0,0.24)]">
393
  <div class="flex items-start gap-3">
394
+ <div class="mt-0.5 flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl ${statusIconTone}">
395
  <i class="fa-solid ${statusIconName}"></i>
396
  </div>
397
  <div class="min-w-0 flex-1">
398
+ <div class="min-w-0">
399
+ <h3 class="break-words text-[15px] font-semibold leading-6 text-white">${escapeHtml(torrent.name)}</h3>
400
+ <div class="mt-2 flex flex-wrap items-center gap-x-3 gap-y-2">
401
+ <span class="inline-flex items-center gap-2 text-xs ${tone.text}">
402
+ <span class="h-2 w-2 rounded-full ${tone.dot}"></span>${escapeHtml(tone.label)}
403
+ </span>
404
+ ${!isComplete ? `<span class="text-xs text-stone-500">${escapeHtml(torrent.total_size)}</span>` : ""}
405
+ ${activeSpeed}
406
+ ${endpointMeta}
 
 
 
 
 
407
  </div>
408
  </div>
409
  ${statusMessage}
 
420
  </div>
421
  </div>
422
 
423
+ <div class="mt-4 h-px bg-gradient-to-r from-transparent via-white/12 to-transparent"></div>
424
+
425
+ <div class="mt-4 flex flex-wrap items-center gap-x-4 gap-y-3">
426
+ ${compactMetricMarkup}
427
+ ${!isComplete ? `<div class="inline-flex items-center gap-2 text-xs text-stone-400"><i class="fa-regular fa-clock text-[11px] text-stone-300"></i><span class="font-mono text-stone-300">${escapeHtml(torrent.eta)}</span></div>` : ""}
428
+ ${isDownloading || isSeeding ? `<div class="inline-flex items-center gap-2 text-xs text-stone-400"><i class="fa-solid fa-users text-[11px] text-stone-300"></i><span class="font-mono text-stone-300">${escapeHtml(torrent.num_seeds)} / ${escapeHtml(torrent.num_leechs)}</span></div>` : ""}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
429
  </div>
430
 
431
  <div class="mt-4 flex flex-wrap gap-2">${actionButtons(torrent)}</div>