Milestone v1 (v2.0.0): Mokosh — Session Capture #1

Merged
strategy155 merged 297 commits from gsd/phase-04-harden-clean-up-optional into main 2026-05-31 15:34:17 +00:00
Showing only changes of commit f8a9c10758 - Show all commits

View File

@@ -1,5 +1,5 @@
import { Logger } from '../shared/logger'; import { Logger } from '../shared/logger';
import { base64ToBlob } from '../shared/binary'; import { base64ToBlob, blobToBase64 } from '../shared/binary';
import type { import type {
Message, Message,
TransferredVideoSegment, TransferredVideoSegment,
@@ -391,14 +391,12 @@ async function downloadArchive(archiveBlob: Blob) {
logger.log(`Downloading archive: ${filename} (${archiveBlob.size} bytes)`); logger.log(`Downloading archive: ${filename} (${archiveBlob.size} bytes)`);
// Конвертируем Blob в Data URL (работает в Service Worker) // WR-08 fix: delegate to the shared `blobToBase64` helper instead of
const arrayBuffer = await archiveBlob.arrayBuffer(); // re-implementing the same per-byte concat + btoa inline. Keeps the
const uint8Array = new Uint8Array(arrayBuffer); // wire-format encoding single-source-of-truth (also used by the
let binary = ''; // offscreen↔SW port; see src/shared/binary.ts) and ensures any future
for (let i = 0; i < uint8Array.length; i++) { // performance work (chunked apply, etc.) propagates to both call sites.
binary += String.fromCharCode(uint8Array[i]); const base64 = await blobToBase64(archiveBlob);
}
const base64 = btoa(binary);
const url = `data:application/zip;base64,${base64}`; const url = `data:application/zip;base64,${base64}`;
await chrome.downloads.download({ await chrome.downloads.download({