3 lines
4.3 KiB
JavaScript
3 lines
4.3 KiB
JavaScript
import{h as $,v as y,o as s,k as t,t as u,n as i,c as d,u as e,e as a,a as m,w as h,_ as w,y as D,l as V,i as k,m as A,F as x,x as q,b,z as O,N as z,d as g,p as U,q as C,f as B}from"./TrayArrowDown-sRwZP_WA.chunk.mjs";import{N as F,I as j,b as M,a as E,c as I,_ as S}from"./TrashCanOutline-avc1vI9P.chunk.mjs";import"./modulepreload-polyfill-BxzAKjcf.chunk.mjs";const G={key:1},H=$({__name:"OAuthItem",props:{client:{}},emits:["delete"],setup(c){return(r,p)=>(s(),y("tr",null,[t("td",null,u(c.client.name),1),t("td",null,[t("code",{class:i(r.$style.oAuthItem__code)},u(c.client.redirectUri),3)]),t("td",null,[t("code",{class:i(r.$style.oAuthItem__code)},u(c.client.clientId),3)]),t("td",null,[c.client.clientSecret?(s(),d(e(F),{key:0,class:i(r.$style.oAuthItem__clientSecret),"aria-label":e(a)("oauth2","Secret key"),"as-text":"","model-value":c.client.clientSecret,"show-trailing-button":""},null,8,["class","aria-label","model-value"])):(s(),y("span",G,"*****"))]),t("td",null,[m(e(M),{"aria-label":e(a)("oauth2","Delete"),title:e(a)("oauth2","Delete"),variant:"error",onClick:p[0]||(p[0]=f=>r.$emit("delete"))},{icon:h(()=>[m(j,{size:20})]),_:1},8,["aria-label","title"])])]))}}),J="_oAuthItem__code_3r02l_2",K="_oAuthItem__clientSecret_3r02l_11",L={oAuthItem__code:J,oAuthItem__clientSecret:K},P={$style:L},Q=w(H,[["__cssModules",P]]),T={class:"hidden-visually"},W=$({__name:"AdminSettings",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(c){const r=D(c,"modelValue"),p=E().theming.name,f=V("oauth2","oauth2-doc-link"),v=k(!1),o=k({name:"",redirectUri:"",errorMsg:"",error:!1});async function N(l){await g.delete(U("apps/oauth2/clients/{id}",{id:l})),r.value=r.value.filter(n=>n.id!==l)}async function R(){o.value.error=!1;try{const{data:l}=await g.post(U("apps/oauth2/clients"),{name:o.value.name,redirectUri:o.value.redirectUri});r.value.push(l),v.value=!0,o.value.name="",o.value.redirectUri=""}catch(l){o.value.error=!0,C(l)&&l.response?o.value.errorMsg=l.response.data.message:o.value.errorMsg=a("oauth2","An unknown error occurred.")}}return(l,n)=>(s(),d(e(z),{name:e(a)("oauth2","OAuth 2.0 clients"),description:e(a)("oauth2","OAuth 2.0 allows external services to request access to {instanceName}.",{instanceName:e(p)}),"doc-url":e(f)},{default:h(()=>[r.value.length>0?(s(),y("table",{key:0,class:i([l.$style.oauthApp__table,{[l.$style.oauthApp__table_withSecret]:v.value}])},[t("thead",null,[t("tr",null,[t("th",null,u(e(a)("oauth2","Name")),1),t("th",null,u(e(a)("oauth2","Redirection URI")),1),t("th",null,u(e(a)("oauth2","Client identifier")),1),t("th",null,u(e(a)("oauth2","Secret key")),1),t("th",null,[t("span",T,u(e(a)("oauth2","Delete client")),1)])])]),t("tbody",null,[(s(!0),y(x,null,q(r.value,_=>(s(),d(Q,{key:_.id,client:_,onDelete:re=>N(_.id)},null,8,["client","onDelete"]))),128))])],2)):A("",!0),v.value?(s(),d(e(I),{key:1,type:"warning"},{default:h(()=>[b(u(e(a)("oauth2","Make sure you store the secret key, it cannot be recovered.")),1)]),_:1})):A("",!0),n[2]||(n[2]=t("br",null,null,-1)),t("h3",null,u(e(a)("oauth2","Add client")),1),o.value.error?(s(),d(e(I),{key:2,type:"error"},{default:h(()=>[b(u(o.value.errorMsg),1)]),_:1})):A("",!0),t("form",{class:i(l.$style.oauthApp__form),onSubmit:O(R,["prevent"])},[m(e(S),{id:"name",modelValue:o.value.name,"onUpdate:modelValue":n[0]||(n[0]=_=>o.value.name=_),class:i(l.$style.oauthApp__form__input),name:"name",label:e(a)("oauth2","Name"),placeholder:e(a)("oauth2","Name")},null,8,["modelValue","class","label","placeholder"]),m(e(S),{id:"redirectUri",modelValue:o.value.redirectUri,"onUpdate:modelValue":n[1]||(n[1]=_=>o.value.redirectUri=_),type:"url",class:i(l.$style.oauthApp__form__input),name:"redirectUri",label:e(a)("oauth2","Redirection URI"),placeholder:e(a)("oauth2","Redirection URI")},null,8,["modelValue","class","label","placeholder"]),m(e(M),{type:"submit",class:i(l.$style.oauthApp__submitButton)},{default:h(()=>[b(u(e(a)("oauth2","Add")),1)]),_:1},8,["class"])],34)]),_:1},8,["name","description","doc-url"]))}}),X="_oauthApp__form_15nkg_1",Y="_oauthApp__form__input_15nkg_6",Z="_oauthApp__table_15nkg_11",ee="_oauthApp__table_withSecret_15nkg_38",te={oauthApp__form:X,oauthApp__form__input:Y,oauthApp__table:Z,oauthApp__table_withSecret:ee},ae={$style:te},le=w(W,[["__cssModules",ae]]),oe=V("oauth2","clients"),ue=B(le,{modelValue:oe});ue.mount("#oauth2");
|
|
//# sourceMappingURL=oauth2-settings-admin.mjs.map
|