- ipns page: /ipns/QmRn4v4xXt8Qn5dHdDCQrkGCczsU45HYjL2wsQhFjtZ1JN
- gist: gist:0c91a02b46db6c1b8b7c2b7030a4b5fb
- bl.ocks page: bl.ocks:/DrI-T/0c91a02b46db6c1b8b7c2b7030a4b5fb
- git: hologit:iup.git
- this README
Last active
June 20, 2021 02:16
-
-
Save DrI-T/0c91a02b46db6c1b8b7c2b7030a4b5fb to your computer and use it in GitHub Desktop.
a page to check if your internet connection is on
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
<!DOCTYPE html><meta charset=utf8> | |
<link rel=icon href=checking.webp> | |
<title> Is my internet on ? </title> | |
<div id=container> | |
<img alt=bot src="https://robohash.org/:ip"> | |
<h2> Is my internet on ? </h2> | |
<div id=resp><i>checking connection ...</i></div> | |
<br> | |
<div><img alt=status src="on.webp" data-src="https://ipfs.blockringtm.ml/ipfs/:qm/on.webp"></div> | |
</div> | |
<br> | |
<div> | |
<p>If you have <a href=https://bl.ocks.org/DrI-T/882ae8a852ab2bc58a333e3c6f279d03>IPFS</a> running, | |
this page can be found at local urls : | |
<ul> | |
<li><a id=qm href=http://127.0.0.1:8080/ipfs/:qm><i>/ipfs/:qm/</i></a> | |
or | |
<li><a href=http://127.0.0.1:8080/ipns/QmRn4v4xXt8Qn5dHdDCQrkGCczsU45HYjL2wsQhFjtZ1JN><i>/ipns/QmRn4v4xXt8Qn5dHdDCQrkGCczsU45HYjL2wsQhFjtZ1JN/</i></a> | |
</ul> | |
<p>Alternatively you can get the page at the <a href=https://gist.github.com/DrI-T>gist</a> url: <a href=https://bl.ocks.org/DrI-T/raw/0c91a02b46db6c1b8b7c2b7030a4b5fb>gist:0c91a02b46db6c1b8b7c2b7030a4b5fb</a> | |
<p>The Git repository for this code is <a id=git href="https://holoGIT-ml.ipns.dweb.link/odetrolio/isup.git" title="https://holoGIT-ml.ipns.dweb.link/odetrolio/isup.git"><i>holo</i>git:odetrolio/isup.git</a> | |
</div> | |
<style> | |
body { | |
height: 100vh; | |
/* ipfs add -w *.png *.jpg *.svg *.webp --cid-base base36 | |
background-image: URL(http://localhost:8080/ipfs/QmdYeoosSbQdugaf3eB3fJvGfZLEodoM1w6oRyGoscvcPj/universe.webp); | |
background-image: URL(https://k2jmtxwzudn3qvqz4m7khkdj7haenqwslpo5fjhk7htuqt18zi64lzgq.ipfs.dweb.link/universe.webp); | |
*/ | |
background-image: URL(https://kmuj9h5jlkkovu5bh66iwypj42xtbpk5niujq8d9sysm2b90woibu.ipfs.cf-ipfs.com/universe.webp); | |
background-size: 100vw 100%; | |
} | |
body > div:nth-child(1) { | |
margin-top: 10vw; | |
} | |
body > div { | |
background-color: white; | |
max-width: 142vh; | |
border: 1px solid grey; | |
margin: auto; | |
padding: 0.8rem; | |
overflow: auto; | |
box-shadow: 5px 5px 15px 2px rgba(4,3,5,0.9); | |
} | |
img[alt=status] { | |
display: block; | |
text-align: center; | |
/* background-image: URL(checking.webp); */ | |
background-position: center; | |
background-repeat: no-repeat; | |
border: 1px; | |
width: 120px; | |
height: 120px; | |
margin: auto; | |
} | |
img[alt=bot] { | |
display: block; | |
float: right; | |
width: 10vw; | |
height: 10vw; | |
} | |
</style> | |
<script> | |
// ipfs key list -l --ipns-base=b58mh | grep -w isup | |
const keyid='QmRn4v4xXt8Qn5dHdDCQrkGCczsU45HYjL2wsQhFjtZ1JN' | |
// ipfs name publish --key=isup --ipns-base=b58mh /ipfs/$(ipfs add -w index.html *.webp *.svg -Q) | |
var qm= 'QmZczkmTAfAHuQurbzdekKqNotaKoS6732Va8VgrzUgXwF'; // ipfs add -w index.html *.webp *.svg | |
// qm='QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn'; | |
let i = document.querySelector('img[alt=status]'); | |
i.src = i.dataset.src.replace(':qm',qm) | |
let a = document.getElementById('qm'); | |
a.href = a.href.replace(':qm',qm) | |
a.innerText = a.innerText.replace(':qm',qm) | |
let b = document.querySelector('img[alt=bot]'); | |
console.log('b:',b) | |
var el = document.getElementById('resp'); | |
var title = document.getElementsByTagName('title')[0]; | |
var fav = document.getElementsByTagName('link')[0]; | |
check_connection(); | |
function check_connection() { | |
url='https://icanhazip.com' | |
url='https://ipfs.blockringtm.ml/cgi-bin/remote_addr.txt' | |
i.src = '' | |
fav.href = 'checking.webp' | |
title.innerText = 'Is my internet on?' | |
el.innerHTML = '<i>checking connection ...</i>' | |
i.src = `https://gateway.ipfs.io/ipfs/${qm}/checking.svg` | |
return fetch(url,{mode:'cors'}).then(resp => resp.text()). | |
then(ip => { | |
b.src = b.src.replace(':ip',ip) | |
i.src = `https://gateway.ipfs.io/ipfs/${qm}/on.svg` | |
fav.href = 'on.webp' | |
title.innerText = `internet is on: ${ip} 🟢` | |
el.innerHTML = `🟢 Yes and your ip-address is ${ip}.` | |
setTimeout(check_connection, 30011); | |
return ip; | |
}). | |
catch(err => { | |
console.log(err) | |
fav.href = 'off.webp' | |
title.innerText = `internet Down` | |
el.innerHTML = `🔴 No your internet connection seems to be down.` | |
i.src = 'off.svg' | |
setTimeout(check_connection, 60013); | |
return '0.0.0.0'; | |
}); | |
} | |
</script> | |
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
# | |
tic=$(date +%s) | |
find . -name '*~1' -delete | |
qm=$(ipfs add -w index.html *.webp *.svg qm.log $0 -Q) | |
key=$(ipfs key list -l --ipns-base b58mh| grep -w isup | cut -d' ' -f1) | |
gwport=$(ipfs config Addresses.Gateway | cut -d'/' -f 5) | |
echo $tic: $qm >> qm.log | |
echo url: https://ipfs.blockring™.ml/ipfs/$qm | |
echo url: http://localhost:$gwport/ipns/$key | |
ipfs name publish --key=isup /ipfs/$qm | |
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
--- # qmlog blockring | |
1622539624: QmNkHoCjKh6z6bH5JpnM4XRXkqnRtqnZb5uJcU72hQng5G | |
1622539700: QmXETknAWfE5mQVAaiUFvQig9UFAA13hfUsjKYGwbemSax | |
1624155265: QmcebBwojDKJd3AbFPXZoP1JXGSJR7ZiNqTcgdTJVZHZb5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment