nexus33rd commited on
Commit
6f0d256
·
verified ·
1 Parent(s): a555aa6

Upload 18 files

Browse files
Files changed (2) hide show
  1. app.py +6 -1
  2. templates/index.html +9 -6
app.py CHANGED
@@ -425,9 +425,11 @@ def serialize_torrent(torrent, state_entry: dict | None = None) -> dict:
425
  display_speed_label = "Archive"
426
  else:
427
  display_speed_label = f"{upload_provider} Upload" if gofile_uploading else "Download"
 
428
  if not gofile_uploading and torrent_progress >= 1 and torrent_upspeed > 0:
429
  display_speed = format_speed(torrent_upspeed)
430
  display_speed_label = "Seed Upload"
 
431
 
432
  can_gofile_upload = (
433
  bool(content_path)
@@ -448,6 +450,7 @@ def serialize_torrent(torrent, state_entry: dict | None = None) -> dict:
448
  "upspeed": format_speed(torrent_upspeed),
449
  "display_speed": display_speed,
450
  "display_speed_label": display_speed_label,
 
451
  "progress": display_progress,
452
  "progress_label": progress_label,
453
  "num_seeds": getattr(torrent, "num_seeds", 0),
@@ -485,8 +488,10 @@ def prepare_upload_source(source_path: Path, torrent_hash: str, provider_name: s
485
  if source_path.is_file():
486
  return source_path, False
487
 
488
- archive_name = f"{safe_filename(source_path.name)}-{torrent_hash[:8]}.7z"
489
  archive_path = UPLOAD_DIR / archive_name
 
 
490
 
491
  update_torrent_entry(
492
  torrent_hash,
 
425
  display_speed_label = "Archive"
426
  else:
427
  display_speed_label = f"{upload_provider} Upload" if gofile_uploading else "Download"
428
+ display_speed_meta = f"{gofile_progress}%" if gofile_uploading else ""
429
  if not gofile_uploading and torrent_progress >= 1 and torrent_upspeed > 0:
430
  display_speed = format_speed(torrent_upspeed)
431
  display_speed_label = "Seed Upload"
432
+ display_speed_meta = ""
433
 
434
  can_gofile_upload = (
435
  bool(content_path)
 
450
  "upspeed": format_speed(torrent_upspeed),
451
  "display_speed": display_speed,
452
  "display_speed_label": display_speed_label,
453
+ "display_speed_meta": display_speed_meta,
454
  "progress": display_progress,
455
  "progress_label": progress_label,
456
  "num_seeds": getattr(torrent, "num_seeds", 0),
 
488
  if source_path.is_file():
489
  return source_path, False
490
 
491
+ archive_name = f"{source_path.name}.7z"
492
  archive_path = UPLOAD_DIR / archive_name
493
+ if archive_path.exists():
494
+ archive_path = UPLOAD_DIR / f"{source_path.name}-{torrent_hash[:8]}.7z"
495
 
496
  update_torrent_entry(
497
  torrent_hash,
templates/index.html CHANGED
@@ -67,10 +67,13 @@
67
  </div>
68
  {% endif %}
69
  </div>
70
- <div class="grid grid-cols-2 gap-3 text-sm text-stone-300 sm:block">
71
- <div>{{ torrent.total_size }}</div>
72
  <div class="text-xs uppercase tracking-[0.2em] text-stone-500">{{ torrent.display_speed_label }}</div>
73
- {% if torrent.gofile_uploading %}
 
 
 
74
  <div class="text-sky-300">{{ torrent.display_speed }}</div>
75
  {% else %}
76
  <div class="text-emerald-300">{{ torrent.display_speed }}</div>
@@ -465,7 +468,7 @@
465
  : "";
466
  const progressColor = torrent.gofile_uploading ? "bg-sky-400" : "bg-emerald-400";
467
  const transferSpeed = torrent.display_speed
468
- ? `<div class="text-xs uppercase tracking-[0.2em] text-stone-500">${escapeHtml(torrent.display_speed_label || "Speed")}</div><div class="${torrent.gofile_uploading ? "text-sky-300" : "text-emerald-300"}">${escapeHtml(torrent.display_speed)}</div>`
469
  : "";
470
 
471
  return `
@@ -478,8 +481,8 @@
478
  </div>
479
  ${messageBlock}
480
  </div>
481
- <div class="grid grid-cols-2 gap-3 text-sm text-stone-300 sm:block">
482
- <div>${escapeHtml(torrent.total_size)}</div>
483
  ${transferSpeed}
484
  </div>
485
  </div>
 
67
  </div>
68
  {% endif %}
69
  </div>
70
+ <div class="flex flex-col items-start gap-1 text-sm text-stone-300 sm:items-end">
71
+ <div class="text-stone-200">{{ torrent.total_size }}</div>
72
  <div class="text-xs uppercase tracking-[0.2em] text-stone-500">{{ torrent.display_speed_label }}</div>
73
+ {% if torrent.display_speed_meta %}
74
+ <div class="text-[11px] font-medium uppercase tracking-[0.18em] text-stone-400">{{ torrent.display_speed_meta }}</div>
75
+ {% endif %}
76
+ {% if torrent.gofile_uploading %}
77
  <div class="text-sky-300">{{ torrent.display_speed }}</div>
78
  {% else %}
79
  <div class="text-emerald-300">{{ torrent.display_speed }}</div>
 
468
  : "";
469
  const progressColor = torrent.gofile_uploading ? "bg-sky-400" : "bg-emerald-400";
470
  const transferSpeed = torrent.display_speed
471
+ ? `<div class="text-xs uppercase tracking-[0.2em] text-stone-500">${escapeHtml(torrent.display_speed_label || "Speed")}</div>${torrent.display_speed_meta ? `<div class="text-[11px] font-medium uppercase tracking-[0.18em] text-stone-400">${escapeHtml(torrent.display_speed_meta)}</div>` : ""}<div class="${torrent.gofile_uploading ? "text-sky-300" : "text-emerald-300"}">${escapeHtml(torrent.display_speed)}</div>`
472
  : "";
473
 
474
  return `
 
481
  </div>
482
  ${messageBlock}
483
  </div>
484
+ <div class="flex flex-col items-start gap-1 text-sm text-stone-300 sm:items-end">
485
+ <div class="text-stone-200">${escapeHtml(torrent.total_size)}</div>
486
  ${transferSpeed}
487
  </div>
488
  </div>