Commit graph

36 commits

Author SHA1 Message Date
a7ab9243c0 feat: SCP probes remote file size via SSH before pull
Runs 'ssh stat -c%s' or 'ls -l' to get total bytes before starting
SCP transfer. Progress bar now shows real percentage and ETA
instead of indeterminate spinner.
2026-07-24 09:48:43 +00:00
6d4066784d ux: show exact auto-shrink target + warning about complex layouts 2026-07-23 13:04:00 +00:00
cd8d86a98c fix: auto-shrink to 10% of virtual size, min 20 GB
Replaces flat 30 GB default with proportional sizing:
- 500 GB → 50 GB, 200 GB → 20 GB, 80 GB → 20 GB
- Less aggressive for large disks, safer for GRUB boot
- Update UI hint and README to reflect new rule
2026-07-23 12:45:32 +00:00
778e929985 refactor: remove browser file upload — download + SCP only
- Removed UploadFile handling, upload-raw endpoint, source type selector
- index.html: single URL input, 'Download & Analyse' button
- session_upload simplified to download-only (aria2c)
- Removed dead code: _check_disk_space, UPLOAD_PROGRESS_INTERVAL,
  MIN_FREE_DISK_GB, UploadFile/File imports
- SCP Pull remains as separate /scp page
2026-07-23 12:33:23 +00:00
d050b8e6ed fix: progress bar min 1% + spinner for first 5% 2026-07-23 11:11:47 +00:00
344b3b189f debug: console.log upload progress events 2026-07-23 11:01:49 +00:00
5f2cb3dc64 fix: show MB during upload for values <100MB, GiB after
0.00008 GiB rounded to 0.0 — looked like no progress. Now shows
'16 MB' → '128 MB' → '0.5 GiB' → '1.9 GiB' as upload progresses.
2026-07-23 10:59:24 +00:00
39cf91cbc4 fix: corrupted event listeners and undefined sessionId from overzealous string replace
The Python replacement script changed ALL 'error' strings to
'pve-alert pve-alert-error', including:
- addEventListener('error', ...) → broken event listener
- data.phase === 'error' → never matched
- sessionId variable definition was lost/doubled

Restored proper event names and phase comparisons.
2026-07-23 10:56:50 +00:00
6db69f434c fix: Clean Up now deletes entire session directory tmp/{guid}/
- Backend cleanup_staging accepts session_id, deletes whole
  STAGING_ROOT/{guid}/ dir when provided
- CleanupRequest model gets session_id field
- Frontend cleanup proxy passes session_id from body
- api_client passes session_id to backend
- reuseImage JS includes session_id in cleanup payload
2026-07-23 10:54:42 +00:00
90bf8e4842 fix: remove unused out_dir from submit_job + Copy flow uses legacy fallback
1. submit_job() was creating empty tmp/out/{vmid}/ dirs via the old
   flat STAGING_OUT path. Removed — _process_job handles this via
   _staging_out() in the session-aware path.

2. Copy (re-convert) flow was hardcoding boot_type=uefi. Now uses
   auto_detect_boot=true with boot_type=legacy as fallback, matching
   the behavior of the original analyze→convert flow.
2026-07-23 10:52:20 +00:00
fc380f7d08 fix: add session_id to copyVM payload (Copy flow was missing it) 2026-07-23 09:51:30 +00:00
63659e4f93 feat: session GUID isolation for multi-user support
Each browser gets a UUID stored in localStorage, set as a cookie,
and attached to every API call. Files go to session-specific dirs:

  /mnt/converter/in/{guid}/    — uploads, downloads, SCP pulls
  /mnt/converter/out/{guid}/   — converted QCOW2s

Changes:
- base.html: generates UUID via crypto.randomUUID(), stores in
  localStorage + cookie, exposes as window.VM_BENCH_SID
- Frontend: all endpoints accept session_id, _staging() helper
  creates session-aware paths on demand
- JavaScript: session_id appended to all FormData, set as
  X-Session-ID header on raw uploads
- Backend models: JobSubmissionRequest.session_id field added
- Provisioner: _staging_in/_staging_out helpers, source path
  resolution uses session-aware directory
- Converter: extract_if_needed skips re-extraction if dir exists
2026-07-23 09:32:16 +00:00
111d0d1331 chore: remove debug console.log from toggleSourceInput 2026-07-23 09:22:06 +00:00
fd4f8744d2 style: light Proxmox VE theme — white panels, blue header, light badges
Rewrote to match actual Proxmox VE light interface:
- #f0f0f0 page background, white panels
- Dark blue header (#1b3a5c) with white text
- Light gray panel headers (#f8f8f8)
- Bootstrap-style alert colors (yellow/blue/green/red)
- Orange accent throughout
2026-07-23 09:21:07 +00:00
272feefd36 debug: add console.log to toggleSourceInput 2026-07-23 09:19:36 +00:00
b2dbfe81f9 fix: custom select dropdown arrow visible on dark background
Native browser select arrows don't adapt to dark backgrounds.
Added appearance:none with a light SVG chevron via background-image.
2026-07-23 09:17:42 +00:00
4bebbd9da9 fix: add cache-busting ?v=2 to CSS link (nginx was caching old stylesheet) 2026-07-23 09:11:28 +00:00
844d86c105 style: Proxmox VE-inspired dark theme — pve-* class naming
Rewrote proxmox.css with consistent pve- prefix matching the Proxmox
VE design language: panels with orange-accent headers, clean tables,
orange progress bars, green/red/orange badges, subtle shadows.

Updated all templates (base, index, _analysis, polling, scp)
to use pve-btn, pve-input, pve-select, pve-panel, pve-progress,
pve-badge, pve-alert, pve-spinner, pve-hidden, pve-dim, etc.
2026-07-23 09:09:29 +00:00
492924f346 fix: remove dangling } from regex cleanup of submitReuse 2026-07-23 09:05:11 +00:00
9eb0f15261 feat: Clone (qm clone) + Copy (re-convert) buttons on completion
After conversion completes, the user sees a form with VM Name and ID
prefilled, and three buttons:

- Clone (instant): qm clone --full via backend, takes seconds
- Copy (re-convert): shows CPU/RAM/Disk fields, re-runs full pipeline
- Clean Up & Finish: deletes staging, returns to start page

Backend: new /api/v1/clone endpoint → provisioner.clone_vm()
Frontend: new /session/clone proxy, api_client.clone_vm()
2026-07-23 09:02:57 +00:00
7e1303a217 fix: auto-detect BIOS boot type + simplified reuse form
1. BIOS: provisioner now calls detect_efi() on the first disk when
   auto_detect_boot=true. Detects EFI partition via guestfish.
   Falls back to user's boot_type if detection inconclusive.

2. Reuse: 'Create Another VM' now shows an inline form asking only
   for VM Name and ID, reusing the same disk image, format, and
   boot settings from the completed job. No redirect needed.
2026-07-23 08:48:31 +00:00
334883dd26 fix: show download progress bar percentage when content_length is known
Previously always showed indeterminate spinner (pct=0) because
total size was unknown. Now if the HEAD request returns
Content-Length, the progress bar fills proportionally.
2026-07-23 08:12:21 +00:00
c31ad3409a fix: restore missing progress bar width update in setPhase + cleanup debug logs
The fill.style.width = pct + '%' line was lost during a previous edit,
so the progress bar element was found but never visually updated.
Events fired, label updated, but bar stayed at 0%.
2026-07-22 11:49:08 +00:00
0f69e725a5 debug: add progress/loadstart console.logs 2026-07-22 09:16:12 +00:00
4428d91feb debug: add console.log to handleUpload entry point 2026-07-22 09:10:54 +00:00
f3477dc23b fix: raw streaming upload endpoint — bypasses multipart parser for large files
Starlette's multipart parser (pure Python) is too slow for >1 GB uploads —
boundary scanning over gigabytes blocks the event loop indefinitely.

New /session/upload-raw endpoint:
- Receives raw binary body via request.stream() — no parsing overhead
- Metadata (filename, vmid, vm_name) passed in HTTP headers
- Async chunked write directly to staging — true zero-copy streaming
- Same progress logging as before

Frontend now sends File object directly via xhr.send(file)
instead of FormData — eliminates multipart encoding on the client too.
2026-07-22 09:02:05 +00:00
837e674195 feat: SCP Pull page for large files from remote servers
New /scp page with form for host, user, password, remote path.
Runs scp via sshpass in background with progress polling.
Files go to /mnt/converter/in/{session_id}/ for multi-user isolation.

- Added sshpass + openssh-client to frontend installer
- scp.html template with full form + progress bar
- POST /scp/start — launches background SCP via sshpass -e
- GET /scp/progress/{sid}/{file} — polls file size + speed
- 'SCP Pull (+10 GB)' button on start page
2026-07-22 05:52:01 +00:00
1183059d8b fix: add no-cache headers + remove debug console.logs
- Cache-Control/Pragma/Expires headers prevent browser caching
  of JS-heavy pages (fixes stale code after updates)
- Removed debug console.log statements from upload handlers
2026-07-22 05:24:21 +00:00
6519fc1cf7 fix: use permanent DOM elements for progress instead of innerHTML reset
innerHTML reset in startSession was destroying #phase-label and
#progress-fill elements, then recreating them with same IDs. XHR
progress events fired asynchronously but getElementById might
return stale references or fail during the DOM update window.

Now #phase-label, #progress-fill, and #session-error are permanent
elements in the static HTML. startSession clears them via
textContent/style instead of innerHTML — no DOM destruction.
showError appends to #session-error instead of #session-status.
2026-07-22 05:19:13 +00:00
f032c546e1 debug: add console.log to upload handlers to diagnose missing progress 2026-07-21 19:46:08 +00:00
5ff0635aa5 fix: show upload phase immediately + fallback for non-computable progress
Added loadstart handler to show 'Uploading...' spinner as soon as
upload begins, plus fallback label when lengthComputable is false
(shows bytes uploaded even without percentage).
2026-07-21 19:43:04 +00:00
989807f29e fix: innerHTML script execution bug — confirm form and polling now work
Root cause: innerHTML does not execute <script> tags in modern browsers.
The _analysis.html and polling.html fragments had inline <script> blocks
that were silently dropped, causing:
- Confirm form's submitJob() undefined → form submitted as normal GET
  back to '/' (user saw 'New Conversion Session' instead of polling)
- Polling page's poll() never started → stuck on 'Waiting for backend...'

Fix:
- Stripped all <script> tags from _analysis.html and polling.html
- Moved all JS logic into index.html (executed on page load)
- initConfirmForm() attaches submit/change listeners after analysis HTML
  is injected via innerHTML
- initPolling() attaches poll timer + reuse button handlers after
  polling fragment is injected
- Polling fragment replaces step1/analysis content while keeping
  base.html header/footer intact
- Reuse buttons now use onclick attached via JS (not inline)
2026-07-21 18:43:16 +00:00
af26da7b64 feat: two-phase upload/download with real-time progress + smart speed timeout
Split monolithic /session/start into two endpoints:
- POST /session/upload  — phase 1: file acquisition only, returns JSON
- POST /session/analyze — phase 2: backend analysis, returns HTML
- GET  /session/progress/{filename} — poll download progress

Uploads:
- Browser-native progress bar via XMLHttpRequest (real % + GiB)

Downloads:
- wget runs in background (Popen), frontend polls /session/progress
- HEAD request gets Content-Length before download starts
- Real-time speed (MB/s) and ETA displayed in the UI
- Smart timeout: after 30s, if ETA > 1 hour, kills download and
  suggests manual download to laptop + File Upload instead
- Absolute safety net at 4 hours

UI: clear phase transitions — 'Downloading... 2.3 GiB (4.5 MB/s) ~12 min'
→ 'Step 2/2: Analysing source image...' → result
2026-07-21 18:10:52 +00:00
509eb97b57 fix: large-file support + user-defined VM name
Large-file handling:
- Set TMPDIR=/mnt/converter/in in service to spool uploads to
  shared storage instead of 24 GB LXC rootfs (critical for >24GB)
- Chunked upload streaming (8 MiB) with progress logging every 1 GiB
- Pre-flight disk space check via Content-Length header
- Clean up partial files on upload/download failure
- Download timeout extended to 7200s (2 hours) for 88 GB images
- Switched wget from --show-progress to --progress=dot:giga
  (compact output, won't fill memory on large transfers)
- uvicorn --timeout-keep-alive 300 on both frontend and backend

VM name:
- Added vm_name field to initial session form (step 1)
- Falls back to auto-generated 'os_type-vmid' if left blank
- Pre-filled & editable in confirm form (step 2)
2026-07-21 17:59:31 +00:00
6bcb68c552 chore: VM ID range 21000-21100, network default vmbr0, target_storage default local-lvm 2026-07-21 16:50:40 +00:00
a8099f504c chore: initial commit — vm-bench frontend + backend 2026-07-21 14:53:29 +00:00