Compare commits

2 Commits
Author SHA1 Message Date
Aemeath 70a932b8ea Dawnline 0.3.1
Build packages / Version (push) Waiting to run
- Find home devices (Bonjour) removed: iOS looks for services over the
  tunnel only under a search domain, and Android and Chromecast only over
  multicast, which WireGuard does not carry. Upgrading removes its server
  option and dnsmasq records
- Home services still show the ports devices announce when umdns runs
2026-10-15 19:01:15 +03:00
Aemeath e657742b52 README: new screenshots for 0.3.0, Access added 2026-10-15 18:21:27 +03:00
29 changed files with 30 additions and 231 deletions

No files matched your search

+4 -5
View File
@@ -20,9 +20,11 @@ limits, live traffic and a LuCI admin that follows a modern design.
|---|---|
| ![People](docs/screenshots/people.png) | ![Person](docs/screenshots/person.png) |
| Personal portal | Where people connect from |
| Personal portal | Home network access |
|---|---|
| ![Personal portal](docs/screenshots/portal.png) | ![Map](docs/screenshots/map.png) |
| ![Personal portal](docs/screenshots/portal.png) | ![Access](docs/screenshots/access.png) |
![Where people connect from](docs/screenshots/map.png)
## Features
@@ -44,9 +46,6 @@ limits, live traffic and a LuCI admin that follows a modern design.
or within circles (family sees family, guests see guests). "Who reaches what"
sums up the rules and "Check access" walks them step by step for a device
and an address.
- **Find home devices** (optional, needs `umdns`): AirPlay, printers and shared
Macs at home show up on iPhone, iPad and Mac over the tunnel, published as
DNS-SD records in dnsmasq.
- **Limits.** End dates (pause, keep, or remove devices when they pass), monthly
or total data limits, allowed hours, pause one person or everyone. Devices
drop off the tunnel at once (`awg syncconf`, no interface restart).
Binary file not shown.

After

Width:  |  Height:  |  Size: 287 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 418 KiB

After

Width:  |  Height:  |  Size: 427 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 277 KiB

After

Width:  |  Height:  |  Size: 283 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 283 KiB

After

Width:  |  Height:  |  Size: 283 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 301 KiB

After

Width:  |  Height:  |  Size: 323 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 291 KiB

After

Width:  |  Height:  |  Size: 274 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 328 KiB

After

Width:  |  Height:  |  Size: 344 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 153 KiB

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 KiB

After

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 KiB

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 KiB

After

Width:  |  Height:  |  Size: 147 KiB

+1 -1
View File
@@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-dawnline
PKG_VERSION:=0.3.0
PKG_VERSION:=0.3.1
PKG_RELEASE:=1
PKG_LICENSE:=MIT
@@ -7,14 +7,14 @@
'require rpc';
'require uci';
'require ui';
var An=Object.create;var Qt=Object.defineProperty;var Pn=Object.getOwnPropertyDescriptor;var Nn=Object.getOwnPropertyNames;var zn=Object.getPrototypeOf,Rn=Object.prototype.hasOwnProperty;var Hn=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var In=(i,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Nn(t))!Rn.call(i,s)&&s!==n&&Qt(i,s,{get:()=>t[s],enumerable:!(a=Pn(t,s))||a.enumerable});return i};var Bn=(i,t,n)=>(n=i!=null?An(zn(i)):{},In(t||!i||!i.__esModule?Qt(n,"default",{value:i,enumerable:!0}):n,i));var nn=Hn((en,tn)=>{"use strict";var Xt=(function(){var i=function($,N){var C=236,T=17,y=$,A=n[N],m=null,h=0,P=null,f=[],_={},O=function(M,E){h=y*4+17,m=(function(x){for(var D=new Array(x),k=0;k<x;k+=1){D[k]=new Array(x);for(var H=0;H<x;H+=1)D[k][H]=null}return D})(h),G(0,0),G(h-7,0),G(0,h-7),q(),S(),te(M,E),y>=7&&W(M),P==null&&(P=Te(y,A,f)),le(P,E)},G=function(M,E){for(var x=-1;x<=7;x+=1)if(!(M+x<=-1||h<=M+x))for(var D=-1;D<=7;D+=1)E+D<=-1||h<=E+D||(0<=x&&x<=6&&(D==0||D==6)||0<=D&&D<=6&&(x==0||x==6)||2<=x&&x<=4&&2<=D&&D<=4?m[M+x][E+D]=!0:m[M+x][E+D]=!1)},B=function(){for(var M=0,E=0,x=0;x<8;x+=1){O(!0,x);var D=s.getLostPoint(_);(x==0||M>D)&&(M=D,E=x)}return E},S=function(){for(var M=8;M<h-8;M+=1)m[M][6]==null&&(m[M][6]=M%2==0);for(var E=8;E<h-8;E+=1)m[6][E]==null&&(m[6][E]=E%2==0)},q=function(){for(var M=s.getPatternPosition(y),E=0;E<M.length;E+=1)for(var x=0;x<M.length;x+=1){var D=M[E],k=M[x];if(m[D][k]==null)for(var H=-2;H<=2;H+=1)for(var V=-2;V<=2;V+=1)H==-2||H==2||V==-2||V==2||H==0&&V==0?m[D+H][k+V]=!0:m[D+H][k+V]=!1}},W=function(M){for(var E=s.getBCHTypeNumber(y),x=0;x<18;x+=1){var D=!M&&(E>>x&1)==1;m[Math.floor(x/3)][x%3+h-8-3]=D}for(var x=0;x<18;x+=1){var D=!M&&(E>>x&1)==1;m[x%3+h-8-3][Math.floor(x/3)]=D}},te=function(M,E){for(var x=A<<3|E,D=s.getBCHTypeInfo(x),k=0;k<15;k+=1){var H=!M&&(D>>k&1)==1;k<6?m[k][8]=H:k<8?m[k+1][8]=H:m[h-15+k][8]=H}for(var k=0;k<15;k+=1){var H=!M&&(D>>k&1)==1;k<8?m[8][h-k-1]=H:k<9?m[8][15-k-1+1]=H:m[8][15-k-1]=H}m[h-8][8]=!M},le=function(M,E){for(var x=-1,D=h-1,k=7,H=0,V=s.getMaskFunction(E),K=h-1;K>0;K-=2)for(K==6&&(K-=1);;){for(var ie=0;ie<2;ie+=1)if(m[D][K-ie]==null){var ce=!1;H<M.length&&(ce=(M[H]>>>k&1)==1);var Q=V(D,K-ie);Q&&(ce=!ce),m[D][K-ie]=ce,k-=1,k==-1&&(H+=1,k=7)}if(D+=x,D<0||h<=D){D-=x,x=-x;break}}},de=function(M,E){for(var x=0,D=0,k=0,H=new Array(E.length),V=new Array(E.length),K=0;K<E.length;K+=1){var ie=E[K].dataCount,ce=E[K].totalCount-ie;D=Math.max(D,ie),k=Math.max(k,ce),H[K]=new Array(ie);for(var Q=0;Q<H[K].length;Q+=1)H[K][Q]=255&M.getBuffer()[Q+x];x+=ie;var ge=s.getErrorCorrectPolynomial(ce),fe=r(H[K],ge.getLength()-1),Vt=fe.mod(ge);V[K]=new Array(ge.getLength()-1);for(var Q=0;Q<V[K].length;Q+=1){var Yt=Q+Vt.getLength()-V[K].length;V[K][Q]=Yt>=0?Vt.getAt(Yt):0}}for(var Jt=0,Q=0;Q<E.length;Q+=1)Jt+=E[Q].totalCount;for(var Et=new Array(Jt),ot=0,Q=0;Q<D;Q+=1)for(var K=0;K<E.length;K+=1)Q<H[K].length&&(Et[ot]=H[K][Q],ot+=1);for(var Q=0;Q<k;Q+=1)for(var K=0;K<E.length;K+=1)Q<V[K].length&&(Et[ot]=V[K][Q],ot+=1);return Et},Te=function(M,E,x){for(var D=l.getRSBlocks(M,E),k=d(),H=0;H<x.length;H+=1){var V=x[H];k.put(V.getMode(),4),k.put(V.getLength(),s.getLengthInBits(V.getMode(),M)),V.write(k)}for(var K=0,H=0;H<D.length;H+=1)K+=D[H].dataCount;if(k.getLengthInBits()>K*8)throw"code length overflow. ("+k.getLengthInBits()+">"+K*8+")";for(k.getLengthInBits()+4<=K*8&&k.put(0,4);k.getLengthInBits()%8!=0;)k.putBit(!1);for(;!(k.getLengthInBits()>=K*8||(k.put(C,8),k.getLengthInBits()>=K*8));)k.put(T,8);return de(k,D)};_.addData=function(M,E){E=E||"Byte";var x=null;switch(E){case"Numeric":x=p(M);break;case"Alphanumeric":x=u(M);break;case"Byte":x=c(M);break;case"Kanji":x=b(M);break;default:throw"mode:"+E}f.push(x),P=null},_.isDark=function(M,E){if(M<0||h<=M||E<0||h<=E)throw M+","+E;return m[M][E]},_.getModuleCount=function(){return h},_.make=function(){if(y<1){for(var M=1;M<40;M++){for(var E=l.getRSBlocks(M,A),x=d(),D=0;D<f.length;D++){var k=f[D];x.put(k.getMode(),4),x.put(k.getLength(),s.getLengthInBits(k.getMode(),M)),k.write(x)}for(var H=0,D=0;D<E.length;D++)H+=E[D].dataCount;if(x.getLengthInBits()<=H*8)break}y=M}O(!1,B())},_.createTableTag=function(M,E){M=M||2,E=typeof E>"u"?M*4:E;var x="";x+='<table style="',x+=" border-width: 0px; border-style: none;",x+=" border-collapse: collapse;",x+=" padding: 0px; margin: "+E+"px;",x+='">',x+="<tbody>";for(var D=0;D<_.getModuleCount();D+=1){x+="<tr>";for(var k=0;k<_.getModuleCount();k+=1)x+='<td style="',x+=" border-width: 0px; border-style: none;",x+=" border-collapse: collapse;",x+=" padding: 0px; margin: 0px;",x+=" width: "+M+"px;",x+=" height: "+M+"px;",x+=" background-color: ",x+=_.isDark(D,k)?"#000000":"#ffffff",x+=";",x+='"/>';x+="</tr>"}return x+="</tbody>",x+="</table>",x},_.createSvgTag=function(M,E,x,D){var k={};typeof arguments[0]=="object"&&(k=arguments[0],M=k.cellSize,E=k.margin,x=k.alt,D=k.title),M=M||2,E=typeof E>"u"?M*4:E,x=typeof x=="string"?{text:x}:x||{},x.text=x.text||null,x.idLine truncated
`}return x%2&&M>0?fe.substring(0,fe.length-x-1)+Array(x+1).join("▀"):fe.substring(0,fe.length-1)};return _.createASCII=function(M,E){if(M=M||1,M<2)return ae(E);M-=1,E=typeof E>"u"?M*2:E;var x=_.getModuleCount()*M+E*2,D=E,k=x-E,H,V,K,ie,ce=Array(M+1).join("██"),Q=Array(M+1).join(" "),ge="",fe="";for(H=0;H<x;H+=1){for(K=Math.floor((H-D)/M),fe="",V=0;V<x;V+=1)ie=1,D<=V&&V<k&&D<=H&&H<k&&_.isDark(K,Math.floor((V-D)/M))&&(ie=0),fe+=ie?ce:Q;for(K=0;K<M;K+=1)ge+=fe+`
`}return ge.substring(0,ge.length-1)},_.renderTo2dContext=function(M,E){E=E||2;for(var x=_.getModuleCount(),D=0;D<x;D++)for(var k=0;k<x;k++)M.fillStyle=_.isDark(D,k)?"black":"white",M.fillRect(D*E,k*E,E,E)},_};i.stringToBytesFuncs={default:function($){for(var N=[],C=0;C<$.length;C+=1){var T=$.charCodeAt(C);N.push(T&255)}return N}},i.stringToBytes=i.stringToBytesFuncs.default,i.createStringToBytes=function($,N){var C=(function(){for(var y=F($),A=function(){var S=y.read();if(S==-1)throw"eof";return S},m=0,h={};;){var P=y.read();if(P==-1)break;var f=A(),_=A(),O=A(),G=String.fromCharCode(P<<8|f),B=_<<8|O;h[G]=B,m+=1}if(m!=N)throw m+" != "+N;return h})(),T=63;return function(y){for(var A=[],m=0;m<y.length;m+=1){var h=y.charCodeAt(m);if(h<128)A.push(h);else{var P=C[y.charAt(m)];typeof P=="number"?(P&255)==P?A.push(P):(A.push(P>>>8),A.push(P&255)):A.push(T)}}return A}};var t={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},n={L:1,M:0,Q:3,H:2},a={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},s=(function(){var $=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],N=1335,C=7973,T=21522,y={},A=function(m){for(var h=0;m!=0;)h+=1,m>>>=1;return h};return y.getBCHTypeInfo=function(m){for(var h=m<<10;A(h)-A(N)>=0;)h^=N<<A(h)-A(N);return(m<<10|h)^T},y.getBCHTypeNumber=function(m){for(var h=m<<12;A(h)-A(C)>=0;)h^=C<<A(h)-A(C);return m<<12|h},y.getPatternPosition=function(m){return $[m-1]},y.getMaskFunction=function(m){switch(m){case a.PATTERN000:return function(h,P){return(h+P)%2==0};case a.PATTERN001:return function(h,P){return h%2==0};case a.PATTERN010:return function(h,P){return P%3==0};case a.PATTERN011:return function(h,P){return(h+P)%3==0};case a.PATTERN100:return function(h,P){return(Math.floor(h/2)+Math.floor(P/3))%2==0};case a.PATTERN101:return function(h,P){return h*P%2+h*P%3==0};case a.PATTERN110:return function(h,P){return(h*P%2+h*P%3)%2==0};case a.PATTERN111:return function(h,P){return(h*P%3+(h+P)%2)%2==0};default:throw"bad maskPattern:"+m}},y.getErrorCorrectPolynomial=function(m){for(var h=r([1],0),P=0;P<m;P+=1)h=h.multiply(r([1,o.gexp(P)],0));return h},y.getLengthInBits=function(m,h){if(1<=h&&h<10)switch(m){case t.MODE_NUMBER:return 10;case t.MODE_ALPHA_NUM:return 9;case t.MODE_8BIT_BYTE:return 8;case t.MODE_KANJI:return 8;default:throw"mode:"+m}else if(h<27)switch(m){case t.MODE_NUMBER:return 12;case t.MODE_ALPHA_NUM:return 11;case t.MODE_8BIT_BYTE:return 16;case t.MODE_KANJI:return 10;default:throw"mode:"+m}else if(h<41)switch(m){case t.MODE_NUMBER:return 14;case t.MODE_ALPHA_NUM:return 13;case t.MODE_8BIT_BYTE:return 16;case t.MODE_KANJI:return 12;default:throw"mode:"+m}else throw"type:"+h},y.getLostPoint=function(m){for(var h=m.getModuleCount(),P=0,f=0;f<h;f+=1)for(var _=0;_<h;_+=1){for(var O=0,G=m.isDark(f,_),B=-1;B<=1;B+=1)if(!(f+B<0||h<=f+B))for(var S=-1;S<=1;S+=1)_+S<0||h<=_+S||B==0&&S==0||G==m.isDark(f+B,_+S)&&(O+=1);O>5&&(P+=3+O-5)}for(var f=0;f<h-1;f+=1)for(var _=0;_<h-1;_+=1){var q=0;m.isDark(f,_)&&(q+=1),m.isDark(f+1,_)&&(q+=1),m.isDark(f,_+1)&&(q+=1),m.isDark(f+1,_+1)&&(q+=1),(q==0||q==4)&&(P+=3)}for(var f=0;f<h;f+=1)for(var _=0;_<h-6;_+=1)m.isDark(f,_)&&!m.isDark(f,_+1)&&m.isDark(f,_+2)&&m.isDark(f,_+3)&&m.isDark(f,_+4)&&!m.isDark(f,_+5)&&m.isDark(f,_+6)&&(P+=40);for(var _=0;_<h;_+=1)for(var f=0;f<h-6;f+=1)m.isDark(f,_)&&!m.isDark(f+1,_)&&m.isDark(f+2,_)&&m.isDark(f+3,_)&&m.isDark(f+4,_)&&!m.isDark(f+5,_)&&m.isDark(f+6,_)&&(P+=40);for(var W=0,_=0;_<h;_+=1)for(var f=0;f<h;f+=1)m.isDark(f,_)&&(W+=1);var te=Math.abs(100*W/h/h-50)/5;return P+=te*10,P},y})(),o=(function(){for(var $=new Array(256),N=new Array(256),C=0;C<8;C+=1)$[C]=1<<C;for(var C=8;C<256;C+=1)$[C]=$[C-4]^$[C-5]^$[C-6]^$[C-8];for(var C=0;C<255;C+=1)N[$[C]]=C;var T={};return T.glog=function(y){if(y<1)throw"glog("+y+")";return N[y]},T.gexp=function(y){for(;y<0;)y+=255;for(;y>=256;)y-=255;return $[y]},T})();function r($,N){if(typeof $.length>"u")throw $.length+"/"+N;var C=(function(){for(var y=0;y<$.length&&$[y]==0;)y+=1;for(var A=new Array($.length-y+N),m=0;m<$.length-y;m+=1)A[m]=$[m+y];return A})(),T={};return T.getAt=function(y){return C[y]},T.getLength=function(){return C.length},T.multiply=function(y){for(var A=new Array(T.getLength()+y.getLength()-1),m=0;m<T.getLength();m+=1)for(var h=0;h<y.getLength();h+=1)A[m+h]^=o.gexp(o.glog(T.getAt(m))+o.glog(y.getAt(h)));return r(A,0)},T.mod=function(y){if(T.getLength() Line truncated
`),hostName:o,mtu:n.mtu,persistent_keep_alive:n.persistent_keep_alive,port:Number(n.port),psk_key:n.psk_key,server_pub_key:n.server_pub_key},l={containers:[{container:"amnezia-awg",awg:{isThirdPartyConfig:!0,last_config:JSON.stringify(r),port:String(n.port),protocol_version:a.header_protection_key?"3.1":"2",transport_proto:"udp"}}],defaultContainer:"amnezia-awg",description:t,hostName:o};return n.dns[0]&&(l.dns1=n.dns[0]),n.dns[1]&&(l.dns2=n.dns[1]),l}function Zn(i){let t="";for(let n=0;n<i.length;n+=32768)t+=String.fromCharCode(...i.subarray(n,n+32768));return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Xn(i){let t=globalThis;if(typeof t.CompressionStream>"u")return null;try{let n=new t.Blob([i]).stream().pipeThrough(new t.CompressionStream("deflate")),a=new Uint8Array(await new t.Response(n).arrayBuffer()),s=new Uint8Array(4+a.length);return new DataView(s.buffer).setUint32(0,i.length,!1),s.set(a,4),s}catch{return null}}async function sn(i,t,n=!0){let a=new TextEncoder().encode(JSON.stringify(Qn(i,t))),s=n?await Xn(a):null;return`vpn://${Zn(s??a)}`}function Z(i){if(!i||i<0)return"0 B";let t=["B","KB","MB","GB","TB"],n=0,a=i;for(;a>=1024&&n<t.length-1;)a/=1024,n++;return`${a>=100||n===0?Math.round(a):a.toFixed(1)} ${t[n]}`}function $e(i){let t=i*8;return t<1e3?`${Math.round(t)} bit/s`:t<1e6?`${(t/1e3).toFixed(t<1e4?1:0)} kbit/s`:t<1e9?`${(t/1e6).toFixed(t<1e7?1:0)} Mbit/s`:`${(t/1e9).toFixed(1)} Gbit/s`}function ue(i,t=Date.now()/1e3){if(!i)return"never";let n=Math.max(0,Math.round(t-i));return n<60?"just now":n<3600?`${Math.floor(n/60)} min ago`:n<86400?`${Math.floor(n/3600)} h ago`:n<86400*30?`${Math.floor(n/86400)} d ago`:new Date(i*1e3).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function on(i){if(!i||i<0)return"—";let t=Math.floor(i/86400),n=Math.floor(i%86400/3600),a=Math.floor(i%3600/60);return t?`${t}d ${n}h`:n?`${n}h ${a}m`:`${a}m`}function Ne(i){let t=new Date(i*1e3),n=new Date,a=t.toDateString()===n.toDateString(),s=t.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"});return a?s:`${t.toLocaleDateString("en-GB",{day:"numeric",month:"short"})} ${s}`}function _e(i){if(!i)return"";let[t,n,a]=i.split("-").map(Number);return new Date(t,n-1,a).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function ze(i,t=Date.now()){if(!i)return null;let[n,a,s]=i.split("-").map(Number),o=new Date(n,a-1,s,23,59,59).getTime();return Math.ceil((o-t)/864e5)}var Ue={lan:"Home network",internet:"Internet",both:"Home network + Internet"};var rn=["computer","phone","tablet","router","other"],Se={computer:"PC",phone:"Phone",tablet:"Tablet",router:"Router",other:"Other"},Pt={active:"Active",paused:"Paused",paused_all:"Paused (everyone)",expired:"Expired",quota:"Data limit reached",hours:"Outside allowed hours",no_server:"No server"};function Re(i){let t=i.trim().split(/\s+/).filter(Boolean);if(!t.length)return"?";let n=t[0][0]??"",a=t.length>1?t[t.length-1][0]??"":t[0][1]??"";return(n+a).toUpperCase()}function rt(i){let t=n=>n.disabled?3:n.online?0:n.handshake?1:2;return i.map((n,a)=>[n,a]).sort((n,a)=>t(n[0])-t(a[0])||n[1]-a[1]).map(([n])=>n)}var ln="https://unpkg.com/maplibre-gl@4.7.1/dist/maplibre-gl",ea="https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json",ta="https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",na={online:0,"24h":86400,"7d":7*86400,"30d":30*86400},Qe=null;function aa(i){let t=window;return i.appendChild(e("link",{rel:"stylesheet",href:`${ln}.css`})),t.maplibregl?Promise.resolve(t.maplibregl):Qe||(Qe=new Promise((n,a)=>{let s=e("script",{src:`${ln}.js`});s.onload=()=>t.maplibregl?n(t.maplibregl):a(new Error("MapLibre failed to load")),s.onerror=()=>{Qe=null,a(new Error("Could not load the map library (no internet access from this browser?)"))},i.appendChild(s)}),Qe)}function lt(){let i=document.documentElement.getAttribute("data-darkmode");return i!=null?i==="true":window.matchMedia?.("(prefers-color-scheme: dark)").matches??!1}function sa(i,t,n=48){let a=(i[0]+t[0])/2,s=(i[1]+t[1])/2,o=t[0]-i[0],r=t[1]-i[1],l=Math.hypot(o,r)||1,d=Math.min(.25*l,12),p=a-r/l*d,u=s+o/l*d,c=[];for(let b=0;b<=n;b++){let g=b/n,w=1-g;c.push([w*w*i[0]+2*w*g*p+g*g*t[0],w*w*i[1]+2*w*g*u+g*g*t[1]])}return c}function ia(i,t){let n=new Map;for(let a of i.geo.points){if(i.person&&a.person!==i.person||(t==="online"?!a.online:i.now-a.ts>na[t]))continue;let s=n.get(a.device);(!s||a.online&&!s.online||a.online===s.online&&a.ts>s.ts)&&n.set(a.device,a)}return[...n.values()]}var qe=class{constructor(t,n="online",a=380){this.cb=t;this.map=null;this.gl=null;this.markers=[];this.popup=null;this.anim=0;this.data=null;this.fitted=!1;this.range=n,this.status=e("div",{class:"dl-map-status"}),this.el=e("div",{class:"dl-geomap",style:`height:${a}px`},this.status)}async mount(t){this.data=t;try{this.gl=await aa(this.el)}catch(n){this.status.textContent=n.message;return}this.map=new this.gl.Map({container:this.el,style:lt()?ea:t Line truncated
${c.detail}`:""}`,where:ut[c.src]??c.src,by:""}))].sort((c,b)=>c.ts-b.ts).map(({ts:c,...b})=>({time:new Date(c*1e3).toISOString(),...b})),l=new Date().toISOString().slice(0,10),d=`dawnline-activity${a?`-${a}`:""}-${l}.${n}`;if(n==="json"){ve(d,JSON.stringify(r,null,2),"application/json");return}let p=["time","category","type","person","device","detail","where","by"],u=[p.join(","),...r.map(c=>p.map(b=>va(c[b])).join(","))].join(`
`);ve(d,u,"text/csv")}var ba=[["","Everything"],["7","Older than 7 days"],["30","Older than 30 days"],["90","Older than 90 days"]];function Ce(i,t,n,a,s,o=!1){let r=e("select",{class:"cbi-input-select"},[e("option",{value:""},"All categories"),...Xe.map(d=>e("option",{value:d,selected:d===s?"selected":null},Ge[d])),o?e("option",{value:"system",selected:s==="system"?"selected":null},"System"):""]),l=e("select",{class:"cbi-input-select"},ba.map(([d,p])=>e("option",{value:d},p)));se(i,[e("p",{class:"dl-muted"},`${t} This cannot be undone; export first if you want a copy.`),e("label",{class:"dl-fld"},[e("span",{class:"dl-fld-label"},"Category"),r]),e("label",{class:"dl-fld"},[e("span",{class:"dl-fld-label"},"Which events"),l])],[e("button",{class:"cbi-button cbi-button-neutral",click:X},"Cancel")," ",R("Clear",async()=>{let d=await U(async()=>{let p=o&&(r.value==="system"||r.value==="")?await z.serviceLogClear(l.value):{removed:0},u=r.value==="system"?{removed:0}:await z.logsClear({...n,category:r.value,older_days:l.value});return{removed:p.removed+u.removed}});d&&(X(),ne(d.removed?`${d.removed} event${d.removed===1?"":"s"} removed`:"Nothing matched","success",3e3),a())},"negative")])}function Fe(i,t,n,a){let s=i==="device"?`Clears ${n}'s daily and monthly traffic history. Their person's totals and data limit are not changed.`:i==="person"?`Clears ${n}'s traffic history and that of their devices. Their data limit starts again from zero.`:"Clears traffic history for everyone. Data limits start again from zero.";se(i==="all"?"Reset all traffic history?":`Reset traffic history for ${n}?`,[e("p",{class:"dl-muted"},s)],[e("button",{class:"cbi-button cbi-button-neutral",click:X},"Cancel")," ",R("Reset",async()=>{await U(()=>z.usageClear(i,t),"Traffic history reset")&&(X(),a())},"negative")])}var mt=null;function xa(i){return i?new Date(i*1e3).toLocaleString("en-GB",{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}function un(i,t,n=!1){return e("div",{class:"dl-kvrow"},[e("span",{class:"dl-kvrow-k"},i),e("button",{type:"button",class:`dl-kvrow-v copy${n?" dl-mono":""}`,title:"Copy",click:()=>he(t,`${i} copied`)},[e("span",{},t),v("copy")])])}function gt(i,t){return e("div",{class:"dl-kvrow"},[e("span",{class:"dl-kvrow-k"},i),e("span",{class:"dl-kvrow-v"},t)])}function mn(i,t){if(/^\s*\[.+\]\s*$/.test(i))return e("span",{class:"dl-conf-sec"},i);let n=/^(\s*[A-Za-z0-9]+\s*=)\s*(.*)$/.exec(i);if(!n)return document.createTextNode(i);let a=/^(\s*)(PrivateKey|PresharedKey)\b/.test(i);return e("span",{},[e("span",{class:"dl-conf-k"},n[1])," ",a&&!t?e("span",{class:"dl-conf-mask"},"••••••••••••••••"):n[2]])}function wa(i){let t=!1,n=e("pre",{class:"dl-conf"}),a=()=>dom.content(n,i.conf.split(`
var An=Object.create;var Qt=Object.defineProperty;var Pn=Object.getOwnPropertyDescriptor;var Nn=Object.getOwnPropertyNames;var zn=Object.getPrototypeOf,Rn=Object.prototype.hasOwnProperty;var Hn=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var In=(i,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Nn(t))!Rn.call(i,s)&&s!==n&&Qt(i,s,{get:()=>t[s],enumerable:!(a=Pn(t,s))||a.enumerable});return i};var Bn=(i,t,n)=>(n=i!=null?An(zn(i)):{},In(t||!i||!i.__esModule?Qt(n,"default",{value:i,enumerable:!0}):n,i));var nn=Hn((en,tn)=>{"use strict";var Xt=(function(){var i=function(_,N){var C=236,D=17,$=_,A=n[N],m=null,h=0,P=null,f=[],S={},j=function(M,E){h=$*4+17,m=(function(w){for(var y=new Array(w),T=0;T<w;T+=1){y[T]=new Array(w);for(var B=0;B<w;B+=1)y[T][B]=null}return y})(h),W(0,0),W(h-7,0),W(0,h-7),q(),U(),le(M,E),$>=7&&X(M),P==null&&(P=De($,A,f)),ie(P,E)},W=function(M,E){for(var w=-1;w<=7;w+=1)if(!(M+w<=-1||h<=M+w))for(var y=-1;y<=7;y+=1)E+y<=-1||h<=E+y||(0<=w&&w<=6&&(y==0||y==6)||0<=y&&y<=6&&(w==0||w==6)||2<=w&&w<=4&&2<=y&&y<=4?m[M+w][E+y]=!0:m[M+w][E+y]=!1)},v=function(){for(var M=0,E=0,w=0;w<8;w+=1){j(!0,w);var y=s.getLostPoint(S);(w==0||M>y)&&(M=y,E=w)}return E},U=function(){for(var M=8;M<h-8;M+=1)m[M][6]==null&&(m[M][6]=M%2==0);for(var E=8;E<h-8;E+=1)m[6][E]==null&&(m[6][E]=E%2==0)},q=function(){for(var M=s.getPatternPosition($),E=0;E<M.length;E+=1)for(var w=0;w<M.length;w+=1){var y=M[E],T=M[w];if(m[y][T]==null)for(var B=-2;B<=2;B+=1)for(var Y=-2;Y<=2;Y+=1)B==-2||B==2||Y==-2||Y==2||B==0&&Y==0?m[y+B][T+Y]=!0:m[y+B][T+Y]=!1}},X=function(M){for(var E=s.getBCHTypeNumber($),w=0;w<18;w+=1){var y=!M&&(E>>w&1)==1;m[Math.floor(w/3)][w%3+h-8-3]=y}for(var w=0;w<18;w+=1){var y=!M&&(E>>w&1)==1;m[w%3+h-8-3][Math.floor(w/3)]=y}},le=function(M,E){for(var w=A<<3|E,y=s.getBCHTypeInfo(w),T=0;T<15;T+=1){var B=!M&&(y>>T&1)==1;T<6?m[T][8]=B:T<8?m[T+1][8]=B:m[h-15+T][8]=B}for(var T=0;T<15;T+=1){var B=!M&&(y>>T&1)==1;T<8?m[8][h-T-1]=B:T<9?m[8][15-T-1+1]=B:m[8][15-T-1]=B}m[h-8][8]=!M},ie=function(M,E){for(var w=-1,y=h-1,T=7,B=0,Y=s.getMaskFunction(E),F=h-1;F>0;F-=2)for(F==6&&(F-=1);;){for(var ae=0;ae<2;ae+=1)if(m[y][F-ae]==null){var de=!1;B<M.length&&(de=(M[B]>>>T&1)==1);var J=Y(y,F-ae);J&&(de=!de),m[y][F-ae]=de,T-=1,T==-1&&(B+=1,T=7)}if(y+=w,y<0||h<=y){y-=w,w=-w;break}}},me=function(M,E){for(var w=0,y=0,T=0,B=new Array(E.length),Y=new Array(E.length),F=0;F<E.length;F+=1){var ae=E[F].dataCount,de=E[F].totalCount-ae;y=Math.max(y,ae),T=Math.max(T,de),B[F]=new Array(ae);for(var J=0;J<B[F].length;J+=1)B[F][J]=255&M.getBuffer()[J+w];w+=ae;var ge=s.getErrorCorrectPolynomial(de),fe=r(B[F],ge.getLength()-1),Yt=fe.mod(ge);Y[F]=new Array(ge.getLength()-1);for(var J=0;J<Y[F].length;J+=1){var Vt=J+Yt.getLength()-Y[F].length;Y[F][J]=Vt>=0?Yt.getAt(Vt):0}}for(var Jt=0,J=0;J<E.length;J+=1)Jt+=E[J].totalCount;for(var Mt=new Array(Jt),ot=0,J=0;J<y;J+=1)for(var F=0;F<E.length;F+=1)J<B[F].length&&(Mt[ot]=B[F][J],ot+=1);for(var J=0;J<T;J+=1)for(var F=0;F<E.length;F+=1)J<Y[F].length&&(Mt[ot]=Y[F][J],ot+=1);return Mt},De=function(M,E,w){for(var y=l.getRSBlocks(M,E),T=d(),B=0;B<w.length;B+=1){var Y=w[B];T.put(Y.getMode(),4),T.put(Y.getLength(),s.getLengthInBits(Y.getMode(),M)),Y.write(T)}for(var F=0,B=0;B<y.length;B+=1)F+=y[B].dataCount;if(T.getLengthInBits()>F*8)throw"code length overflow. ("+T.getLengthInBits()+">"+F*8+")";for(T.getLengthInBits()+4<=F*8&&T.put(0,4);T.getLengthInBits()%8!=0;)T.putBit(!1);for(;!(T.getLengthInBits()>=F*8||(T.put(C,8),T.getLengthInBits()>=F*8));)T.put(D,8);return me(T,y)};S.addData=function(M,E){E=E||"Byte";var w=null;switch(E){case"Numeric":w=p(M);break;case"Alphanumeric":w=u(M);break;case"Byte":w=c(M);break;case"Kanji":w=x(M);break;default:throw"mode:"+E}f.push(w),P=null},S.isDark=function(M,E){if(M<0||h<=M||E<0||h<=E)throw M+","+E;return m[M][E]},S.getModuleCount=function(){return h},S.make=function(){if($<1){for(var M=1;M<40;M++){for(var E=l.getRSBlocks(M,A),w=d(),y=0;y<f.length;y++){var T=f[y];w.put(T.getMode(),4),w.put(T.getLength(),s.getLengthInBits(T.getMode(),M)),T.write(w)}for(var B=0,y=0;y<E.length;y++)B+=E[y].dataCount;if(w.getLengthInBits()<=B*8)break}$=M}j(!1,v())},S.createTableTag=function(M,E){M=M||2,E=typeof E>"u"?M*4:E;var w="";w+='<table style="',w+=" border-width: 0px; border-style: none;",w+=" border-collapse: collapse;",w+=" padding: 0px; margin: "+E+"px;",w+='">',w+="<tbody>";for(var y=0;y<S.getModuleCount();y+=1){w+="<tr>";for(var T=0;T<S.getModuleCount();T+=1)w+='<td style="',w+=" border-width: 0px; border-style: none;",w+=" border-collapse: collapse;",w+=" padding: 0px; margin: 0px;",w+=" width: "+M+"px;",w+=" height: "+M+"px;",w+=" background-color: ",w+=S.isDark(y,T)?"#000000":"#ffffff",w+=";",w+='"/>';w+="</tr>"}return w+="</tbody>",w+="</table>",w},S.createSvgTag=function(M,E,w,y){var T={};typeof arguments[0]=="object"&&(T=arguments[0],M=T.cellSize,E=T.margin,w=T.alt,y=T.title),M=M||2,E=typeof E>"u"?M*4:E,w=typeof w=="string"?{text:w}:w||{},w.text=w.text||null,w.idLine truncated
`}return w%2&&M>0?fe.substring(0,fe.length-w-1)+Array(w+1).join("▀"):fe.substring(0,fe.length-1)};return S.createASCII=function(M,E){if(M=M||1,M<2)return re(E);M-=1,E=typeof E>"u"?M*2:E;var w=S.getModuleCount()*M+E*2,y=E,T=w-E,B,Y,F,ae,de=Array(M+1).join("██"),J=Array(M+1).join(" "),ge="",fe="";for(B=0;B<w;B+=1){for(F=Math.floor((B-y)/M),fe="",Y=0;Y<w;Y+=1)ae=1,y<=Y&&Y<T&&y<=B&&B<T&&S.isDark(F,Math.floor((Y-y)/M))&&(ae=0),fe+=ae?de:J;for(F=0;F<M;F+=1)ge+=fe+`
`}return ge.substring(0,ge.length-1)},S.renderTo2dContext=function(M,E){E=E||2;for(var w=S.getModuleCount(),y=0;y<w;y++)for(var T=0;T<w;T++)M.fillStyle=S.isDark(y,T)?"black":"white",M.fillRect(y*E,T*E,E,E)},S};i.stringToBytesFuncs={default:function(_){for(var N=[],C=0;C<_.length;C+=1){var D=_.charCodeAt(C);N.push(D&255)}return N}},i.stringToBytes=i.stringToBytesFuncs.default,i.createStringToBytes=function(_,N){var C=(function(){for(var $=G(_),A=function(){var U=$.read();if(U==-1)throw"eof";return U},m=0,h={};;){var P=$.read();if(P==-1)break;var f=A(),S=A(),j=A(),W=String.fromCharCode(P<<8|f),v=S<<8|j;h[W]=v,m+=1}if(m!=N)throw m+" != "+N;return h})(),D=63;return function($){for(var A=[],m=0;m<$.length;m+=1){var h=$.charCodeAt(m);if(h<128)A.push(h);else{var P=C[$.charAt(m)];typeof P=="number"?(P&255)==P?A.push(P):(A.push(P>>>8),A.push(P&255)):A.push(D)}}return A}};var t={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},n={L:1,M:0,Q:3,H:2},a={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},s=(function(){var _=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],N=1335,C=7973,D=21522,$={},A=function(m){for(var h=0;m!=0;)h+=1,m>>>=1;return h};return $.getBCHTypeInfo=function(m){for(var h=m<<10;A(h)-A(N)>=0;)h^=N<<A(h)-A(N);return(m<<10|h)^D},$.getBCHTypeNumber=function(m){for(var h=m<<12;A(h)-A(C)>=0;)h^=C<<A(h)-A(C);return m<<12|h},$.getPatternPosition=function(m){return _[m-1]},$.getMaskFunction=function(m){switch(m){case a.PATTERN000:return function(h,P){return(h+P)%2==0};case a.PATTERN001:return function(h,P){return h%2==0};case a.PATTERN010:return function(h,P){return P%3==0};case a.PATTERN011:return function(h,P){return(h+P)%3==0};case a.PATTERN100:return function(h,P){return(Math.floor(h/2)+Math.floor(P/3))%2==0};case a.PATTERN101:return function(h,P){return h*P%2+h*P%3==0};case a.PATTERN110:return function(h,P){return(h*P%2+h*P%3)%2==0};case a.PATTERN111:return function(h,P){return(h*P%3+(h+P)%2)%2==0};default:throw"bad maskPattern:"+m}},$.getErrorCorrectPolynomial=function(m){for(var h=r([1],0),P=0;P<m;P+=1)h=h.multiply(r([1,o.gexp(P)],0));return h},$.getLengthInBits=function(m,h){if(1<=h&&h<10)switch(m){case t.MODE_NUMBER:return 10;case t.MODE_ALPHA_NUM:return 9;case t.MODE_8BIT_BYTE:return 8;case t.MODE_KANJI:return 8;default:throw"mode:"+m}else if(h<27)switch(m){case t.MODE_NUMBER:return 12;case t.MODE_ALPHA_NUM:return 11;case t.MODE_8BIT_BYTE:return 16;case t.MODE_KANJI:return 10;default:throw"mode:"+m}else if(h<41)switch(m){case t.MODE_NUMBER:return 14;case t.MODE_ALPHA_NUM:return 13;case t.MODE_8BIT_BYTE:return 16;case t.MODE_KANJI:return 12;default:throw"mode:"+m}else throw"type:"+h},$.getLostPoint=function(m){for(var h=m.getModuleCount(),P=0,f=0;f<h;f+=1)for(var S=0;S<h;S+=1){for(var j=0,W=m.isDark(f,S),v=-1;v<=1;v+=1)if(!(f+v<0||h<=f+v))for(var U=-1;U<=1;U+=1)S+U<0||h<=S+U||v==0&&U==0||W==m.isDark(f+v,S+U)&&(j+=1);j>5&&(P+=3+j-5)}for(var f=0;f<h-1;f+=1)for(var S=0;S<h-1;S+=1){var q=0;m.isDark(f,S)&&(q+=1),m.isDark(f+1,S)&&(q+=1),m.isDark(f,S+1)&&(q+=1),m.isDark(f+1,S+1)&&(q+=1),(q==0||q==4)&&(P+=3)}for(var f=0;f<h;f+=1)for(var S=0;S<h-6;S+=1)m.isDark(f,S)&&!m.isDark(f,S+1)&&m.isDark(f,S+2)&&m.isDark(f,S+3)&&m.isDark(f,S+4)&&!m.isDark(f,S+5)&&m.isDark(f,S+6)&&(P+=40);for(var S=0;S<h;S+=1)for(var f=0;f<h-6;f+=1)m.isDark(f,S)&&!m.isDark(f+1,S)&&m.isDark(f+2,S)&&m.isDark(f+3,S)&&m.isDark(f+4,S)&&!m.isDark(f+5,S)&&m.isDark(f+6,S)&&(P+=40);for(var X=0,S=0;S<h;S+=1)for(var f=0;f<h;f+=1)m.isDark(f,S)&&(X+=1);var le=Math.abs(100*X/h/h-50)/5;return P+=le*10,P},$})(),o=(function(){for(var _=new Array(256),N=new Array(256),C=0;C<8;C+=1)_[C]=1<<C;for(var C=8;C<256;C+=1)_[C]=_[C-4]^_[C-5]^_[C-6]^_[C-8];for(var C=0;C<255;C+=1)N[_[C]]=C;var D={};return D.glog=function($){if($<1)throw"glog("+$+")";return N[$]},D.gexp=function($){for(;$<0;)$+=255;for(;$>=256;)$-=255;return _[$]},D})();function r(_,N){if(typeof _.length>"u")throw _.length+"/"+N;var C=(function(){for(var $=0;$<_.length&&_[$]==0;)$+=1;for(var A=new Array(_.length-$+N),m=0;m<_.length-$;m+=1)A[m]=_[m+$];return A})(),D={};return D.getAt=function($){return C[$]},D.getLength=function(){return C.length},D.multiply=function($){for(var A=new Array(D.getLength()+$.getLength()-1),m=0;m<D.getLength();m+=1)for(var h=0;h<$.getLength();h+=1)A[m+h]^=o.gexp(o.glog(D.getAt(m))+o.glog($.getAt(h)));return r(A,0)},D.mod=function($){if(D.getLength() Line truncated
`),hostName:o,mtu:n.mtu,persistent_keep_alive:n.persistent_keep_alive,port:Number(n.port),psk_key:n.psk_key,server_pub_key:n.server_pub_key},l={containers:[{container:"amnezia-awg",awg:{isThirdPartyConfig:!0,last_config:JSON.stringify(r),port:String(n.port),protocol_version:a.header_protection_key?"3.1":"2",transport_proto:"udp"}}],defaultContainer:"amnezia-awg",description:t,hostName:o};return n.dns[0]&&(l.dns1=n.dns[0]),n.dns[1]&&(l.dns2=n.dns[1]),l}function Zn(i){let t="";for(let n=0;n<i.length;n+=32768)t+=String.fromCharCode(...i.subarray(n,n+32768));return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function Xn(i){let t=globalThis;if(typeof t.CompressionStream>"u")return null;try{let n=new t.Blob([i]).stream().pipeThrough(new t.CompressionStream("deflate")),a=new Uint8Array(await new t.Response(n).arrayBuffer()),s=new Uint8Array(4+a.length);return new DataView(s.buffer).setUint32(0,i.length,!1),s.set(a,4),s}catch{return null}}async function sn(i,t,n=!0){let a=new TextEncoder().encode(JSON.stringify(Qn(i,t))),s=n?await Xn(a):null;return`vpn://${Zn(s??a)}`}function Q(i){if(!i||i<0)return"0 B";let t=["B","KB","MB","GB","TB"],n=0,a=i;for(;a>=1024&&n<t.length-1;)a/=1024,n++;return`${a>=100||n===0?Math.round(a):a.toFixed(1)} ${t[n]}`}function $e(i){let t=i*8;return t<1e3?`${Math.round(t)} bit/s`:t<1e6?`${(t/1e3).toFixed(t<1e4?1:0)} kbit/s`:t<1e9?`${(t/1e6).toFixed(t<1e7?1:0)} Mbit/s`:`${(t/1e9).toFixed(1)} Gbit/s`}function he(i,t=Date.now()/1e3){if(!i)return"never";let n=Math.max(0,Math.round(t-i));return n<60?"just now":n<3600?`${Math.floor(n/60)} min ago`:n<86400?`${Math.floor(n/3600)} h ago`:n<86400*30?`${Math.floor(n/86400)} d ago`:new Date(i*1e3).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function on(i){if(!i||i<0)return"—";let t=Math.floor(i/86400),n=Math.floor(i%86400/3600),a=Math.floor(i%3600/60);return t?`${t}d ${n}h`:n?`${n}h ${a}m`:`${a}m`}function Ne(i){let t=new Date(i*1e3),n=new Date,a=t.toDateString()===n.toDateString(),s=t.toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit"});return a?s:`${t.toLocaleDateString("en-GB",{day:"numeric",month:"short"})} ${s}`}function _e(i){if(!i)return"";let[t,n,a]=i.split("-").map(Number);return new Date(t,n-1,a).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function ze(i,t=Date.now()){if(!i)return null;let[n,a,s]=i.split("-").map(Number),o=new Date(n,a-1,s,23,59,59).getTime();return Math.ceil((o-t)/864e5)}var Ue={lan:"Home network",internet:"Internet",both:"Home network + Internet"};var rn=["computer","phone","tablet","router","other"],Se={computer:"PC",phone:"Phone",tablet:"Tablet",router:"Router",other:"Other"},At={active:"Active",paused:"Paused",paused_all:"Paused (everyone)",expired:"Expired",quota:"Data limit reached",hours:"Outside allowed hours",no_server:"No server"};function Re(i){let t=i.trim().split(/\s+/).filter(Boolean);if(!t.length)return"?";let n=t[0][0]??"",a=t.length>1?t[t.length-1][0]??"":t[0][1]??"";return(n+a).toUpperCase()}function rt(i){let t=n=>n.disabled?3:n.online?0:n.handshake?1:2;return i.map((n,a)=>[n,a]).sort((n,a)=>t(n[0])-t(a[0])||n[1]-a[1]).map(([n])=>n)}var ln="https://unpkg.com/maplibre-gl@4.7.1/dist/maplibre-gl",ea="https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json",ta="https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",na={online:0,"24h":86400,"7d":7*86400,"30d":30*86400},Je=null;function aa(i){let t=window;return i.appendChild(e("link",{rel:"stylesheet",href:`${ln}.css`})),t.maplibregl?Promise.resolve(t.maplibregl):Je||(Je=new Promise((n,a)=>{let s=e("script",{src:`${ln}.js`});s.onload=()=>t.maplibregl?n(t.maplibregl):a(new Error("MapLibre failed to load")),s.onerror=()=>{Je=null,a(new Error("Could not load the map library (no internet access from this browser?)"))},i.appendChild(s)}),Je)}function lt(){let i=document.documentElement.getAttribute("data-darkmode");return i!=null?i==="true":window.matchMedia?.("(prefers-color-scheme: dark)").matches??!1}function sa(i,t,n=48){let a=(i[0]+t[0])/2,s=(i[1]+t[1])/2,o=t[0]-i[0],r=t[1]-i[1],l=Math.hypot(o,r)||1,d=Math.min(.25*l,12),p=a-r/l*d,u=s+o/l*d,c=[];for(let x=0;x<=n;x++){let g=x/n,k=1-g;c.push([k*k*i[0]+2*k*g*p+g*g*t[0],k*k*i[1]+2*k*g*u+g*g*t[1]])}return c}function ia(i,t){let n=new Map;for(let a of i.geo.points){if(i.person&&a.person!==i.person||(t==="online"?!a.online:i.now-a.ts>na[t]))continue;let s=n.get(a.device);(!s||a.online&&!s.online||a.online===s.online&&a.ts>s.ts)&&n.set(a.device,a)}return[...n.values()]}var qe=class{constructor(t,n="online",a=380){this.cb=t;this.map=null;this.gl=null;this.markers=[];this.popup=null;this.anim=0;this.data=null;this.fitted=!1;this.range=n,this.status=e("div",{class:"dl-map-status"}),this.el=e("div",{class:"dl-geomap",style:`height:${a}px`},this.status)}async mount(t){this.data=t;try{this.gl=await aa(this.el)}catch(n){this.status.textContent=n.message;return}this.map=new this.gl.Map({container:this.el,style:lt()?ea:t Line truncated
${c.detail}`:""}`,where:ut[c.src]??c.src,by:""}))].sort((c,x)=>c.ts-x.ts).map(({ts:c,...x})=>({time:new Date(c*1e3).toISOString(),...x})),l=new Date().toISOString().slice(0,10),d=`dawnline-activity${a?`-${a}`:""}-${l}.${n}`;if(n==="json"){ve(d,JSON.stringify(r,null,2),"application/json");return}let p=["time","category","type","person","device","detail","where","by"],u=[p.join(","),...r.map(c=>p.map(x=>va(c[x])).join(","))].join(`
`);ve(d,u,"text/csv")}var ba=[["","Everything"],["7","Older than 7 days"],["30","Older than 30 days"],["90","Older than 90 days"]];function Te(i,t,n,a,s,o=!1){let r=e("select",{class:"cbi-input-select"},[e("option",{value:""},"All categories"),...Ze.map(d=>e("option",{value:d,selected:d===s?"selected":null},Ge[d])),o?e("option",{value:"system",selected:s==="system"?"selected":null},"System"):""]),l=e("select",{class:"cbi-input-select"},ba.map(([d,p])=>e("option",{value:d},p)));ne(i,[e("p",{class:"dl-muted"},`${t} This cannot be undone; export first if you want a copy.`),e("label",{class:"dl-fld"},[e("span",{class:"dl-fld-label"},"Category"),r]),e("label",{class:"dl-fld"},[e("span",{class:"dl-fld-label"},"Which events"),l])],[e("button",{class:"cbi-button cbi-button-neutral",click:Z},"Cancel")," ",R("Clear",async()=>{let d=await O(async()=>{let p=o&&(r.value==="system"||r.value==="")?await z.serviceLogClear(l.value):{removed:0},u=r.value==="system"?{removed:0}:await z.logsClear({...n,category:r.value,older_days:l.value});return{removed:p.removed+u.removed}});d&&(Z(),te(d.removed?`${d.removed} event${d.removed===1?"":"s"} removed`:"Nothing matched","success",3e3),a())},"negative")])}function Fe(i,t,n,a){let s=i==="device"?`Clears ${n}'s daily and monthly traffic history. Their person's totals and data limit are not changed.`:i==="person"?`Clears ${n}'s traffic history and that of their devices. Their data limit starts again from zero.`:"Clears traffic history for everyone. Data limits start again from zero.";ne(i==="all"?"Reset all traffic history?":`Reset traffic history for ${n}?`,[e("p",{class:"dl-muted"},s)],[e("button",{class:"cbi-button cbi-button-neutral",click:Z},"Cancel")," ",R("Reset",async()=>{await O(()=>z.usageClear(i,t),"Traffic history reset")&&(Z(),a())},"negative")])}var mt=null;function xa(i){return i?new Date(i*1e3).toLocaleString("en-GB",{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}function un(i,t,n=!1){return e("div",{class:"dl-kvrow"},[e("span",{class:"dl-kvrow-k"},i),e("button",{type:"button",class:`dl-kvrow-v copy${n?" dl-mono":""}`,title:"Copy",click:()=>pe(t,`${i} copied`)},[e("span",{},t),b("copy")])])}function gt(i,t){return e("div",{class:"dl-kvrow"},[e("span",{class:"dl-kvrow-k"},i),e("span",{class:"dl-kvrow-v"},t)])}function mn(i,t){if(/^\s*\[.+\]\s*$/.test(i))return e("span",{class:"dl-conf-sec"},i);let n=/^(\s*[A-Za-z0-9]+\s*=)\s*(.*)$/.exec(i);if(!n)return document.createTextNode(i);let a=/^(\s*)(PrivateKey|PresharedKey)\b/.test(i);return e("span",{},[e("span",{class:"dl-conf-k"},n[1])," ",a&&!t?e("span",{class:"dl-conf-mask"},"••••••••••••••••"):n[2]])}function wa(i){let t=!1,n=e("pre",{class:"dl-conf"}),a=()=>dom.content(n,i.conf.split(`
`).flatMap((r,l)=>l?[`
`,mn(r,t)]:[mn(r,t)])),s=e("button",{type:"button",class:"dl-chipbtn",click:r=>{r.preventDefault(),t=!t,dom.content(s,[v(t?"x":"key"),t?"Hide key":"Show key"]),a()}},[v("key"),"Show key"]);a();let o=new Blob([i.conf]).size;return e("div",{class:"dl-stack gap8"},[e("div",{class:"dl-filecard"},[e("span",{class:"dl-filecard-ic"},".conf"),e("span",{class:"dl-stack"},[e("span",{class:"dl-mono dl-ellipsis"},i.filename),e("span",{class:"dl-sub"},`AmneziaWG · ${o} bytes · import it in the app`)]),R([v("download")," Download"],()=>ve(i.filename,i.conf,"application/octet-stream"),"positive")]),e("details",{class:"dl-params"},[e("summary",{},[v("chevron"),e("span",{},"Configuration"),e("span",{class:"dl-spacer"}),s,e("button",{type:"button",class:"dl-chipbtn",click:r=>{r.preventDefault(),he(i.conf,"Configuration copied")}},[v("copy"),"Copy"])]),n])])}async function It(i,t="file"){if(!i.has_private_key)return e("div",{class:"dl-hint"},"This device generated its own keys in the browser, so its full configuration only exists on that device.");let n=await sn(i,`${i.server} · ${i.person} · ${i.name}`),a={qr:()=>e("div",{class:"dl-qr-pane"},[Pe(Oe(i.conf),"dl-qr"),e("span",{class:"dl-sub"},"Scan with AmneziaVPN or AmneziaWG on the device.")]),key:()=>e("div",{class:"dl-stack gap8"},[e("div",{class:"dl-linkbox"},[e("span",{class:"dl-mono"},n),R("Copy",()=>he(n,"Key copied"))]),e("span",{class:"dl-sub"},"AmneziaVPN → Add server → Insert key. Keep it private.")]),file:()=>wa(i)},s=e("div",{class:"dl-connect-body"}),o=e("div",{class:"dl-seg"}),r=l=>{o.querySelectorAll("button").forEach(d=>d.classList.toggle("on",d.dataset.id===l)),dom.content(s,a[l]())};for(let[l,d]of[["file","File"],["key","Key"],["qr","QR code"]])o.appendChild(e("button",{type:"button","data-id":l,click:()=>r(l)},d));return r(t),e("div",{class:"dl-stack gap12"},[o,s])}function ya(i,t,n,a){mt?.close();let s=e("aside",{class:"dl-drawer",role:"dialog","aria-modal":"true"},[e("div",{class:"dl-drawer-head"},[i,e("button",{type:"button",class:"dl-drawer-x","aria-label":"Close",click:()=>l()},v("x"))]),e("div",{class:"dl-drawer-body"},t),n?e("div",{class:"dl-drawer-foot"},n):""]),o=e("div",{class:"dl-drawer-overlay dl-root",click:p=>{p.target===o&&l()}},s),r=p=>{p.key==="Escape"&&!document.body.classList.contains("modal-overlay-active")&&l()};function l(){document.removeEventListener("keydown",r),o.classList.remove("open"),setTimeout(()=>o.remove(),220),mt===d&&(mt=null),a()}let d={close:l,panel:s};return document.addEventListener("keydown",r),document.body.appendChild(o),requestAnimationFrame(()=>o.classList.add("open")),mt=d,d}var gn={connect:["ok","Connected","plug"],disconnect:["","Went offline","plug"],roam:["","Changed network","network"],device_added:["ok","Added","plus"],device_removed:["","Removed","trash"],device_keys:["","New keys","reset"]};function ka(i,t){let n=i.filter(a=>a.device===t&&gn[a.type]).reverse().slice(0,12);return n.length?e("div",{class:"dl-dev-log"},n.map(a=>{let[s,o,r]=gn[a.type],l=a.type==="connect"?[a.detail?e("span",{class:"dl-muted"},` from ${a.detail}`):"",a.where?e("span",{class:"dl-muted"},` · ${a.where}`):""]:a.type==="roam"?[e("span",{class:"dl-muted"},` · ${a.detail??""}`)]:a.type==="device_added"||a.type==="device_removed"||a.type==="device_keys"?[e("span",{class:"dl-muted"},xe(a)==="portal"?" on the portal":xe(a)==="admin"?" by you":"")]:[],d=new Date(a.ts*1e3);return e("div",{class:`dl-dev-log-row${xe(a)==="admin"?" dl-ev-by-admin":""}`},[xe(a)==="admin"?e("span",{class:"dl-ev-tile",title:"Done by you in LuCI"},v("admin")):e("span",{class:`dl-ev-tile ev ${s}`},v(r)),e("span",{class:"dl-row-main"},[e("span",{},o),...l]),e("span",{class:"dl-faint dl-nowrap",title:d.toLocaleString()},ue(a.ts))])})):e("div",{class:"dl-sub"},"No activity yet.")}function $a(i){return i.disabled?e("span",{class:"dl-dstat"},"Disabled"):i.online?e("span",{class:"dl-dstat ok"},"Connected"):i.handshake?e("span",{class:"dl-dstat"},`Last seen ${ue(i.handshake)}`):e("span",{class:"dl-dstat warn"},"Waiting for the first connection")}async function De(i,t,n,a){let s=await U(()=>z.deviceConfig(t.id));if(!s)return;let o=t,r=i,l=await It(s),d=e("div",{class:"dl-drawer-title"}),p=e("div",{}),u=e("div",{}),c=e("div",{},e("div",{class:"dl-sub"},"Loading…")),b=[],g=async()=>{let h=await z.events(5e3).catch(()=>null);h&&(b=h.events.filter(P=>P.device===o.id),dom.content(c,ka(h.events,o.id)))},w=()=>{let h=a?.points.find(f=>f.device===o.id&&f.ip===o.endpoint);dom.content(d,[e("span",{class:`dl-dcard-ic${o.online?" on":""}`},v(o.kind)),e("div",{class:"dl-stack"},[e("div",{class:"dl-title-row"},[e("h3",{},o.name),R([v("edit")],()=>Y(),"neutral",{title:"Rename",class:"cbi-button cbi-button-neutral dl-icon-only sm"})]),e("span",{class:"dl-sub"},[`${r.name} · ${Se[o.kind]}`])])]);let P=o.spark.reduce((f,_)=>f+_,0);dom.content(p,e("div",{class:"dl-dstats"},[e("div",{class:"dl-dstats-cell wide"},[e("span",{class:"dl-metric-label"},"Status"),$a(o)]),e("div",{ Line truncated
`),d=e("div",{class:"dl-pgrid"},[s("Junk packets","zap",o?`${o} random packet${o===1?"":"s"} of ${i.jmin}–${i.jmax} bytes before each handshake.`:"No junk packets.",["jc","jmin","jmax"]),s("Padding","archive","Random bytes in front of handshake, cookie and data packets, so their sizes do not match WireGuard.",["s1","s2","s3","s4"]),s("Packet types","key","The values that replace WireGuard’s recognisable message types.",["h1","h2","h3","h4"]),s("Signatures","globe",r,["i1","i2","i3","i4","i5"]),s("Protection","lock","AmneziaWG 3.1: encrypted headers, random tails and extra padding on data packets.",["header_protection_key","content_padding_addition","random_trailers","disable_cookies"]),s("Timing","clock","Handshake and key timers vary within these ranges instead of WireGuard’s fixed values.",["rekey_after_time","rekey_timeout","reject_after_time","keepalive_timeout","max_handshake_attempts"])]);return e("details",{class:"dl-params"},[e("summary",{},[v("chevron"),e("span",{},"Current parameters"),e("span",{class:"dl-pcount"},String(n.length)),e("span",{class:"dl-spacer"}),e("button",{type:"button",class:"dl-linkbtn",click:p=>{p.preventDefault(),he(l,"Parameters copied")}},"Copy as config")]),d])}var jt=(i,t)=>{let n=new URLSearchParams;i&&n.set("server",i),t&&t!=="overview"&&n.set("section",t);let a=n.toString();return`${L.url("admin/network/dawnline/server")}${a?`?${a}`:""}`},st=class{constructor(){this.noFooter=!0;this.root=e("div",{class:"dl-root"});this.section="overview";this.srvId="";this.ov={};this.pp={};this.tabsEl=e("div",{});this.headEl=e("div",{});this.secEl=e("div",{});this.bodyEl=e("div",{class:"dl-srvbody"})}async load(){let t=await z.status(31),n=t.servers.length?null:await z.setupDefaults();return[t,n]}render([t,n]){if(this.st=t,!t.servers.length&&n)return this.wizard(n);let a=new URLSearchParams(location.search),s=a.get("section")??"",o=Ua[s]??s;return Sn.some(([r])=>r===o)&&(this.section=o),this.srvId=(t.servers.find(r=>r.id===a.get("server"))??t.servers[0]).id,dom.content(this.root,[this.tabsEl,this.headEl,this.secEl,this.bodyEl]),this.paint(),poll.add(async()=>{if(this.section!=="overview")return;let r=await z.status(31).catch(()=>null);if(!r||!r.servers.length)return;this.st=r;let l=this.current();dom.content(this.headEl,this.head(l)),this.paintTabs(),this.ov[l.id]?.update(r)},10),this.root}current(){return this.st.servers.find(t=>t.id===this.srvId)??this.st.servers[0]}async refresh(){let t=await z.status(31).catch(()=>null);t&&(this.st=t,t.servers.length?this.paint():location.href=jt())}paint(){this.paintTabs(),dom.content(this.headEl,this.head(this.current())),this.paintSections(),this.showSection(this.section)}paintTabs(){let t=this.current();dom.content(this.tabsEl,e("div",{class:"dl-srvtabs",role:"tablist","aria-label":"Servers"},[...this.st.servers.map(n=>e("button",{type:"button",role:"tab",class:`dl-srvtab${n.id===t.id?" on":""}`,"aria-selected":n.id===t.id?"true":"false",click:()=>{n.id!==this.srvId&&(this.srvId=n.id,this.paint())}},[e("i",{class:`dot ${n.up?"ok":"bad"}`}),e("b",{},n.name),e("span",{class:"dl-mono dl-faint"},`:${n.port}`)])),e("button",{type:"button",class:"dl-srvtab add",click:()=>this.addServer()},[v("plus"),"Add server"])]))}paintSections(){dom.content(this.secEl,e("div",{class:"dl-seg dl-srvsections",role:"tablist","aria-label":"Server"},Sn.map(([t,n])=>e("button",{type:"button",role:"tab","data-section":t,class:t===this.section?"on":"","aria-selected":t===this.section?"true":"false",click:()=>this.showSection(t)},n))))}go(t,n){let a=this.pp[this.current().id];if(n&&a)a.filter=n,a.el&&a.decorate();else if(n){let s=this.pp[this.current().id]=new Be;s.filter=n}this.showSection(t),window.scrollTo({top:0,behavior:"smooth"})}detachKept(){let t=[...Object.values(this.ov).map(n=>n.el),...Object.values(this.pp).map(n=>n.el)];for(let n of t)n&&this.bodyEl.contains(n)&&n.remove()}showSection(t){this.section=t,this.secEl.querySelectorAll("[data-section]").forEach(r=>{let l=r.dataset.section===t;r.classList.toggle("on",l),r.setAttribute("aria-selected",l?"true":"false")});let n=this.st,a=this.current(),o={overview:()=>{let r=this.ov[a.id];return r?(r.update(n),r.el):(this.ov[a.id]=new pt(a.id,(l,d)=>this.go(l,d))).mount(n)},people:()=>{var p,u;let r=this.pp[a.id];if(r?.el)return r.poll(),r.el;let l=e("div",{},e("p",{class:"dl-muted"},"Loading people…"));return((p=this.pp)[u=a.id]??(p[u]=new Be)).embed(n,a.id).then(c=>{l.isConnected?dom.content(l,c):l.replaceChildren(c)}),l},connection:()=>this.connection(a),access:()=>this.access(a),disguise:()=>this.disguise(a),tunnel:()=>this.tunnel(a)}[t]();this.detachKept(),dom.content(this.bodyEl,o)}head(t){let n=this.st,a=(l,d)=>e("span",{class:"dl-addrbar-seg"},[v(l),...d]),s=`${t.endpoint||"—"}:${t.port}`,o=!t.enabled||n.settings.paused_all,r=e("div",{class:"dl-actions"},[o?R([v("play")," Turn on"],async()=>{n.settings.paused_all&&!await U(()=>z.pauseAll(!1))||(t.enabled?await this.refresh():await this.save(t,{enabled Line truncated
`))]):"",h=y.length+(o?.update?1:0)+(r?.update?1:0),P=[s?.version?`OpenWrt ${s.version} · ${s.target}`:"",t.check?h?`${h} update${h===1?"":"s"} ready`:"everything is current":"not checked yet",t.check?`checked ${Ne(t.check.time)}`:""].filter(Boolean).join(" · ");dom.content(this.root,[e("div",{class:"dl-pagehead"},[e("div",{class:"dl-stack"},[e("h2",{class:"dl-h1"},"Updates"),e("span",{class:"dl-faint"},P)]),R([v("refresh")," Check now"],()=>this.run("check"),"neutral",d)]),g,j,A,m])}async runAwg(t,n,a){await re(a?`Install AmneziaWG ${a}?`:"Install AmneziaWG?","Every AmneziaWG tunnel on the router restarts for a few seconds, HomeTunnel too. Devices stay configured.","Install")&&this.start(`amneziawg:${t}${n?":ru":""}`)}async runPkgs(t,n,a=t){await re(`Update ${n}?`,`${a.join(", ")} from the OpenWrt feeds. Services that use them restart for a moment.`,"Update")&&this.start(`pkgs:${t.join(",")}`)}async run(t){t!=="check"&&!await re(`Update ${t==="app"?"Dawnline":t}?`,"A backup is made first. The page reloads when it finishes.","Update")||this.start(t)}async start(t){if(await U(()=>z.updatesRun(t))){this.running=!0;let n=await z.updatesStatus().catch(()=>null);n&&this.paint(n)}}};function Kt(i){return`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`}function Za(i,t,n,a=30){let s=i?new Date(`${i}T12:00:00`):new Date;return t==="day"?s.setDate(s.getDate()+n):t==="week"?s.setDate(s.getDate()+7*n):t==="month"?s.setMonth(s.getMonth()+n):t==="year"?s.setFullYear(s.getFullYear()+n):s.setDate(s.getDate()+a*n),Kt(s)}var Xa={internet:"Browse the internet through your router. No access to devices at home, and home cannot reach theirs.",lan:"Reach devices at home, and home reaches theirs. Internet stays on their own connection.",both:"Home devices and the internet, all through your router. Home reaches their devices too."},Lt=class{constructor(){this.id="";this.events=[];this.mapOpen=!1;this.map=null;this.parts={};this.series=[];this.devSeries={};this.refreshSeq=0;this.refreshShown=0}async load(){this.id=new URLSearchParams(location.search).get("id")??"";let[t,n,a]=await Promise.all([z.status(30),z.events(5e3).catch(()=>({events:[]})),z.personUsage(this.id,30).catch(()=>null)]);return this.series=a?.person??[],this.devSeries=a?.devices??{},[t,n.events]}render([t,n]){this.st=t,this.events=n;let a=t.people.find(l=>l.id===this.id);if(!a)return e("div",{class:"dl-empty"},[e("h3",{},"Person not found"),e("p",{},"They may have been removed."),e("a",{class:"cbi-button",href:L.url("admin/network/dawnline/server")},"Back to Servers")]);this.p=a;for(let l of["head","devices","traffic","places","activity","limits"])this.parts[l]=e("div",{});this.parts.devices.className="dl-person-devices";let s=e("div",{},[e("nav",{class:"dl-crumbs","aria-label":"Breadcrumb"},[e("a",{href:Ze(a.server)},t.servers.find(l=>l.id===a.server)?.name??"Servers"),e("span",{},"/"),e("a",{href:Ze(a.server)},"People"),e("span",{},"/"),e("span",{},a.name)]),this.parts.head,e("div",{class:"dl-grid-person"},[e("div",{class:"dl-col"},[this.parts.devices,this.parts.traffic,this.parts.places,this.parts.activity]),e("div",{class:"dl-col"},[this.parts.limits])])]);this.paint();let o=new URLSearchParams(location.search),r=o.get("device")&&a.devices.find(l=>l.id===o.get("device"));return r?setTimeout(()=>De(this.p,r,()=>this.refresh(),this.st.geo),50):o.get("add")&&setTimeout(()=>Ke(this.p,()=>this.refresh()),50),poll.add(()=>this.refresh(!0),15),s}async refresh(t=!1){let n=++this.refreshSeq,[a,s,o]=await Promise.all([z.status(30).catch(()=>null),z.events(5e3).catch(()=>null),z.personUsage(this.id,30).catch(()=>null)]);if(!a||n<this.refreshShown)return;this.refreshShown=n,this.st=a,s&&(this.events=s.events),o&&(this.series=o.person,this.devSeries=o.devices);let r=a.people.find(l=>l.id===this.id);if(!r){t||(location.href=Ze(this.p?.server));return}this.p=r,this.paint(),this.map?.update(this.mapData())}async patch(t,n){var o;let a=await U(()=>z.personUpdate(this.p.id,t),n);if(!a)return;let s=this.st.people.findIndex(r=>r.id===this.p.id);(o=a.person).rate??(o.rate=this.p.rate),s>=0&&(this.st.people[s]=a.person),this.p=a.person,this.paint()}mapData(){return{geo:this.st.geo,people:this.st.people,now:this.st.now,person:this.p.id}}mapCard(){let t=e("div",{class:"dl-panel-head pad"},[e("h3",{},"Locations"),e("span",{class:"dl-spacer"}),this.st.geo.enabled?dt("30d",n=>this.map?.setRange(n),!1):"",R("Hide",()=>{this.mapOpen=!1,this.map?.destroy(),this.map=null,this.paintPlaces()},"neutral")]);return this.st.geo.enabled?(this.map=new qe({openPerson:()=>{},openDevice:(n,a)=>{let s=this.p.devices.find(o=>o.id===a);s&&De(this.p,s,()=>this.refresh(),this.st.geo)}},"30d",280),requestAnimationFrame(()=>this.map.mount(this.mapData())),e("div",{class:"dl-panel flush"},[t,this.map.el])):e("div",{class:"dl-panel flush"},[t,e("div",{class:"dl-map-off"},["Locations are off. ",e("a",{href:L.url("admin/network/dawnline/settings")},"Turn them Line truncated
`)}d.push(w),c+=g-1}let u=R([v("more")],()=>we(u,[{label:"Export CSV",icon:v("download"),run:()=>Le(this.st,l,"csv",t.id)},{label:"Export JSON",icon:v("download"),run:()=>Le(this.st,l,"json",t.id)},null,{label:`Clear ${t.name}'s activity`,icon:v("trash"),danger:!0,run:()=>Ce(`Clear ${t.name}'s activity`,`Removes events about ${t.name} and their devices.`,{person:t.id},()=>this.refresh())}]),"neutral",{title:"Export or clear",class:"cbi-button cbi-button-neutral dl-icon-only"});dom.content(this.parts.activity,e("div",{class:"dl-panel flush"},[e("div",{class:"dl-panel-head pad"},[e("h3",{},"Activity"),e("span",{class:"dl-sub"},l.length>10?`latest 10 of ${l.length}`:""),e("span",{class:"dl-spacer"}),u]),d.length?d:e("div",{class:"dl-row dl-muted"},"Nothing yet.")]))}deviceStatus(t){return t.disabled?e("span",{class:"dl-dstat"},"Disabled"):t.online?e("span",{class:"dl-dstat ok"},"Connected"):t.handshake?e("span",{class:"dl-dstat"},`Last seen ${ue(t.handshake,this.st.now)}`):e("span",{class:"dl-dstat warn",title:"Waiting for the first connection"},"Not set up yet")}deviceBars(t){let n=(this.devSeries[t]??[]).slice(-30),a=n.map(r=>r.rx+r.tx),s=Math.max(1,...a),o=r=>new Date(`${r}T12:00:00`).toLocaleDateString("en-GB",{day:"numeric",month:"short"});return e("div",{class:"dl-dbars"},n.map((r,l)=>{let d=e("i",{class:`${a[l]?"":"zero"}${l===n.length-1?" hi":""}`});return d.style.height=`${Math.max(8,a[l]/s*100)}%`,pe(d,()=>[e("div",{class:"dl-tip-title"},l===n.length-1?`Today · ${o(r.day)}`:o(r.day)),e("div",{},Z(a[l]))]),d}))}paintDevices(){let t=this.p,n=()=>this.refresh(),a=rt(t.devices).map(o=>{let r=()=>De(t,o,n,this.st.geo);return e("article",{class:`dl-dcard${o.online?" online":""}${o.disabled?" off":""}`},[e("div",{class:"dl-dcard-head"},[e("span",{class:"dl-dcard-ic"},v(o.kind)),e("button",{type:"button",class:"dl-dcard-title",click:r},[e("b",{},o.name),this.deviceStatus(o),o.config_stale?e("span",{class:"dl-pill warn dl-stale"},"Update config"):""]),R([v("more")],r,"neutral",{title:`${o.name}: connect, rename, keys, remove`,class:"cbi-button cbi-button-neutral dl-icon-only"})]),o.handshake?e("div",{class:"dl-dcard-trend"},[e("div",{class:"dl-stack"},[e("b",{},Z(o.month[0]+o.month[1])),e("span",{class:"dl-sub"},"this month")]),this.deviceBars(o.id)]):o.disabled?e("div",{class:"dl-sub"},`${Se[o.kind]} · created ${ue(o.created,this.st.now)} ${o.created_by==="portal"?"in the portal":"by you"}.`):e("div",{class:"dl-chips-row"},[e("button",{type:"button",class:"dl-chipbtn",click:()=>this.showDeviceQr(o)},[v("qr"),"Show QR"]),e("button",{type:"button",class:"dl-chipbtn",click:()=>this.downloadConfig(o)},[v("download"),"Config"])])])}),s=t.devices.length>=t.device_limit;a.push(e("button",{type:"button",class:"dl-dslot add",click:()=>Ke(t,n)},[e("span",{class:"dl-dslot-ic"},v("plus")),e("span",{class:"dl-stack"},[e("b",{},"Add device"),s?e("span",{class:"dl-sub"},`Over the limit · ${t.devices.length} of ${t.device_limit}`):""])])),dom.content(this.parts.devices,e("section",{class:"dl-devsec"},[e("div",{class:"dl-panel-head"},[e("h3",{},"Devices"),e("span",{class:"dl-sub"},`${t.online} online`)]),e("div",{class:"dl-dgrid"},a)]))}paintLimits(){let t=this.p,n=e("div",{class:"dl-seg wide",role:"radiogroup","aria-label":"Access"},["internet","lan","both"].map(m=>e("button",{type:"button",role:"radio",class:t.access===m?"on":"","aria-checked":t.access===m?"true":"false",click:()=>t.access!==m&&this.patch({access:m},`Access: ${Ue[m]}`)},[v(m==="internet"?"globe":m==="lan"?"home":"shield"),m==="internet"?"Internet":m==="lan"?"Home":"Both"]))),a=ze(t.expires),s=e("input",{type:"date",class:"dl-date-hidden",value:t.expires,tabindex:"-1","aria-hidden":"true"});s.addEventListener("change",()=>s.value&&this.patch({expires:s.value},`Access until ${_e(s.value)}`));let o=(m,h,P)=>{let f=Za(t.expires&&(a??-1)>=0?t.expires:"",m,h);return this.patch({expires:f},`Access until ${_e(f)}`),P},r=[["week",1,"+1 week"],["month",1,"+1 month"],["month",3,"+3 months"],["year",1,"+1 year"]].map(([m,h,P])=>e("button",{type:"button",class:"dl-chipbtn",click:()=>o(m,h,P)},P)),l=e("span",{class:"dl-datechip"},[e("button",{type:"button",class:"dl-chipbtn",click:()=>{try{s.showPicker()}catch{s.focus()}}},[v("calendar"),t.expires?_e(t.expires):"Date"]),s]),d={pause:"pause access",notify:"keep access",remove:"remove their devices"}[t.expire_action],p=e("div",{class:"dl-tile2"},[e("div",{class:"dl-tile2-label"},[e("span",{},"Access ends"),t.expires?e("span",{class:a!=null&&a<0?"dl-bad":a!=null&&a<=t.expire_warn?"dl-warn":"dl-ok"},a!=null&&a<0?"ended":`${a} day${a===1?"":"s"} left`):e("span",{class:"dl-faint"},"no end date")]),e("div",{class:"dl-chips-row"},[...r,l,t.expires?e("button",{type:"button",class:"dl-chipbtn",click:()=>this.patch({expires:""},"No end date")},"No end"):""]),e("div",{class:"dl-tile2-foot"},[e("span",{class:"dl-muted"},`When it ends: ${d}${t.expire_warn?`, warn ${t.expire_warn} day${t.expire_warn===1?"":"s"} before`:""}`),e("a" Line truncated
`,mn(r,t)]:[mn(r,t)])),s=e("button",{type:"button",class:"dl-chipbtn",click:r=>{r.preventDefault(),t=!t,dom.content(s,[b(t?"x":"key"),t?"Hide key":"Show key"]),a()}},[b("key"),"Show key"]);a();let o=new Blob([i.conf]).size;return e("div",{class:"dl-stack gap8"},[e("div",{class:"dl-filecard"},[e("span",{class:"dl-filecard-ic"},".conf"),e("span",{class:"dl-stack"},[e("span",{class:"dl-mono dl-ellipsis"},i.filename),e("span",{class:"dl-sub"},`AmneziaWG · ${o} bytes · import it in the app`)]),R([b("download")," Download"],()=>ve(i.filename,i.conf,"application/octet-stream"),"positive")]),e("details",{class:"dl-params"},[e("summary",{},[b("chevron"),e("span",{},"Configuration"),e("span",{class:"dl-spacer"}),s,e("button",{type:"button",class:"dl-chipbtn",click:r=>{r.preventDefault(),pe(i.conf,"Configuration copied")}},[b("copy"),"Copy"])]),n])])}async function Ht(i,t="file"){if(!i.has_private_key)return e("div",{class:"dl-hint"},"This device generated its own keys in the browser, so its full configuration only exists on that device.");let n=await sn(i,`${i.server} · ${i.person} · ${i.name}`),a={qr:()=>e("div",{class:"dl-qr-pane"},[Pe(Oe(i.conf),"dl-qr"),e("span",{class:"dl-sub"},"Scan with AmneziaVPN or AmneziaWG on the device.")]),key:()=>e("div",{class:"dl-stack gap8"},[e("div",{class:"dl-linkbox"},[e("span",{class:"dl-mono"},n),R("Copy",()=>pe(n,"Key copied"))]),e("span",{class:"dl-sub"},"AmneziaVPN → Add server → Insert key. Keep it private.")]),file:()=>wa(i)},s=e("div",{class:"dl-connect-body"}),o=e("div",{class:"dl-seg"}),r=l=>{o.querySelectorAll("button").forEach(d=>d.classList.toggle("on",d.dataset.id===l)),dom.content(s,a[l]())};for(let[l,d]of[["file","File"],["key","Key"],["qr","QR code"]])o.appendChild(e("button",{type:"button","data-id":l,click:()=>r(l)},d));return r(t),e("div",{class:"dl-stack gap12"},[o,s])}function ya(i,t,n,a){mt?.close();let s=e("aside",{class:"dl-drawer",role:"dialog","aria-modal":"true"},[e("div",{class:"dl-drawer-head"},[i,e("button",{type:"button",class:"dl-drawer-x","aria-label":"Close",click:()=>l()},b("x"))]),e("div",{class:"dl-drawer-body"},t),n?e("div",{class:"dl-drawer-foot"},n):""]),o=e("div",{class:"dl-drawer-overlay dl-root",click:p=>{p.target===o&&l()}},s),r=p=>{p.key==="Escape"&&!document.body.classList.contains("modal-overlay-active")&&l()};function l(){document.removeEventListener("keydown",r),o.classList.remove("open"),setTimeout(()=>o.remove(),220),mt===d&&(mt=null),a()}let d={close:l,panel:s};return document.addEventListener("keydown",r),document.body.appendChild(o),requestAnimationFrame(()=>o.classList.add("open")),mt=d,d}var gn={connect:["ok","Connected","plug"],disconnect:["","Went offline","plug"],roam:["","Changed network","network"],device_added:["ok","Added","plus"],device_removed:["","Removed","trash"],device_keys:["","New keys","reset"]};function ka(i,t){let n=i.filter(a=>a.device===t&&gn[a.type]).reverse().slice(0,12);return n.length?e("div",{class:"dl-dev-log"},n.map(a=>{let[s,o,r]=gn[a.type],l=a.type==="connect"?[a.detail?e("span",{class:"dl-muted"},` from ${a.detail}`):"",a.where?e("span",{class:"dl-muted"},` · ${a.where}`):""]:a.type==="roam"?[e("span",{class:"dl-muted"},` · ${a.detail??""}`)]:a.type==="device_added"||a.type==="device_removed"||a.type==="device_keys"?[e("span",{class:"dl-muted"},xe(a)==="portal"?" on the portal":xe(a)==="admin"?" by you":"")]:[],d=new Date(a.ts*1e3);return e("div",{class:`dl-dev-log-row${xe(a)==="admin"?" dl-ev-by-admin":""}`},[xe(a)==="admin"?e("span",{class:"dl-ev-tile",title:"Done by you in LuCI"},b("admin")):e("span",{class:`dl-ev-tile ev ${s}`},b(r)),e("span",{class:"dl-row-main"},[e("span",{},o),...l]),e("span",{class:"dl-faint dl-nowrap",title:d.toLocaleString()},he(a.ts))])})):e("div",{class:"dl-sub"},"No activity yet.")}function $a(i){return i.disabled?e("span",{class:"dl-dstat"},"Disabled"):i.online?e("span",{class:"dl-dstat ok"},"Connected"):i.handshake?e("span",{class:"dl-dstat"},`Last seen ${he(i.handshake)}`):e("span",{class:"dl-dstat warn"},"Waiting for the first connection")}async function Ce(i,t,n,a){let s=await O(()=>z.deviceConfig(t.id));if(!s)return;let o=t,r=i,l=await Ht(s),d=e("div",{class:"dl-drawer-title"}),p=e("div",{}),u=e("div",{}),c=e("div",{},e("div",{class:"dl-sub"},"Loading…")),x=[],g=async()=>{let h=await z.events(5e3).catch(()=>null);h&&(x=h.events.filter(P=>P.device===o.id),dom.content(c,ka(h.events,o.id)))},k=()=>{let h=a?.points.find(f=>f.device===o.id&&f.ip===o.endpoint);dom.content(d,[e("span",{class:`dl-dcard-ic${o.online?" on":""}`},b(o.kind)),e("div",{class:"dl-stack"},[e("div",{class:"dl-title-row"},[e("h3",{},o.name),R([b("edit")],()=>K(),"neutral",{title:"Rename",class:"cbi-button cbi-button-neutral dl-icon-only sm"})]),e("span",{class:"dl-sub"},[`${r.name} · ${Se[o.kind]}`])])]);let P=o.spark.reduce((f,S)=>f+S,0);dom.content(p,e("div",{class:"dl-dstats"},[e("div",{class:"dl-dstats-cell wide"},[e("span",{class:"dl-metric-label"},"Status"),$a(o)]),e("div",{ Line truncated
`),d=e("div",{class:"dl-pgrid"},[s("Junk packets","zap",o?`${o} random packet${o===1?"":"s"} of ${i.jmin}–${i.jmax} bytes before each handshake.`:"No junk packets.",["jc","jmin","jmax"]),s("Padding","archive","Random bytes in front of handshake, cookie and data packets, so their sizes do not match WireGuard.",["s1","s2","s3","s4"]),s("Packet types","key","The values that replace WireGuard’s recognisable message types.",["h1","h2","h3","h4"]),s("Signatures","globe",r,["i1","i2","i3","i4","i5"]),s("Protection","lock","AmneziaWG 3.1: encrypted headers, random tails and extra padding on data packets.",["header_protection_key","content_padding_addition","random_trailers","disable_cookies"]),s("Timing","clock","Handshake and key timers vary within these ranges instead of WireGuard’s fixed values.",["rekey_after_time","rekey_timeout","reject_after_time","keepalive_timeout","max_handshake_attempts"])]);return e("details",{class:"dl-params"},[e("summary",{},[b("chevron"),e("span",{},"Current parameters"),e("span",{class:"dl-pcount"},String(n.length)),e("span",{class:"dl-spacer"}),e("button",{type:"button",class:"dl-linkbtn",click:p=>{p.preventDefault(),pe(l,"Parameters copied")}},"Copy as config")]),d])}var jt=(i,t)=>{let n=new URLSearchParams;i&&n.set("server",i),t&&t!=="overview"&&n.set("section",t);let a=n.toString();return`${L.url("admin/network/dawnline/server")}${a?`?${a}`:""}`},st=class{constructor(){this.noFooter=!0;this.root=e("div",{class:"dl-root"});this.section="overview";this.srvId="";this.ov={};this.pp={};this.tabsEl=e("div",{});this.headEl=e("div",{});this.secEl=e("div",{});this.bodyEl=e("div",{class:"dl-srvbody"})}async load(){let t=await z.status(31),n=t.servers.length?null:await z.setupDefaults();return[t,n]}render([t,n]){if(this.st=t,!t.servers.length&&n)return this.wizard(n);let a=new URLSearchParams(location.search),s=a.get("section")??"",o=Ua[s]??s;return Sn.some(([r])=>r===o)&&(this.section=o),this.srvId=(t.servers.find(r=>r.id===a.get("server"))??t.servers[0]).id,dom.content(this.root,[this.tabsEl,this.headEl,this.secEl,this.bodyEl]),this.paint(),poll.add(async()=>{if(this.section!=="overview")return;let r=await z.status(31).catch(()=>null);if(!r||!r.servers.length)return;this.st=r;let l=this.current();dom.content(this.headEl,this.head(l)),this.paintTabs(),this.ov[l.id]?.update(r)},10),this.root}current(){return this.st.servers.find(t=>t.id===this.srvId)??this.st.servers[0]}async refresh(){let t=await z.status(31).catch(()=>null);t&&(this.st=t,t.servers.length?this.paint():location.href=jt())}paint(){this.paintTabs(),dom.content(this.headEl,this.head(this.current())),this.paintSections(),this.showSection(this.section)}paintTabs(){let t=this.current();dom.content(this.tabsEl,e("div",{class:"dl-srvtabs",role:"tablist","aria-label":"Servers"},[...this.st.servers.map(n=>e("button",{type:"button",role:"tab",class:`dl-srvtab${n.id===t.id?" on":""}`,"aria-selected":n.id===t.id?"true":"false",click:()=>{n.id!==this.srvId&&(this.srvId=n.id,this.paint())}},[e("i",{class:`dot ${n.up?"ok":"bad"}`}),e("b",{},n.name),e("span",{class:"dl-mono dl-faint"},`:${n.port}`)])),e("button",{type:"button",class:"dl-srvtab add",click:()=>this.addServer()},[b("plus"),"Add server"])]))}paintSections(){dom.content(this.secEl,e("div",{class:"dl-seg dl-srvsections",role:"tablist","aria-label":"Server"},Sn.map(([t,n])=>e("button",{type:"button",role:"tab","data-section":t,class:t===this.section?"on":"","aria-selected":t===this.section?"true":"false",click:()=>this.showSection(t)},n))))}go(t,n){let a=this.pp[this.current().id];if(n&&a)a.filter=n,a.el&&a.decorate();else if(n){let s=this.pp[this.current().id]=new Be;s.filter=n}this.showSection(t),window.scrollTo({top:0,behavior:"smooth"})}detachKept(){let t=[...Object.values(this.ov).map(n=>n.el),...Object.values(this.pp).map(n=>n.el)];for(let n of t)n&&this.bodyEl.contains(n)&&n.remove()}showSection(t){this.section=t,this.secEl.querySelectorAll("[data-section]").forEach(r=>{let l=r.dataset.section===t;r.classList.toggle("on",l),r.setAttribute("aria-selected",l?"true":"false")});let n=this.st,a=this.current(),o={overview:()=>{let r=this.ov[a.id];return r?(r.update(n),r.el):(this.ov[a.id]=new pt(a.id,(l,d)=>this.go(l,d))).mount(n)},people:()=>{var p,u;let r=this.pp[a.id];if(r?.el)return r.poll(),r.el;let l=e("div",{},e("p",{class:"dl-muted"},"Loading people…"));return((p=this.pp)[u=a.id]??(p[u]=new Be)).embed(n,a.id).then(c=>{l.isConnected?dom.content(l,c):l.replaceChildren(c)}),l},connection:()=>this.connection(a),access:()=>this.access(a),disguise:()=>this.disguise(a),tunnel:()=>this.tunnel(a)}[t]();this.detachKept(),dom.content(this.bodyEl,o)}head(t){let n=this.st,a=(l,d)=>e("span",{class:"dl-addrbar-seg"},[b(l),...d]),s=`${t.endpoint||"—"}:${t.port}`,o=!t.enabled||n.settings.paused_all,r=e("div",{class:"dl-actions"},[o?R([b("play")," Turn on"],async()=>{n.settings.paused_all&&!await O(()=>z.pauseAll(!1))||(t.enabled?await this.refresh():await this.save(t,{enabled Line truncated
`))]):"",h=$.length+(o?.update?1:0)+(r?.update?1:0),P=[s?.version?`OpenWrt ${s.version} · ${s.target}`:"",t.check?h?`${h} update${h===1?"":"s"} ready`:"everything is current":"not checked yet",t.check?`checked ${Ne(t.check.time)}`:""].filter(Boolean).join(" · ");dom.content(this.root,[e("div",{class:"dl-pagehead"},[e("div",{class:"dl-stack"},[e("h2",{class:"dl-h1"},"Updates"),e("span",{class:"dl-faint"},P)]),R([b("refresh")," Check now"],()=>this.run("check"),"neutral",d)]),g,I,A,m])}async runAwg(t,n,a){await oe(a?`Install AmneziaWG ${a}?`:"Install AmneziaWG?","Every AmneziaWG tunnel on the router restarts for a few seconds, HomeTunnel too. Devices stay configured.","Install")&&this.start(`amneziawg:${t}${n?":ru":""}`)}async runPkgs(t,n,a=t){await oe(`Update ${n}?`,`${a.join(", ")} from the OpenWrt feeds. Services that use them restart for a moment.`,"Update")&&this.start(`pkgs:${t.join(",")}`)}async run(t){t!=="check"&&!await oe(`Update ${t==="app"?"Dawnline":t}?`,"A backup is made first. The page reloads when it finishes.","Update")||this.start(t)}async start(t){if(await O(()=>z.updatesRun(t))){this.running=!0;let n=await z.updatesStatus().catch(()=>null);n&&this.paint(n)}}};function Kt(i){return`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}-${String(i.getDate()).padStart(2,"0")}`}function Za(i,t,n,a=30){let s=i?new Date(`${i}T12:00:00`):new Date;return t==="day"?s.setDate(s.getDate()+n):t==="week"?s.setDate(s.getDate()+7*n):t==="month"?s.setMonth(s.getMonth()+n):t==="year"?s.setFullYear(s.getFullYear()+n):s.setDate(s.getDate()+a*n),Kt(s)}var Xa={internet:"Browse the internet through your router. No access to devices at home, and home cannot reach theirs.",lan:"Reach devices at home, and home reaches theirs. Internet stays on their own connection.",both:"Home devices and the internet, all through your router. Home reaches their devices too."},St=class{constructor(){this.id="";this.events=[];this.mapOpen=!1;this.map=null;this.parts={};this.series=[];this.devSeries={};this.refreshSeq=0;this.refreshShown=0}async load(){this.id=new URLSearchParams(location.search).get("id")??"";let[t,n,a]=await Promise.all([z.status(30),z.events(5e3).catch(()=>({events:[]})),z.personUsage(this.id,30).catch(()=>null)]);return this.series=a?.person??[],this.devSeries=a?.devices??{},[t,n.events]}render([t,n]){this.st=t,this.events=n;let a=t.people.find(l=>l.id===this.id);if(!a)return e("div",{class:"dl-empty"},[e("h3",{},"Person not found"),e("p",{},"They may have been removed."),e("a",{class:"cbi-button",href:L.url("admin/network/dawnline/server")},"Back to Servers")]);this.p=a;for(let l of["head","devices","traffic","places","activity","limits"])this.parts[l]=e("div",{});this.parts.devices.className="dl-person-devices";let s=e("div",{},[e("nav",{class:"dl-crumbs","aria-label":"Breadcrumb"},[e("a",{href:Qe(a.server)},t.servers.find(l=>l.id===a.server)?.name??"Servers"),e("span",{},"/"),e("a",{href:Qe(a.server)},"People"),e("span",{},"/"),e("span",{},a.name)]),this.parts.head,e("div",{class:"dl-grid-person"},[e("div",{class:"dl-col"},[this.parts.devices,this.parts.traffic,this.parts.places,this.parts.activity]),e("div",{class:"dl-col"},[this.parts.limits])])]);this.paint();let o=new URLSearchParams(location.search),r=o.get("device")&&a.devices.find(l=>l.id===o.get("device"));return r?setTimeout(()=>Ce(this.p,r,()=>this.refresh(),this.st.geo),50):o.get("add")&&setTimeout(()=>Ke(this.p,()=>this.refresh()),50),poll.add(()=>this.refresh(!0),15),s}async refresh(t=!1){let n=++this.refreshSeq,[a,s,o]=await Promise.all([z.status(30).catch(()=>null),z.events(5e3).catch(()=>null),z.personUsage(this.id,30).catch(()=>null)]);if(!a||n<this.refreshShown)return;this.refreshShown=n,this.st=a,s&&(this.events=s.events),o&&(this.series=o.person,this.devSeries=o.devices);let r=a.people.find(l=>l.id===this.id);if(!r){t||(location.href=Qe(this.p?.server));return}this.p=r,this.paint(),this.map?.update(this.mapData())}async patch(t,n){var o;let a=await O(()=>z.personUpdate(this.p.id,t),n);if(!a)return;let s=this.st.people.findIndex(r=>r.id===this.p.id);(o=a.person).rate??(o.rate=this.p.rate),s>=0&&(this.st.people[s]=a.person),this.p=a.person,this.paint()}mapData(){return{geo:this.st.geo,people:this.st.people,now:this.st.now,person:this.p.id}}mapCard(){let t=e("div",{class:"dl-panel-head pad"},[e("h3",{},"Locations"),e("span",{class:"dl-spacer"}),this.st.geo.enabled?dt("30d",n=>this.map?.setRange(n),!1):"",R("Hide",()=>{this.mapOpen=!1,this.map?.destroy(),this.map=null,this.paintPlaces()},"neutral")]);return this.st.geo.enabled?(this.map=new qe({openPerson:()=>{},openDevice:(n,a)=>{let s=this.p.devices.find(o=>o.id===a);s&&Ce(this.p,s,()=>this.refresh(),this.st.geo)}},"30d",280),requestAnimationFrame(()=>this.map.mount(this.mapData())),e("div",{class:"dl-panel flush"},[t,this.map.el])):e("div",{class:"dl-panel flush"},[t,e("div",{class:"dl-map-off"},["Locations are off. ",e("a",{href:L.url("admin/network/dawnline/settings")},"Turn them Line truncated
`)}d.push(k),c+=g-1}let u=R([b("more")],()=>we(u,[{label:"Export CSV",icon:b("download"),run:()=>Le(this.st,l,"csv",t.id)},{label:"Export JSON",icon:b("download"),run:()=>Le(this.st,l,"json",t.id)},null,{label:`Clear ${t.name}'s activity`,icon:b("trash"),danger:!0,run:()=>Te(`Clear ${t.name}'s activity`,`Removes events about ${t.name} and their devices.`,{person:t.id},()=>this.refresh())}]),"neutral",{title:"Export or clear",class:"cbi-button cbi-button-neutral dl-icon-only"});dom.content(this.parts.activity,e("div",{class:"dl-panel flush"},[e("div",{class:"dl-panel-head pad"},[e("h3",{},"Activity"),e("span",{class:"dl-sub"},l.length>10?`latest 10 of ${l.length}`:""),e("span",{class:"dl-spacer"}),u]),d.length?d:e("div",{class:"dl-row dl-muted"},"Nothing yet.")]))}deviceStatus(t){return t.disabled?e("span",{class:"dl-dstat"},"Disabled"):t.online?e("span",{class:"dl-dstat ok"},"Connected"):t.handshake?e("span",{class:"dl-dstat"},`Last seen ${he(t.handshake,this.st.now)}`):e("span",{class:"dl-dstat warn",title:"Waiting for the first connection"},"Not set up yet")}deviceBars(t){let n=(this.devSeries[t]??[]).slice(-30),a=n.map(r=>r.rx+r.tx),s=Math.max(1,...a),o=r=>new Date(`${r}T12:00:00`).toLocaleDateString("en-GB",{day:"numeric",month:"short"});return e("div",{class:"dl-dbars"},n.map((r,l)=>{let d=e("i",{class:`${a[l]?"":"zero"}${l===n.length-1?" hi":""}`});return d.style.height=`${Math.max(8,a[l]/s*100)}%`,ce(d,()=>[e("div",{class:"dl-tip-title"},l===n.length-1?`Today · ${o(r.day)}`:o(r.day)),e("div",{},Q(a[l]))]),d}))}paintDevices(){let t=this.p,n=()=>this.refresh(),a=rt(t.devices).map(o=>{let r=()=>Ce(t,o,n,this.st.geo);return e("article",{class:`dl-dcard${o.online?" online":""}${o.disabled?" off":""}`},[e("div",{class:"dl-dcard-head"},[e("span",{class:"dl-dcard-ic"},b(o.kind)),e("button",{type:"button",class:"dl-dcard-title",click:r},[e("b",{},o.name),this.deviceStatus(o),o.config_stale?e("span",{class:"dl-pill warn dl-stale"},"Update config"):""]),R([b("more")],r,"neutral",{title:`${o.name}: connect, rename, keys, remove`,class:"cbi-button cbi-button-neutral dl-icon-only"})]),o.handshake?e("div",{class:"dl-dcard-trend"},[e("div",{class:"dl-stack"},[e("b",{},Q(o.month[0]+o.month[1])),e("span",{class:"dl-sub"},"this month")]),this.deviceBars(o.id)]):o.disabled?e("div",{class:"dl-sub"},`${Se[o.kind]} · created ${he(o.created,this.st.now)} ${o.created_by==="portal"?"in the portal":"by you"}.`):e("div",{class:"dl-chips-row"},[e("button",{type:"button",class:"dl-chipbtn",click:()=>this.showDeviceQr(o)},[b("qr"),"Show QR"]),e("button",{type:"button",class:"dl-chipbtn",click:()=>this.downloadConfig(o)},[b("download"),"Config"])])])}),s=t.devices.length>=t.device_limit;a.push(e("button",{type:"button",class:"dl-dslot add",click:()=>Ke(t,n)},[e("span",{class:"dl-dslot-ic"},b("plus")),e("span",{class:"dl-stack"},[e("b",{},"Add device"),s?e("span",{class:"dl-sub"},`Over the limit · ${t.devices.length} of ${t.device_limit}`):""])])),dom.content(this.parts.devices,e("section",{class:"dl-devsec"},[e("div",{class:"dl-panel-head"},[e("h3",{},"Devices"),e("span",{class:"dl-sub"},`${t.online} online`)]),e("div",{class:"dl-dgrid"},a)]))}paintLimits(){let t=this.p,n=e("div",{class:"dl-seg wide",role:"radiogroup","aria-label":"Access"},["internet","lan","both"].map(m=>e("button",{type:"button",role:"radio",class:t.access===m?"on":"","aria-checked":t.access===m?"true":"false",click:()=>t.access!==m&&this.patch({access:m},`Access: ${Ue[m]}`)},[b(m==="internet"?"globe":m==="lan"?"home":"shield"),m==="internet"?"Internet":m==="lan"?"Home":"Both"]))),a=ze(t.expires),s=e("input",{type:"date",class:"dl-date-hidden",value:t.expires,tabindex:"-1","aria-hidden":"true"});s.addEventListener("change",()=>s.value&&this.patch({expires:s.value},`Access until ${_e(s.value)}`));let o=(m,h,P)=>{let f=Za(t.expires&&(a??-1)>=0?t.expires:"",m,h);return this.patch({expires:f},`Access until ${_e(f)}`),P},r=[["week",1,"+1 week"],["month",1,"+1 month"],["month",3,"+3 months"],["year",1,"+1 year"]].map(([m,h,P])=>e("button",{type:"button",class:"dl-chipbtn",click:()=>o(m,h,P)},P)),l=e("span",{class:"dl-datechip"},[e("button",{type:"button",class:"dl-chipbtn",click:()=>{try{s.showPicker()}catch{s.focus()}}},[b("calendar"),t.expires?_e(t.expires):"Date"]),s]),d={pause:"pause access",notify:"keep access",remove:"remove their devices"}[t.expire_action],p=e("div",{class:"dl-tile2"},[e("div",{class:"dl-tile2-label"},[e("span",{},"Access ends"),t.expires?e("span",{class:a!=null&&a<0?"dl-bad":a!=null&&a<=t.expire_warn?"dl-warn":"dl-ok"},a!=null&&a<0?"ended":`${a} day${a===1?"":"s"} left`):e("span",{class:"dl-faint"},"no end date")]),e("div",{class:"dl-chips-row"},[...r,l,t.expires?e("button",{type:"button",class:"dl-chipbtn",click:()=>this.patch({expires:""},"No end date")},"No end"):""]),e("div",{class:"dl-tile2-foot"},[e("span",{class:"dl-muted"},`When it ends: ${d}${t.expire_warn?`, warn ${t.expire_warn} day${t.expire_warn===1?"":"s"} before`:""}`),e("a" Line truncated
@@ -20,6 +20,14 @@ rm -f /www/luci-static/resources/view/dawnline/backups.js
# Portal assets moved out of the web root (served only with a valid code).
rm -rf /usr/share/dawnline/portal/www/assets
# "Find home devices" (0.3.0) is gone: its option and dnsmasq records too.
for s in $(uci -q show dawnline | sed -n 's/^dawnline\.\([^.]*\)\.bonjour=.*/\1/p'); do uci -q delete "dawnline.$s.bonjour"; done
uci -q commit dawnline
if ls /tmp/dnsmasq*.d/dawnline-bonjour.conf >/dev/null 2>&1; then
rm -f /tmp/dnsmasq*.d/dawnline-bonjour.conf /var/run/dawnline/bonjour.json
/etc/init.d/dnsmasq restart 2>/dev/null
fi
# LuCI caches: menu index, and module URLs (?v= follows the opkg status time).
rm -f /tmp/luci-indexcache* /tmp/luci-modulecache/* 2>/dev/null
touch /usr/lib/opkg/status 2>/dev/null
@@ -20,7 +20,6 @@ import * as ops from 'dawnline.ops';
import * as geo from 'dawnline.geo';
import * as watchdog from 'dawnline.watchdog';
import * as net from 'dawnline.net';
import * as bonjour from 'dawnline.bonjour';
const TICK = 60 * 1000;
const FLUSH_EVERY = 3600;
@@ -357,12 +356,6 @@ function tick() {
check_wan(m);
}
catch (e) {}
try {
bonjour.sync(m);
}
catch (e) {
slog('dawnline', 'error', `failed: ${e.message}`, null, 'Find home devices');
}
nightly_backup();
try {
check_geo(m);
@@ -28,7 +28,7 @@ const AWG_RU = 'luci-i18n-amneziawg-ru';
// OpenWrt packages Dawnline runs on (the Updates tab groups and names them).
// What Dawnline itself adds to OpenWrt (the rest of LuCI, ucode, rpcd and uhttpd is the
// stock system): the home-like link, and HTTPS plus certificates for the personal portal.
const SYS_PKGS = [ 'ip-full', 'kmod-veth', 'libustream-openssl', 'openssl-util', 'acme', 'acme-acmesh-dnsapi', 'luci-app-acme', 'umdns' ];
const SYS_PKGS = [ 'ip-full', 'kmod-veth', 'libustream-openssl', 'openssl-util', 'acme', 'acme-acmesh-dnsapi', 'luci-app-acme' ];
// Packages released together with each of the above, updated as a set so OpenSSL never ends up
// half old and half new.
const PKG_FAMILY = [
@@ -463,9 +463,6 @@ function install_pkgs(arg) {
// The portal's HTTPS runs in uhttpd. Restart after this job saved its state.
let touched = [ ...names, ...have ];
// A missing piece arrived: set up what waited for it (the portal, the home-like link).
// Bonjour: OpenWrt's mDNS daemon starts at once; the agent publishes what it finds.
if (index(missing, 'umdns') >= 0)
run('/etc/init.d/umdns enable; /etc/init.d/umdns start');
if (length(missing) && length(filter(missing, (n) => match(n, /^(openssl-util|libustream|ip-full|kmod-veth)/))))
run('( sleep 3; /usr/bin/dawnline apply; /etc/init.d/uhttpd restart; /etc/init.d/dawnline restart ) </dev/null >/dev/null 2>&1 &');
else if (length(filter(touched, (n) => match(n, /^(libustream|libopenssl)/))))
@@ -17,7 +17,6 @@ import * as net from 'dawnline.net';
import * as loop from 'dawnline.loop';
import * as watchdog from 'dawnline.watchdog';
import * as access from 'dawnline.access';
import * as bonjour from 'dawnline.bonjour';
function wrap(fn) {
return function(req) {
@@ -426,7 +425,6 @@ function interfaces_view(srv, snap) {
device_mesh: srv.device_mesh, mesh: srv.mesh },
like_home: loop.status(),
needs: ops.needs().home,
bonjour: { on: srv.bonjour, needs: ops.needs().bonjour, ...bonjour.view(core.load()) },
effective: sn,
zones: snap.zones,
devices,
@@ -551,12 +549,6 @@ function server_update(a) {
}
if (v.enabled != null)
set('enabled', v.enabled === true || v.enabled == '1' ? '1' : '0');
let bj = v.bonjour == null ? null : (v.bonjour === true || v.bonjour == '1');
if (bj != null) {
if (bj && length(ops.needs().bonjour))
die('Install umdns first.');
set('bonjour', bj ? '1' : null);
}
if (v.device_mesh != null && v.mesh == null)
v.mesh = v.device_mesh === true || v.device_mesh == '1' ? 'all' : 'off';
if (v.mesh != null) {
@@ -604,12 +596,6 @@ function server_update(a) {
admin_log('awg', on ? 'turned on' : 'turned off', 'server', name);
if (length(what))
admin_log('awg', 'changed', 'server', name, join(', ', what));
if (bj != null && bj != srv.bonjour) {
admin_log('awg', bj ? 'turned on' : 'turned off', 'server', name, 'finding home devices (Bonjour)');
if (bj)
bonjour.start_mdns();
bonjour.sync(core.load(), true);
}
if (mesh != null && mesh != srv.mesh)
admin_log('awg', 'changed', 'server', name,
{ off: 'devices kept apart', all: 'devices reach each other', circles: 'devices reach each other in circles' }[mesh]);
@@ -1,149 +0,0 @@
// Dawnline: "Find home devices" (Bonjour over the tunnel). Multicast DNS does
// not cross WireGuard, so what umdns sees on the home networks is published
// as unicast DNS-SD records in dnsmasq: iPhone, iPad and Mac look there
// (browse domains under the home domain and the reverse zone of their own
// tunnel address) and list AirPlay, printers and shared Macs as at home.
'use strict';
import { readfile, writefile, unlink, lsdir, stat } from 'fs';
import { read_json, write_json, ensure_dir, RUN_DIR } from 'dawnline.util';
import * as ops from 'dawnline.ops';
const FILE = 'dawnline-bonjour.conf';
const STATE = `${RUN_DIR}/bonjour.json`;
/** dnsmasq restarts to read the records: at most this often when only TXT data changed. */
const QUIET = 600;
/** Not useful from a phone, or not a service at all. */
const SKIP = [ '_device-info._tcp', '_companion-link._tcp', '_sleep-proxy._udp', '_workstation._tcp', '_rdlink._tcp', '_hap._udp' ];
export function enabled(m) {
for (let id, srv in m.servers)
if (srv.bonjour && srv.private_key)
return true;
return false;
};
/** dnsmasq's conf-dirs (one per instance), from its generated configs. */
function conf_dirs() {
let out = [];
for (let f in lsdir('/var/etc') ?? []) {
if (!match(f, /^dnsmasq\.conf\./))
continue;
for (let line in split(readfile(`/var/etc/${f}`) ?? '', '\n')) {
let mm = match(line, /^conf-dir=([^,]+)/);
if (mm && index(out, mm[1]) < 0)
push(out, mm[1]);
}
}
return out;
}
/** An instance name as dnsmasq takes it: printable ASCII, no dots or commas. */
function instance(s) {
s = replace(s ?? '', /[\u2018\u2019]/g, "'");
s = replace(s, /[\u201c\u201d]/g, '');
s = replace(s, /[^\x20-\x7e]/g, '');
s = replace(s, /[.,"\\]/g, ' ');
s = trim(replace(s, / +/g, ' '));
return substr(s, 0, 63);
}
function label(s) {
return substr(trim(replace(replace(s ?? '', /[^A-Za-z0-9-]+/g, '-'), /^-+|-+$/g, '')), 0, 63);
}
/** Reverse zone of a server's tunnel network (its /24), where devices look for browse domains. */
function reverse24(subnet) {
let mm = match(subnet ?? '', /^([0-9]+)\.([0-9]+)\.([0-9]+)\.[0-9]+\//);
return mm ? `0.${mm[3]}.${mm[2]}.${mm[1]}.in-addr.arpa` : null;
}
/** The records, and a signature of what matters without TXT data. */
export function records(m, services) {
let dom = m.settings.domain || 'lan';
let lines = [], sig = [];
let zones = [ dom ];
for (let id, srv in m.servers)
if (srv.bonjour && reverse24(srv.subnet))
push(zones, reverse24(srv.subnet));
for (let z in zones)
for (let b in [ 'b', 'db', 'lb' ])
push(lines, `ptr-record=${b}._dns-sd._udp.${z},${dom}`);
let types = {}, hosts = {};
for (let s in services) {
if (!s.port || index(SKIP, s.type) >= 0 || !match(s.type, /^_[A-Za-z0-9-]+\._(tcp|udp)$/))
continue;
let name = instance(s.name), host = label(s.host) || label(replace(s.address, /\./g, '-'));
if (name == '')
continue;
let full = `${name}.${s.type}.${dom}`;
types[s.type] = true;
hosts[host] = s.address;
push(lines, `ptr-record=${s.type}.${dom},${full}`);
push(lines, `srv-host=${full},${host}.${dom},${s.port}`);
let txt = filter(s.txt ?? [], (t) => type(t) == 'string' && length(t) <= 255 && !match(t, /["\\\n]/));
push(lines, length(txt) ? `txt-record=${full},${join(',', map(txt, (t) => `"${t}"`))}` : `txt-record=${full}`);
push(sig, `${full}|${host}|${s.port}`);
}
for (let t in sort(keys(types)))
push(lines, `ptr-record=_services._dns-sd._udp.${dom},${t}.${dom}`);
for (let h in sort(keys(hosts))) {
push(lines, `host-record=${h}.${dom},${hosts[h]}`);
push(sig, `${h}=${hosts[h]}`);
}
return { conf: '# Written by Dawnline: home devices for Bonjour over the tunnel.\n' + join('\n', lines) + '\n', sig: join('\n', sort(sig)) };
};
function restart_dnsmasq() {
system('/etc/init.d/dnsmasq restart >/dev/null 2>&1');
}
/**
* Keep the records in step with what umdns sees (agent tick and apply).
* Turned off: the records go away.
*/
export function sync(m, force) {
let dirs = conf_dirs();
if (!enabled(m) || !ops.mdns_running()) {
let removed = false;
for (let d in dirs)
if (stat(`${d}/${FILE}`)) {
unlink(`${d}/${FILE}`);
removed = true;
}
if (removed)
restart_dnsmasq();
unlink(STATE);
return false;
}
let r = records(m, ops.mdns_services());
let st = read_json(STATE, {});
let now = time();
let same = st.conf == r.conf;
let quiet = !force && st.sig == r.sig && now - (st.ts ?? 0) < QUIET;
let missing = length(filter(dirs, (d) => !stat(`${d}/${FILE}`)));
if ((same || quiet) && !missing)
return false;
for (let d in dirs) {
ensure_dir(d);
writefile(`${d}/${FILE}`, r.conf);
system(`chmod 644 ${d}/${FILE}`);
}
write_json(STATE, { conf: r.conf, sig: r.sig, ts: now }, 0o644);
restart_dnsmasq();
return true;
};
/** Turning it on: umdns must run and look at the home networks. */
export function start_mdns() {
system('/etc/init.d/umdns enable >/dev/null 2>&1; /etc/init.d/umdns start >/dev/null 2>&1');
};
export function view(m) {
let s = ops.mdns_running() ? ops.mdns_services() : [];
return {
running: ops.mdns_running(),
services: length(filter(s, (x) => x.port && index(SKIP, x.type) < 0)),
};
};
@@ -137,8 +137,6 @@ export function load(c) {
// (Older configs: device_mesh 0/1.)
mesh: index(MESH, r.mesh) >= 0 ? r.mesh : (bool(r.device_mesh, true) ? 'all' : 'off'),
enabled: bool(r.enabled, true),
// Home devices found over Bonjour are published as DNS-SD records (needs umdns).
bonjour: bool(r.bonjour, false),
obf: {},
};
// A person's own devices reach each other whenever the mesh is not off.
@@ -34,7 +34,6 @@ export function needs() {
acme: miss([ [ file_exists('/usr/lib/acme/client/acme.sh'), 'acme' ], [ file_exists('/usr/lib/acme/client/dnsapi/dns_cf.sh'), 'acme-acmesh-dnsapi' ],
[ file_exists('/www/luci-static/resources/view/acme.js'), 'luci-app-acme' ] ]),
home: miss([ [ file_exists('/usr/libexec/ip-full'), 'ip-full' ], [ veth, 'kmod-veth' ] ]),
bonjour: miss([ [ file_exists('/usr/sbin/umdns'), 'umdns' ] ]),
};
};
@@ -52,7 +51,7 @@ export function mdns_services() {
return [];
let r = {};
try {
r = json(sh_out(`ubus call umdns browse '{"address":true}' 2>/dev/null`) || '{}') ?? {};
r = json(sh_out(`ubus call umdns browse '{"address":true,"array":true}' 2>/dev/null`) || '{}') ?? {};
}
catch (e) {
r = {};
@@ -3,7 +3,7 @@
import { open, readfile, writefile, rename, mkdir, stat, unlink, popen, lsdir } from 'fs';
export const VERSION = '0.3.0';
export const VERSION = '0.3.1';
/** GitHub repository with Dawnline releases (updates and the installer). */
export const REPO = 'tickcount/luci-app-dawnline';
export const RUN_DIR = '/var/run/dawnline';
+1
View File
@@ -24,6 +24,7 @@ SHOTS = {
'person': 'router.lan · Dawnline · Myata',
'portal': 'vpn.example.com/kamiro-telosu-bavine',
'map': 'router.lan · Dawnline · Overview',
'access': 'router.lan · Dawnline · Home · Access',
}
PAD_X, PAD_Y, BAR = 120, 96, 40
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "dawnline-web",
"version": "0.3.0",
"version": "0.3.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "dawnline-web",
"version": "0.3.0",
"version": "0.3.1",
"license": "MIT",
"dependencies": {
"qrcode-generator": "1.4.4"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "dawnline-web",
"version": "0.3.0",
"version": "0.3.1",
"private": true,
"license": "MIT",
"type": "module",
-3
View File
@@ -95,7 +95,6 @@ export interface Needs {
https: string[];
acme: string[];
home: string[];
bonjour: string[];
}
export interface SettingsData {
@@ -189,8 +188,6 @@ export interface InterfacesData {
mesh: MeshMode;
};
like_home: LikeHome;
/** Find home devices: published from umdns as DNS-SD records. */
bonjour: { on: boolean; needs: string[]; running: boolean; services: number };
effective: {
wan: { dev: string | null; zone: string; auto: boolean; missing: boolean };
home: { dev: string; auto: boolean; nets: string[]; zone: string | null; missing: boolean }[];
-29
View File
@@ -374,7 +374,6 @@ export function accessCards(srv: Server, st: Status, reload: () => void): HTMLEl
'',
mesh === 'circles' ? circleChips(st, serverId, reload) : undefined,
),
bonjourRow(),
services,
]),
E('div', { class: 'dl-setsec-foot' }, [
@@ -397,34 +396,6 @@ export function accessCards(srv: Server, st: Status, reload: () => void): HTMLEl
window.scrollTo({ top: y });
}
/** Find home devices: AirPlay, printers and shared Macs listed on Apple devices over the tunnel. */
function bonjourRow(): HTMLElement {
const b = d.bonjour;
const set = async (on: boolean) => {
if (await attempt(() => api.serverUpdate(serverId, { bonjour: on }), on ? 'Finding home devices' : 'Home devices no longer listed'))
load(false);
};
const state = b.needs.length
? E('span', { class: 'dl-warn' }, ` Needs ${b.needs.join(', ')}.`)
: b.on && !b.running
? E('span', { class: 'dl-warn' }, ' umdns is not running.')
: b.on
? ` Listing ${b.services} service${b.services === 1 ? '' : 's'} from home now.`
: '';
return setrow(
'wifi',
['Find home devices ', E('span', { class: 'dl-faint dl-w400' }, '· Bonjour')],
[
'iPhone, iPad and Mac on the VPN see AirPlay, printers and shared Macs at home, as on Wi-Fi. Android and Chromecast look only on the local network.',
state,
],
b.needs.length
? button('Install', () => installMissing('bonjour', b.needs, () => load(false)), 'positive')
: sw(b.on, 'Find home devices', (v) => set(v)),
b.on && b.running ? 'ok' : '',
);
}
/** Interfaces that can be home networks as tiles; the rest folded, by kind. */
function netPicker(): HTMLElement {
const avail = d.devices.filter(pickable);
-1
View File
@@ -8,7 +8,6 @@ const WHAT: Record<keyof Needs, string> = {
https: 'HTTPS for the portal',
acme: 'ACME certificates',
home: 'the home-like link',
bonjour: 'Bonjour for home devices',
};
const WAIT_MS = 5 * 60 * 1000;