2 lines
9.5 KiB
JavaScript
2 lines
9.5 KiB
JavaScript
|
|
import{_ as ae}from"./index-BGYvyLDv.js?v=1773287522785";import{_ as X}from"./index-DIKmrNCq.js?v=1773287522785";import{cq as se,t as te,h as Z,aw as oe,m as S,B as N,Q as le,g5 as M,i as ie,c as pe,ei as re,n as de,g6 as ue,g7 as me,g8 as ce,g9 as _e,ga as ve,gb as fe,gc as be}from"./index-BTglIPU2.js?v=1773287522785";import{i as he,p as ge,k as L,R,r as $,$ as C,Z as U,_ as c,a0 as e,a9 as d,j as k,aa as v,S as r,e as J,X as T,F as xe,ak as Pe,t as ye}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import{al as we,a0 as W,B as j,g as A,a6 as $e,k as Ae,a1 as De,_ as Se,a8 as ke,b as Ce,t as G}from"./naive-ui--dJnpVcV.js?v=1773287522785";import{u as Ue}from"./useLoading-CZ2gSAW7.js?v=1773287522785";import{_ as Be}from"./index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";const Y=Symbol("php-admin");function Ne(g){ge(Y,g)}function Le(){return he(Y)}function K(g,x,t,p){return new Promise(o=>{const u="".concat(g,"/index.php?lang=en"),s=document.createElement("form"),i='\n <input type="text" name="pma_username" id="pma_username" value="'.concat(t,'" />\n <input type="password" name="pma_password" id="pma_password" value="').concat(p,'" />\n <input type="text" name="server" value="1" />\n <input type="text" name="target" value="index.php" />\n <input type="text" name="db" id="db" value="').concat(x,'" />\n ');s.action=u,s.setAttribute("public-data",u),s.method="post",s.target="_blank",s.style.display="none",s.innerHTML=i,document.body.appendChild(s),s.submit(),document.body.removeChild(s),o(s)})}async function Q(g,x){const t="/phpmyadmin/index.php?lang=en",{data:p}=await se.get(t),o={session:"",token:""},u=p.match(/"set_session"\s+value="(\w+)"/),s=p.match(/"token"\s+value="(\w+)"/);u&&u.length>1&&(o.session=u[1]||""),s&&s.length>1&&(o.token=s[1]||"");const i=document.createElement("form");i.action="/phpmyadmin/index.php",i.method="post",i.target="_blank",i.style.display="none";const l='\n <input name="set_session" id="input_session" value="'.concat(o.session,'" />\n <input type="text" name="pma_username" id="pma_username" value="').concat(g,'" size="24" />\n <input type="password" name="pma_password" id="pma_password" value="').concat(x,'" size="24" />\n <input name="token" id="input_token" value="').concat(o.token,'" />\n <input name="target" id="input_target" value="index.php" />\n <input name="server" value="1" id="input_server" />\n ');i.innerHTML=l,document.body.appendChild(i),i.submit(),document.body.removeChild(i)}const Re={class:"p-4px"},Ie={class:"mb-16px"},Ve={class:"text-error"},Fe={class:"mt-20px"},H="phpmyadmin",He=L({__name:"index",setup(g,{expose:x}){const{t}=R(),p=te(),{mysqlInfo:o}=Le(),u=$(!1),s=a=>{Z({title:t("Database.PhpAdmin.index_12",[t(a?"Public.Status.Start":"Public.Status.Stop")]),content:t("Database.PhpAdmin.index_13",[t(a?"Public.Status.start":"Public.Status.stop")]),onConfirm:async()=>{await oe({name:H,type:a?"start":"stop"}),l()}})},i=async a=>{const m=S.loading(t("Database.PhpAdmin.index_14"));try{const{message:f}=await N({sName:H}),h=A(f,"ext.url",""),P=A(f,"ext.auth",!1);if(a=="panel"){if(P){S.error(t("Database.PhpAdmin.index_15")),m.close();return}if(p.isFree){le({source:160}),m.close();return}if(o.value)await Q(o.value.username,o.value.password);else{const{message:b}=await M(),y=A(b,"result","");await Q("root",y)}}else if(o.value)await K(h,o.value.name,o.value.username,o.value.password);else{const{message:b}=await M(),y=A(b,"result","");await K(h,"","root",y)}m.close()}catch(f){m.close(),console.error(f)}},l=async()=>{const{message:a}=await N({sName:H});ie(a)&&(u.value=a.status)};return l(),x({init:l}),(a,m)=>{const f=we,h=X,P=W,b=j;return C(),U("div",Re,[c("div",Ie,[e(f,{checked:r(u),"onUpdate:checked":s},{default:d(()=>[k(v(a.$t("Database.PhpAdmin.index_4")),1)]),_:1},8,["checked"])]),e(h,{class:"mb-20px"},{default:d(()=>[c("li",Ve,v(a.$t("Database.PhpAdmin.index_5")),1)]),_:1}),e(P,{dashed:""}),c("div",Fe,[e(b,{onClick:m[0]||(m[0]=y=>i("panel"))},{default:d(()=>[c("span",null,v(a.$t("Database.PhpAdmin.in
|