Merge pull request #126505 from deviant/fix-obs-browser

Fix obs-browser

authored by

Anderson Torres and committed by
GitHub
905ab466 8ca654a3

+130 -20
+26
pkgs/applications/video/obs-studio/Change-product_version-to-user_agent_product.patch
··· 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 +
+36
pkgs/applications/video/obs-studio/Enable-file-access-and-universal-access-for-file-URL.patch
··· 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 +
+8
pkgs/applications/video/obs-studio/default.nix
··· 53 53 fetchSubmodules = true; 54 54 }; 55 55 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 + 56 64 nativeBuildInputs = [ addOpenGLRunpath cmake pkg-config ]; 57 65 58 66 buildInputs = [
+59 -19
pkgs/development/libraries/libcef/default.nix
··· 1 - { lib, stdenv, fetchurl, cmake, alsa-lib, atk, cairo, cups, dbus, expat, fontconfig 2 - , GConf, gdk-pixbuf, glib, gtk2, libX11, libxcb, libXcomposite, libXcursor 3 - , libXdamage, libXext, libXfixes, libXi, libXrandr, libXrender, libXScrnSaver 4 - , libXtst, nspr, nss, pango, libpulseaudio, systemd, at-spi2-atk, at-spi2-core 1 + { lib, stdenv, fetchurl, cmake 2 + , glib 3 + , nss 4 + , nspr 5 + , atk 6 + , at-spi2-atk 7 + , libdrm 8 + , expat 9 + , libxcb 10 + , libxkbcommon 11 + , libX11 12 + , libXcomposite 13 + , libXdamage 14 + , libXext 15 + , libXfixes 16 + , libXrandr 17 + , mesa 18 + , gtk3 19 + , pango 20 + , cairo 21 + , alsa-lib 22 + , dbus 23 + , at-spi2-core 24 + , cups 25 + , libxshmfence 5 26 }: 6 27 7 28 let 8 - libPath = 9 - lib.makeLibraryPath [ 10 - alsa-lib atk cairo cups dbus expat fontconfig GConf gdk-pixbuf glib gtk2 11 - libX11 libxcb libXcomposite libXcursor libXdamage libXext libXfixes libXi 12 - libXrandr libXrender libXScrnSaver libXtst nspr nss pango libpulseaudio 13 - systemd at-spi2-core at-spi2-atk 14 - ]; 15 - in 16 - stdenv.mkDerivation rec { 29 + rpath = lib.makeLibraryPath [ 30 + glib 31 + nss 32 + nspr 33 + atk 34 + at-spi2-atk 35 + libdrm 36 + expat 37 + libxcb 38 + libxkbcommon 39 + libX11 40 + libXcomposite 41 + libXdamage 42 + libXext 43 + libXfixes 44 + libXrandr 45 + mesa 46 + gtk3 47 + pango 48 + cairo 49 + alsa-lib 50 + dbus 51 + at-spi2-core 52 + cups 53 + libxshmfence 54 + ]; 55 + in stdenv.mkDerivation rec { 17 56 pname = "cef-binary"; 18 - version = "75.1.14-gc81164e"; 57 + version = "90.6.7"; 58 + gitRevision = "19ba721"; 59 + chromiumVersion = "90.0.4430.212"; 19 60 20 61 src = fetchurl { 21 - name = "cef_binary_75.1.14+gc81164e+chromium-75.0.3770.100_linux64_minimal.tar.bz2"; 22 - url = "http://opensource.spotify.com/cefbuilds/cef_binary_75.1.14%2Bgc81164e%2Bchromium-75.0.3770.100_linux64_minimal.tar.bz2"; 23 - sha256 = "0985b2bx505j0q693hifjgidzb597wqf5idql5aqxs8lfxhc2pgg"; 62 + url = "https://cef-builds.spotifycdn.com/cef_binary_${version}+g${gitRevision}+chromium-${chromiumVersion}_linux64_minimal.tar.bz2"; 63 + sha256 = "1ja711x9fdlf21qw1k9xn3lvjc5zsfgnjga1w1r8sysam73jk7xj"; 24 64 }; 25 65 26 66 nativeBuildInputs = [ cmake ]; ··· 32 72 mkdir -p $out/lib/ $out/share/cef/ 33 73 cp libcef_dll_wrapper/libcef_dll_wrapper.a $out/lib/ 34 74 cp ../Release/libcef.so $out/lib/ 35 - patchelf --set-rpath "${libPath}" $out/lib/libcef.so 75 + patchelf --set-rpath "${rpath}" $out/lib/libcef.so 36 76 cp ../Release/*.bin $out/share/cef/ 37 77 cp -r ../Resources/* $out/share/cef/ 38 78 cp -r ../include $out/ ··· 40 80 41 81 meta = with lib; { 42 82 description = "Simple framework for embedding Chromium-based browsers in other applications"; 43 - homepage = "http://opensource.spotify.com/cefbuilds/index.html"; 83 + homepage = "https://cef-builds.spotifycdn.com/index.html"; 44 84 maintainers = with maintainers; [ puffnfresh ]; 45 85 license = licenses.bsd3; 46 86 platforms = with platforms; linux;
+1 -1
pkgs/top-level/all-packages.nix
··· 15926 15926 15927 15927 libcec_platform = callPackage ../development/libraries/libcec/platform.nix { }; 15928 15928 15929 - libcef = callPackage ../development/libraries/libcef { inherit (gnome2) GConf; }; 15929 + libcef = callPackage ../development/libraries/libcef {}; 15930 15930 15931 15931 libcello = callPackage ../development/libraries/libcello {}; 15932 15932