watchyourlan/backend/internal/web/public/assets/Config.js
2026-02-16 13:25:42 +01:00

1 line
11 KiB
JavaScript

import{c as J,o as K,a as X,t,i as r,b as d,s as Y,d as z,e as b,S as j,f as e,F as M,g as Z,h as tt,j as Q}from"./index.js";var et=t('<div class="card border-primary"><div class=card-header>About (<a target=_blank></a>)</div><div class="card-body table-responsive"><table class="table table-striped"><tbody><tr><td><b>Swagger API docs</b></td><td><a href=/swagger/index.html target=_blank>/swagger/index.html</a></td></tr><tr><td><b>Local node-bootstrap URL</b></td><td>local themes and fonts (optional). If empty, the app will pull everything from <code>cdn</code></td></tr><tr><td><b>Shoutrrr URL</b></td><td>provides notifications to Discord, Email, Gotify, Telegram and other services. <a href=https://shoutrrr.nickfedor.com/services/overview/ target=_blank>Link to documentation</a></td></tr><tr><td><b>Interfaces</b></td><td>one or more, space separated</td></tr><tr><td><b>Timeout (seconds)</b></td><td>time between scans</td></tr><tr><td><b>Args for arp-scan</b></td><td>pass your own arguments to <code>arp-scan</code>. Enable <b>debug</b> log level to see resulting command. (Example: <code>-r 1</code>). See <a href=https://github.com/aceberg/WatchYourLAN/blob/main/docs/VLAN_ARP_SCAN.md target=_blank>docs</a> for more</td></tr><tr><td><b>Arp Strings</b></td><td>can setup scans for <code>vlans</code>, <code>docker0</code> and etcetera. See <a href=https://github.com/aceberg/WatchYourLAN/blob/main/docs/VLAN_ARP_SCAN.md target=_blank>docs</a> for more</td></tr><tr><td><b>Trim History</b></td><td>remove history after (hours)</td></tr><tr><td><b>PG Connect URL</b></td><td>address to connect to PostgreSQL DB. (Example: <code>postgres://username:password@192.168.0.1:5432/dbname?sslmode=disable</code>). Full list of URL parameters <a href=https://pkg.go.dev/github.com/lib/pq#hdr-Connection_String_Parameters target=_blank>here');function rt(){const[i,o]=J(""),[s,a]=J("");return K(async()=>{const l=await X();o(l),a("https://github.com/aceberg/WatchYourLAN/releases/tag/"+l)}),(()=>{var l=et(),n=l.firstChild,c=n.firstChild,m=c.nextSibling;return r(m,i),d(()=>Y(m,"href",s())),l})()}var lt=t("<option value=dark selected>dark"),it=t("<option value=light>light"),st=t('<div class="card border-primary"><div class=card-header>Basic config</div><div class="card-body table-responsive"><form method=post><table class="table table-borderless"><tbody><tr><td>Host</td><td><input name=host type=text class=form-control></td></tr><tr><td>Port</td><td><input name=port type=text class=form-control></td></tr><tr><td>Theme</td><td><select name=theme class=form-select></select></td></tr><tr><td>Color mode</td><td><select name=color class=form-select></select></td></tr><tr><td>Local node-bootstrap URL</td><td><input name=node type=text class=form-control></td></tr><tr><td>Shoutrrr URL</td><td><textarea name=shout class=form-control style=width:100%; rows=3 wrap=soft></textarea></td></tr><tr><td><button type=submit class="btn btn-primary">Save</button></td><td><button type=button style=float:right; class="btn btn-info">Test notification</button></td><td>'),at=t("<option selected>"),nt=t("<option>"),dt=t("<option value=dark>dark"),ot=t("<option value=light selected>light");function ct(){const i=["cerulean","cosmo","cyborg","darkly","emerald","flatly","grass","grayscale","journal","litera","lumen","lux","materia","minty","morph","ocean","pulse","quartz","sand","sandstone","simplex","sketchy","slate","solar","spacelab","superhero","united","vapor","wood","yeti","zephyr"],o=()=>{Z()};return(()=>{var s=st(),a=s.firstChild,l=a.nextSibling,n=l.firstChild,c=n.firstChild,m=c.firstChild,u=m.firstChild,g=u.firstChild,_=g.nextSibling,T=_.firstChild,w=u.nextSibling,P=w.firstChild,v=P.nextSibling,N=v.firstChild,L=w.nextSibling,E=L.firstChild,x=E.nextSibling,R=x.firstChild,C=L.nextSibling,U=C.firstChild,S=U.nextSibling,D=S.firstChild,A=C.nextSibling,B=A.firstChild,y=B.nextSibling,q=y.firstChild,I=A.nextSibling,G=I.firstChild,k=G.nextSibling,H=k.firstChild,V=I.nextSibling,W=V.firstChild,F=W.nextSibling,O=F.firstChild;return Y(n,"action",z+"/api/config/"),r(R,b(M,{each:i,children:$=>b(j,{get when(){return $==e().Theme},get fallback(){return(()=>{var p=nt();return p.value=$,r(p,$),p})()},get children(){var p=at();return p.value=$,r(p,$),p}})})),r(D,b(j,{get when(){return e().Color=="dark"},get fallback(){return[dt(),ot()]},get children(){return[lt(),it()]}})),r(H,()=>e().ShoutURL),O.$$click=o,d(()=>T.value=e().Host),d(()=>N.value=e().Port),d(()=>q.value=e().NodePath),s})()}tt(["click"]);var bt=t('<div class="card border-info"><div class=card-header>Donations and Work</div><div class=card-body><p>Every <a href=https://github.com/aceberg#donate target=_blank>donation</a> is truly appreciated!</p><p>I am offering self-hosted and mobile apps development for a small price. The Open Source apps I created are listed in my <a href=https://aceberg.github.io/portfolio/ target=_blank>portfolio</a>. They are all human-coded, not generated by AI. Please, <a href=https://github.com/aceberg#contact target=_blank>contact</a> me, if you are interested.');function pt(){return bt()}var ft=t('<div class="card border-primary"><div class=card-header>InfluxDB2 config</div><div class="card-body table-responsive"><form method=post><table class="table table-borderless"><tbody><tr><td>Enable</td><td><div class="form-check form-switch"></div></td></tr><tr><td>Address</td><td><input name=addr type=text class=form-control></td></tr><tr><td>Token</td><td><input name=token type=text class=form-control></td></tr><tr><td>Org</td><td><input name=org type=text class=form-control></td></tr><tr><td>Bucket</td><td><input name=bucket type=text class=form-control></td></tr><tr><td>Network Name</td><td><input name=network_name type=text class=form-control></td></tr><tr><td>Device Location</td><td><input name=device_location type=text class=form-control></td></tr><tr><td>Skip TLS verify</td><td><div class="form-check form-switch"></div></td></tr><tr><td><button type=submit class="btn btn-primary">Save</button></td><td>'),mt=t("<input class=form-check-input type=checkbox name=enable checked>"),ht=t("<input class=form-check-input type=checkbox name=enable>"),_t=t("<input class=form-check-input type=checkbox name=skip checked>"),$t=t("<input class=form-check-input type=checkbox name=skip>");function ut(){return(()=>{var i=ft(),o=i.firstChild,s=o.nextSibling,a=s.firstChild,l=a.firstChild,n=l.firstChild,c=n.firstChild,m=c.firstChild,u=m.nextSibling,g=u.firstChild,_=c.nextSibling,T=_.firstChild,w=T.nextSibling,P=w.firstChild,v=_.nextSibling,N=v.firstChild,L=N.nextSibling,E=L.firstChild,x=v.nextSibling,R=x.firstChild,C=R.nextSibling,U=C.firstChild,S=x.nextSibling,D=S.firstChild,A=D.nextSibling,B=A.firstChild,y=S.nextSibling,q=y.firstChild,I=q.nextSibling,G=I.firstChild,k=y.nextSibling,H=k.firstChild,V=H.nextSibling,W=V.firstChild,F=k.nextSibling,O=F.firstChild,$=O.nextSibling,p=$.firstChild;return Y(a,"action",z+"/api/config_influx/"),r(g,(()=>{var f=Q(()=>!!e().InfluxEnable);return()=>f()?mt():ht()})()),r(p,(()=>{var f=Q(()=>!!e().InfluxSkipTLS);return()=>f()?_t():$t()})()),d(()=>P.value=e().InfluxAddr),d(()=>E.value=e().InfluxToken),d(()=>U.value=e().InfluxOrg),d(()=>B.value=e().InfluxBucket),d(()=>G.value=e().InfluxNetworkName),d(()=>W.value=e().InfluxDeviceLocation),i})()}var gt=t('<div class="card border-primary"><div class=card-header>Prometheus config</div><div class="card-body table-responsive"><form method=post><table class="table table-borderless"><tbody><tr><td>Enable</td><td><div class="form-check form-switch"></div></td></tr><tr><td><button type=submit class="btn btn-primary">Save</button></td><td><a href=/metrics target=_blank>/metrics'),vt=t("<input class=form-check-input type=checkbox name=enable checked>"),xt=t("<input class=form-check-input type=checkbox name=enable>");function Ct(){return(()=>{var i=gt(),o=i.firstChild,s=o.nextSibling,a=s.firstChild,l=a.firstChild,n=l.firstChild,c=n.firstChild,m=c.firstChild,u=m.nextSibling,g=u.firstChild;return Y(a,"action",z+"/api/config_prometheus/"),r(g,(()=>{var _=Q(()=>!!e().PrometheusEnable);return()=>_()?vt():xt()})()),i})()}var St=t("<option value=sqlite selected>sqlite"),yt=t("<option value=postgres>postgres"),kt=t('<div class="card border-primary"><div class=card-header>Scan settings</div><div class="card-body table-responsive"><form method=post><table class="table table-borderless"><tbody><tr><td>Interfaces</td><td><input name=ifaces type=text class=form-control></td></tr><tr><td>Timeout (seconds)</td><td><input name=timeout type=number class=form-control></td></tr><tr><td>Args for arp-scan</td><td><input name=arpargs type=text class=form-control></td></tr><tr><td>Arp Strings</td><td><input name=arpstrs type=text class=form-control></td></tr><tr><td>Log level</td><td><select name=log class=form-select></select></td></tr><tr><td>Trim History (hours)</td><td><input name=trim type=number class=form-control></td></tr><tr><td>Use DB</td><td><select name=usedb class=form-select></select></td></tr><tr><td>PG Connect URL</td><td><textarea name=pgconnect class=form-control style=width:100%; rows=3 wrap=soft></textarea></td></tr><tr><td><button type=submit class="btn btn-primary">Save</button></td><td class=text-muted>*Pressing <b>Save</b> button will trigger rescan'),wt=t("<input name=arpstrs type=text class=form-control>"),Lt=t("<option selected>"),At=t("<option>"),It=t("<option value=sqlite>sqlite"),Tt=t("<option value=postgres selected>postgres");function Pt(){return(()=>{var i=kt(),o=i.firstChild,s=o.nextSibling,a=s.firstChild,l=a.firstChild,n=l.firstChild,c=n.firstChild,m=c.firstChild,u=m.nextSibling,g=u.firstChild,_=c.nextSibling,T=_.firstChild,w=T.nextSibling,P=w.firstChild,v=_.nextSibling,N=v.firstChild,L=N.nextSibling,E=L.firstChild,x=v.nextSibling,R=x.firstChild,C=R.nextSibling,U=C.firstChild,S=x.nextSibling,D=S.firstChild,A=D.nextSibling,B=A.firstChild,y=S.nextSibling,q=y.firstChild,I=q.nextSibling,G=I.firstChild,k=y.nextSibling,H=k.firstChild,V=H.nextSibling,W=V.firstChild,F=k.nextSibling,O=F.firstChild,$=O.nextSibling,p=$.firstChild;return Y(a,"action",z+"/api/config_settings/"),r(C,b(M,{get each(){return e().ArpStrs},children:f=>(()=>{var h=wt();return h.value=f,h})()}),U),r(B,b(M,{each:["debug","info","warn","error"],children:f=>b(j,{get when(){return f==e().LogLevel},get fallback(){return(()=>{var h=At();return h.value=f,r(h,f),h})()},get children(){var h=Lt();return h.value=f,r(h,f),h}})})),r(W,b(j,{get when(){return e().UseDB=="sqlite"},get fallback(){return[It(),Tt()]},get children(){return[St(),yt()]}})),r(p,()=>e().PGConnect),d(()=>g.value=e().Ifaces),d(()=>P.value=e().Timeout),d(()=>E.value=e().ArpArgs),d(()=>G.value=e().TrimHist),i})()}var Nt=t('<div class=row><div class=col-md><div class=mt-4></div><div class="mt-4 mb-4"></div></div><div class=col-md><div class=mt-4></div><div class=mt-4>');function Rt(){return(()=>{var i=Nt(),o=i.firstChild,s=o.firstChild,a=s.nextSibling,l=o.nextSibling,n=l.firstChild,c=n.nextSibling;return r(o,b(ct,{}),s),r(s,b(pt,{})),r(a,b(Pt,{})),r(l,b(ut,{}),n),r(n,b(Ct,{})),r(c,b(rt,{})),i})()}export{Rt as default};