Skip to content

Create polished demo videos without editing skills. Mac/Windows/Linux

Merge remote-tracking branch 'origin/main' into feat/export-pipeline

webadderalld855fd9a10fb
diff --cc electron/ipc/handlers.ts
index 000c25ef,fc138e34..9e7d56be
--- a/electron/ipc/handlers.ts
+++ b/electron/ipc/handlers.ts
@@@ -167,11 -166,7 +167,18 @@@ let currentProjectPath: string | null
let nativeScreenRecordingActive = false;
let currentVideoPath: string | null = null;
let currentRecordingSession: RecordingSessionData | null = null;
- const userApprovedPaths = new Set<string>();
+ const approvedLocalReadPaths = new Set<string>();
+function approveUserPath(filePath: string | null | undefined) {
- if (!filePath) return
- try { userApprovedPaths.add(path.resolve(filePath)) } catch {}
++ if (!filePath) {
++ return;
++ }
++
++ try {
++ approvedLocalReadPaths.add(path.resolve(filePath));
++ } catch {
++ // Ignore invalid paths; later reads will surface the underlying error.
++ }
+}
let nativeCaptureProcess: ChildProcessWithoutNullStreams | null = null;
let nativeCaptureOutputBuffer = "";
let nativeCaptureTargetPath: string | null = null;
@@@ -636,23 -631,11 +643,26 @@@ async function loadProjectFromPath(proj
currentProjectPath = normalizedPath;
currentVideoPath = mediaSources.videoPath;
- currentRecordingSession = {
- videoPath: mediaSources.videoPath,
- webcamPath: mediaSources.webcamPath,
- timeOffsetMs: 0,
- };
- approveUserPath(mediaSources.videoPath);
- approveUserPath(mediaSources.webcamPath);
-
- // Approve any audio/media tracks referenced in the project
+ const projectObj = project as Record<string, unknown>;
+ const editorObj = projectObj?.editor as Record<string, unknown> | undefined;
+ const audioTracks = editorObj?.audioTracks as { sourcePath?: unknown }[] | undefined;
++ const approvedProjectPaths: Array<string | null | undefined> = [
++ mediaSources.videoPath,
++ mediaSources.webcamPath,
++ ];
+ if (Array.isArray(audioTracks)) {
+ for (const track of audioTracks) {
- if (typeof track?.sourcePath === "string") approveUserPath(track.sourcePath);
++ if (typeof track?.sourcePath === "string") {
++ approvedProjectPaths.push(track.sourcePath);
++ }
+ }
+ }
++ await replaceApprovedSessionLocalReadPaths(approvedProjectPaths);
+ currentRecordingSession = {
+ videoPath: mediaSources.videoPath,
+ webcamPath: mediaSources.webcamPath,
+ timeOffsetMs: 0,
+ };
await rememberRecentProject(normalizedPath);
return {
@@@ -689,16 -675,18 +702,13 @@@ function isPathInsideDirectory(candidat
}
function isAllowedLocalReadPath(candidatePath: string) {
- const allowedPrefixes = [
- RECORDINGS_DIR,
- USER_DATA_PATH,
- getAssetRootPath(),
- app.getPath('temp'),
- ]
- const allowedPrefixes = [
- RECORDINGS_DIR,
- USER_DATA_PATH,
- getAssetRootPath(),
- app.getPath("temp"),
- ];
++ const allowedPrefixes = [RECORDINGS_DIR, USER_DATA_PATH, getAssetRootPath(), app.getPath("temp")];
- return existsSync(candidatePath)
- || allowedPrefixes.some((prefix) => isPathInsideDirectory(candidatePath, prefix))
- || userApprovedPaths.has(candidatePath)
+ return (
+ existsSync(candidatePath) ||
+ allowedPrefixes.some((prefix) => isPathInsideDirectory(candidatePath, prefix)) ||
+ approvedLocalReadPaths.has(candidatePath)
+ );
}
async function rememberApprovedLocalReadPath(filePath?: string | null) {
@@@ -1089,6 -1078,61 +1100,57 @@@ function getNativeWindowListBinaryPath(
return path.join(app.getPath("userData"), "native-tools", "recordly-window-list");
}
+ let nativeHelperMigrationPromise: Promise<void> | null = null;
+
+ async function migrateLegacyNativeHelperBinaries() {
+ const legacyToCurrentPaths: Array<[string, string]> = [
+ [
- path.join(
- app.getPath("userData"),
- "native-tools",
- "openscreen-screencapturekit-helper",
- ),
++ path.join(app.getPath("userData"), "native-tools", "openscreen-screencapturekit-helper"),
+ getNativeCaptureHelperBinaryPath(),
+ ],
+ [
+ path.join(app.getPath("userData"), "native-tools", "openscreen-window-list"),
+ getNativeWindowListBinaryPath(),
+ ],
+ [
+ path.join(app.getPath("userData"), "native-tools", "openscreen-system-cursors"),
+ getSystemCursorHelperBinaryPath(),
+ ],
+ [
+ path.join(app.getPath("userData"), "native-tools", "openscreen-native-cursor-monitor"),
+ getNativeCursorMonitorBinaryPath(),
+ ],
+ ];
+
+ for (const [legacyPath, currentPath] of legacyToCurrentPaths) {
+ if (legacyPath === currentPath || existsSync(currentPath) || !existsSync(legacyPath)) {
+ continue;
+ }
+
+ try {
+ await fs.mkdir(path.dirname(currentPath), { recursive: true });
+ await fs.rename(legacyPath, currentPath);
+ } catch (error) {
+ console.warn("[native-tools] Failed to migrate helper binary", {
+ legacyPath,
+ currentPath,
+ error,
+ });
+ }
+ }
+ }
+
+ async function ensureNativeHelperMigration() {
+ if (!nativeHelperMigrationPromise) {
+ nativeHelperMigrationPromise = migrateLegacyNativeHelperBinaries().catch((error) => {
+ nativeHelperMigrationPromise = null;
+ throw error;
+ });
+ }
+
+ return nativeHelperMigrationPromise;
+ }
+
type NativeMacWindowSource = {
id: string;
name: string;
@@@ -3799,7 -3818,7 +3866,7 @@@ function normalizeHookMouseButton(rawBu
return 1;
}
- function getHookMouseButton(event: HookMouseEvent): 1 | 2 | 3 {
-function getHookMouseButton(event: HookCursorEvent | null | undefined): 1 | 2 | 3 {
++function getHookMouseButton(event: HookMouseEvent | null | undefined): 1 | 2 | 3 {
return normalizeHookMouseButton(
event?.button ?? event?.mouseButton ?? event?.data?.button ?? event?.data?.mouseButton,
);
@@@ -3963,7 -3982,9 +4030,9 @@@ function getNormalizedCursorPoint()
return { cx, cy };
}
- function getHookCursorScreenPoint(event: HookMouseEvent): { x: number; y: number } | null {
+ function getHookCursorScreenPoint(
- event: HookCursorEvent | null | undefined,
++ event: HookMouseEvent | null | undefined,
+ ): { x: number; y: number } | null {
const rawX = event?.x ?? event?.data?.x ?? event?.screenX ?? event?.data?.screenX;
const rawY = event?.y ?? event?.data?.y ?? event?.screenY ?? event?.data?.screenY;