Unverified Commit 301425c6 authored by Ryze312's avatar Ryze312
Browse files

ff2mpv-rust: support Chromium based browsers

parent 0ca719c5
Loading
Loading
Loading
Loading
+32 −2
Original line number Diff line number Diff line
@@ -3,6 +3,24 @@
, fetchFromGitHub
}:

let
  firefoxPaths = [
    "lib/mozilla/native-messaging-hosts"

    # wrapFirefox only links lib/mozilla path, so this is ineffective
    # Still the above path works, despite documentation stating otherwise
    # See: https://librewolf.net/docs/faq/#how-do-i-get-native-messaging-to-work
    # "lib/librewolf/native-messaging-hosts"
  ];

  chromiumPaths = [
    "etc/chromium/native-messaging-hosts"
    "etc/opt/vivaldi/native-messaging-hosts"
    "etc/opt/chrome/native-messaging-hosts"
    "etc/opt/edge/native-messaging-hosts"
  ];
in

rustPlatform.buildRustPackage rec {
  pname = "ff2mpv-rust";
  version = "1.1.2";
@@ -19,8 +37,20 @@ rustPlatform.buildRustPackage rec {
  };

  postInstall = ''
    mkdir -p $out/lib/mozilla/native-messaging-hosts/
    $out/bin/ff2mpv-rust manifest > $out/lib/mozilla/native-messaging-hosts/ff2mpv.json
    $out/bin/ff2mpv-rust manifest > manifest.json
    $out/bin/ff2mpv-rust manifest_chromium > manifest_chromium.json

    for path in ${toString firefoxPaths}
    do
        mkdir -p "$out/$path"
        cp manifest.json "$out/$path/ff2mpv.json"
    done

    for path in ${toString chromiumPaths}
    do
        mkdir -p "$out/$path"
        cp manifest_chromium.json "$out/$path/ff2mpv.json"
    done
  '';

  meta = with lib; {