nexus33rd commited on
Commit
614e0d0
·
verified ·
1 Parent(s): a0378d8

Upload 18 files

Browse files
Files changed (3) hide show
  1. README.md +1 -1
  2. app.py +7 -5
  3. templates/index.html +2 -2
README.md CHANGED
@@ -19,7 +19,7 @@ Fitur utama:
19
  - pause, resume, delete
20
  - auto cancel untuk torrent stuck
21
  - upload file atau folder hasil torrent ke GoFile atau PixelDrain
22
- mode folder: ZIP dengan 7-Zip atau raw files melalui modal pilihan
23
  - panel ringkasan server dan speedtest
24
 
25
  ## Jalankan Dengan Docker
 
19
  - pause, resume, delete
20
  - auto cancel untuk torrent stuck
21
  - upload file atau folder hasil torrent ke GoFile atau PixelDrain
22
+ mode folder: archive `.7z` dengan 7-Zip atau raw files melalui modal pilihan
23
  - panel ringkasan server dan speedtest
24
 
25
  ## Jalankan Dengan Docker
app.py CHANGED
@@ -485,7 +485,7 @@ 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]}.zip"
489
  archive_path = UPLOAD_DIR / archive_name
490
 
491
  update_torrent_entry(
@@ -499,7 +499,7 @@ def prepare_upload_source(source_path: Path, torrent_hash: str, provider_name: s
499
  )
500
 
501
  process = subprocess.Popen(
502
- ["7z", "a", "-tzip", "-mx=5", "-bsp1", str(archive_path), source_path.name],
503
  cwd=str(source_path.parent),
504
  stdout=subprocess.PIPE,
505
  stderr=subprocess.STDOUT,
@@ -578,7 +578,7 @@ def upload_folder_raw_gofile(torrent_hash: str, source_path: Path) -> tuple[str,
578
  )
579
 
580
  with file_path.open("rb") as handle:
581
- files = {"file": (flatten_relative_name(relative_path), handle)}
582
  data: dict[str, str] = {}
583
  headers = {}
584
  if folder_id:
@@ -637,7 +637,7 @@ def upload_folder_raw_pixeldrain(torrent_hash: str, source_path: Path) -> str:
637
  )
638
 
639
  with file_path.open("rb") as handle:
640
- encoded_name = quote(flatten_relative_name(relative_path), safe="")
641
  response = requests.put(
642
  f"{PIXELDRAIN_API_URL}/file/{encoded_name}",
643
  data=handle,
@@ -1583,9 +1583,11 @@ def cancel_gofile_upload(torrent_hash: str):
1583
 
1584
  provider = entry.get("gofile_provider", "upload")
1585
  entry["gofile_cancel_requested"] = True
1586
- entry["status_message"] = "Membatalkan upload GoFile..."
1587
  save_monitor_state(state)
1588
  cancel_upload_process(int(entry.get("gofile_pid", 0) or 0))
 
 
1589
  return action_response(f"Pembatalan upload {provider} diproses.")
1590
 
1591
 
 
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(
 
499
  )
500
 
501
  process = subprocess.Popen(
502
+ ["7z", "a", "-t7z", "-mx=5", "-ms=off", "-bsp1", str(archive_path), source_path.name],
503
  cwd=str(source_path.parent),
504
  stdout=subprocess.PIPE,
505
  stderr=subprocess.STDOUT,
 
578
  )
579
 
580
  with file_path.open("rb") as handle:
581
+ files = {"file": (relative_path.as_posix(), handle)}
582
  data: dict[str, str] = {}
583
  headers = {}
584
  if folder_id:
 
637
  )
638
 
639
  with file_path.open("rb") as handle:
640
+ encoded_name = quote(relative_path.name, safe="")
641
  response = requests.put(
642
  f"{PIXELDRAIN_API_URL}/file/{encoded_name}",
643
  data=handle,
 
1583
 
1584
  provider = entry.get("gofile_provider", "upload")
1585
  entry["gofile_cancel_requested"] = True
1586
+ entry["status_message"] = "Membatalkan proses berjalan..."
1587
  save_monitor_state(state)
1588
  cancel_upload_process(int(entry.get("gofile_pid", 0) or 0))
1589
+ if provider == "Archiving":
1590
+ return action_response("Pembatalan proses archive diproses.")
1591
  return action_response(f"Pembatalan upload {provider} diproses.")
1592
 
1593
 
templates/index.html CHANGED
@@ -302,8 +302,8 @@
302
  <p id="folder-upload-text" class="mt-4 text-sm text-stone-300"></p>
303
  <div class="mt-5 grid gap-3">
304
  <button type="button" data-upload-mode="zip" class="folder-upload-choice rounded-2xl border border-emerald-400/30 bg-emerald-400/10 px-4 py-4 text-left transition hover:bg-emerald-400/20">
305
- <span class="block text-sm font-semibold text-emerald-100"><i class="fa-solid fa-file-zipper mr-2"></i>ZIP with 7-Zip</span>
306
- <span class="mt-1 block text-xs text-emerald-50/80">Direkomendasikan. Struktur folder tetap utuh dan upload lebih konsisten.</span>
307
  </button>
308
  <button type="button" data-upload-mode="raw" class="folder-upload-choice rounded-2xl border border-white/10 bg-white/5 px-4 py-4 text-left transition hover:bg-white/10">
309
  <span class="block text-sm font-semibold text-white"><i class="fa-solid fa-folder-tree mr-2"></i>Raw Files</span>
 
302
  <p id="folder-upload-text" class="mt-4 text-sm text-stone-300"></p>
303
  <div class="mt-5 grid gap-3">
304
  <button type="button" data-upload-mode="zip" class="folder-upload-choice rounded-2xl border border-emerald-400/30 bg-emerald-400/10 px-4 py-4 text-left transition hover:bg-emerald-400/20">
305
+ <span class="block text-sm font-semibold text-emerald-100"><i class="fa-solid fa-file-zipper mr-2"></i>Archive with 7-Zip</span>
306
+ <span class="mt-1 block text-xs text-emerald-50/80">Direkomendasikan. Struktur folder tetap utuh dalam satu file arsip `.7z`.</span>
307
  </button>
308
  <button type="button" data-upload-mode="raw" class="folder-upload-choice rounded-2xl border border-white/10 bg-white/5 px-4 py-4 text-left transition hover:bg-white/10">
309
  <span class="block text-sm font-semibold text-white"><i class="fa-solid fa-folder-tree mr-2"></i>Raw Files</span>