dsql-admin/dsql-app/.local_dist/server/pages/admin/[user_id]/connect.js

1 line
20 KiB
JavaScript
Raw Normal View History

2024-12-09 09:39:09 +00:00
"use strict";(()=>{var e={};e.id=2504,e.ids=[2504],e.modules={30671:(e,s)=>{Object.defineProperty(s,"M",{enumerable:!0,get:function(){return function e(s,t){return t in s?s[t]:"then"in s&&"function"==typeof s.then?s.then(s=>e(s,t)):"function"==typeof s&&"default"===t?s:void 0}}})},88297:(e,s,t)=>{t.r(s),t.d(s,{config:()=>z,default:()=>U,getServerSideProps:()=>D,getStaticPaths:()=>V,getStaticProps:()=>O,reportWebVitals:()=>F,routeModule:()=>Y,unstable_getServerProps:()=>Q,unstable_getServerSideProps:()=>X,unstable_getStaticParams:()=>W,unstable_getStaticPaths:()=>B,unstable_getStaticProps:()=>H});var a={};t.r(a),t.d(a,{ConnectContext:()=>T,default:()=>q,getServerSideProps:()=>G});var l=t(63865),r=t(9455),n=t(30671),i=t(49407),d=t(89600),c=t(8732),o=t(82015),u=t.n(o),h=t(95222),p=t(20048),x=t.n(p),m=t(67216),j=t.n(m),y=t(58548),f=t(96089),b=t(25088);function g(e){let{user:s,query:t,mariadbUserCred:a}=u().useContext(T);return(0,c.jsx)("section",{className:"paper",children:(0,c.jsxs)("div",{className:"flex-col items-start w-full",children:[(0,c.jsx)("span",{children:"You can connect to your database remotely using any MySQL/Mariadb client. Use these credentials to connect:"}),(0,c.jsx)("hr",{}),(0,c.jsxs)("ul",{className:"m-0",children:[(0,c.jsxs)("li",{children:["Server:"," ",(0,c.jsx)("b",{children:"172.72.0.24"})]}),(0,c.jsxs)("li",{children:["Username: ",(0,c.jsx)("b",{children:a.mariadb_user})]}),(0,c.jsxs)("li",{children:["Host: ",(0,c.jsx)("b",{children:a.mariadb_host})]}),(0,c.jsxs)("li",{children:["Password: ",(0,c.jsx)("b",{children:"*****************"}),(0,c.jsx)("button",{className:"ghost inline-block -my-4",onClick:e=>{navigator.clipboard.writeText(a.mariadb_pass||"").then(()=>{window.alert("Copied Password!")})},children:(0,c.jsx)(f.A,{})})]}),(0,c.jsx)("li",{children:(0,c.jsxs)("div",{className:"flex",children:["SSL Certificate:"," ",(0,c.jsx)("b",{children:(0,c.jsx)("span",{className:"flex items-center gap-2",children:(0,c.jsxs)("a",{href:"https://datasquirel.com/documents/ssl/ca-cert.pem",className:"flex items-center gap-2 border-none hover:opacity-60",target:"_blank",children:[(0,c.jsx)(b.A,{}),"Download"]})})})]})})]})]})})}var v=t(55158),A=t(32415),E=t(63715),S=t(11717),N=t(96725);function w({mariadbUser:e}){let{setTargetMariadbUser:s}=u().useContext(T),t=!!String(e.primary)?.match(/1/),[a,l]=u().useState(!1);return(0,c.jsxs)("div",{className:"card w-full col"+(t?" green":""),children:[a&&(0,c.jsx)(A.A,{width:"25px"}),(0,c.jsxs)("div",{className:"w-full justify-between h-auto md:h-8 flex-wrap",children:[(0,c.jsxs)("span",{className:"title",children:[e.username,"@",e.host]}),(0,c.jsxs)("div",{children:[t&&(0,c.jsx)("span",{className:"info small w-auto",children:"Primary User"}),(0,c.jsx)("button",{className:"ghost",title:"Edit User",onClick:t=>{s(e),(0,v.PB)("edit-mariadb-user-popup")},children:(0,c.jsx)(S.A,{size:20})}),!t&&(0,c.jsx)("button",{className:"ghost -ml-6",title:"Edit User",onClick:s=>{window.confirm("Are you sure you want to delete this User?")&&(l(!0),(0,E.A)("/api/sql-users/delete",{method:"POST",body:{id:e.id}},!0).then(e=>{e.success?window.location.reload():e.msg&&window.alert(e.msg)}).finally(()=>{setTimeout(()=>{l(!1)},1e3)}))},children:(0,c.jsx)(N.A,{})})]})]}),(0,c.jsx)("hr",{}),(0,c.jsxs)("ul",{className:"m-0",children:[(0,c.jsxs)("li",{children:["Username: ",(0,c.jsx)("b",{children:e.username})]}),(0,c.jsxs)("li",{children:["Host: ",(0,c.jsx)("b",{children:e.host}),(0,c.jsx)("span",{className:"info gray font-normal",children:"% is a wildcard. Example: 192.168.1.%"})]}),(0,c.jsxs)("li",{children:["Password: ",(0,c.jsx)("b",{children:"*****************"}),(0,c.jsx)("button",{className:"ghost inline-block -my-4",onClick:s=>{navigator.clipboard.writeText(e.password||"").then(()=>{window.alert("Copied Password!")})},children:(0,c.jsx)(f.A,{size:20})})]})]})]})}function k(e){let{mariadbUsers:s}=u().useContext(T);return(0,c.jsxs)("section",{className:"paper",children:[(0,c.jsxs)("div",{className:"w-full justify-between",children:[(0,c.jsx)("h2",{className:"text-xl m-0",children:"SQL Users"