Previously, the Chrome Extension Show My IP has been both accepted by utopian.io and Chrome Webstore. Today I have spent some time adding support for using ipify API to get the IP Address. Therefore, the chrome extension supports 5 API servers which makes it more robust.
Chrome Webstore: https://chrome.google.com/webstore/detail/show-my-ip-addresses-exte/opljiobgnagdjikipnagigiacllolpaj
Github: https://github.com/DoctorLai/what-is-my-ip
This commit: https://github.com/DoctorLai/what-is-my-ip/commit/13a5fc8b9074651d36573bae061ae6ed6896134e#diff-77a711c4c2c9fd1e7125ed653dc9e3ab
The code:
function callThirdParty(server, name) {
var api = server;
logit("Connecting " + server + " ...");
$.ajax({
type: "GET",
url: api,
success: function(data) {
if (data && data['ip']) {
current_ip = data['ip'];
$('pre#ip').append(current_ip + "\n");
}
},
error: function(request, status, error) {
logit('Response: ' + request.responseText);
logit('Error: ' + error );
logit('Status: ' + status);
},
complete: function(data) {
logit('API Finished: ' + name + " Server!");
}
});
}
document.addEventListener('DOMContentLoaded', function() {
getLocalIPs(function(ips) { // <!-- ips is an array of local IP addresses.
ipaddress = ips.join('\n');
$('pre#ip2').html(ipaddress);
var manifest = chrome.runtime.getManifest();
logit(manifest.name);
logit("Version: " + manifest.version);
logit("Chrome Version: " + getChromeVersion());
logit("May you do good, not evil.");
callServer("helloacm", "East USA");
callServer("uploadbeta", "UK");
callServer("happyukgo", "Tokyo Japan");
callServer("steakovercooked", "West USA");
callThirdParty("https://api.ipify.org?format=json", "ipify.org");
});
}, false);
It has been also integrated in this online tool to get the IP.
It works!
Proof of Work
doctorlai
is my github ID and you can see my steemit URL listed on my profile page:
Feel free to submit your Pull Requests at: https://github.com/DoctorLai/what-is-my-ip
Posted on Utopian.io - Rewarding Open Source Contributors