watchyourlan/backend/internal/web/public/assets/Config.js
2026-06-04 21:43:36 +02:00

1 line
12 KiB
JavaScript

import{c as J,o as K,a as X,t,i as l,b as n,s as G,d as V,e as h,S as W,f as e,F as Q,g as Z,h as tt,j as F}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 lt(){const[r,c]=J(""),[d,s]=J("");return K(async()=>{const i=await X();c(i),s("https://github.com/aceberg/WatchYourLAN/releases/tag/"+i)}),(()=>{var i=et(),o=i.firstChild,a=o.firstChild,b=a.nextSibling;return l(b,r),n(()=>G(b,"href",d())),i})()}var rt=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 r=["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"],c=()=>{Z()};return(()=>{var d=st(),s=d.firstChild,i=s.nextSibling,o=i.firstChild,a=o.firstChild,b=a.firstChild,$=b.firstChild,v=$.firstChild,p=v.nextSibling,L=p.firstChild,S=$.nextSibling,T=S.firstChild,f=T.nextSibling,P=f.firstChild,y=S.nextSibling,I=y.firstChild,_=I.nextSibling,E=_.firstChild,x=y.nextSibling,U=x.firstChild,m=U.nextSibling,R=m.firstChild,k=x.nextSibling,N=k.firstChild,w=N.nextSibling,B=w.firstChild,A=k.nextSibling,D=A.firstChild,u=D.nextSibling,O=u.firstChild,Y=A.nextSibling,j=Y.firstChild,z=j.nextSibling,M=z.firstChild;return G(o,"action",V+"/api/config/"),l(E,h(Q,{each:r,children:q=>h(W,{get when(){return q==e().Theme},get fallback(){return(()=>{var C=nt();return C.value=q,l(C,q),C})()},get children(){var C=at();return C.value=q,l(C,q),C}})})),l(R,h(W,{get when(){return e().Color=="dark"},get fallback(){return[dt(),ot()]},get children(){return[rt(),it()]}})),l(O,()=>e().ShoutURL),M.$$click=c,n(()=>L.value=e().Host),n(()=>P.value=e().Port),n(()=>B.value=e().NodePath),d})()}tt(["click"]);var bt=t('<div class="card border-primary"><div class=card-header>ClickHouse 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>User</td><td><input name=user type=text class=form-control></td></tr><tr><td>Password</td><td><input name=password type=password class=form-control></td></tr><tr><td>Database</td><td><input name=db type=text class=form-control></td></tr><tr><td>Table</td><td><input name=table type=text class=form-control></td></tr><tr><td><button type=submit class="btn btn-primary">Save</button></td><td>'),ht=t("<input class=form-check-input type=checkbox name=enable checked>"),pt=t("<input class=form-check-input type=checkbox name=enable>");function $t(){return(()=>{var r=bt(),c=r.firstChild,d=c.nextSibling,s=d.firstChild,i=s.firstChild,o=i.firstChild,a=o.firstChild,b=a.firstChild,$=b.nextSibling,v=$.firstChild,p=a.nextSibling,L=p.firstChild,S=L.nextSibling,T=S.firstChild,f=p.nextSibling,P=f.firstChild,y=P.nextSibling,I=y.firstChild,_=f.nextSibling,E=_.firstChild,x=E.nextSibling,U=x.firstChild,m=_.nextSibling,R=m.firstChild,k=R.nextSibling,N=k.firstChild,w=m.nextSibling,B=w.firstChild,A=B.nextSibling,D=A.firstChild;return G(s,"action",V+"/api/config_clickhouse/"),l(v,(()=>{var u=F(()=>!!e().ClickhouseEnable);return()=>u()?ht():pt()})()),n(()=>T.value=e().ClickhouseAddr),n(()=>I.value=e().ClickhouseUser),n(()=>U.value=e().ClickhousePassword),n(()=>N.value=e().ClickhouseDB),n(()=>D.value=e().ClickhouseTable),r})()}var ft=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 _t(){return ft()}var mt=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>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>'),ut=t("<input class=form-check-input type=checkbox name=enable checked>"),gt=t("<input class=form-check-input type=checkbox name=enable>"),vt=t("<input class=form-check-input type=checkbox name=skip checked>"),xt=t("<input class=form-check-input type=checkbox name=skip>");function Ct(){return(()=>{var r=mt(),c=r.firstChild,d=c.nextSibling,s=d.firstChild,i=s.firstChild,o=i.firstChild,a=o.firstChild,b=a.firstChild,$=b.nextSibling,v=$.firstChild,p=a.nextSibling,L=p.firstChild,S=L.nextSibling,T=S.firstChild,f=p.nextSibling,P=f.firstChild,y=P.nextSibling,I=y.firstChild,_=f.nextSibling,E=_.firstChild,x=E.nextSibling,U=x.firstChild,m=_.nextSibling,R=m.firstChild,k=R.nextSibling,N=k.firstChild,w=m.nextSibling,B=w.firstChild,A=B.nextSibling,D=A.firstChild;return G(s,"action",V+"/api/config_influx/"),l(v,(()=>{var u=F(()=>!!e().InfluxEnable);return()=>u()?ut():gt()})()),l(D,(()=>{var u=F(()=>!!e().InfluxSkipTLS);return()=>u()?vt():xt()})()),n(()=>T.value=e().InfluxAddr),n(()=>I.value=e().InfluxToken),n(()=>U.value=e().InfluxOrg),n(()=>N.value=e().InfluxBucket),r})()}var St=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'),yt=t("<input class=form-check-input type=checkbox name=enable checked>"),kt=t("<input class=form-check-input type=checkbox name=enable>");function wt(){return(()=>{var r=St(),c=r.firstChild,d=c.nextSibling,s=d.firstChild,i=s.firstChild,o=i.firstChild,a=o.firstChild,b=a.firstChild,$=b.nextSibling,v=$.firstChild;return G(s,"action",V+"/api/config_prometheus/"),l(v,(()=>{var p=F(()=>!!e().PrometheusEnable);return()=>p()?yt():kt()})()),r})()}var At=t("<option value=sqlite selected>sqlite"),Lt=t("<option value=postgres>postgres"),Tt=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'),Pt=t("<input name=arpstrs type=text class=form-control>"),It=t("<option selected>"),Et=t("<option>"),Ut=t("<option value=sqlite>sqlite"),Rt=t("<option value=postgres selected>postgres");function Nt(){return(()=>{var r=Tt(),c=r.firstChild,d=c.nextSibling,s=d.firstChild,i=s.firstChild,o=i.firstChild,a=o.firstChild,b=a.firstChild,$=b.nextSibling,v=$.firstChild,p=a.nextSibling,L=p.firstChild,S=L.nextSibling,T=S.firstChild,f=p.nextSibling,P=f.firstChild,y=P.nextSibling,I=y.firstChild,_=f.nextSibling,E=_.firstChild,x=E.nextSibling,U=x.firstChild,m=_.nextSibling,R=m.firstChild,k=R.nextSibling,N=k.firstChild,w=m.nextSibling,B=w.firstChild,A=B.nextSibling,D=A.firstChild,u=w.nextSibling,O=u.firstChild,Y=O.nextSibling,j=Y.firstChild,z=u.nextSibling,M=z.firstChild,q=M.nextSibling,C=q.firstChild;return G(s,"action",V+"/api/config_settings/"),l(x,h(Q,{get each(){return e().ArpStrs},children:H=>(()=>{var g=Pt();return g.value=H,g})()}),U),l(N,h(Q,{each:["debug","info","warn","error"],children:H=>h(W,{get when(){return H==e().LogLevel},get fallback(){return(()=>{var g=Et();return g.value=H,l(g,H),g})()},get children(){var g=It();return g.value=H,l(g,H),g}})})),l(j,h(W,{get when(){return e().UseDB=="sqlite"},get fallback(){return[Ut(),Rt()]},get children(){return[At(),Lt()]}})),l(C,()=>e().PGConnect),n(()=>v.value=e().Ifaces),n(()=>T.value=e().Timeout),n(()=>I.value=e().ArpArgs),n(()=>D.value=e().TrimHist),r})()}var Bt=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></div><div class=mt-4>');function qt(){return(()=>{var r=Bt(),c=r.firstChild,d=c.firstChild,s=d.nextSibling,i=c.nextSibling,o=i.firstChild,a=o.nextSibling,b=a.nextSibling;return l(c,h(ct,{}),d),l(d,h(_t,{})),l(s,h(Nt,{})),l(i,h(Ct,{}),o),l(o,h(wt,{})),l(a,h($t,{})),l(b,h(lt,{})),r})()}export{qt as default};