git.iko.soy/typeable/nixpkgs
on master help sign in
obs-studio: Fix compilation with latest CEF
commit40e8cd7214bab9087d5bcb6aba6c31667fb5c78b authorV <v@anomalous.eu> dateThu 10 Jun 2021, 19:18 (5 years ago) parent4175693
3 files changed+70
pkgs/applications/video/obs-studio/Change-product_version-to-user_agent_product.patch+26 pkgs/applications/video/obs-studio/Enable-file-access-and-universal-access-for-file-URL.patch+36 pkgs/applications/video/obs-studio/default.nix+8
pkgs/applications/video/obs-studio/Change-product_version-to-user_agent_product.patchnew file+26
@@ -0,0 +1,26 @@
1+From 635772c4c5ecf11a0f84e6c9fc273dce6b9a5688 Mon Sep 17 00:00:00 2001
2+From: V <v@anomalous.eu>
3+Date: Thu, 10 Jun 2021 18:36:22 +0200
4+Subject: [PATCH] Change product_version to user_agent_product
5+
6+This is its name as of CEF 91.1.0.
7+---
8+ obs-browser-plugin.cpp | 2 +-
9+ 1 file changed, 1 insertion(+), 1 deletion(-)
10+
11+diff --git a/obs-browser-plugin.cpp b/obs-browser-plugin.cpp
12+index 1a6a009..5eb379e 100644
13+--- a/plugins/obs-browser/obs-browser-plugin.cpp
14++++ b/plugins/obs-browser/obs-browser-plugin.cpp
15+@@ -298,7 +298,7 @@ static void BrowserInit(void)
16+ prod_ver << std::to_string(obs_maj) << "." << std::to_string(obs_min)
17+ << "." << std::to_string(obs_pat);
18+
19+- CefString(&settings.product_version) = prod_ver.str();
20++ CefString(&settings.user_agent_product) = prod_ver.str();
21+
22+ #ifdef USE_QT_LOOP
23+ settings.external_message_pump = true;
24+--
25+2.31.1
26+
pkgs/applications/video/obs-studio/Enable-file-access-and-universal-access-for-file-URL.patchnew file+36
@@ -0,0 +1,36 @@
1+From 0de0a90f8fe5e1e48fa4ec7aa7c825ef88770f9d Mon Sep 17 00:00:00 2001
2+From: Ryan Foster <RytoEX@gmail.com>
3+Date: Mon, 9 Sep 2019 23:55:02 -0400
4+Subject: [PATCH] Enable file access and universal access for file URLs
5+
6+When loading a local file, instead of disabling CEF's web security,
7+enable file access and universal access for file URLs. This should allow
8+local files to make CORS requests without completely disabling CEF's
9+security model.
10+---
11+ obs-browser-source.cpp | 9 ++++++---
12+ 1 file changed, 6 insertions(+), 3 deletions(-)
13+
14+diff --git a/obs-browser-source.cpp b/obs-browser-source.cpp
15+index ab1181e..c775283 100644
16+--- a/plugins/obs-browser/obs-browser-source.cpp
17++++ b/plugins/obs-browser/obs-browser-source.cpp
18+@@ -179,9 +179,12 @@ bool BrowserSource::CreateBrowser()
19+
20+ #if ENABLE_LOCAL_FILE_URL_SCHEME
21+ if (is_local) {
22+- /* Disable web security for file:// URLs to allow
23+- * local content access to remote APIs */
24+- cefBrowserSettings.web_security = STATE_DISABLED;
25++ /* Enable file access and universal access from file://
26++ * URLs to allow local content access to remote APIs */
27++ cefBrowserSettings.file_access_from_file_urls =
28++ STATE_ENABLED;
29++ cefBrowserSettings.universal_access_from_file_urls =
30++ STATE_ENABLED;
31+ }
32+ #endif
33+
34+--
35+2.31.1
36+
pkgs/applications/video/obs-studio/default.nix+8
@@ -53,6 +53,14 @@ in mkDerivation rec {
5353 fetchSubmodules = true;
5454 };
5555
56+ patches = [
57+ # Lets obs-browser build against CEF 90.1.0+
58+ ./Enable-file-access-and-universal-access-for-file-URL.patch
59+
60+ # Lets obs-browser build against CEF 91.1.0+
61+ ./Change-product_version-to-user_agent_product.patch
62+ ];
63+
5664 nativeBuildInputs = [ addOpenGLRunpath cmake pkg-config ];
5765
5866 buildInputs = [