n1crack / vuefinder

Empower your Vue.js applications with this versatile and customizable file manager component, simplifying file organization and navigation.
https://vuefinder.ozdemir.be
MIT License
259 stars 75 forks source link

Add support for sending headers with previewing items #45

Open n1crack opened 8 months ago

n1crack commented 8 months ago

Currently, the VueFinder file manager's preview feature lacks support for sending custom headers, such as Authorization headers containing JWT tokens, when fetching images or loading videos, previewing pdfs etc..

This limitation arises because the preview feature utilizes straightforward URLs in the tag to display images, which does not allow for the inclusion of headers in the requests.

We can disable the preview feature, if the Authentication header is set. And show only the public links if they are set. This is the easiest solution I think.

If we want to show previews of auth protected items, there are some discussions to look at first:

https://alphahydrae.com/2021/02/how-to-display-an-image-protected-by-header-based-authentication/

https://stackoverflow.com/questions/46642960/authorization-header-in-img-src-link

Btw, out of context, while talking about previews, when displaying folder with a large amount of images like more than 50 or 100, i'm thinking to disable the preview in grid view. It will increase performance.