3
0
Fork 0
forked from mirrors/nixpkgs

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

Fix obs-browser
This commit is contained in:
Anderson Torres 2021-06-12 22:12:18 -03:00 committed by GitHub
commit 905ab4667c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 130 additions and 20 deletions

View file

@ -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

View file

@ -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

View file

@ -53,6 +53,14 @@ in mkDerivation rec {
fetchSubmodules = true; 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 ]; nativeBuildInputs = [ addOpenGLRunpath cmake pkg-config ];
buildInputs = [ buildInputs = [

View file

@ -1,26 +1,66 @@
{ lib, stdenv, fetchurl, cmake, alsa-lib, atk, cairo, cups, dbus, expat, fontconfig { lib, stdenv, fetchurl, cmake
, GConf, gdk-pixbuf, glib, gtk2, libX11, libxcb, libXcomposite, libXcursor , glib
, libXdamage, libXext, libXfixes, libXi, libXrandr, libXrender, libXScrnSaver , nss
, libXtst, nspr, nss, pango, libpulseaudio, systemd, at-spi2-atk, at-spi2-core , nspr
, atk
, at-spi2-atk
, libdrm
, expat
, libxcb
, libxkbcommon
, libX11
, libXcomposite
, libXdamage
, libXext
, libXfixes
, libXrandr
, mesa
, gtk3
, pango
, cairo
, alsa-lib
, dbus
, at-spi2-core
, cups
, libxshmfence
}: }:
let let
libPath = rpath = lib.makeLibraryPath [
lib.makeLibraryPath [ glib
alsa-lib atk cairo cups dbus expat fontconfig GConf gdk-pixbuf glib gtk2 nss
libX11 libxcb libXcomposite libXcursor libXdamage libXext libXfixes libXi nspr
libXrandr libXrender libXScrnSaver libXtst nspr nss pango libpulseaudio atk
systemd at-spi2-core at-spi2-atk at-spi2-atk
]; libdrm
in expat
stdenv.mkDerivation rec { libxcb
libxkbcommon
libX11
libXcomposite
libXdamage
libXext
libXfixes
libXrandr
mesa
gtk3
pango
cairo
alsa-lib
dbus
at-spi2-core
cups
libxshmfence
];
in stdenv.mkDerivation rec {
pname = "cef-binary"; pname = "cef-binary";
version = "75.1.14-gc81164e"; version = "90.6.7";
gitRevision = "19ba721";
chromiumVersion = "90.0.4430.212";
src = fetchurl { src = fetchurl {
name = "cef_binary_75.1.14+gc81164e+chromium-75.0.3770.100_linux64_minimal.tar.bz2"; url = "https://cef-builds.spotifycdn.com/cef_binary_${version}+g${gitRevision}+chromium-${chromiumVersion}_linux64_minimal.tar.bz2";
url = "http://opensource.spotify.com/cefbuilds/cef_binary_75.1.14%2Bgc81164e%2Bchromium-75.0.3770.100_linux64_minimal.tar.bz2"; sha256 = "1ja711x9fdlf21qw1k9xn3lvjc5zsfgnjga1w1r8sysam73jk7xj";
sha256 = "0985b2bx505j0q693hifjgidzb597wqf5idql5aqxs8lfxhc2pgg";
}; };
nativeBuildInputs = [ cmake ]; nativeBuildInputs = [ cmake ];
@ -32,7 +72,7 @@ stdenv.mkDerivation rec {
mkdir -p $out/lib/ $out/share/cef/ mkdir -p $out/lib/ $out/share/cef/
cp libcef_dll_wrapper/libcef_dll_wrapper.a $out/lib/ cp libcef_dll_wrapper/libcef_dll_wrapper.a $out/lib/
cp ../Release/libcef.so $out/lib/ cp ../Release/libcef.so $out/lib/
patchelf --set-rpath "${libPath}" $out/lib/libcef.so patchelf --set-rpath "${rpath}" $out/lib/libcef.so
cp ../Release/*.bin $out/share/cef/ cp ../Release/*.bin $out/share/cef/
cp -r ../Resources/* $out/share/cef/ cp -r ../Resources/* $out/share/cef/
cp -r ../include $out/ cp -r ../include $out/
@ -40,7 +80,7 @@ stdenv.mkDerivation rec {
meta = with lib; { meta = with lib; {
description = "Simple framework for embedding Chromium-based browsers in other applications"; description = "Simple framework for embedding Chromium-based browsers in other applications";
homepage = "http://opensource.spotify.com/cefbuilds/index.html"; homepage = "https://cef-builds.spotifycdn.com/index.html";
maintainers = with maintainers; [ puffnfresh ]; maintainers = with maintainers; [ puffnfresh ];
license = licenses.bsd3; license = licenses.bsd3;
platforms = with platforms; linux; platforms = with platforms; linux;

View file

@ -15926,7 +15926,7 @@ in
libcec_platform = callPackage ../development/libraries/libcec/platform.nix { }; libcec_platform = callPackage ../development/libraries/libcec/platform.nix { };
libcef = callPackage ../development/libraries/libcef { inherit (gnome2) GConf; }; libcef = callPackage ../development/libraries/libcef {};
libcello = callPackage ../development/libraries/libcello {}; libcello = callPackage ../development/libraries/libcello {};