# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2019-2021 Mikhail Morfikov
# Copyright (C) 2021-2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only

abi <abi/4.0>,

include <tunables/global>

@{name} = {F,f}ree{T,t}ube{,-vue}
@{lib_dirs} = @{lib}/@{name} /opt/@{name}
@{config_dirs} = @{user_config_dirs}/@{name}
@{cache_dirs} = @{user_cache_dirs}/@{name}

@{exec_path} = @{bin}/@{name} @{lib_dirs}/@{name}
profile freetube @{exec_path} flags=(attach_disconnected) {
  include <abstractions/base>
  include <abstractions/audio-client>
  include <abstractions/bus-session>
  include <abstractions/bus/org.freedesktop.ScreenSaver>
  include <abstractions/bus/org.gnome.SessionManager>
  include <abstractions/common/electron>
  include <abstractions/consoles>
  include <abstractions/user-download-strict>

  network inet dgram,
  network inet6 dgram,
  network inet stream,
  network inet6 stream,
  network netlink raw,

  #aa:dbus own bus=session name=org.mpris.MediaPlayer2.freetube path=/org/mpris/MediaPlayer2

  @{exec_path} mrix,

  @{open_path}         rPx -> child-open-strict,

  #aa:stack X xdg-settings
  @{bin}/xdg-settings  rPx -> freetube//&xdg-settings,

  include if exists <local/freetube>
}

# vim:syntax=apparmor
