yonjah / piwigo_privacy

A small script and nginx configuration to increase the privacy of piwigo gallery
GNU General Public License v2.0
20 stars 8 forks source link

Videos don't have derivatives, serve them straight away. #9

Open ghost opened 7 years ago

ghost commented 7 years ago

This PR allows to serve directly the videos instead of trying to create derivates. They would fail to serve videos, since yo don't need either the full resolution permission or a derivative.

yonjah commented 7 years ago

I can see your point. The thing is I took the authorization code from piwigo core action.php. Maybe I missed something, but it doesn't seem like the core code skip this check for any file type. So I don't think it wise to skip it by default. Also your solution in theory will only work with 'mp4' files explicitly (not even MP4) which as common as it might be won't cover all use cases where skipping the derivative process might be necessary. If there is no existing piwigo setting to solve this issue, I would suggest adding a setting - piwigo_privacy_no_derivative which will be array of extensions which does not have derivative and original can be served. The check should verify the extension of the file is exactly as the extension in the list (if user wants both upper case and lower case extension it should add both of them).

Please not that you have a bug in the test which will actually cause it to skip any file unless it starts with '.mp4' which is definitely not what we want.

ghost commented 7 years ago

Thanks for the comments. I like the idea of having that setting to control the extensions that have no derivatives generated. I will rework this code then.