noxify / gridsome-plugin-remote-image

simple plugin to download remote images in gridsome
MIT License
14 stars 16 forks source link

Add configuration options to allow HTTP and download images from local network #19

Closed HCl-not-HCi closed 4 years ago

HCl-not-HCi commented 4 years ago

Hi, I added two new configuration options to the plugin because I needed to download images from a CMS that is located on a host in the local network (whithout using HTTPS). In the current version of the plugin, URLs that contain a private IP address or the hostname "localhost" are ignored, i.e. images are not downloaded. Also, all URLs are rewritten from "http://example.com" to "https://example.com".

So I added these new options:

Property Type Required Default Description
forceHttps Boolean No true Enable/disable rewrite from http to https
downloadFromLocalNetwork Boolean No false Download images from local network (e.g. private ip address or localhost)

The default values are chosen in a way so that the behaviour of the plugin stays the same as before if the options are omitted.

I think other people may run into the same problem, so I created this PR.

noxify commented 4 years ago

Hi,

Thanks for the PR.

Can you please also create a PR for the documentation changes?

You can find the documentation here:

https://github.com/noxify/webstone.info/tree/master/content/documentation/gridsome-plugin-remote-image

HCl-not-HCi commented 4 years ago

I added the options to the Configuration table: https://github.com/noxify/webstone.info/pull/2

noxify commented 4 years ago

Thanks @HCl-not-HCi

noxify commented 4 years ago

@HCl-not-HCi - new version 1.2.0 is now available at npm :)

HCl-not-HCi commented 4 years ago

Thank you :)