nextcloud/dist/oauth2-settings-admin.mjs
Ferdinand Thiessen b4b5986be9 chore: compile assets
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2026-01-27 23:52:40 +01:00

2 lines
4.9 KiB
JavaScript

import{a as V,g as R,l as $}from"./index-xFugdZPW.chunk.mjs";import{b as w,j as y,o as s,k as t,t as r,n as i,c as m,u as e,e as d,w as p,s as x,l as f,r as U,F as C,C as O,g as v,H as q,h as B}from"./runtime-dom.esm-bundler-DSTOTAEf.chunk.mjs";import{c as k,i as T}from"./index-D9L8KHF3.chunk.mjs";import{t as a}from"./translation-DoG5ZELJ-2ffMJaM4.chunk.mjs";import{g}from"./createElementId-DhjFt1I9-Bjk2333q.chunk.mjs";import{c as M}from"./logger-D3RVzcfQ-iUjwSNGe.chunk.mjs";import{N as I}from"./NcNoteCard-CVhtNL04-CdF6Qoal.chunk.mjs";import{N as j}from"./ContentCopy-caJ7vqeg.chunk.mjs";import{D as z,_ as S}from"./TrashCanOutline-DKx7CxBb.chunk.mjs";import{N as F}from"./NcPasswordField-djttkA5Q-DvTgf1Bu.chunk.mjs";import"./modulepreload-polyfill-BxzAKjcf.chunk.mjs";import"./index-6_gsQFyp.chunk.mjs";import"./string_decoder-BO00msnV.chunk.mjs";import"./NcInputField-Bwsh2aHY-Bf_22pmD.chunk.mjs";const H={key:1},E=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(F),{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",H,"*****"))]),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(z,{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(E,[["__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 k.delete(g("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 k.post(g("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(j),{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(C,null,O(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:q(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=B(le,{modelValue:oe});re.mount("#oauth2");
//# sourceMappingURL=oauth2-settings-admin.mjs.map