trannamtrung1st / elFinder.Net.Core

An elFinder backend connector with less magic code and more compatibility. This enables .NET Standard 2.0 projects to easily integrate elFinder functionalities.
Apache License 2.0
12 stars 8 forks source link

Prevent direct access to files from URL #14

Closed benny-adiwijaya closed 3 years ago

benny-adiwijaya commented 3 years ago

Hi,

In your demo project I noticed that user cant access files from url, thats good. I try to create new project with blazor wasm and using this library but cant prevent direct access to files from URL. So, is there any configuration to prevent direct access to files from URL?

trannamtrung1st commented 3 years ago

Hi @benny-adiwijaya , You can move those static files out of the wwwroot folder, and store it somewhere that users can only access via a Controller. Did I understand your question properly?

benny-adiwijaya commented 3 years ago

Allright thats work, thank you

benny-adiwijaya commented 3 years ago

Hi @trannamtrung1st, moving those static files out of the wwwroot folder can prevent direct access to files from URL, unfortunately the preview command is not working. So, how to prevent direct access to files from URL eventhough those static files are inside wwwroot folder just like in your demo project?

trannamtrung1st commented 3 years ago

Hi @benny-adiwijaya , do you have any idea why the preview didn't work?

benny-adiwijaya commented 3 years ago

I think because preview is handled by elFinder client only and not by controller so when I try to preview I get status code 404 not found. Is there any solution?

trannamtrung1st commented 3 years ago

Hi, it seems we need some extra works. I already encapsulated a default behavior in the package elFinder.Net.AspNetCore and released v1.2.6. You can use your own logic since it is not too complicated. Please see the Advanced Demo project. There are some updates in the Startup class and FilesController.

benny-adiwijaya commented 3 years ago

Hi @trannamtrung1st, thank you it works. but with video preview I can't forward or rewind.. can it be fixed?

trannamtrung1st commented 3 years ago

Hi, thanks for pointing that out. According to Microsoft doc, I published a minor release 1.2.6.1 of the AspNetCore package. Just update the package and it will work.