Move most Mac related code to a separate file, don't even load it unless web UI is run under macOS.
Attach a file by drag & drop or click to upload