You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
43 KiB

5 months ago
import{cr as J,cZ as xe,cs as h,ct as ue,da as we,cv as o,cy as _,cG as I,cB as t,cA as e,cC as a,cK as r,cI as U,cW as de,dk as ye,cL as C,cF as oe,dl as lt,dO as ot,cY as Ye,cq as A,dP as Ae,de as ve,cS as Me,cw as Ce,dQ as Te,cM as ee,cO as Re,cz as M,cD as pe,cE as he,dR as je,cN as Xe,cU as nt,cT as re,dq as Ne,dS as it,cR as st,cX as ct,dT as pt,dd as Ke,cu as Je,dp as rt,dU as Se,dV as ut,dW as Oe,cH as dt,dX as ce,dY as K,dZ as vt,d_ as mt,cP as _t}from"./index-6b91f299.js";import{_ as ft}from"./EditAvatarDialog.vue_vue_type_script_setup_true_lang-364bf23e.js";const gt="/ui/assets/window1-b13220c7.png",At="/ui/assets/window2-6d9fe74f.png",ht={class:"border"},wt={class:"title p-16 bold"},yt={class:"code layout-bg border-t p-8"},bt={class:"flex-between p-8"},Dt={class:"bold"},kt={class:"pre-wrap p-8 pt-0"},It={class:"border"},$t={class:"title p-16 bold"},Ct={class:"code layout-bg border-t p-8"},Ot={class:"flex-between p-8"},Vt={class:"bold"},St={class:"pre-wrap p-8 pt-0"},xt=J({__name:"EmbedDialog",props:{data:Object,apiInputParams:String},emits:["addData"],setup(Q,{expose:f,emit:z}){const{application:Y}=xe(),O=Q,E=h(!1),y=h(""),s=h(""),l=ue(()=>O.apiInputParams?"?"+O.apiInputParams:""),D=ue(()=>O.apiInputParams?"&"+O.apiInputParams:"");return we(E,g=>{g||(y.value="",s.value="")}),f({open:g=>{y.value=`<iframe
src="${Y.location+g+l.value}"
style="width: 100%; height: 100%;"
frameborder="0"
allow="microphone">
</iframe>
`,s.value=`<script
async
defer
src="${window.location.origin}/api/application/embed?protocol=${window.location.protocol.replace(":","")}&host=${window.location.host}&token=${g}${D.value}">
<\/script>
`,E.value=!0}}),(g,b)=>{const d=o("AppIcon"),v=o("el-button"),m=o("el-scrollbar"),c=o("el-col"),V=o("el-row"),S=o("el-dialog");return _(),I(S,{title:g.$t("views.applicationOverview.appInfo.embedInWebsite"),modelValue:E.value,"onUpdate:modelValue":b[2]||(b[2]=B=>E.value=B),width:"900",class:"embed-dialog","close-on-click-modal":!1,"close-on-press-escape":!1},{default:t(()=>[e(V,{gutter:12},{default:t(()=>[e(c,{span:12},{default:t(()=>[a("div",ht,[a("p",wt,r(g.$t("views.applicationOverview.appInfo.EmbedDialog.fullscreenModeTitle")),1),b[3]||(b[3]=a("img",{src:gt,alt:"",class:"ml-8",height:"150"},null,-1)),a("div",yt,[a("div",bt,[a("span",Dt,r(g.$t("views.applicationOverview.appInfo.EmbedDialog.copyInstructions")),1),e(v,{text:"",onClick:b[0]||(b[0]=B=>U(de)(y.value))},{default:t(()=>[e(d,{iconName:"app-copy"})]),_:1})]),e(m,{height:"150",always:""},{default:t(()=>[a("div",kt,r(y.value),1)]),_:1})])])]),_:1}),e(c,{span:12},{default:t(()=>[a("div",It,[a("p",$t,r(g.$t("views.applicationOverview.appInfo.EmbedDialog.floatingModeTitle")),1),b[4]||(b[4]=a("img",{src:At,alt:"",class:"ml-8",height:"150"},null,-1)),a("div",Ct,[a("div",Ot,[a("span",Vt,r(g.$t("views.applicationOverview.appInfo.EmbedDialog.copyInstructions")),1),e(v,{text:"",onClick:b[1]||(b[1]=B=>U(de)(s.value))},{default:t(()=>[e(d,{iconName:"app-copy"})]),_:1})]),e(m,{height:"150",always:""},{default:t(()=>[a("div",St,r(s.value),1)]),_:1})])])]),_:1})]),_:1})]),_:1},8,["title","modelValue"])}}});const Rt={class:"vertical-middle lighter break-all"},Et={class:"mr-4"},Bt=J({__name:"APIKeyDialog",emits:["addData"],setup(Q,{expose:f,emit:z}){const Y=ye(),{params:{id:O}}=Y,E=h(),y=h(!1),s=h(!1),l=h(null);we(y,c=>{c||(l.value=null)});function D(c){E.value.open(c,"APPLICATION")}function R(c){Ye(`${A("views.applicationOverview.appInfo.APIKeyDialog.msgConfirm1")}: ${c.secret_key}?`,A("views.applicationOverview.appInfo.APIKeyDialog.msgConfirm2"),{confirmButtonText:A("common.delete"),cancelButtonText:A("common.cancel"),confirmButtonClass:"danger"}).then(()=>{Ae.delAPIKey(O,c.id,s).then(()=>{ve(A("common.deleteSuccess")),v()})}).catch(()=>{})}function g(c,V){const S={is_active:c},B=c?A("views.applicationOverview.appInfo.APIKeyDialog.enabledSuccess"):A("views.applicationOverview.appInfo.APIKeyDialog.disabledSuccess");Ae.putAPIKey(O,V.id,S,s).then(n=>{ve(B),v()})}function b(){Ae.postAPIKey(O,s).then(c=>{v()})}const d=()=>{v(),y.value=!0};function v(){Ae.getAPIKey(O,s).then(c=>{l.value=c.data})}function m(){v()}return f({open:d}),(c,V)=>{const S=o("el-button"),B=o("AppIcon"),n=o("el-table-column"),i=o("el-switch"),L=o("Setting"),k=o("el-icon"),x=o("el-tooltip"),j=o("Delete"),H=o("el-table"),te=o("el-dialog");return _(),I(te,{title:"API Key",modelValue:y.value,"onUpdate:modelValue":V[1]||(V[1]=P=>y.value=P),width:"800","close-on-click-modal":!1,"close-on-press-escape":!1,"align-center":""},{default:t(()=>[e(S,{type:"primary",class:"mb-16",onClick:b},{default:t(()=>[C(r(c.$t("common.create")),1)]),_:1}),e(H,{data:l.value,class:"mb-16",loading:s.value,height:"420"},{default:t(()=>[e(n,{prop:"secret_key",label:"API Key"},{default:t(({row:P})=>[a("span",Rt,r(P.secret_key),1),e(S,{type:"primary",text:"",onClick:$=>U(de)(P.secret_key)},{default:t(()=>[e(B,{iconName:"app-copy"})]),_:2},1032,["onClick"])]),_:1}),e(n,{label:c.$t("common.status.label"),width:"70"},{default:t(({row:P})=>[a("div",{onClick:V[0]||(V[0]=oe(()=>{},["stop"]))},[e(i,{size:"small",modelValue:P.is_active,"onUpdate:modelValue":$=>P.is_active=$,onChange:$=>g($,P)},null,8,["modelValue","onUpdate:modelValue","onChange"])])]),_:1},8,["label"]),e(n,{prop:"name",label:c.$t("common.createDate"),width:"170"},{default:t(({row:P})=>[C(r(U(lt)(P.create_time)),1)]),_:1},8,["label"]),e(n,{label:c.$t("common.operation"),align:"left",width:"90"},{default:t(({row:P})=>[a("span",Et,[e(x,{effect:"dark",content:c.$t("common.setting"),placement:"top"},{default:t(()=>[e(S,{type:"primary",text:"",onClick:oe($=>D(P),["stop"])},{default:t(()=>[e(k,null,{default:t(()=>[e(L)]),_:1})]),_:2},1032,["onClick"])]),_:2},1032,["content"])]),e(x,{effec
`):"",s.value.authentication_value=m.authentication_value,s.value.authentication=m.authentication,l.value=!0},g=async m=>{m&&await m.validate((c,V)=>{if(c){const S={white_list:s.value.white_list?s.value.white_list.split(`
`):[],white_active:s.value.white_active,access_num:s.value.access_num,authentication:s.value.authentication,authentication_value:s.value.authentication_value};Re.putAccessToken(O,S,D).then(B=>{E("refresh"),ve(A("common.settingSuccess")),l.value=!1})}})};function b(m=10){const c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",V=new Uint8Array(m);return window.crypto.getRandomValues(V),Array.from(V).map(S=>c[S%c.length]).join("")}function d(){s.value.authentication_value=b()}function v(){s.value.authentication&&!s.value.authentication_value&&(s.value.authentication_value=b())}return f({open:R}),(m,c)=>{const V=o("el-input-number"),S=o("el-form-item"),B=o("el-switch"),n=o("AppIcon"),i=o("el-button"),L=o("el-tooltip"),k=o("RefreshRight"),x=o("el-icon"),j=o("el-input"),H=o("el-form"),te=o("el-dialog"),P=Me("hasPermission");return _(),I(te,{title:m.$t("views.applicationOverview.appInfo.accessControl"),modelValue:l.value,"onUpdate:modelValue":c[9]||(c[9]=$=>l.value=$),"close-on-click-modal":!1,"close-on-press-escape":!1},{footer:t(()=>[a("span",Ut,[e(i,{onClick:c[7]||(c[7]=oe($=>l.value=!1,["prevent"]))},{default:t(()=>[C(r(m.$t("common.cancel")),1)]),_:1}),e(i,{type:"primary",onClick:c[8]||(c[8]=$=>g(y.value)),loading:D.value},{default:t(()=>[C(r(m.$t("common.save")),1)]),_:1},8,["loading"])])]),default:t(()=>[e(H,{"label-position":"top",ref_key:"limitFormRef",ref:y,model:s.value},{default:t(()=>[e(S,{label:m.$t("views.applicationOverview.appInfo.LimitDialog.clientQueryLimitLabel")},{default:t(()=>[e(V,{modelValue:s.value.access_num,"onUpdate:modelValue":c[0]||(c[0]=$=>s.value.access_num=$),min:0,step:1,max:1e4,"value-on-clear":0,"controls-position":"right",style:{width:"268px"},"step-strictly":""},null,8,["modelValue"]),a("span",Pt,r(m.$t("views.applicationOverview.appInfo.LimitDialog.timesDays")),1)]),_:1},8,["label"]),Ce((_(),I(S,{label:m.$t("views.applicationOverview.appInfo.LimitDialog.authentication")},{default:t(()=>[e(B,{size:"small",modelValue:s.value.authentication,"onUpdate:modelValue":c[1]||(c[1]=$=>s.value.authentication=$),onChange:v},null,8,["modelValue"])]),_:1},8,["label"])),[[P,new(U(Te))([],["x-pack"],"OR")]]),s.value.authentication?Ce((_(),I(S,{key:0,prop:"authentication_value",label:m.$t("views.applicationOverview.appInfo.LimitDialog.authenticationValue")},{default:t(()=>[e(j,{class:"authentication-append-input",modelValue:s.value.authentication_value,"onUpdate:modelValue":c[3]||(c[3]=$=>s.value.authentication_value=$),readonly:"",style:{width:"268px"},disabled:""},{append:t(()=>[e(L,{content:m.$t("common.copy"),placement:"top"},{default:t(()=>[e(i,{type:"primary",text:"",onClick:c[2]||(c[2]=$=>U(de)(s.value.authentication_value)),style:{margin:"0 4px !important"}},{default:t(()=>[e(n,{iconName:"app-copy"})]),_:1})]),_:1},8,["content"]),e(L,{content:m.$t("common.refresh"),placement:"top"},{default:t(()=>[e(i,{onClick:d,type:"primary",text:"",style:{margin:"0 4px 0 0 !important"}},{default:t(()=>[e(x,null,{default:t(()=>[e(k)]),_:1})]),_:1})]),_:1},8,["content"])]),_:1},8,["modelValue"])]),_:1},8,["label"])),[[P,new(U(Te))([],["x-pack"],"OR")]]):ee("",!0),e(S,{label:m.$t("views.applicationOverview.appInfo.LimitDialog.whitelistLabel"),onClick:c[5]||(c[5]=oe(()=>{},["prevent"]))},{default:t(()=>[e(B,{size:"small",modelValue:s.value.white_active,"onUpdate:modelValue":c[4]||(c[4]=$=>s.value.white_active=$)},null,8,["modelValue"])]),_:1},8,["label"]),e(S,null,{default:t(()=>[e(j,{modelValue:s.value.white_list,"onUpdate:modelValue":c[6]||(c[6]=$=>s.value.white_list=$),placeholder:m.$t("views.applicationOverview.appInfo.LimitDialog.whitelistPlaceholder"),rows:10,type:"textarea"},null,8,["modelValue","placeholder"])]),_:1})]),_:1},8,["model"])]),_:1},8,["title","modelValue"])}}});const Ft={class:"dialog-footer"},Qt=J({__name:"DisplaySettingDialog",emits:["refresh"],setup(Q,{expose:f,emit:z}){const Y=ye(),{params:{id:O}}=Y,E=z,y=h(),s=h({show_source:!1,language:""}),l=h(null),D=h(!1),R=h(!1);we(D,d=>{d||(s.value={show_source:!1,language:""})});const g=(d,v)=>{l.value=v,s.value.show_source=d.show_so