Kirby javascript/css access based on user permission

Is there a way to provide conditional access to the so-called ‘media’ files (e.g. javascript/css/image files)?
As it stands currently the (plugin)-routes are not called for ‘media’ files, so how would one restrict direct access to script/css files?

Additional info: I want to expose a few scripts/css files only when a user is logged in.

Any file that is copied to the media folder is publicly accessible. There is no way to restrict access to the media folder. Why is it important to restrict direct access to such files? Do they contain any secrets?

might be, not sure :stuck_out_tongue:.

I know about the ‘assets’ folder mechanics. But that is not what I am after. I basically want to return a different version for a script and/or stylesheet based on the user-permissions (or lack thereof). I can do it differenlty and decide it client-side, but that is a bit messy (since dynamically loading javascript files aint that straight-foreward).