Rust implementation of NextGraph, a Decentralized and local-first web 3.0 ecosystem
https://nextgraph.org
byzantine-fault-tolerancecrdtsdappsdecentralizede2eeeventual-consistencyjson-ldlocal-firstmarkdownocapoffline-firstp2pp2p-networkprivacy-protectionrdfrich-text-editorself-hostedsemantic-websparqlweb3collaboration
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
27 KiB
37 lines
27 KiB
<!--
|
|
// Copyright (c) 2022-2025 Niko Bonnieure, Par le Peuple, NextGraph.org developers
|
|
// All rights reserved.
|
|
// Licensed under the Apache License, Version 2.0
|
|
// <LICENSE-APACHE2 or http://www.apache.org/licenses/LICENSE-2.0>
|
|
// or the MIT license <LICENSE-MIT or http://opensource.org/licenses/MIT>,
|
|
// at your option. All files in the project carrying such
|
|
// notice may not be copied, modified, or distributed except
|
|
// according to those terms.
|
|
-->
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<title>NextGraph.net Bootstrap Manager</title>
|
|
<script type="module" crossorigin>
|
|
var M=Object.defineProperty;var T=(n,i,o)=>i in n?M(n,i,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[i]=o;var S=(n,i,o)=>(T(n,typeof i!="symbol"?i+"":i,o),o);(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const g of document.querySelectorAll('link[rel="modulepreload"]'))w(g);new MutationObserver(g=>{for(const p of g)if(p.type==="childList")for(const m of p.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&w(m)}).observe(document,{childList:!0,subtree:!0});function o(g){const p={};return g.integrity&&(p.integrity=g.integrity),g.referrerPolicy&&(p.referrerPolicy=g.referrerPolicy),g.crossOrigin==="use-credentials"?p.credentials="include":g.crossOrigin==="anonymous"?p.credentials="omit":p.credentials="same-origin",p}function w(g){if(g.ep)return;g.ep=!0;const p=o(g);fetch(g.href,p)}})();var L=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function z(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var D;(function(){var n,i,o,w,g,p,m,y;y=function(u){var l,I,a,h;return l=(u&255<<24)>>>24,I=(u&255<<16)>>>16,a=(u&65280)>>>8,h=u&255,[l,I,a,h].join(".")},m=function(u){var l,I,a,h,d,e;for(l=[],a=h=0;h<=3&&u.length!==0;a=++h){if(a>0){if(u[0]!==".")throw new Error("Invalid IP");u=u.substring(1)}e=i(u),d=e[0],I=e[1],u=u.substring(I),l.push(d)}if(u.length!==0)throw new Error("Invalid IP");switch(l.length){case 1:if(l[0]>4294967295)throw new Error("Invalid IP");return l[0]>>>0;case 2:if(l[0]>255||l[1]>16777215)throw new Error("Invalid IP");return(l[0]<<24|l[1])>>>0;case 3:if(l[0]>255||l[1]>255||l[2]>65535)throw new Error("Invalid IP");return(l[0]<<24|l[1]<<16|l[2])>>>0;case 4:if(l[0]>255||l[1]>255||l[2]>255||l[3]>255)throw new Error("Invalid IP");return(l[0]<<24|l[1]<<16|l[2]<<8|l[3])>>>0;default:throw new Error("Invalid IP")}},o=function(u){return u.charCodeAt(0)},w=o("0"),p=o("a"),g=o("A"),i=function(u){var l,I,a,h,d;for(h=0,l=10,I="9",a=0,u.length>1&&u[a]==="0"&&(u[a+1]==="x"||u[a+1]==="X"?(a+=2,l=16):"0"<=u[a+1]&&u[a+1]<="9"&&(a++,l=8,I="7")),d=a;a<u.length;){if("0"<=u[a]&&u[a]<=I)h=h*l+(o(u[a])-w)>>>0;else if(l===16)if("a"<=u[a]&&u[a]<="f")h=h*l+(10+o(u[a])-p)>>>0;else if("A"<=u[a]&&u[a]<="F")h=h*l+(10+o(u[a])-g)>>>0;else break;else break;if(h>4294967295)throw new Error("too large");a++}if(a===d)throw new Error("empty octet");return[h,a]},n=function(){function u(l,I){var a,h,d;if(typeof l!="string")throw new Error("Missing `net' parameter");if(I||(d=l.split("/",2),l=d[0],I=d[1]),I||(I=32),typeof I=="string"&&I.indexOf(".")>-1){try{this.maskLong=m(I)}catch{throw new Error("Invalid mask: "+I)}for(a=h=32;h>=0;a=--h)if(this.maskLong===4294967295<<32-a>>>0){this.bitmask=a;break}}else if(I||I===0)this.bitmask=parseInt(I,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw new Error("Invalid mask: empty");try{this.netLong=(m(l)&this.maskLong)>>>0}catch{throw new Error("Invalid net address: "+l)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+I);this.size=Math.pow(2,32-this.bitmask),this.base=y(this.netLong),this.mask=y(this.maskLong),this.hostmask=y(~this.maskLong),this.first=this.bitmask<=30?y(this.netLong+1):this.base,this.last=this.bitmask<=30?y(this.netLong+this.size-2):y(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?y(this.netLong+this.size-1):void 0}return u.prototype.contains=function(l){return typeof l=="string"&&(l.indexOf("/")>0||l.split(".").length!==4)&&(l=new u(l)),l instanceof u?this.contains(l.base)&&this.contains(l.broadcast||l.last):(m(l)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},u.prototype.next=function(l){return l==null&&(l=1),new u(y(this.netLong+this.size*l),this.mask)},u.prototype.forEach=function(l){var I,a,h;for(h=m(this.first),a=m(this.last),I=0;h<=a;)l(y(h),h,I),I++,h++},u.prototype.toString=function(){return this.base+"/"+this.bitmask},u}(),D=n}).call(L);const C="[a-fA-F\\d:]",A=n=>n&&n.includeBoundaries?`(?:(?<=\\s|^)(?=${C})|(?<=${C})(?=\\s|$))`:"",b="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",x="[a-fA-F\\d]{1,4}",$=`
|
|
(?:
|
|
(?:${x}:){7}(?:${x}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
|
|
(?:${x}:){6}(?:${b}|:${x}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
|
|
(?:${x}:){5}(?::${b}|(?::${x}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
|
|
(?:${x}:){4}(?:(?::${x}){0,1}:${b}|(?::${x}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
|
|
(?:${x}:){3}(?:(?::${x}){0,2}:${b}|(?::${x}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
|
|
(?:${x}:){2}(?:(?::${x}){0,3}:${b}|(?::${x}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
|
|
(?:${x}:){1}(?:(?::${x}){0,4}:${b}|(?::${x}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
|
|
(?::(?:(?::${x}){0,5}:${b}|(?::${x}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
|
|
)(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
|
|
`.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),G=new RegExp(`(?:^${b}$)|(?:^${$}$)`),j=new RegExp(`^${b}$`),V=new RegExp(`^${$}$`),R=n=>n&&n.exact?G:new RegExp(`(?:${A(n)}${b}${A(n)})|(?:${A(n)}${$}${A(n)})`,"g");R.v4=n=>n&&n.exact?j:new RegExp(`${A(n)}${b}${A(n)}`,"g");R.v6=n=>n&&n.exact?V:new RegExp(`${A(n)}${$}${A(n)}`,"g");class U{constructor(){S(this,"index",0);S(this,"input","")}new(i){return this.index=0,this.input=i,this}readAtomically(i){const o=this.index,w=i();return w===void 0&&(this.index=o),w}parseWith(i){const o=i();if(this.index===this.input.length)return o}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(i){return this.readAtomically(()=>{const o=this.readChar();if(o===i)return o})}readSeparator(i,o,w){return this.readAtomically(()=>{if(!(o>0&&this.readGivenChar(i)===void 0))return w()})}readNumber(i,o,w,g){return this.readAtomically(()=>{let p=0,m=0;const y=this.peekChar();if(y===void 0)return;const u=y==="0",l=2**(8*g)-1;for(;;){const I=this.readAtomically(()=>{const a=this.readChar();if(a===void 0)return;const h=Number.parseInt(a,i);if(!Number.isNaN(h))return h});if(I===void 0)break;if(p*=i,p+=I,p>l||(m+=1,o!==void 0&&m>o))return}if(m!==0)return!w&&u&&m>1?void 0:p})}readIPv4Addr(){return this.readAtomically(()=>{const i=new Uint8Array(4);for(let o=0;o<i.length;o++){const w=this.readSeparator(".",o,()=>this.readNumber(10,3,!1,1));if(w===void 0)return;i[o]=w}return i})}readIPv6Addr(){const i=o=>{for(let w=0;w<o.length/2;w++){const g=w*2;if(w<o.length-3){const m=this.readSeparator(":",w,()=>this.readIPv4Addr());if(m!==void 0)return o[g]=m[0],o[g+1]=m[1],o[g+2]=m[2],o[g+3]=m[3],[g+4,!0]}const p=this.readSeparator(":",w,()=>this.readNumber(16,4,!0,2));if(p===void 0)return[g,!1];o[g]=p>>8,o[g+1]=p&255}return[o.length,!1]};return this.readAtomically(()=>{const o=new Uint8Array(16),[w,g]=i(o);if(w===16)return o;if(g||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;const p=new Uint8Array(14),m=16-(w+2),[y]=i(p.subarray(0,m));return o.set(p.subarray(0,y),16-y),o})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}}const B=45,_=new U;function q(n,i=!1){if(n.includes("%")&&(n=n.split("%")[0]),n.length>B)return;const o=_.new(n).parseWith(()=>_.readIPAddr());if(o)return i&&o.length===4?Uint8Array.from([0,0,0,0,0,0,0,0,0,0,255,255,o[0],o[1],o[2],o[3]]):o}function Q(n){return!!q(n)}var N={exports:{}};(function(n){(function(i){const o="(0?\\d+|0x[a-f0-9]+)",w={fourOctet:new RegExp(`^${o}\\.${o}\\.${o}\\.${o}$`,"i"),threeOctet:new RegExp(`^${o}\\.${o}\\.${o}$`,"i"),twoOctet:new RegExp(`^${o}\\.${o}$`,"i"),longValue:new RegExp(`^${o}$`,"i")},g=new RegExp("^0[0-7]+$","i"),p=new RegExp("^0x[a-f0-9]+$","i"),m="%[0-9a-z]{1,}",y="(?:[0-9a-f]+::?)+",u={zoneIndex:new RegExp(m,"i"),native:new RegExp(`^(::)?(${y})?([0-9a-f]+)?(::)?(${m})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${o}\\.${o}\\.${o}\\.${o}(${m})?)$`,"i"),transitional:new RegExp(`^((?:${y})|(?:::)(?:${y})?)${o}\\.${o}\\.${o}\\.${o}(${m})?$`,"i")};function l(e,t){if(e.indexOf("::")!==e.lastIndexOf("::"))return null;let s=0,r=-1,c=(e.match(u.zoneIndex)||[])[0],f,v;for(c&&(c=c.substring(1),e=e.replace(/%.+$/,""));(r=e.indexOf(":",r+1))>=0;)s++;if(e.substr(0,2)==="::"&&s--,e.substr(-2,2)==="::"&&s--,s>t)return null;for(v=t-s,f=":";v--;)f+="0:";return e=e.replace("::",f),e[0]===":"&&(e=e.slice(1)),e[e.length-1]===":"&&(e=e.slice(0,-1)),t=function(){const F=e.split(":"),k=[];for(let P=0;P<F.length;P++)k.push(parseInt(F[P],16));return k}(),{parts:t,zoneId:c}}function I(e,t,s,r){if(e.length!==t.length)throw new Error("ipaddr: cannot match CIDR for objects with different lengths");let c=0,f;for(;r>0;){if(f=s-r,f<0&&(f=0),e[c]>>f!==t[c]>>f)return!1;r-=s,c+=1}return!0}function a(e){if(p.test(e))return parseInt(e,16);if(e[0]==="0"&&!isNaN(parseInt(e[1],10))){if(g.test(e))return parseInt(e,8);throw new Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function h(e,t){for(;e.length<t;)e=`0${e}`;return e}const d={};d.IPv4=function(){function e(t){if(t.length!==4)throw new Error("ipaddr: ipv4 octet count should be 4");let s,r;for(s=0;s<t.length;s++)if(r=t[s],!(0<=r&&r<=255))throw new Error("ipaddr: ipv4 octet should fit in 8 bits");this.octets=t}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,18,0,0]),15],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]],as112:[[new e([192,175,48,0]),24],[new e([192,31,196,0]),24]],amt:[[new e([192,52,193,0]),24]]},e.prototype.kind=function(){return"ipv4"},e.prototype.match=function(t,s){let r;if(s===void 0&&(r=t,t=r[0],s=r[1]),t.kind()!=="ipv4")throw new Error("ipaddr: cannot match ipv4 address with non-ipv4 one");return I(this.octets,t.octets,8,s)},e.prototype.prefixLengthFromSubnetMask=function(){let t=0,s=!1;const r={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0};let c,f,v;for(c=3;c>=0;c-=1)if(f=this.octets[c],f in r){if(v=r[f],s&&v!==0)return null;v!==8&&(s=!0),t+=v}else return null;return 32-t},e.prototype.range=function(){return d.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return d.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(".")},e}(),d.IPv4.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),s=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),c=[];let f=0;for(;f<4;)c.push(parseInt(s[f],10)|parseInt(r[f],10)^255),f++;return new this(c)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},d.IPv4.isIPv4=function(e){return this.parser(e)!==null},d.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch{return!1}},d.IPv4.isValidCIDR=function(e){try{return this.parseCIDR(e),!0}catch{return!1}},d.IPv4.isValidFourPartDecimal=function(e){return!!(d.IPv4.isValid(e)&&e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},d.IPv4.networkAddressFromCIDR=function(e){let t,s,r,c,f;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),f=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),c=[],s=0;s<4;)c.push(parseInt(r[s],10)&parseInt(f[s],10)),s++;return new this(c)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},d.IPv4.parse=function(e){const t=this.parser(e);if(t===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(t)},d.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){const s=parseInt(t[2]);if(s>=0&&s<=32){const r=[this.parse(t[1]),s];return Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},d.IPv4.parser=function(e){let t,s,r;if(t=e.match(w.fourOctet))return function(){const c=t.slice(1,6),f=[];for(let v=0;v<c.length;v++)s=c[v],f.push(a(s));return f}();if(t=e.match(w.longValue)){if(r=a(t[1]),r>4294967295||r<0)throw new Error("ipaddr: address outside defined range");return function(){const c=[];let f;for(f=0;f<=24;f+=8)c.push(r>>f&255);return c}().reverse()}else return(t=e.match(w.twoOctet))?function(){const c=t.slice(1,4),f=[];if(r=a(c[1]),r>16777215||r<0)throw new Error("ipaddr: address outside defined range");return f.push(a(c[0])),f.push(r>>16&255),f.push(r>>8&255),f.push(r&255),f}():(t=e.match(w.threeOctet))?function(){const c=t.slice(1,5),f=[];if(r=a(c[2]),r>65535||r<0)throw new Error("ipaddr: address outside defined range");return f.push(a(c[0])),f.push(a(c[1])),f.push(r>>8&255),f.push(r&255),f}():null},d.IPv4.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),e<0||e>32)throw new Error("ipaddr: invalid IPv4 prefix length");const t=[0,0,0,0];let s=0;const r=Math.floor(e/8);for(;s<r;)t[s]=255,s++;return r<4&&(t[r]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},d.IPv6=function(){function e(t,s){let r,c;if(t.length===16)for(this.parts=[],r=0;r<=14;r+=2)this.parts.push(t[r]<<8|t[r+1]);else if(t.length===8)this.parts=t;else throw new Error("ipaddr: ipv6 part count should be 8 or 16");for(r=0;r<this.parts.length;r++)if(c=this.parts[r],!(0<=c&&c<=65535))throw new Error("ipaddr: ipv6 part should fit in 16 bits");s&&(this.zoneId=s)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],discard:[new e([256,0,0,0,0,0,0,0]),64],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[new e([100,65435,0,0,0,0,0,0]),96],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],benchmarking:[new e([8193,2,0,0,0,0,0,0]),48],amt:[new e([8193,3,0,0,0,0,0,0]),32],as112v6:[[new e([8193,4,274,0,0,0,0,0]),48],[new e([9760,79,32768,0,0,0,0,0]),48]],deprecated:[new e([8193,16,0,0,0,0,0,0]),28],orchid2:[new e([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new e([8193,48,0,0,0,0,0,0]),28],reserved:[[new e([8193,0,0,0,0,0,0,0]),23],[new e([8193,3512,0,0,0,0,0,0]),32]]},e.prototype.isIPv4MappedAddress=function(){return this.range()==="ipv4Mapped"},e.prototype.kind=function(){return"ipv6"},e.prototype.match=function(t,s){let r;if(s===void 0&&(r=t,t=r[0],s=r[1]),t.kind()!=="ipv6")throw new Error("ipaddr: cannot match ipv6 address with non-ipv6 one");return I(this.parts,t.parts,16,s)},e.prototype.prefixLengthFromSubnetMask=function(){let t=0,s=!1;const r={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0};let c,f;for(let v=7;v>=0;v-=1)if(c=this.parts[v],c in r){if(f=r[c],s&&f!==0)return null;f!==16&&(s=!0),t+=f}else return null;return 128-t},e.prototype.range=function(){return d.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let t;const s=[],r=this.parts;for(let c=0;c<r.length;c++)t=r[c],s.push(t>>8),s.push(t&255);return s},e.prototype.toFixedLengthString=function(){const t=(function(){const r=[];for(let c=0;c<this.parts.length;c++)r.push(h(this.parts[c].toString(16),4));return r}).call(this).join(":");let s="";return this.zoneId&&(s=`%${this.zoneId}`),t+s},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw new Error("ipaddr: trying to convert a generic ipv6 address to ipv4");const t=this.parts.slice(-2),s=t[0],r=t[1];return new d.IPv4([s>>8,s&255,r>>8,r&255])},e.prototype.toNormalizedString=function(){const t=(function(){const r=[];for(let c=0;c<this.parts.length;c++)r.push(this.parts[c].toString(16));return r}).call(this).join(":");let s="";return this.zoneId&&(s=`%${this.zoneId}`),t+s},e.prototype.toRFC5952String=function(){const t=/((^|:)(0(:|$)){2,})/g,s=this.toNormalizedString();let r=0,c=-1,f;for(;f=t.exec(s);)f[0].length>c&&(r=f.index,c=f[0].length);return c<0?s:`${s.substring(0,r)}::${s.substring(r+c)}`},e.prototype.toString=function(){return this.toRFC5952String()},e}(),d.IPv6.broadcastAddressFromCIDR=function(e){try{const t=this.parseCIDR(e),s=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),c=[];let f=0;for(;f<16;)c.push(parseInt(s[f],10)|parseInt(r[f],10)^255),f++;return new this(c)}catch(t){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${t})`)}},d.IPv6.isIPv6=function(e){return this.parser(e)!==null},d.IPv6.isValid=function(e){if(typeof e=="string"&&e.indexOf(":")===-1)return!1;try{const t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch{return!1}},d.IPv6.isValidCIDR=function(e){if(typeof e=="string"&&e.indexOf(":")===-1)return!1;try{return this.parseCIDR(e),!0}catch{return!1}},d.IPv6.networkAddressFromCIDR=function(e){let t,s,r,c,f;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),f=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),c=[],s=0;s<16;)c.push(parseInt(r[s],10)&parseInt(f[s],10)),s++;return new this(c)}catch(v){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${v})`)}},d.IPv6.parse=function(e){const t=this.parser(e);if(t.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(t.parts,t.zoneId)},d.IPv6.parseCIDR=function(e){let t,s,r;if((s=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(s[2]),t>=0&&t<=128))return r=[this.parse(s[1]),t],Object.defineProperty(r,"toString",{value:function(){return this.join("/")}}),r;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},d.IPv6.parser=function(e){let t,s,r,c,f,v;if(r=e.match(u.deprecatedTransitional))return this.parser(`::ffff:${r[1]}`);if(u.native.test(e))return l(e,8);if((r=e.match(u.transitional))&&(v=r[6]||"",t=r[1],r[1].endsWith("::")||(t=t.slice(0,-1)),t=l(t+v,6),t.parts)){for(f=[parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5])],s=0;s<f.length;s++)if(c=f[s],!(0<=c&&c<=255))return null;return t.parts.push(f[0]<<8|f[1]),t.parts.push(f[2]<<8|f[3]),{parts:t.parts,zoneId:t.zoneId}}return null},d.IPv6.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),e<0||e>128)throw new Error("ipaddr: invalid IPv6 prefix length");const t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let s=0;const r=Math.floor(e/8);for(;s<r;)t[s]=255,s++;return r<16&&(t[r]=Math.pow(2,e%8)-1<<8-e%8),new this(t)},d.fromByteArray=function(e){const t=e.length;if(t===4)return new d.IPv4(e);if(t===16)return new d.IPv6(e);throw new Error("ipaddr: the binary input is neither an IPv6 nor IPv4 address")},d.isValid=function(e){return d.IPv6.isValid(e)||d.IPv4.isValid(e)},d.isValidCIDR=function(e){return d.IPv6.isValidCIDR(e)||d.IPv4.isValidCIDR(e)},d.parse=function(e){if(d.IPv6.isValid(e))return d.IPv6.parse(e);if(d.IPv4.isValid(e))return d.IPv4.parse(e);throw new Error("ipaddr: the address has neither IPv6 nor IPv4 format")},d.parseCIDR=function(e){try{return d.IPv6.parseCIDR(e)}catch{try{return d.IPv4.parseCIDR(e)}catch{throw new Error("ipaddr: the address has neither IPv6 nor IPv4 CIDR format")}}},d.process=function(e){const t=this.parse(e);return t.kind()==="ipv6"&&t.isIPv4MappedAddress()?t.toIPv4Address():t},d.subnetMatch=function(e,t,s){let r,c,f,v;s==null&&(s="unicast");for(c in t)if(Object.prototype.hasOwnProperty.call(t,c)){for(f=t[c],f[0]&&!(f[0]instanceof Array)&&(f=[f]),r=0;r<f.length;r++)if(v=f[r],e.kind()===v[0].kind()&&e.match.apply(e,v))return c}return s},n.exports?n.exports=d:i.ipaddr=d})(L)})(N);var W=N.exports;const J=z(W),{isValid:K,parse:X}=J,Z=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"],H=Z.map(n=>new D(n));function Y(n){for(let i of H)if(i.contains(n))return!0;return!1}function O(n){return/^::$/.test(n)||/^::1$/.test(n)||/^::f{4}:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(n)||/^::f{4}:0.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(n)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(n)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(n)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(n)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(n)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(n)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(n)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(n)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(n)||/^ff([0-9a-fA-F]{2,2}):/i.test(n)}const ee=n=>{if(K(n)){const i=X(n);if(i.kind()==="ipv4")return Y(i.toNormalizedString());if(i.kind()==="ipv6")return O(n)}else if(Q(n)&&R.v6().test(n))return O(n)};function te(n,i){return new WritableStream(new re(n,i))}class re{constructor(i,o={}){this._port=i,this._transferChunk=o.transferChunk,this._resetReady(),this._port.onmessage=w=>this._onMessage(w.data)}start(i){return this._controller=i,this._readyPromise}write(i,o){const w={type:"write",chunk:i};let g=this._transferChunk?this._transferChunk(i):[];return g.length?this._port.postMessage(w,g):this._port.postMessage(w),this._resetReady(),this._readyPromise}close(){const i={type:"close"};this._port.postMessage(i),this._port.close()}abort(i){const o={type:"abort",reason:i};this._port.postMessage(o),this._port.close()}_onMessage(i){switch(i.type){case"pull":this._resolveReady();break;case"error":this._onError(i.reason);break}}_onError(i){this._controller.error(i),this._rejectReady(i),this._port.close()}_resetReady(){this._readyPromise=new Promise((i,o)=>{this._readyResolve=i,this._readyReject=o}),this._readyPending=!0}_resolveReady(){this._readyResolve(),this._readyPending=!1}_rejectReady(i){this._readyPending||this._resetReady(),this._readyPromise.catch(()=>{}),this._readyReject(i),this._readyPending=!1}}const ne=["https://nextgraph.eu","https://nextgraph.one"];let E;try{E=new BroadcastChannel("ng_bootstrap"),E.onmessage=n=>{n.origin===location.origin&&n.data.key&&(async()=>{try{let i=localStorage;try{i=(await document.requestStorageAccess({localStorage:!0})).localStorage,console.log("BroadcastChannel: REQUEST STORAGE ACCESS GRANTED by chrome")}catch(w){console.warn("BroadcastChannel: requestStorageAccess of chrome failed. falling back to previous api",w);try{await document.requestStorageAccess(),console.log("BroadcastChannel: REQUEST STORAGE ACCESS GRANTED")}catch(g){console.error("BroadcastChannel: REQUEST STORAGE ACCESS DENIED",g);return}}let o=JSON.parse(i.getItem("ng_bootstrap")||"{}");n.data.value?(console.log("received added",n.data.key,n.data.value),o[n.data.key]||(o[n.data.key]=n.data.value,i.setItem("ng_bootstrap",JSON.stringify(o)))):(console.log("received removed",n.data.key),o[n.data.key]&&(delete o[n.data.key],i.setItem("ng_bootstrap",JSON.stringify(o))))}catch(i){console.log("localStorage error in BroadcastChannel",i)}})()}}catch(n){console.error("error in BroadcastChannel",n)}window.addEventListener("message",async n=>{console.log("net-bootstrap got msg",n.data,n.origin);const{method:i,port:o,msgs:w}=n.data,p=te(o).getWriter();if(i==="test"){try{let a=localStorage;try{a=(await document.requestStorageAccess({localStorage:!0})).localStorage,console.log("REQUEST STORAGE ACCESS GRANTED by chrome")}catch(h){console.warn("requestStorageAccess of chrome failed. falling back to previous api",h);try{await document.requestStorageAccess(),console.log("REQUEST STORAGE ACCESS GRANTED")}catch(d){console.error("REQUEST STORAGE ACCESS DENIED",d),p.write({status:"error",error:d}),p.close();return}}localStorage,console.log("net-bootstrap writes back ok"),p.write({status:"ok"}),console.log(`localStorage on bootstrap ${location.origin} is ok`)}catch(a){console.log("net-bootstrap writes back error"),p.write({status:"error",error:a}),console.error(`localStorage on bootstrap ${location.origin} is blocked`,a)}p.close();return}let m=n.origin==="https://nextgraph.app",y=!1,u=!1,l=!1;m||(l=n.origin.startsWith("http://localhost"),l||(u=!!ee(new URL(n.origin).hostname),u||(y=ne.includes(n.origin))));let I=[];for(const a of w){let h;if(console.log("ng_bootstrap received msg",JSON.stringify(a),m,y,u,l,new URL(n.origin).hostname,new URL(n.origin).hostname===a.domain,a.domain&&y&&new URL(n.origin).hostname===a.domain),a.ngbox&&(m||u||l||y))h="Self-hosted / NGbox";else if(a.domain&&y&&new URL(n.origin).hostname===a.domain)h=a.domain,console.log("key for domain is",h);else if(a.localhost&&(l||u)){if(!a.peer_id){p.write({status:"error",error:"missing peer_id of localhost"}),p.close();return}let d=Number(new URL(n.origin).port||"80");if(!{}.NG_DEV&&l&&d!==a.localhost){p.write({status:"error",error:"mismatch of localhost port"}),p.close();return}h=`Local port ${a.localhost}`}else if(a.private&&(u||l)){if(!a.peer_id){p.write({status:"error",error:"missing peer_id of LAN"}),p.close();return}h=`Network ${a.peer_id.substring(0,7)}`}else{p.write({status:"error",error:"mismatch between origin and msg"}),p.close();return}I.push(h)}try{let a=localStorage;try{a=(await document.requestStorageAccess({localStorage:!0})).localStorage,console.log("REQUEST STORAGE ACCESS GRANTED by chrome")}catch(d){console.warn("requestStorageAccess of chrome failed. falling back to previous api",d);try{await document.requestStorageAccess(),console.log("REQUEST STORAGE ACCESS GRANTED")}catch(e){console.error("REQUEST STORAGE ACCESS DENIED",e),p.write({status:"error",error:`REQUEST STORAGE ACCESS DENIED : ${e}`}),p.close();return}}let h=JSON.parse(a.getItem("ng_bootstrap")||"{}");for(const[d,e]of I.entries()){console.log(i,i==="add",h,!h[e]);const t=w[d];i==="add"&&!h[e]?(console.log("adding..."+e),h[e]=t,E&&E.postMessage({key:e,value:t}),console.log("added",e,t)):i==="remove"&&h[e]&&(delete h[e],E&&E.postMessage({key:e}),console.log("removed",e))}a.setItem("ng_bootstrap",JSON.stringify(h)),p.write({status:"ok"}),p.close()}catch(a){console.error("access to local Storage for nextgraph.net is blocked"),p.write({status:"error",error:`access to local Storage for nextgraph.net is blocked : ${a}`}),p.close();return}},!1);
|
|
|
|
</script>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
</body>
|
|
</html>
|
|
|