diff --git a/docs/privacy.md b/docs/privacy.md index 05c44c97d7..1c150e5092 100644 --- a/docs/privacy.md +++ b/docs/privacy.md @@ -118,9 +118,10 @@ Dashy supports [Widgets](/docs/widgets.md) for displaying dynamic content. Below - [OWM Privacy Policy](https://openweather.co.uk/privacy-policy) - **[RSS Feed](/docs/widgets.md#rss-feed)**: `https://api.rss2json.com/v1/api.json` - [Rss2Json Privacy Policy](https://rss2json.com/privacy-policy) -- **[IP Address](/docs/widgets.md#public-ip)**: `https://ipapi.co/json` or `http://ip-api.com/json` +- **[IP Address](/docs/widgets.md#public-ip)**: `https://ipapi.co/json` or `http://ip-api.com/json` or `https://api.ip2location.io/` - [IPGeoLocation Privacy Policy](https://ipgeolocation.io/privacy.html) - [IP-API Privacy Policy](https://ip-api.com/docs/legal) + - [IP2Location.io Privacy Policy](https://ip2location.io/privacy-policy) - **[IP Blacklist](/docs/widgets.md#ip-blacklist)**: `https://api.blacklistchecker.com` - [Blacklist Checker Privacy Policy](https://blacklistchecker.com/privacy) - **[Domain Monitor](/docs/widgets.md#domain-monitor)**: `http://api.whoapi.com` diff --git a/docs/widgets.md b/docs/widgets.md index a657693a6c..c66fa521db 100644 --- a/docs/widgets.md +++ b/docs/widgets.md @@ -287,7 +287,7 @@ Unless image fetched from remote source, no external data request is made. ### Public IP -Often find yourself searching "What's my IP", just so you can check your VPN is still connected? This widget displays your public IP address, along with ISP name and approx location. Data can be fetched from either [IpApi.co](https://ipapi.co/), [IP-API.com](https://ip-api.com/) or [IpGeolocation.io](https://ipgeolocation.io/). +Often find yourself searching "What's my IP", just so you can check your VPN is still connected? This widget displays your public IP address, along with ISP name and approx location. Data can be fetched from either [IpApi.co](https://ipapi.co/), [IP-API.com](https://ip-api.com/), [IpGeolocation.io](https://ipgeolocation.io/) or [IP2Location.io](https://ip2location.io/).
@@ -297,8 +297,8 @@ _All fields are optional._ **Field** | **Type** | **Required** | **Description** --- | --- | --- | --- -**`provider`** | `string` | _Optional_ | The name of the service to fetch IP address from. Can be either `ipapi.co`, `ip-api` or `ipgeolocation`. Defaults to `ipapi.co`. Note, `ip-api` doesn't work on HTTPS, and if you set to `ipgeolocation` then you must also provide an API key -**`apiKey`** | `string` | _Optional_ | Only required if provider is set to `ipgeolocation`. You can get a free API key [here](https://ipgeolocation.io/signup.html) +**`provider`** | `string` | _Optional_ | The name of the service to fetch IP address from. Can be either `ipapi.co`, `ip-api`, `ipgeolocation` or `ip2location.io`. Defaults to `ipapi.co`. Note, `ip-api` doesn't work on HTTPS, and if you set to `ipgeolocation` or `ip2location.io` then you must also provide an API key +**`apiKey`** | `string` | _Optional_ | Only required if provider is set to `ipgeolocation` or `ip2location.io`. You can get a free IPGeolocation API key [here](https://ipgeolocation.io/signup.html) or a free IP2Location.io API key [here](https://ip2location.io/pricing) #### Example @@ -321,7 +321,7 @@ Or - **Auth**: 🟠Optional - **Price**: 🟢 Free - **Host**: Managed Instance Only -- **Privacy**: _See [IPGeoLocation Privacy Policy](https://ipgeolocation.io/privacy.html) or [IP-API Privacy Policy](https://ip-api.com/docs/legal)_ +- **Privacy**: _See [IPGeoLocation Privacy Policy](https://ipgeolocation.io/privacy.html) or [IP-API Privacy Policy](https://ip-api.com/docs/legal) or [IP2Location.io Privacy Policy](https://ip2location.io/privacy-policy) --- diff --git a/src/components/Widgets/PublicIp.vue b/src/components/Widgets/PublicIp.vue index 8a188974a3..a3a31510dc 100644 --- a/src/components/Widgets/PublicIp.vue +++ b/src/components/Widgets/PublicIp.vue @@ -24,6 +24,8 @@ export default { endpoint() { if (this.provider === 'ipgeolocation') { return `${widgetApiEndpoints.publicIp2}?apiKey=${this.apiKey}`; + } else if (this.provider === 'ip2location.io') { + return `${widgetApiEndpoints.publicIp4}?key=${this.apiKey}`; } else if (this.provider === 'ipapi') { return widgetApiEndpoints.publicIp3; } @@ -31,10 +33,11 @@ export default { }, apiKey() { if (this.provider === 'ipgeolocation' && !this.options.apiKey) this.error('Missing API Key'); + if (this.provider === 'ip2location.io' && !this.options.apiKey) this.error('Missing API Key'); return this.options.apiKey; }, provider() { - // Can be either `ip-api`, `ipapi.co` or `ipgeolocation` + // Can be either `ip-api`, `ipapi.co`, `ipgeolocation` or `ip2location.io` return this.parseAsEnvVar(this.options.provider) || 'ipapi.co'; }, }, @@ -72,6 +75,12 @@ export default { this.location = `${ipInfo.city}, ${ipInfo.regionName}`; this.flagImg = getCountryFlag(ipInfo.countryCode); this.mapsUrl = getMapUrl({ lat: ipInfo.lat, lon: ipInfo.lon }); + } else if (this.provider === 'ip2location.io') { + this.ipAddr = ipInfo.ip; + this.ispName = ipInfo.isp || 'IP2Location.io Starter plan or higher required.'; + this.location = `${ipInfo.city_name}, ${ipInfo.region_name}`; + this.flagImg = getCountryFlag(ipInfo.country_code); + this.mapsUrl = getMapUrl({ lat: ipInfo.latitude, lon: ipInfo.longitude }); } else { this.error('Unknown API provider fo IP address'); } diff --git a/src/utils/defaults.js b/src/utils/defaults.js index f952a18b54..e1918bed89 100644 --- a/src/utils/defaults.js +++ b/src/utils/defaults.js @@ -244,6 +244,7 @@ module.exports = { publicIp: 'https://ipapi.co/json', publicIp2: 'https://api.ipgeolocation.io/ipgeo', publicIp3: 'http://ip-api.com/json', + publicIp4: 'https://api.ip2location.io/', readMeStats: 'https://github-readme-stats.vercel.app/api', rescueTime: 'https://www.rescuetime.com/anapi/data', rssToJson: 'https://api.rss2json.com/v1/api.json',