# 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/3.0>,

include <tunables/global>

@{name} = {F,f}reetube{,-vue}
@{lib_dirs} = @{lib}/@{name} /opt/@{name} 
@{config_dirs} = @{user_config_dirs}/@{name}
@{cache_dirs} = @{user_cache_dirs}/@{name}

@{exec_path} = @{lib_dirs}/@{name}
profile freetube @{exec_path} {
  include <abstractions/base>
  include <abstractions/audio-client>
  include <abstractions/common/electron>
  include <abstractions/consoles>
  include <abstractions/thumbnails-cache-read>
  include <abstractions/user-download-strict>

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

  @{exec_path} mrix,

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

  /etc/fstab r,
  /etc/machine-id r,
  /var/lib/dbus/machine-id r,

  owner @{run}/user/@{uid}/ r,

  owner /dev/tty@{int} rw,

  include if exists <local/freetube>
}
