nixpkgs/pkgs/applications/video/obs-studio/Enable-file-access-and-universal-access-for-file-URL.patch
2024-07-19 12:06:41 -04:00

34 lines
1.3 KiB
Diff

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 09b3017..1094340 100644
--- a/plugins/obs-browser/obs-browser-source.cpp
+++ b/plugins/obs-browser/obs-browser-source.cpp
@@ -239,9 +239,12 @@ bool BrowserSource::CreateBrowser()
#if ENABLE_LOCAL_FILE_URL_SCHEME && CHROME_VERSION_BUILD < 4430
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
auto browser = CefBrowserHost::CreateBrowserSync(