#4 Add workaround for evil websites for Firefox
Merged 4 months ago by ngompa. Opened 4 months ago by marcan.
fedora-asahi/ marcan/asahi-platform-metapackage firefox-hack  into  main

@@ -1,16 +1,20 @@ 

+ # This package does not have anything to compile and have debug symbols

+ %global debug_package %{nil}

+ 

  Name:           asahi-platform-metapackage

  Version:        0

- Release:        7%{?dist}

+ Release:        8%{?dist}

  Summary:        Metapackage declaring Asahi platform dependencies

  Group:          Metapackages

  License:        MIT

  URL:            https://pagure.io/fedora-asahi/asahi-platform-metapackage

- BuildArch:      noarch

+ ExclusiveArch:  aarch64

  

  BuildRequires:  systemd-rpm-macros

  Requires:       %{name}-core = %{version}-%{release}

  Requires:       (%{name}-audio = %{version}-%{release} if pipewire)

  Requires:       (%{name}-plasma = %{version}-%{release} if plasma-desktop)

+ Requires:       (%{name}-firefox = %{version}-%{release} if firefox)

  %dnl If/when we have desktop subpackages or whatever, we can make them

  %dnl conditional dependencies with the following format:

  %dnl Requires:       (%{name}-desktop-<variant> = %{version}-%{release} if <desktop-main-package>)
@@ -79,6 +83,18 @@ 

  

  %dnl -------------------------------------------------------------------

  

+ %package firefox

+ Summary:        Metapackage declaring Firefox support Asahi platform dependencies

+ %dnl No deps at this time, just a UA hack because YouTube is stupid

+ 

+ %description firefox

+ This package declares the Firefox dependencies for the Asahi platform.

+ 

+ %files firefox

+ %{_libdir}/firefox/defaults/pref/asahi.js

+ 

+ %dnl -------------------------------------------------------------------

+ 

  %prep

  %dnl Nothing to do

  
@@ -95,7 +111,16 @@ 

  mkdir -p %{buildroot}%{_environmentdir}

  echo 'KWIN_FORCE_SW_CURSOR=1' > %{buildroot}%{_environmentdir}/50-asahi-plasma.conf

  

+ # Workaround for YouTube evil:

+ # https://bugzilla.mozilla.org/show_bug.cgi?id=1869521

+ mkdir -p %{buildroot}%{_libdir}/firefox/defaults/pref

+ echo 'pref("general.useragent.override", "Mozilla/5.0 (X11; Linux x86_64; rv:120.0) Gecko/20100101 Firefox/120.0");' \

+     > %{buildroot}%{_libdir}/firefox/defaults/pref/asahi.js

+ 

  %changelog

+ * Tue Dec 12 2023 Hector Martin <marcan@fedoraproject.org>

+ - Add firefox subpackage with UA hack to work around evil websites

+ 

  * Mon Dec 11 2023 Davide Cavalca <dcavalca@fedoraproject.org>

  - Pull in widevine-installer if we have a supported browser

  

no initial comment

We need to drop BuildArch: noarch now, since this is an arch-dependent path. Replace BuildArch: noarch with ExclusiveArch: aarch64.

Do that and add the following to the top of the spec:

# This package does not have anything to compile and have debug symbols
%global debug_package %{nil}

This needs to be rebased as it conflicts with mainline now.

I think that the override should rather be added somewhere like https://searchfox.org/mozilla-central/source/browser/extensions/webcompat/data/ua_overrides.js

As far as I'm concerned there is no legitimate reason to be sniffing architecture, and both Firefox Mac and Windows pretend to be x86 always, as does Chromium. Hence, I'd much rather spoof it across the board. It's not just YouTube, I've already gotten reports of other sites doing stupid stuff for ARM64.

rebased onto 23fea43

4 months ago

Pull-Request has been merged by ngompa

4 months ago
Metadata