FriendsOfFlarum / upload

The file upload extension with insane intelligence for your Flarum forum.
https://discuss.flarum.org/d/4154
MIT License
176 stars 96 forks source link

Feature Request: File Download Template without proxy download and instead using CDN URL #400

Open Petersoj opened 4 months ago

Petersoj commented 4 months ago

The "Default file download template" shows the uploaded filename and size badge embedded within the post which looks great, but it requires that the file be proxy downloaded through PHP so that statistics gathering and hotlink protection can be used. However, if using a CDN URL (like from AWS CloudFront) and hotlink and statistics gathering are disabled, this behavior would be undesirable since the CDN would provide more efficient file downloading capabilities. The "Just URL" template would work fine as it uses the CDN URL, but inserting the plain URL doesn't look as aesthetically pleasing as the filename and size badge embedded within the post. I'm proposing one of the following:

  1. When using the "Default file download template", hotlink and statistics gathering are disabled, and a CDN URL is provided, use the CDN URL to download the file, otherwise proxy download the file through PHP.
  2. Add another download template called "CDN file download template" that behaves the exact same way as "Default file download template", but uses the approach that the "Complete image preview template" uses, that is, no statistics are gathered and hotlink protection is ignored, and the CDN URL is used to download the file.