Milestone v1 (v2.0.0): Mokosh — Session Capture #1
@@ -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({
|
||||||
|
|||||||
Reference in New Issue
Block a user