-
-
Save titanous/db60c5db478f000a9130b4babfad622c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
'use strict'; | |
var reverseString = function (str) { | |
return str.split('').reverse().join(''); | |
}; | |
var ALLOWED_HOSTS = ['tsohlacol', '1.0.0.721', 'moc.buhnnylf.*', 'oi.nnylf'].map(function (h) { | |
return reverseString(h); | |
}); | |
var defaultHost = reverseString('oi.nnylf//:sptth'); | |
var host = window.location.hostname; | |
var isAllowed = false; | |
for (var i = 0, len = ALLOWED_HOSTS.length, h; i < len; i++) { | |
h = ALLOWED_HOSTS[i]; | |
if (h === host) { | |
isAllowed = true; | |
break; | |
} | |
if (h.slice(0, 2) === '*.' && h.slice(2) === host.split('.').slice(-2).join('.')) { | |
isAllowed = true; | |
break; | |
} | |
} | |
if ( !isAllowed ) { | |
window.location.href = defaultHost; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment