## Copyright (C) 2025 - 2025 ENCRYPTED SUPPORT LLC <adrelanos@whonix.org>
## See the file COPYING for copying conditions.

## privleap rules for browser-choice. Only applicable to the live ISO. Copied
## to /etc/privleap/conf.d by
## live-config-dist/usr/lib/systemd/system/browser-choice-live.service.

## Allow use of browser-choice without administrator privileges on the live
## ISO, for official browser plugins.

[action:browser-choice-unprivileged-enabled]
Command=true
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

## Code duplication. All (un)installation commands are copied from the plugins
## under browser-choice/usr/share/browser-choice/plugins.
[action:brave-tpdeb-install]
Command=/usr/libexec/browser-choice/qubes-proxy-maybe extrepo enable brave_release && apt-get-noninteractive update && apt-get-noninteractive --no-install-recommends --yes install brave-browser
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:brave-tpdeb-uninstall]
Command=apt-get-noninteractive --yes remove brave-browser
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:brave-tpdeb-purge]
Command=apt-get-noninteractive --yes purge brave-browser
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:brave-flathub-install]
Command=/usr/libexec/browser-choice/qubes-proxy-maybe flatpak install --assumeyes flathub com.brave.Browser
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:brave-flathub-uninstall]
Command=flatpak uninstall --assumeyes com.brave.Browser
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:chromium-deb-update-install]
Command=pkexec apt-get-noninteractive update && apt-get-noninteractive --no-install-recommends --yes install chromium chromium-sandbox
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:chromium-deb-install]
Command=apt-get-noninteractive --no-install-recommends --yes install chromium chromium-sandbox
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:chromium-deb-uninstall]
Command=apt-get-noninteractive --yes remove chromium
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:chromium-deb-purge]
Command=apt-get-noninteractive --yes purge chromium
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:chromium-flathub-install]
Command=flatpak remote-modify --subset= flathub && /usr/libexec/browser-choice/qubes-proxy-maybe flatpak install --assumeyes flathub org.chromium.Chromium
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:chromium-flathub-uninstall]
Command=flatpak uninstall --assumeyes org.chromium.Chromium
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:firefox-deb-update-install]
Command=apt-get-noninteractive update && apt-get-noninteractive --no-install-recommends --yes install firefox-esr
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:firefox-deb-install]
Command=apt-get-noninteractive --no-install-recommends --yes install firefox-esr
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:firefox-deb-uninstall]
Command=apt-get-noninteractive --yes remove firefox-esr
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:firefox-deb-purge]
Command=apt-get-noninteractive --yes purge firefox-esr
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:firefox-tpdeb-install]
Command=/usr/libexec/browser-choice/qubes-proxy-maybe extrepo enable mozilla && apt-get-noninteractive update && apt-get-noninteractive --no-install-recommends --yes install firefox
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:firefox-tpdeb-uninstall]
Command=apt-get-noninteractive --yes remove firefox
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:firefox-tpdeb-purge]
Command=apt-get-noninteractive --yes purge firefox
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:firefox-flathub-install]
Command=/usr/libexec/browser-choice/qubes-proxy-maybe flatpak install --assumeyes flathub org.mozilla.firefox
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:firefox-flathub-uninstall]
Command=flatpak uninstall --assumeyes org.mozilla.firefox
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:mullvad-tpdeb-install]
Command=/usr/libexec/browser-choice/mullvad-browser-install-helper
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:mullvad-tpdeb-uninstall]
Command=apt-get-noninteractive --yes remove mullvad-browser
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:mullvad-tpdeb-purge]
Command=apt-get-noninteractive --yes purge mullvad-browser
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:torbrowser-deb-install]
Command=/usr/libexec/browser-choice/tor-browser-install-helper
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:torbrowser-deb-uninstall]
Command=/usr/libexec/browser-choice/tor-browser-uninstall-helper
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user

[action:torbrowser-deb-purge]
Command=/usr/libexec/browser-choice/tor-browser-purge-helper
AuthorizedGroups=sudo,privleap
AuthorizedUsers=user
