show message if user tries to open .onion as onionr site

This commit is contained in:
Kevin Froman 2020-08-23 06:29:40 -05:00
parent 68aac2153b
commit e19e23022b
2 changed files with 8 additions and 2 deletions

View File

@ -34,7 +34,7 @@ var getRecent = function(){
if (existing.includes(key)){ if (existing.includes(key)){
return return
} }
existing = key + " - " + value + "\n" + existing existing = "\n" + key + " - " + value + "\n" + existing
}) })
document.getElementsByClassName('recentBlockList')[0].innerText = existing document.getElementsByClassName('recentBlockList')[0].innerText = existing
console.debug(data) console.debug(data)

View File

@ -25,7 +25,13 @@ function checkHex(str) {
} }
document.getElementById('openSite').onclick = function(){ document.getElementById('openSite').onclick = function(){
var hash = document.getElementById('siteViewer').value var hash = document.getElementById('siteViewer').value.trim()
if (hash.includes('.onion')){
PNotify.notice({
text: 'This is for Onionr sites, not Tor onion services.'
})
return
}
if (hash.length == 0){ return } if (hash.length == 0){ return }
if (checkHex(hash) && hash.length >= 50 || hash.length == 52 || hash.length == 56){ if (checkHex(hash) && hash.length >= 50 || hash.length == 52 || hash.length == 56){
window.location.href = '/site/' + hash window.location.href = '/site/' + hash