1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9966],{39966:(e,s,a)=>{a.r(s),a.d(s,{default:()=>f});var r=a(20475),t=a(20107),l=a(72167),d=a(35601),o=a(83086),n=a(32857),i=a(42541),c=a(49153),u=a(36760),h=a(76554),m=a(114),x=a(88926),p=a(44381);let f=()=>{let{toast:e}=(0,n.dj)(),[s,a]=(0,t.useState)(!0),[f,j]=(0,t.useState)([]),[g,b]=(0,t.useState)(!1),[v,y]=(0,t.useState)(""),[N,w]=(0,t.useState)({passthrough:null,selectedMac:null,modemProtocol:null,dnsProxy:null}),[P,C]=(0,t.useState)({passthrough:null,selectedMac:null,modemProtocol:null,dnsProxy:null}),M={passthrough:{disabled:'+QMAP="MPDN_rule",0;+QMAPWAC=1;+QPOWD=1',ETH:e=>'+QMAP="MPDN_rule",0,1,0,1,1,"'.concat(e,'";+QPOWD=1'),USB:e=>'+QMAP="MPDN_rule",0,1,0,3,1,"'.concat(e,'";+QPOWD=1')},modemProtocol:{rmnet:'+QCFG="usbnet",0;+QPOWD=1',ecm:'+QCFG="usbnet",1;+QPOWD=1',mbim:'+QCFG="usbnet",2;+QPOWD=1',rndis:'+QCFG="usbnet",3;+QPOWD=1'},dnsProxy:{enabled:'+QMAP="DHCPV4DNS","enable"',disabled:'+QMAP="DHCPV4DNS","disable"'}},D=e=>{let s={passthrough:null,selectedMac:null,modemProtocol:null,dnsProxy:null};return e.forEach(e=>{let{response:a}=e;if(a.includes("MPDN_rule")){let e=a.split("\n")[1];e.includes('MPDN_rule",0,1,0,1,1')?s.passthrough="ETH":e.includes('MPDN_rule",0,1,0,3,1')?s.passthrough="USB":e.includes('MPDN_rule",0,0,0,0,0')&&(s.passthrough="disabled")}if(a.includes("usbnet")){let e=a.match(/usbnet",(\d)/);e&&(s.modemProtocol=({0:"rmnet",1:"ecm",2:"mbim",3:"rndis"})[e[1]])}a.includes("DHCPV4DNS")&&(a.includes('"enable"')?s.dnsProxy="enabled":a.includes('"disable"')&&(s.dnsProxy="disabled"))}),s},S=()=>{let e=[],s=Object.entries(P).reduce((e,s)=>{let[a,r]=s;return r!==N[a]&&(e[a]=r),e},{});if("passthrough"in s){if("disabled"===s.passthrough)e.push(M.passthrough.disabled.replace(";+QPOWD=1",""));else if(s.passthrough){let e=M.passthrough[s.passthrough](P.selectedMac);return"AT".concat(e.replace(";+QPOWD=1",""))}}if("modemProtocol"in s&&s.modemProtocol){let a=M.modemProtocol[s.modemProtocol];if(1===Object.keys(s).length)return"AT".concat(a.replace(";+QPOWD=1",""));e.push(a.replace(";+QPOWD=1",""))}if("dnsProxy"in s&&s.dnsProxy){let a=M.dnsProxy[s.dnsProxy];if(1===Object.keys(s).length)return"AT".concat(a);e.push(a)}return e.length>0?"AT".concat(e.join(";")):""},R=async()=>{try{var s,a;let r=await (0,x.a)("AT+QPOWD=1",!0);if((null===(s=r.response)||void 0===s?void 0:s.status)==="success")e({title:"Success",description:"Settings saved and device is rebooting..."}),setTimeout(()=>{window.location.reload()},9e4);else throw Error((null===(a=r.response)||void 0===a?void 0:a.raw_output)||"Failed to reboot device")}catch(s){e({variant:"destructive",title:"Error",description:"Failed to reboot device",action:(0,r.jsx)(m.A,{})})}},E=async()=>{try{let e=S();y(e),b(!0)}catch(s){e({variant:"destructive",title:"Error",description:"Failed to prepare settings",action:(0,r.jsx)(m.A,{})})}},A=async()=>{try{var s,a;let e=await (0,x.a)(v,!0);if((null===(s=e.response)||void 0===s?void 0:s.status)!=="success")throw Error((null===(a=e.response)||void 0===a?void 0:a.raw_output)||"Command execution failed");w({...P}),await R()}catch(s){e({variant:"destructive",title:"Error",description:"Failed to save settings",action:(0,r.jsx)(m.A,{})})}};return(0,t.useEffect)(()=>{(async()=>{try{let[e,s]=await Promise.all([fetch("/cgi-bin/quecmanager/advance/fetch_macs.sh"),fetch("/cgi-bin/quecmanager/at_cmd/fetch_data.sh?set=4")]),[r,t]=await Promise.all([e.json(),s.json()]);j(r);let l=D(t);w(l),C(l),a(!1)}catch(s){a(!1),e({variant:"destructive",title:"Uh oh! Something went wrong.",description:"Failed to fetch connectivity settings",action:(0,r.jsx)(m.A,{})})}})()},[]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(l.Zp,{children:[(0,r.jsxs)(l.aR,{children:[(0,r.jsx)(l.ZB,{children:"Connectivity Settings"}),(0,r.jsx)(l.BT,{children:"Configure your device's connectivity settings."})]}),(0,r.jsx)(l.Wu,{children:(0,r.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 grid-flow-row gap-6",children:[(0,r.jsxs)("div",{className:"grid w-full max-w-sm items-center gap-2",children:[(0,r.jsx)(c.J,{htmlFor:"passthrough",children:"IP Passthrough Mode"}),s?(0,r.jsx)(u.E,{className:"w-full h-8"}):(0,r.jsxs)(d.l6,{onValueChange:e=>C(s=>({...s,passthrough:e})),value:P.passthrough||void 0,children:[(0,r.jsx)(d.bq,{children:(0,r.jsx)(d.yv,{placeholder:"Select IP Passthrough Mode"})}),(0,r.jsx)(d.gC,{children:(0,r.jsxs)(d.s3,{children:[(0,r.jsx)(d.TR,{children:"Passthrough Mode"}),(0,r.jsx)(d.eb,{value:"disabled",children:"Disabled"}),(0,r.jsx)(d.eb,{value:"ETH",children:"ETH Passthrough Enabled"}),(0,r.jsx)(d.eb,{value:"USB",children:"USB Passthrough Enabled"})]})})]})]}),(0,r.jsxs)("div",{className:"grid w-full max-w-sm items-center gap-2",children:[(0,r.jsx)(c.J,{htmlFor:"mac",children:"Connected MAC"}),s?(0,r.jsx)(u.E,{className:"w-full h-8"}):(0,r.jsxs)(d.l6,{onValueChange:e=>C(s=>({...s,selectedMac:e})),value:P.selectedMac||void 0,disabled:!P.passthrough||"disabled"===P.passthrough,children:[(0,r.jsx)(d.bq,{children:(0,r.jsx)(d.yv,{placeholder:"Select Active MAC"})}),(0,r.jsx)(d.gC,{children:(0,r.jsxs)(d.s3,{children:[(0,r.jsx)(d.TR,{children:"Active MAC"}),f.map(e=>(0,r.jsx)(d.eb,{value:e.mac,children:"".concat(e.hostname," - ").concat(e.mac)},e.mac))]})})]})]}),(0,r.jsx)(h.w,{className:"lg:col-span-2 col-span-1 my-2"}),(0,r.jsxs)("div",{className:"grid w-full max-w-sm items-center gap-2",children:[(0,r.jsx)(c.J,{htmlFor:"modemProtocol",children:"USB Modem Protocol"}),s?(0,r.jsx)(u.E,{className:"w-full h-8"}):(0,r.jsxs)(d.l6,{onValueChange:e=>C(s=>({...s,modemProtocol:e})),value:P.modemProtocol||void 0,children:[(0,r.jsx)(d.bq,{children:(0,r.jsx)(d.yv,{placeholder:"Select USB Modem Protocol"})}),(0,r.jsx)(d.gC,{children:(0,r.jsxs)(d.s3,{children:[(0,r.jsx)(d.TR,{children:"USB Modem Protocol"}),(0,r.jsx)(d.eb,{value:"rmnet",children:"RMNET"}),(0,r.jsx)(d.eb,{value:"ecm",children:"ECM (Recommended)"}),(0,r.jsx)(d.eb,{value:"mbim",children:"MBIM"}),(0,r.jsx)(d.eb,{value:"rndis",children:"RNDIS"})]})})]})]}),(0,r.jsxs)("div",{className:"grid w-full max-w-sm items-center gap-2",children:[(0,r.jsx)(c.J,{htmlFor:"dnsProxy",children:"Onboard DNS Proxy Mode"}),s?(0,r.jsx)(u.E,{className:"w-full h-8"}):(0,r.jsxs)(d.l6,{onValueChange:e=>C(s=>({...s,dnsProxy:e})),value:P.dnsProxy||void 0,children:[(0,r.jsx)(d.bq,{children:(0,r.jsx)(d.yv,{placeholder:"Select DNS Proxy Mode"})}),(0,r.jsx)(d.gC,{children:(0,r.jsxs)(d.s3,{children:[(0,r.jsx)(d.TR,{children:"DNS Proxy Mode"}),(0,r.jsx)(d.eb,{value:"enabled",children:"Enabled"}),(0,r.jsx)(d.eb,{value:"disabled",children:"Disabled (Recommended for Passthrough)"})]})})]})]})]})}),(0,r.jsx)(l.wL,{className:"grid border-t py-4",children:(0,r.jsx)(i.$,{onClick:E,disabled:!Object.entries(P).some(e=>{let[s,a]=e;return a!==N[s]})||!(!P.passthrough||"disabled"===P.passthrough||P.selectedMac),children:"Save"})})]}),(0,r.jsx)(o.Lt,{open:g,onOpenChange:b,children:(0,r.jsxs)(o.EO,{children:[(0,r.jsxs)(o.wd,{children:[(0,r.jsx)(o.r7,{children:"Reboot Required"}),(0,r.jsx)(o.$v,{children:"The changes you made require a device reboot to take effect. Would you like to reboot now?"})]}),(0,r.jsxs)(o.ck,{children:[(0,r.jsx)(o.Zr,{children:"Later"}),(0,r.jsxs)(o.Rx,{onClick:A,children:[(0,r.jsx)(p.A,{className:"w-4 h-4"}),"Save & Reboot Now"]})]})]})})]})}},114:(e,s,a)=>{a.d(s,{A:()=>d});var r=a(20475),t=a(42541),l=a(7197);let d=()=>(0,r.jsx)(t.$,{asChild:!0,variant:"outline",className:"ml-2",children:(0,r.jsxs)("a",{href:"https://github.com/iamromulan/quectel-rgmii-toolkit/tree/development-SDXPINN",children:[(0,r.jsx)(l.ERf,{className:"w-4 h-4 mr-2"}),"Get there!"]})})},72167:(e,s,a)=>{a.d(s,{BT:()=>i,Wu:()=>c,ZB:()=>n,Zp:()=>d,aR:()=>o,wL:()=>u});var r=a(20475),t=a(20107),l=a(22250);let d=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,r.jsx)("div",{ref:s,className:(0,l.cn)("rounded-xl border bg-card text-card-foreground shadow",a),...t})});d.displayName="Card";let o=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,r.jsx)("div",{ref:s,className:(0,l.cn)("flex flex-col space-y-1.5 p-6",a),...t})});o.displayName="CardHeader";let n=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,r.jsx)("h3",{ref:s,className:(0,l.cn)("font-semibold leading-none tracking-tight",a),...t})});n.displayName="CardTitle";let i=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,r.jsx)("p",{ref:s,className:(0,l.cn)("text-sm text-muted-foreground",a),...t})});i.displayName="CardDescription";let c=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,r.jsx)("div",{ref:s,className:(0,l.cn)("p-6 pt-0",a),...t})});c.displayName="CardContent";let u=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,r.jsx)("div",{ref:s,className:(0,l.cn)("flex items-center p-6 pt-0",a),...t})});u.displayName="CardFooter"},49153:(e,s,a)=>{a.d(s,{J:()=>i});var r=a(20475),t=a(20107),l=a(21840),d=a(29395),o=a(22250);let n=(0,d.F)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),i=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,r.jsx)(l.b,{ref:s,className:(0,o.cn)(n(),a),...t})});i.displayName=l.b.displayName},35601:(e,s,a)=>{a.d(s,{TR:()=>p,bq:()=>u,eb:()=>f,gC:()=>x,l6:()=>n,s3:()=>i,yv:()=>c});var r=a(20475),t=a(20107),l=a(7197),d=a(95257),o=a(22250);let n=d.bL,i=d.YJ,c=d.WT,u=t.forwardRef((e,s)=>{let{className:a,children:t,...n}=e;return(0,r.jsxs)(d.l9,{ref:s,className:(0,o.cn)("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",a),...n,children:[t,(0,r.jsx)(d.In,{asChild:!0,children:(0,r.jsx)(l.TBE,{className:"h-4 w-4 opacity-50"})})]})});u.displayName=d.l9.displayName;let h=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,r.jsx)(d.PP,{ref:s,className:(0,o.cn)("flex cursor-default items-center justify-center py-1",a),...t,children:(0,r.jsx)(l.Mtm,{})})});h.displayName=d.PP.displayName;let m=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,r.jsx)(d.wn,{ref:s,className:(0,o.cn)("flex cursor-default items-center justify-center py-1",a),...t,children:(0,r.jsx)(l.D3D,{})})});m.displayName=d.wn.displayName;let x=t.forwardRef((e,s)=>{let{className:a,children:t,position:l="popper",...n}=e;return(0,r.jsx)(d.ZL,{children:(0,r.jsxs)(d.UC,{ref:s,className:(0,o.cn)("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===l&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:l,...n,children:[(0,r.jsx)(h,{}),(0,r.jsx)(d.LM,{className:(0,o.cn)("p-1","popper"===l&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),(0,r.jsx)(m,{})]})})});x.displayName=d.UC.displayName;let p=t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,r.jsx)(d.JU,{ref:s,className:(0,o.cn)("px-2 py-1.5 text-sm font-semibold",a),...t})});p.displayName=d.JU.displayName;let f=t.forwardRef((e,s)=>{let{className:a,children:t,...n}=e;return(0,r.jsxs)(d.q7,{ref:s,className:(0,o.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...n,children:[(0,r.jsx)("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(d.VF,{children:(0,r.jsx)(l.Srz,{className:"h-4 w-4"})})}),(0,r.jsx)(d.p4,{children:t})]})});f.displayName=d.q7.displayName,t.forwardRef((e,s)=>{let{className:a,...t}=e;return(0,r.jsx)(d.wv,{ref:s,className:(0,o.cn)("-mx-1 my-1 h-px bg-muted",a),...t})}).displayName=d.wv.displayName},76554:(e,s,a)=>{a.d(s,{w:()=>o});var r=a(20475),t=a(20107),l=a(88853),d=a(22250);let o=t.forwardRef((e,s)=>{let{className:a,orientation:t="horizontal",decorative:o=!0,...n}=e;return(0,r.jsx)(l.b,{ref:s,decorative:o,orientation:t,className:(0,d.cn)("shrink-0 bg-border","horizontal"===t?"h-[1px] w-full":"h-full w-[1px]",a),...n})});o.displayName=l.b.displayName},36760:(e,s,a)=>{a.d(s,{E:()=>l});var r=a(20475),t=a(22250);function l(e){let{className:s,...a}=e;return(0,r.jsx)("div",{className:(0,t.cn)("animate-pulse rounded-md bg-primary/10",s),...a})}},88853:(e,s,a)=>{a.d(s,{b:()=>i});var r=a(20107),t=a(34544),l=a(20475),d="horizontal",o=["horizontal","vertical"],n=r.forwardRef((e,s)=>{let{decorative:a,orientation:r=d,...n}=e,i=o.includes(r)?r:d;return(0,l.jsx)(t.sG.div,{"data-orientation":i,...a?{role:"none"}:{"aria-orientation":"vertical"===i?i:void 0,role:"separator"},...n,ref:s})});n.displayName="Separator";var i=n}}]); |