about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/video/obs-studio/Enable-file-access-and-universal-access-for-file-URL.patch
blob: 49d01bacbd10b789de3cc53506231c0291f0e9fa (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From 0de0a90f8fe5e1e48fa4ec7aa7c825ef88770f9d Mon Sep 17 00:00:00 2001
From: Ryan Foster <RytoEX@gmail.com>
Date: Mon, 9 Sep 2019 23:55:02 -0400
Subject: [PATCH] Enable file access and universal access for file URLs

When loading a local file, instead of disabling CEF's web security,
enable file access and universal access for file URLs. This should allow
local files to make CORS requests without completely disabling CEF's
security model.
---
 obs-browser-source.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/obs-browser-source.cpp b/obs-browser-source.cpp
index ab1181e..c775283 100644
--- a/plugins/obs-browser/obs-browser-source.cpp
+++ b/plugins/obs-browser/obs-browser-source.cpp
@@ -179,9 +179,12 @@ bool BrowserSource::CreateBrowser()
 
 #if ENABLE_LOCAL_FILE_URL_SCHEME
 		if (is_local) {
-			/* Disable web security for file:// URLs to allow
-			 * local content access to remote APIs */
-			cefBrowserSettings.web_security = STATE_DISABLED;
+			/* Enable file access and universal access from file://
+			 * URLs to allow local content access to remote APIs */
+			cefBrowserSettings.file_access_from_file_urls =
+				STATE_ENABLED;
+			cefBrowserSettings.universal_access_from_file_urls =
+				STATE_ENABLED;
 		}
 #endif
 
-- 
2.31.1