You can do it from the Web panel
Goodies -> Htaccess/WebDAV.
Select the domain you want to protect
Bottom half of screen tick the box for “Forbid linking to files in this dir”, configure the extensions, and any other domains that you want to allowl to link.
Hope this helps