v0.0.16: clickable file download link instead of auto-download

Files now appear as a styled clickable link in chat:
📎 filename.pdf (1.6 KB) from sender
Click to download. No auto-save dialog.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Siavash Sameni
2026-03-27 18:17:33 +04:00
parent ebaf5df671
commit f4eac7b2aa
3 changed files with 13 additions and 15 deletions

View File

@@ -237,7 +237,7 @@ let pollTimer = null;
let ws = null; // WebSocket connection
let wasmReady = false;
const VERSION = '0.0.15';
const VERSION = '0.0.16';
let DEBUG = true; // toggle with /debug command
// ── Receipt tracking ──
@@ -641,16 +641,14 @@ function handleFileChunk(result) {
offset += c.length;
}
// Trigger download
// Show clickable download link
const blob = new Blob([assembled]);
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = pf.filename;
a.click();
URL.revokeObjectURL(url);
addSys('File "' + pf.filename + '" downloaded (' + formatSize(assembled.length) + ')');
const d = document.createElement('div');
d.className = 'msg';
d.innerHTML = '<span class="ts">' + ts() + '</span> &#128206; <a href="' + url + '" download="' + esc(pf.filename) + '" style="color:#67c7eb;background:#0f3460;padding:4px 10px;border-radius:4px;text-decoration:none">' + esc(pf.filename) + ' (' + formatSize(assembled.length) + ')</a> from ' + esc(pf.sender.slice(0,12));
$messages.appendChild(d);
$messages.scrollTop = $messages.scrollHeight;
delete pendingFiles[result.id];
}
}