diachedelic / capacitor-blob-writer

Capacitor plugin to write binary data to the filesystem
MIT License
132 stars 17 forks source link

Feature request: Lock plugin server port. #24

Open beruic opened 3 years ago

beruic commented 3 years ago

I just had a problem with using this plugin because of our apps Content-Security-Policy. I had to add localhost:* to the policy to make the plugin work.

I do not like that I have to allow all ports to make this work, and thus my request is: Add the possibility to lock the server to a specific port. With this possible, the Content-Security-Policy would not need to be so permissive.

diachedelic commented 3 years ago

What if the port is not available on the device? Should it fail and run in fallback mode?

beruic commented 3 years ago

Good question. How about defining an array or range of port numbers so it's predictable? That way, you can set the CSR for these numbers and have the vast majority blocked, while having a good chance of having at least one of them free.

diachedelic commented 3 years ago

For simplicity, I am inclined to let a single port number be specified. If the port is taken, it can run in fallback mode.

beruic commented 3 years ago

As long as you can detect that the port is taken somehow and warn the user, I'm fine with that.

beruic commented 3 years ago

Of course the current behaviour should be available too for those relying on that.