diachedelic/capacitor-blob-writer

Feature request: Lock plugin server port.

beruic opened this issue · 5 comments

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.

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

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.

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

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

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