mirror of
https://github.com/PhaseII-eAmusement-Network/PhaseWeb3-Vue.git
synced 2026-10-27 09:30:48 -05:00
2 lines
3.5 KiB
JavaScript
2 lines
3.5 KiB
JavaScript
import{r as u,o as L,a as i,c as v,w as d,b as n,i as h,X as N,e as r,al as O,_ as S,v as U,Y as F,ai as M,g as m,F as P,j as R,k as b,f as g,am as j,aa as G,l as J,n as D,p as H}from"./index.26ff47d4.js";import{_ as X}from"./ArcadeCard.c1ce6a82.js";import{_ as Y}from"./FormField.3920cd23.js";import{_ as q}from"./FormCheckRadio.c2c9f311.js";import{g as V,s as y}from"./values.1bd6ac4a.js";import{A as z,a as K,b as Q}from"./arcade.ae9af55b.js";const T={class:"grid grid-cols-1 w-full gap-2 md:gap-6 md:flex md:place-content-stretch"},W={key:0,class:"space-x-2 mt-6"},Z=m("h1",{class:"text-lg md:text-xl"},"OpenVPN Configuration",-1),ee=m("p",{class:"pb-1 dark:text-white/50"}," Use this to download your VPN config. ",-1),ae={class:"grid grid-cols-1 gap-6 sm:grid-cols-2 md:grid-cols-3 mb-6"},ce={__name:"ArcadeView",setup(te){const l=u(null),p=u(null),s=u(null),A=u(!0),x=H(),f=parseInt(x.params.id);var w=[{id:"paseli_enabled",name:"PASELI Services",help:"Enable PASELI for this arcade.",type:"Boolean"},{id:"paseli_infinite",name:"Infinite PASELI",help:"Enable infinite PASELI for this arcade.",type:"Boolean"},{id:"maint",name:"Maintenance Mode",help:"Place this arcade under maintenance.",type:"Boolean"},{id:"hide_network",name:"Incognito Mode",help:"Hide the network and all ranking data.",type:"Boolean"}];async function _(){try{s.value={},l.value={},p.value={};const t=await z(f);s.value=t;for(const a of w){const e=V(s.value.data,a.id);y(l.value,a.id,e),y(p.value,a.id,e)}A.value=!1}catch(t){console.error("Failed to fetch arcade data:",t)}}async function B(){(await Q(f,l.value)).status!="error"&&await _()}L(()=>{_()});function I(t,a="NA_"){var e=[...t].map(c=>c.charCodeAt(0)<128?c:a).join("");return e=e.replace(/[!"#$%&'()*+,-./:;<=>?@[\\\]^_`{|}~]/g,""),e=e.replace(/\s+/g,"_"),e}async function C(){try{const t=await K(f),a=new Blob([t],{type:"application/ovpn"}),e=document.createElement("a");e.href=URL.createObjectURL(a),e.download=`gradius-${I(s.value.name)}-phaseii-config.ovpn`,document.body.appendChild(e),e.click(),URL.revokeObjectURL(e.href),document.body.removeChild(e)}catch(t){console.log("Failed to fetch arcade data:",t)}}return(t,a)=>(i(),v(D,null,{default:d(()=>[n(J,null,{default:d(()=>{var e,c;return[A.value?b("",!0):(i(),h(P,{key:0},[n(X,{class:"mb-6",arcade:s.value},null,8,["arcade"]),n(N,{icon:r(O),title:"Arcade Administration",main:""},null,8,["icon"]),n(S,{"is-form":"",class:"mb-6",onSubmit:U(B,["prevent"])},{default:d(()=>[n(F,{color:"info",label:"Settings",icon:r(M),class:"mb-2"},null,8,["icon"]),m("div",T,[(i(!0),h(P,null,R(r(w),o=>(i(),v(Y,{key:o.id,label:o.name,help:o.help},{default:d(()=>{var k;return[o.type=="Boolean"?(i(),v(q,{key:0,name:o.id,"model-value":Boolean((k=r(V)(l.value,o.id))!=null?k:0),"input-value":!0,type:"switch","onUpdate:modelValue":E=>{var $;return r(y)(l.value,o.id,($=Number(E))!=null?$:0)}},null,8,["name","model-value","onUpdate:modelValue"])):b("",!0)]}),_:2},1032,["label","help"]))),128))]),JSON.stringify(l.value)!==JSON.stringify(p.value)?(i(),h("div",W,[n(g,{color:"success",label:"Save",type:"submit"}),n(g,{color:"danger",label:"Revert",onClick:a[0]||(a[0]=o=>_())})])):b("",!0)]),_:1},8,["onSubmit"]),n(S,{class:"w-1/2 mb-6"},{default:d(()=>[Z,ee,n(g,{small:!1,color:"success",class:"my-2",label:"Export",onClick:a[1]||(a[1]=o=>C())})]),_:1}),n(N,{icon:r(j),title:"Arcade Overview",main:""},null,8,["icon"]),m("div",ae,[n(G,{number:(c=(e=s.value)==null?void 0:e.machines)==null?void 0:c.length,label:"Active Machines"},null,8,["number"])])],64))]}),_:1})]),_:1}))}};export{ce as default};
|