WGDashboard/src/static/app/dist/assets/index-C8JLgmcN.js
2024-11-08 16:13:47 +08:00

2 lines
8.1 KiB
JavaScript

import{r as C,o as D,a as o,c as l,b as e,d as s,e as g,f as m,t as v,_ as k,W as L,D as $,g as H,G as N,w as c,F as y,h as w,n as S,i as _,T as M,j as b,k as A,l as G,S as T}from"./index-BPNEscAR.js";import{L as h}from"./localeText-DX813vQA.js";import{M as V}from"./message-Cw7_G39b.js";import"./dayjs.min-Lw24H7b2.js";const U={class:"peerSettingContainer w-100 h-100 position-absolute top-0 start-0 overflow-y-scroll"},W={class:"container d-flex h-100 w-100"},B={class:"m-auto modal-dialog-centered dashboardModal"},O={class:"card rounded-3 shadow flex-grow-1"},R={class:"card-header bg-transparent d-flex align-items-center gap-2 border-0 p-4 pb-2"},z={class:"mb-0"},F={class:"card-body px-4 pb-4 d-flex flex-column gap-2"},j={class:"card text-decoration-none",target:"_blank",role:"button",href:"https://discord.com/invite/ZkJSPAaQ"},q={class:"card-body d-flex gap-4 align-items-center"},I={class:"d-flex align-items-center"},J={class:"badge rounded-pill text-bg-primary ms-2"},P={key:0,class:"spinner-border spinner-border-sm",style:{width:"0.7rem",height:"0.7rem"}},E={key:1},Q={class:"text-muted"},Z={class:"card text-decoration-none",href:"https://donaldzou.github.io/WGDashboard-Documentation/",target:"_blank"},K={class:"card-body d-flex gap-4 align-items-center"},X={class:"mb-0"},Y={class:"text-muted"},ee={__name:"helpModal",setup(n){const t=C(!0),f=C(void 0);return D(()=>{t.value=!0,fetch("https://discord.com/api/guilds/1276818723637956628/widget.json").then(d=>d.json()).then(d=>{f.value=d,t.value=!1}).catch(()=>{t.value=!1})}),(d,a)=>(o(),l("div",U,[e("div",W,[e("div",B,[e("div",O,[e("div",R,[e("h4",z,[s(h,{t:"Help"})]),e("button",{type:"button",class:"btn-close ms-auto",onClick:a[0]||(a[0]=p=>d.$emit("close"))})]),e("div",F,[e("a",j,[e("div",q,[a[3]||(a[3]=e("h1",{class:"mb-0"},[e("i",{class:"bi bi-discord"})],-1)),e("div",null,[e("div",I,[a[2]||(a[2]=e("h5",{class:"mb-0"}," Discord Server ",-1)),e("span",J,[t.value?(o(),l("span",P)):g("",!0),f.value!==void 0&&!t.value?(o(),l("span",E,[a[1]||(a[1]=e("i",{class:"bi bi-person-fill me-2"},null,-1)),m(v(f.value.presence_count)+" Online ",1)])):g("",!0)])]),e("small",Q,[s(h,{t:"Join our Discord server for quick help or chat about WGDashboard!"})])])])]),e("a",Z,[e("div",K,[a[4]||(a[4]=e("h1",{class:"mb-0"},[e("i",{class:"bi bi-hash"})],-1)),e("div",null,[e("h5",X,[s(h,{t:"Official Documentation"})]),e("small",Y,[s(h,{t:"Official documentation contains User Guides and more..."})])])])])])])])])]))}},te={name:"navbar",components:{HelpModal:ee,LocaleText:h},setup(){const n=L(),t=$();return{wireguardConfigurationsStore:n,dashboardConfigurationStore:t}},data(){return{updateAvailable:!1,updateMessage:"Checking for update...",updateUrl:"",openHelpModal:!1}},computed:{getActiveCrossServer(){if(this.dashboardConfigurationStore.ActiveServerConfiguration)return new URL(this.dashboardConfigurationStore.CrossServerConfiguration.ServerList[this.dashboardConfigurationStore.ActiveServerConfiguration].host)}},mounted(){H("/api/getDashboardUpdate",{},n=>{n.status?(n.data&&(this.updateAvailable=!0,this.updateUrl=n.data),this.updateMessage=n.message):(this.updateMessage=N("Failed to check available update"),console.log(`Failed to get update: ${n.message}`))})}},se=["data-bs-theme"],oe={id:"sidebarMenu",class:"bg-body-tertiary sidebar border h-100 rounded-3 shadow overflow-y-scroll"},ae={class:"sidebar-sticky"},ne={class:"text-white text-center m-0 py-3 mb-3 btn-brand"},ie={key:0,class:"ms-auto"},re={class:"nav flex-column px-2"},le={class:"nav-item"},de={class:"nav-item"},ce={class:"nav-item"},ue={class:"sidebar-heading px-3 mt-4 mb-1 text-muted text-center"},me={class:"nav flex-column px-2"},be={class:"nav-item"},fe={class:"sidebar-heading px-3 mt-4 mb-1 text-muted text-center"},pe={class:"nav flex-column px-2"},ve={class:"nav-item"},he={class:"nav-item"},_e={class:"nav flex-column px-2 mb-3"},ge={class:"nav-item"},xe={class:"nav-item",style:{"font-size":"0.8rem"}},Ce=["href"],Se={class:"nav-link text-muted rounded-3"},ke={key:1,class:"nav-link text-muted rounded-3"};function $e(n,t,f,d,a,p){const i=b("LocaleText"),u=b("RouterLink"),x=b("HelpModal");return o(),l("div",{class:S(["col-md-3 col-lg-2 d-md-block p-2 navbar-container",{active:this.dashboardConfigurationStore.ShowNavBar}]),"data-bs-theme":d.dashboardConfigurationStore.Configuration.Server.dashboard_theme},[e("nav",oe,[e("div",ae,[e("div",ne,[t[4]||(t[4]=e("h5",{class:"mb-0"}," WGDashboard ",-1)),p.getActiveCrossServer!==void 0?(o(),l("small",ie,[t[3]||(t[3]=e("i",{class:"bi bi-hdd-rack-fill me-2"},null,-1)),m(v(p.getActiveCrossServer.host),1)])):g("",!0)]),e("ul",re,[e("li",le,[s(u,{class:"nav-link rounded-3",to:"/","exact-active-class":"active"},{default:c(()=>[t[5]||(t[5]=e("i",{class:"bi bi-house me-2"},null,-1)),s(i,{t:"Home"})]),_:1})]),e("li",de,[s(u,{class:"nav-link rounded-3",to:"/settings","exact-active-class":"active"},{default:c(()=>[t[6]||(t[6]=e("i",{class:"bi bi-gear me-2"},null,-1)),s(i,{t:"Settings"})]),_:1})]),e("li",ce,[e("a",{class:"nav-link rounded-3",role:"button",onClick:t[0]||(t[0]=r=>a.openHelpModal=!0)},[t[7]||(t[7]=e("i",{class:"bi bi-question-circle me-2"},null,-1)),s(i,{t:"Help"})])])]),t[12]||(t[12]=e("hr",{class:"text-body"},null,-1)),e("h6",ue,[t[8]||(t[8]=e("i",{class:"bi bi-body-text me-2"},null,-1)),s(i,{t:"WireGuard Configurations"})]),e("ul",me,[(o(!0),l(y,null,w(this.wireguardConfigurationsStore.Configurations,r=>(o(),l("li",be,[s(u,{to:"/configuration/"+r.Name+"/peers",class:"nav-link nav-conf-link rounded-3","active-class":"active"},{default:c(()=>[e("span",{class:S(["dot me-2",{active:r.Status}])},null,2),m(" "+v(r.Name),1)]),_:2},1032,["to"])]))),256))]),t[13]||(t[13]=e("hr",{class:"text-body"},null,-1)),e("h6",fe,[t[9]||(t[9]=e("i",{class:"bi bi-tools me-2"},null,-1)),s(i,{t:"Tools"})]),e("ul",pe,[e("li",ve,[s(u,{to:"/ping",class:"nav-link rounded-3","active-class":"active"},{default:c(()=>[s(i,{t:"Ping"})]),_:1})]),e("li",he,[s(u,{to:"/traceroute",class:"nav-link rounded-3","active-class":"active"},{default:c(()=>[s(i,{t:"Traceroute"})]),_:1})])]),t[14]||(t[14]=e("hr",{class:"text-body"},null,-1)),e("ul",_e,[e("li",ge,[e("a",{class:"nav-link text-danger rounded-3",onClick:t[1]||(t[1]=r=>this.dashboardConfigurationStore.signOut()),role:"button",style:{"font-weight":"bold"}},[t[10]||(t[10]=e("i",{class:"bi bi-box-arrow-left me-2"},null,-1)),s(i,{t:"Sign Out"})])]),e("li",xe,[this.updateAvailable?(o(),l("a",{key:0,href:this.updateUrl,class:"text-decoration-none rounded-3",target:"_blank"},[e("small",Se,[s(i,{t:this.updateMessage},null,8,["t"]),t[11]||(t[11]=m(" (")),s(i,{t:"Current Version:"}),m(" "+v(d.dashboardConfigurationStore.Configuration.Server.version)+") ",1)])],8,Ce)):(o(),l("small",ke,[s(i,{t:this.updateMessage},null,8,["t"]),m(" ("+v(d.dashboardConfigurationStore.Configuration.Server.version)+") ",1)]))])])])]),s(M,{name:"zoom"},{default:c(()=>[this.openHelpModal?(o(),_(x,{key:0,onClose:t[2]||(t[2]=r=>{a.openHelpModal=!1})})):g("",!0)]),_:1})],10,se)}const ye=k(te,[["render",$e],["__scopeId","data-v-83a7789f"]]),we={name:"index",components:{Message:V,Navbar:ye},async setup(){return{dashboardConfigurationStore:$()}},computed:{getMessages(){return this.dashboardConfigurationStore.Messages.filter(n=>n.show)}}},Me=["data-bs-theme"],De={class:"row h-100"},Le={class:"col-md-9 col-lg-10 overflow-y-scroll mb-0 pt-2"},He={class:"messageCentre text-body position-fixed d-flex"};function Ne(n,t,f,d,a,p){const i=b("Navbar"),u=b("RouterView"),x=b("Message");return o(),l("div",{class:"container-fluid flex-grow-1 main","data-bs-theme":this.dashboardConfigurationStore.Configuration.Server.dashboard_theme},[e("div",De,[s(i),e("main",Le,[(o(),_(T,null,{default:c(()=>[s(u,null,{default:c(({Component:r})=>[s(M,{name:"fade2",mode:"out-in",appear:""},{default:c(()=>[(o(),_(G(r)))]),_:2},1024)]),_:1})]),_:1})),e("div",He,[s(A,{name:"message",tag:"div",class:"position-relative flex-sm-grow-0 flex-grow-1 d-flex align-items-end ms-sm-auto flex-column gap-2"},{default:c(()=>[(o(!0),l(y,null,w(p.getMessages.slice().reverse(),r=>(o(),_(x,{message:r,key:r.id},null,8,["message"]))),128))]),_:1})])])])],8,Me)}const Ue=k(we,[["render",Ne],["__scopeId","data-v-ce114a8b"]]);export{Ue as default};