nextcloud/dist/oauth2-settings-admin.mjs
Ferdinand Thiessen a24fc77bcf
chore: compile assets
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2026-03-18 14:14:31 +01:00

2 lines
4.8 KiB
JavaScript

import{a as V,g as R,l as $}from"./index-BgmsSgl5.chunk.mjs";import{f as w,o as s,c as y,b as t,t as r,A as i,g as m,u as e,h as d,w as p,B as x,H as O,I as q,e as f,v,M as B,r as U,x as C}from"./runtime-dom.esm-bundler-CKxgtjB6.chunk.mjs";import{c as g,i as T}from"./index-2a6kOrDy.chunk.mjs";import{t as a}from"./translation-DoG5ZELJ-XUrtIRvk.chunk.mjs";import{g as k}from"./createElementId-DhjFt1I9-DdwCqgaq.chunk.mjs";import{N as M}from"./autolink-U5pBzLgI-D1NMH9bI.chunk.mjs";import{N as I}from"./mdi--cNatcgF.chunk.mjs";import{N as z}from"./ContentCopy-ljx8CODs.chunk.mjs";import{D as H,_ as S}from"./TrashCanOutline-DmYYOQ4b.chunk.mjs";import{N as j}from"./NcPasswordField-BOLzDHBJ-CKSnPt2n.chunk.mjs";import"./modulepreload-polyfill-BxzAKjcf.chunk.mjs";import"./index-Bndk0DrU.chunk.mjs";import"./index-sH3U_332.chunk.mjs";import"./NcInputField-CPL-a_MM-R1bsVnGI.chunk.mjs";const E={key:1},F=w({__name:"OAuthItem",props:{client:{}},emits:["delete"],setup(c){return(u,h)=>(s(),y("tr",null,[t("td",null,r(c.client.name),1),t("td",null,[t("code",{class:i(u.$style.oAuthItem__code)},r(c.client.redirectUri),3)]),t("td",null,[t("code",{class:i(u.$style.oAuthItem__code)},r(c.client.clientId),3)]),t("td",null,[c.client.clientSecret?(s(),m(e(j),{key:0,class:i(u.$style.oAuthItem__clientSecret),"aria-label":e(a)("oauth2","Secret key"),asText:"",modelValue:c.client.clientSecret,showTrailingButton:""},null,8,["class","aria-label","modelValue"])):(s(),y("span",E,"*****"))]),t("td",null,[d(e(M),{"aria-label":e(a)("oauth2","Delete"),title:e(a)("oauth2","Delete"),variant:"error",onClick:h[0]||(h[0]=b=>u.$emit("delete"))},{icon:p(()=>[d(H,{size:20})]),_:1},8,["aria-label","title"])])]))}}),G="_oAuthItem__code_3r02l_2",J="_oAuthItem__clientSecret_3r02l_11",K={oAuthItem__code:G,oAuthItem__clientSecret:J},L={$style:K},P=V(F,[["__cssModules",L]]),Q={class:"hidden-visually"},W=w({__name:"AdminSettings",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(c){const u=x(c,"modelValue"),h=R().theming.name,b=$("oauth2","oauth2-doc-link"),A=U(!1),o=U({name:"",redirectUri:"",errorMsg:"",error:!1});async function N(l){await g.delete(k("apps/oauth2/clients/{id}",{id:l})),u.value=u.value.filter(n=>n.id!==l)}async function D(){o.value.error=!1;try{const{data:l}=await g.post(k("apps/oauth2/clients"),{name:o.value.name,redirectUri:o.value.redirectUri});u.value.push(l),A.value=!0,o.value.name="",o.value.redirectUri=""}catch(l){o.value.error=!0,T(l)&&l.response?o.value.errorMsg=l.response.data.message:o.value.errorMsg=a("oauth2","An unknown error occurred.")}}return(l,n)=>(s(),m(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(h)}),docUrl:e(b)},{default:p(()=>[u.value.length>0?(s(),y("table",{key:0,class:i([l.$style.oauthApp__table,{[l.$style.oauthApp__table_withSecret]:A.value}])},[t("thead",null,[t("tr",null,[t("th",null,r(e(a)("oauth2","Name")),1),t("th",null,r(e(a)("oauth2","Redirection URI")),1),t("th",null,r(e(a)("oauth2","Client identifier")),1),t("th",null,r(e(a)("oauth2","Secret key")),1),t("th",null,[t("span",Q,r(e(a)("oauth2","Delete client")),1)])])]),t("tbody",null,[(s(!0),y(O,null,q(u.value,_=>(s(),m(P,{key:_.id,client:_,onDelete:ue=>N(_.id)},null,8,["client","onDelete"]))),128))])],2)):f("",!0),A.value?(s(),m(e(I),{key:1,type:"warning"},{default:p(()=>[v(r(e(a)("oauth2","Make sure you store the secret key, it cannot be recovered.")),1)]),_:1})):f("",!0),n[2]||(n[2]=t("br",null,null,-1)),t("h3",null,r(e(a)("oauth2","Add client")),1),o.value.error?(s(),m(e(I),{key:2,type:"error"},{default:p(()=>[v(r(o.value.errorMsg),1)]),_:1})):f("",!0),t("form",{class:i(l.$style.oauthApp__form),onSubmit:B(D,["prevent"])},[d(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"]),d(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"]),d(e(M),{type:"submit",class:i(l.$style.oauthApp__submitButton)},{default:p(()=>[v(r(e(a)("oauth2","Add")),1)]),_:1},8,["class"])],34)]),_:1},8,["name","description","docUrl"]))}}),X="_oauthApp__form_10pnp_1",Y="_oauthApp__form__input_10pnp_6",Z="_oauthApp__table_10pnp_11",ee="_oauthApp__table_withSecret_10pnp_38",te={oauthApp__form:X,oauthApp__form__input:Y,oauthApp__table:Z,oauthApp__table_withSecret:ee},ae={$style:te},le=V(W,[["__cssModules",ae]]),oe=$("oauth2","clients"),re=C(le,{modelValue:oe});re.mount("#oauth2");
//# sourceMappingURL=oauth2-settings-admin.mjs.map