Web file transfer: send + receive with auto-download
Web client: - Paperclip file upload button in chat bar - Chunked upload: 64KB chunks, SHA-256 integrity - Progress display during send/receive - Auto-download on complete (browser save dialog) - Max 10MB per file WASM: - decrypt_wire_message now returns file_header and file_chunk with type, id, filename, chunk data (hex encoded) Receive flow: - FileHeader: registers pending transfer - FileChunk: stores chunk, shows progress - All chunks received: assembles, triggers blob download Send flow (web→web or web→CLI): - File sent as JSON messages (not bincode, for simplicity) - Receiver handles both JSON and bincode formats Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -448,8 +448,33 @@ pub fn decrypt_wire_message(
|
||||
"receipt_type": rt_str,
|
||||
}).to_string())
|
||||
}
|
||||
WireMessage::FileHeader {
|
||||
id, sender_fingerprint, filename, file_size, total_chunks, sha256,
|
||||
} => {
|
||||
Ok(serde_json::json!({
|
||||
"type": "file_header",
|
||||
"id": id,
|
||||
"sender": sender_fingerprint,
|
||||
"filename": filename,
|
||||
"file_size": file_size,
|
||||
"total_chunks": total_chunks,
|
||||
"sha256": sha256,
|
||||
}).to_string())
|
||||
}
|
||||
WireMessage::FileChunk {
|
||||
id, sender_fingerprint, filename, chunk_index, total_chunks, data,
|
||||
} => {
|
||||
Ok(serde_json::json!({
|
||||
"type": "file_chunk",
|
||||
"id": id,
|
||||
"sender": sender_fingerprint,
|
||||
"filename": filename,
|
||||
"chunk_index": chunk_index,
|
||||
"total_chunks": total_chunks,
|
||||
"data": hex::encode(&data),
|
||||
}).to_string())
|
||||
}
|
||||
_ => {
|
||||
// File transfer messages not yet handled in WASM
|
||||
Ok(serde_json::json!({
|
||||
"type": "unsupported",
|
||||
}).to_string())
|
||||
|
||||
Reference in New Issue
Block a user