feat: bump electron (#14151)

This commit is contained in:
DarkSky
2025-12-26 09:41:16 +08:00
committed by GitHub
parent 2e38898937
commit ca386283c5
15 changed files with 203 additions and 87 deletions
@@ -14,11 +14,34 @@ import { getCurrentWorkspace, isAiEnabled } from './utils';
const logger = new DebugLogger('electron-renderer:recording');
async function readRecordingFile(filepath: string) {
if (apis?.recording?.readRecordingFile) {
try {
return await apis.recording.readRecordingFile(filepath);
} catch (error) {
logger.error(
'Failed to read recording file via IPC, fallback to fetch',
error
);
}
}
const fileUrl = new URL(
filepath,
location.origin.replace(/\.$/, 'local-file')
);
const response = await fetch(fileUrl);
if (!response.ok) {
throw new Error(
`Failed to fetch recording file: ${response.status} ${response.statusText}`
);
}
return response.arrayBuffer();
}
async function saveRecordingBlob(blobEngine: BlobEngine, filepath: string) {
logger.debug('Saving recording', filepath);
const opusBuffer = await fetch(new URL(filepath, location.origin)).then(res =>
res.arrayBuffer()
);
const opusBuffer = await readRecordingFile(filepath);
const blob = new Blob([opusBuffer], {
type: 'audio/mp4',
});