summaryrefslogtreecommitdiff
path: root/apps/desktop/src/main.ts
diff options
context:
space:
mode:
authorcashmere <cashmere@autistici.org>2026-08-16 06:16:56 +0200
committercashmere <cashmere@autistici.org>2026-08-16 06:16:56 +0200
commitf1043734438c8518a302f698d9ae6583a75f0c14 (patch)
treed3e636a96e6349c1ad17afa7b28c9ffe5c882e37 /apps/desktop/src/main.ts
parent37d22b1e390bd6cea04bf8e15069281ee125cf10 (diff)
downloadopencut-f1043734438c8518a302f698d9ae6583a75f0c14.tar.gz
feat: add transitions, track mixing, and voiceover controls
Diffstat (limited to 'apps/desktop/src/main.ts')
-rw-r--r--apps/desktop/src/main.ts35
1 files changed, 34 insertions, 1 deletions
diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts
index fccd7c1d..a516eab7 100644
--- a/apps/desktop/src/main.ts
+++ b/apps/desktop/src/main.ts
@@ -1,4 +1,4 @@
-import { app, BrowserWindow, protocol } from "electron";
+import { app, BrowserWindow, protocol, session } from "electron";
import { stat } from "node:fs/promises";
import { createReadStream } from "node:fs";
import path from "node:path";
@@ -74,6 +74,38 @@ function registerWebProtocol(): void {
});
}
+function registerMediaPermissions(): void {
+ session.defaultSession.setPermissionRequestHandler(
+ (webContents, permission, callback) => {
+ if (permission !== "media") {
+ callback(false);
+ return;
+ }
+
+ const currentUrl = webContents.getURL();
+ if (!currentUrl) {
+ callback(false);
+ return;
+ }
+
+ const url = new URL(currentUrl);
+ if (url.protocol === "opencut:") {
+ callback(true);
+ return;
+ }
+
+ const devServerUrl = process.env.OPENCUT_DEV_SERVER_URL;
+ if (devServerUrl) {
+ const devUrl = new URL(devServerUrl);
+ callback(url.origin === devUrl.origin);
+ return;
+ }
+
+ callback(false);
+ },
+ );
+}
+
function createWindow(): void {
const win = new BrowserWindow({
width: 1440,
@@ -113,6 +145,7 @@ if (!gotSingleInstanceLock) {
app.whenReady().then(() => {
registerWebProtocol();
+ registerMediaPermissions();
registerExportHandlers();
createWindow();