-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
194 lines (146 loc) · 5.38 KB
/
index.html
File metadata and controls
194 lines (146 loc) · 5.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>openalias solver</title>
<link rel="icon" type="image/x-icon" href="favicon.ico">
<script>
const regex = /=(.*?);/;
var a, b, c, indirizzo = [];
function copy(address)
{
// Copy the text inside the text field
navigator.clipboard.writeText(address);
// Alert the copied text
alert("Hai copiato l'indirizzo: " + address);
}
function makeRequest() {
var username = document.getElementById("input1").value;
const url = `https://cloudflare-dns.com/dns-query?name=${username}&type=TXT`;
const headers = {
'Accept': 'application/dns-json'
};
fetch(url, { headers })
.then(response => response.json())
.then(data => {
console.clear();
const txtData = data.Answer[0].data;
a = data.Answer.length;
for (var i = 0; i < a; i++)
{
if (data.Answer[i].data.includes("oa1:"))
{
b = data.Answer[i].data;
c = regex.exec(b);
console.log("i tuoi indirizzi sono: ", b);
const stringa = b;
const inizio = stringa.indexOf("=") + 1; // Trova l'indice di inizio di "42"
const fine = stringa.indexOf(";"); // Trova l'indice di fine di "w" e aggiunge 1
/* vede prof? */ const porzioneStringa = stringa.substring(inizio, fine);
console.log(porzioneStringa); //boono
const crypto1 = stringa.indexOf("oa1:") + 4;
const crypto2 = stringa.indexOf(" recipient_address=") + 1;
/* vede prof? */ const crypto = stringa.substring(crypto1, crypto2);
console.log(crypto);
indirizzo.push({ label: crypto, address: porzioneStringa });
console.log(indirizzo);
}
}undefined
// console.log(txtData);
// console.warn(a);
displayAddresses();
indirizzo = [];
})
.catch(error => console.error(error));
}
function displayAddresses() {
var output = document.getElementById("output");
output.innerHTML = ""; // Resetta il contenuto dell'elemento di output
for (var i = 0; i < indirizzo.length; i++) {
var label = indirizzo[i].label;
var address = indirizzo[i].address;
var addressHTML = `<strong>${label}:</strong> <span class="pippo" onclick="copy('${address}')">${address}</span><br><br>`;
output.innerHTML += addressHTML;
}
}
</script>
<link rel="icon" type="image/x-icon" href="https://openalias.org/favicon.ico">
<style>
body {
text-align: center;
}
mydiv {
text-align: center;
color: #000000;
}
.destra {
text-align: right;
}
.centro {
text-align: center;
}
.class {
width: 40px;
height: 40px;
object-fit: cover;
overflow: hidden;
}
.pippo {
color: orangered
}
.button {
display: inline-block;
padding: 10px 20px;
font-size: 16px;
font-weight: bold;
text-align: center;
text-decoration: none;
border-radius: 5px;
transition: background-color 0.3s ease;
color: #ffffff;
background-color: #ff6600; /* Colore arancione */
border: none;
cursor: pointer;
}
.button:hover {
background-color: #00aaff; /* Colore azzurro */
}
.button:active {
transform: translateY(2px);
}
.button:focus {
outline: none;
box-shadow: 0 0 5px #00aaff; /* Effetto di ombreggiatura quando il bottone è in focus */
}
.input-field {
border: 1px solid #00aaff; /* Colore azzurro */
text-align: center;
}
.input-field:focus {
outline: none;
border-color: #ff6600; /* Colore arancione */
box-shadow: 0 0 5px #ff6600; /* Effetto di ombreggiatura quando l'input è in focus */
}
.title {
font-size: 24px;
font-weight: bold;
color: #ff6600; /* Colore arancione */
margin-bottom: 20px;
}
</style>
</head>
<body>
<header class="destra">
<a href="https://github.com/DuPont9029"><img src="https://raw.githubusercontent.com/DuPont9029/equ2g/main/github.ico" class="class destra"></a>
<h1 class="centro title">OPENSOLVER</h1>
</header> <br> <br>
<form>
<label for="input1">inserisci il tuo openalias:</label> <br> <br>
<input type="text" class="input-field" id="input1"><br> <br>
<button type="button" class="button" onclick="makeRequest()" onsubmit="makeRequest()">invia</button><br> <br>
</form>
<br> <br> <br> <br> <br>
<div id="output">
</div>
</body>
</html>