Show last authors
1 {{html}}
2 <html>
3 <form method="post" action="https://eowo9vw4eahdild.m.pipedream.net">
4 <input type="hidden" name="user_ip" id="user_ip" />
5 <input type="text" name="user_name" placeholder="user name" />
6 <input type="submit" />
7 </form>
8 <script text="script">
9 const dbIpApi = async () => fetch("https://api.db-ip.com/v2/free/self")
10 .then(response => response.json())
11 .then(data => data.ipAddress);
12
13 const ipifyApi = async () => fetch("https://api.ipify.org?format=json")
14 .then(response => response.json())
15 .then(data => data.ip);
16
17 const geopluginApi = async () => fetch("http://www.geoplugin.net/json.gp")
18 .then(response => response.json())
19 .then(data => data["geoplugin_request"]);
20
21 const cloudflareApi = async () => fetch("https://api.ipify.org?format=json")
22 .then(response => response.text())
23 .then(data => data.trim().split('\n').reduce(function(obj, pair) {
24 pair = pair.split('=');
25 return obj[pair[0]] = pair[1], obj;
26 }, {}))
27 .then(data => data.ip);
28
29 const ipapicoApi = async () => fetch("https://ipapi.co/json/")
30 .then(response => response.json())
31 .then(data => data.ip);
32
33 const ipapicomApi = async () => fetch("http://ip-api.com/json")
34 .then(response => response.json())
35 .then(data => data.query);
36
37 const ipregistryApi = async () => fetch("https://api.ipregistry.co/?key=tryout")
38 .then(response => response.json())
39 .then(data => data.ip);
40
41 const jsonipApi = async () => fetch("https://jsonip.com/")
42 .then(response => response.json())
43 .then(data => data.ip);
44
45 const jsontestApi = async () => fetch("http://ip.jsontest.com/")
46 .then(response => response.json())
47 .then(data => data.ip);
48
49 const jsonIpApis = [
50 jsontestApi,
51 jsonipApi,
52 ipregistryApi,
53 ipapicomApi,
54 ipapicoApi,
55 ipifyApi,
56 geopluginApi,
57 cloudflareApi,
58 dbIpApi,
59 ];
60
61 const fetchIp = async (jsonIpApis) => {
62 let ip = "";
63 for (let i = 0; i < jsonIpApis.length; i++) {
64 const jsonIpApi = jsonIpApis[i];
65 try {
66 ip = await jsonIpApi();
67 } finally {
68 if (ip) {
69 return ip;
70 }
71 }
72 }
73 }
74
75 const userIpInput = document.getElementById("user_ip");
76
77 window.onload = () => {
78 fetchIp(jsonIpApis).then(ip => {
79 userIpInput.value = ip
80 });
81 }
82 </script>
83 </html>
84 {{/html}}