/
script.js
51 lines (41 loc) · 1.29 KB
/
script.js
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
window.addEventListener("load", () => {
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("service-worker.js");
}
});
const LIST_URL = "https://torscan-ru.ntc.party/relays.txt";
const gettor = () => {
return fetch(LIST_URL);
};
const gettor_corsproxy1 = () => {
return fetch(`https://corsanywhere.herokuapp.com/${LIST_URL}`);
};
const gettor_corsproxy2 = () => {
return fetch(`https://tauron.herokuapp.com/${LIST_URL}`);
};
const gettor_corsproxy3 = () => {
return fetch(`https://corsbypasser.herokuapp.com/${LIST_URL}`);
};
const process_data = (result) => {
document.getElementById("working").value = result;
};
const do_everything = (datafunc) => {
return datafunc().then(result => {
return result.text();
}).then(result => {
process_data(result);
});
};
do_everything(gettor)
.catch(error => {
console.log(error);
do_everything(gettor_corsproxy1)
.catch(error => {
console.log(error);
do_everything(gettor_corsproxy2)
.catch(error => {
console.log(error);
do_everything(gettor_corsproxy3);
});
});
});