Compare commits

..

2 commits

Author SHA1 Message Date
c92640e098
friendly urls
All checks were successful
/ deploy (push) Successful in 29s
2024-10-11 13:10:05 +02:00
0db9f8e871
trolled once again 2024-10-11 12:54:19 +02:00
7 changed files with 68 additions and 84 deletions

View file

@ -2,7 +2,6 @@
cp geofeed.csv dist cp geofeed.csv dist
ncftp -u $FTP_USER -p $FTP_PASSWORD $FTP_SERVER -c "rmdir -r *"
ncftpput -R -u $FTP_USER -p $FTP_PASSWORD $FTP_SERVER . dist/* ncftpput -R -u $FTP_USER -p $FTP_PASSWORD $FTP_SERVER . dist/*
curl -H "AccessKey: $ACCESS_KEY" "https://api.bunny.net/purge?url=https%3A%2F%2Fdn42.m724.eu&async=false" curl -H "AccessKey: $ACCESS_KEY" "https://api.bunny.net/purge?url=https%3A%2F%2Fdn42.m724.eu&async=false"

View file

@ -1,4 +1,8 @@
{ {
"scripts": {
"start": "parcel src/index.html src/**/index.html",
"build": "parcel build src/index.html src/**/index.html"
},
"devDependencies": { "devDependencies": {
"parcel": "^2.12.0" "parcel": "^2.12.0"
}, },

19
src/calculator/index.html Normal file
View file

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>dn724</title>
<script src="./script.js" defer></script>
<style>
html {
background: black;
color: white;
}
</style>
<input type="number" min="0" placeholder="your ASN" oninput="calculate(this)">
<p>Port: <span id="result"></span></p>
</html>

32
src/calculator/script.js Normal file
View file

@ -0,0 +1,32 @@
const result = document.getElementById('result');
const isNumber = (s) => /^\d+$/.test(s);
function calculate(el) {
if (el.value == '') {
result.innerText = '';
return;
}
let cand = cyrb53(el.value).toString().slice(0, 5);
if (cand > 65535 || cand < 30000) {
cand = (cand % 3 + 3) * 10000 + (cand % 10000);
}
result.innerText = cand;
}
const cyrb53 = (str, seed = 0) => {
let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
for (let i = 0, ch; i < str.length; i++) {
ch = str.charCodeAt(i);
h1 = Math.imul(h1 ^ ch, 2654435761);
h2 = Math.imul(h2 ^ ch, 1597334677);
}
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507);
h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909);
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507);
h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);
return 4294967296 * (2097151 & h2) + (h1 >>> 0);
};

View file

@ -10,6 +10,7 @@
} }
body { body {
margin: 0 auto; margin: 0 auto;
padding-right: 20px; /* make it look aligned */
max-width: calc(100vw - 40px); max-width: calc(100vw - 40px);
word-wrap: break-word; word-wrap: break-word;
width: fit-content; width: fit-content;
@ -20,17 +21,6 @@
p { p {
line-height: 0.6em; line-height: 0.6em;
} }
.hostname {
font-weight: bold;
user-select: all;
}
.meta {
color: darkslategray;
user-select: all;
max-width: 200px;
overflow: scroll;
white-space: nowrap;
}
.sel { .sel {
user-select: all; user-select: all;
} }
@ -44,7 +34,6 @@
<li>Rome. Italy</li> <li>Rome. Italy</li>
<li>Nuremberg, Germany</li> <li>Nuremberg, Germany</li>
<li>Netherlands, Amsterdam</li> <li>Netherlands, Amsterdam</li>
<li><a href="./map/index.html">Network map</a> (uses thunderforest.com API)</li>
</ul> </ul>
<p>Peering requirements</p> <p>Peering requirements</p>
@ -56,11 +45,11 @@
<li>I can make an exception for you in most cases</li> <li>I can make an exception for you in most cases</li>
</ul> </ul>
<p>Other</p> <p>How to</p>
<ul> <ul>
<li><a href="https://git.m724.eu/Minecon724/dn42-info/src/branch/master/nodes.md">Nodes with details</a></li> <li><a href="https://git.m724.eu/Minecon724/dn42-info/src/branch/master/nodes.md">Nodes with details</a></li>
<li>Port is last 5 digits of your ASN (2xxx), unless</li> <li>Port is last 5 digits of your ASN (2xxx), unless</li>
<li>your ASN is not 424242xxxx, then <a href="port-calc.html">use this</a></li> <li>your ASN is not 424242xxxx, then <a href="./calculator">use this</a></li>
</ul> </ul>
<p>Contact</p> <p>Contact</p>
@ -71,4 +60,10 @@
<li>Session: <span class=sel>05293535c0f0b5ae76a663f3f875582590edd77abd72ab9b12f3acbe4bb078aa49</span></li> <li>Session: <span class=sel>05293535c0f0b5ae76a663f3f875582590edd77abd72ab9b12f3acbe4bb078aa49</span></li>
</ul> </ul>
<p>Other</p>
<ul>
<li><a href="./map">Network map</a> (uses thunderforest.com API)</li>
<li><a href="./services.html">Services</a></li>
</ul>
</html> </html>

View file

@ -1,55 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>dn724</title>
<style>
html {
background: black;
color: white;
}
</style>
<input type="number" min="0" placeholder="your ASN" oninput="calculate(this)">
<p>Port: <span id="result"></span></p>
<script>
const result = document.getElementById('result');
const isNumber = (s) => /^\d+$/.test(s);
function calculate(el) {
console.log(el);
if (el.value == '') {
result.innerText = '';
return;
}
let cand = cyrb53(el.value).toString().slice(0, 5);
if (cand > 65535 || cand < 30000) {
cand = (cand % 3 + 3) * 10000 + (cand % 10000);
}
result.innerText = cand;
}
const cyrb53 = (str, seed = 0) => {
let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
for(let i = 0, ch; i < str.length; i++) {
ch = str.charCodeAt(i);
h1 = Math.imul(h1 ^ ch, 2654435761);
h2 = Math.imul(h2 ^ ch, 1597334677);
}
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507);
h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909);
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507);
h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);
return 4294967296 * (2097151 & h2) + (h1 >>> 0);
};
</script>
</html>

View file

@ -42,22 +42,12 @@
<th>Description</th> <th>Description</th>
</tr> </tr>
<tr> <tr>
<td>Minetest</td> <td>None yet</td>
<td>nodecode.pivipi.dn42<br></td> <td>m724.dn42<br></td>
<td> <td>
<ul> <ul>
<li>Game: NodeCore</li> <li>lorem ipsum</li>
<li>Hosted in Netherlands</li> <li>dolor sit amet</li>
</ul>
</td>
</tr>
<tr>
<td>Minecraft</td>
<td>fd11:ef8b:72ac::<br></td>
<td>
<ul>
<li>Running on Cuberite</li>
<li>Hosted in Poland</li>
</ul> </ul>
</td> </td>
</tr> </tr>