mirror of
https://github.com/infrost/RaptorQR.git
synced 2026-09-03 16:40:27 +08:00
feat(receiver): remove sessions, add filename/mime, fix gen counter, compact UI
- Removed session tracking entirely; single global decode state - Receiver UI: no sessions table, no big progress bar - Inline stats above video: scanned / useful / need · gen X of Y - Sender passes filename and mimeType to encode worker - Packetizer wraps file payloads with [filenameLen][name][mimeLen][mime] header - Decode worker parses metadata and uses it for download name/type - Fixed generation counter bug: final progress was skipped when reconstruction succeeded; now reportProgress is called right before early return
This commit is contained in:
@@ -14,6 +14,8 @@ interface EncodeInput {
|
||||
data: ArrayBuffer;
|
||||
isText: boolean;
|
||||
compress: boolean;
|
||||
filename?: string;
|
||||
mimeType?: string;
|
||||
}
|
||||
|
||||
interface EncodeOutput {
|
||||
@@ -33,7 +35,7 @@ interface ErrorOutput {
|
||||
message: string;
|
||||
}
|
||||
|
||||
// ─── Worker handler ─────────────────────────────────────────────────────────────────u2500
|
||||
// ─── Worker handler ───────────────────────────────────────────────────────────────────
|
||||
|
||||
self.onmessage = (e: MessageEvent<EncodeInput>) => {
|
||||
const msg = e.data;
|
||||
@@ -52,7 +54,7 @@ self.onmessage = (e: MessageEvent<EncodeInput>) => {
|
||||
|
||||
function handleEncode(input: EncodeInput): EncodeOutput {
|
||||
const originalBytes = new Uint8Array(input.data);
|
||||
const result = packetize(originalBytes, input.isText, input.compress);
|
||||
const result = packetize(originalBytes, input.isText, input.compress, input.filename, input.mimeType);
|
||||
const frames = scheduleFrames(result.packets, result.totalGenerations, result.sessionId);
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user