about summary refs log tree commit diff
path: root/pkgs/applications/video
diff options
context:
space:
mode:
authorV <v@anomalous.eu>2021-06-10 19:18:46 +0200
committerV <v@anomalous.eu>2021-06-10 19:25:32 +0200
commit40e8cd7214bab9087d5bcb6aba6c31667fb5c78b (patch)
tree7cd8e47c6f72a59688f0aaab8c17c49280c88a9a /pkgs/applications/video
parent41756934db77a275e83d7b03d7a639dc0e76541e (diff)
obs-studio: Fix compilation with latest CEF
Diffstat (limited to 'pkgs/applications/video')
-rw-r--r--pkgs/applications/video/obs-studio/Change-product_version-to-user_agent_product.patch26
-rw-r--r--pkgs/applications/video/obs-studio/Enable-file-access-and-universal-access-for-file-URL.patch36
-rw-r--r--pkgs/applications/video/obs-studio/default.nix8
3 files changed, 70 insertions, 0 deletions
diff --git a/pkgs/applications/video/obs-studio/Change-product_version-to-user_agent_product.patch b/pkgs/applications/video/obs-studio/Change-product_version-to-user_agent_product.patch
new file mode 100644
index 0000000000000..0bc7962486075
--- /dev/null
+++ b/pkgs/applications/video/obs-studio/Change-product_version-to-user_agent_product.patch
@@ -0,0 +1,26 @@
+From 635772c4c5ecf11a0f84e6c9fc273dce6b9a5688 Mon Sep 17 00:00:00 2001
+From: V <v@anomalous.eu>
+Date: Thu, 10 Jun 2021 18:36:22 +0200
+Subject: [PATCH] Change product_version to user_agent_product
+
+This is its name as of CEF 91.1.0.
+---
+ obs-browser-plugin.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/obs-browser-plugin.cpp b/obs-browser-plugin.cpp
+index 1a6a009..5eb379e 100644
+--- a/plugins/obs-browser/obs-browser-plugin.cpp
++++ b/plugins/obs-browser/obs-browser-plugin.cpp
+@@ -298,7 +298,7 @@ static void BrowserInit(void)
+ 	prod_ver << std::to_string(obs_maj) << "." << std::to_string(obs_min)
+ 		 << "." << std::to_string(obs_pat);
+ 
+-	CefString(&settings.product_version) = prod_ver.str();
++	CefString(&settings.user_agent_product) = prod_ver.str();
+ 
+ #ifdef USE_QT_LOOP
+ 	settings.external_message_pump = true;
+-- 
+2.31.1
+
diff --git a/pkgs/applications/video/obs-studio/Enable-file-access-and-universal-access-for-file-URL.patch b/pkgs/applications/video/obs-studio/Enable-file-access-and-universal-access-for-file-URL.patch
new file mode 100644
index 0000000000000..49d01bacbd10b
--- /dev/null
+++ b/pkgs/applications/video/obs-studio/Enable-file-access-and-universal-access-for-file-URL.patch
@@ -0,0 +1,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
+
diff --git a/pkgs/applications/video/obs-studio/default.nix b/pkgs/applications/video/obs-studio/default.nix
index a50fe16660fb1..ff56fa1c0fbc6 100644
--- a/pkgs/applications/video/obs-studio/default.nix
+++ b/pkgs/applications/video/obs-studio/default.nix
@@ -53,6 +53,14 @@ in mkDerivation rec {
     fetchSubmodules = true;
   };
 
+  patches = [
+    # Lets obs-browser build against CEF 90.1.0+
+    ./Enable-file-access-and-universal-access-for-file-URL.patch
+
+    # Lets obs-browser build against CEF 91.1.0+
+    ./Change-product_version-to-user_agent_product.patch
+  ];
+
   nativeBuildInputs = [ addOpenGLRunpath cmake pkg-config ];
 
   buildInputs = [