git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #126505 from deviant/fix-obs-browser

Fix obs-browser

commit905ab4667c91695f3e6b0933c98665662e47e84a authorAnderson Torres <torres.anderson.85@protonmail.com> dateSat 12 Jun 2021, 22:12 (5 years ago) parent8ca654a40e8cd7
5 files changed+130−20
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/development/libraries/libcef/default.nix+59−19 pkgs/top-level/all-packages.nix+1−1
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 = [
pkgs/development/libraries/libcef/default.nix+59−19
@@ -1,26 +1,66 @@
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
526}:
627
728let
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 {
1756 pname = "cef-binary";
18− version = "75.1.14-gc81164e";
57+ version = "90.6.7";
58+ gitRevision = "19ba721";
59+ chromiumVersion = "90.0.4430.212";
1960
2061 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";
2464 };
2565
2666 nativeBuildInputs = [ cmake ];
@@ -32,7 +72,7 @@ stdenv.mkDerivation rec {
3272 mkdir -p $out/lib/ $out/share/cef/
3373 cp libcef_dll_wrapper/libcef_dll_wrapper.a $out/lib/
3474 cp ../Release/libcef.so $out/lib/
35− patchelf --set-rpath "${libPath}" $out/lib/libcef.so
75+ patchelf --set-rpath "${rpath}" $out/lib/libcef.so
3676 cp ../Release/*.bin $out/share/cef/
3777 cp -r ../Resources/* $out/share/cef/
3878 cp -r ../include $out/
@@ -40,7 +80,7 @@ stdenv.mkDerivation rec {
4080
4181 meta = with lib; {
4282 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";
4484 maintainers = with maintainers; [ puffnfresh ];
4585 license = licenses.bsd3;
4686 platforms = with platforms; linux;
pkgs/top-level/all-packages.nix+1−1
@@ -15926,7 +15926,7 @@ in
1592615926
1592715927 libcec_platform = callPackage ../development/libraries/libcec/platform.nix { };
1592815928
15929− libcef = callPackage ../development/libraries/libcef { inherit (gnome2) GConf; };
15929+ libcef = callPackage ../development/libraries/libcef {};
1593015930
1593115931 libcello = callPackage ../development/libraries/libcello {};
1593215932