nextcloud/dist/files_external-settings.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
25 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{d as he,c as xe}from"./pinia-eNUbsHsw.chunk.mjs";import{a5 as Z,a1 as Y,I as we,p as C,b as $,s as B,c as V,o as u,u as e,r as M,q as Q,v as I,j as h,l as T,n as x,k as y,t as v,F as S,L as Ve,C as q,E as z,G as K,a0 as ne,e as b,w,g as k,V as G,H as ke,h as Se}from"./runtime-dom.esm-bundler-DSTOTAEf.chunk.mjs";import{N as ue,l as Ce,n as Me,o as Ae,p as Ue,f as $e,q as Te,e as qe}from"./mdi-kAZc0JKn.chunk.mjs";import{a as O,l as A}from"./index-xFugdZPW.chunk.mjs";import{t as n,b as Oe}from"./translation-DoG5ZELJ-2ffMJaM4.chunk.mjs";import{c as N,N as F}from"./logger-D3RVzcfQ-iUjwSNGe.chunk.mjs";import"./Plus-BVjFGi0H.chunk.mjs";import{N as oe}from"./NcNoteCard-CVhtNL04-CdF6Qoal.chunk.mjs";import{N as de}from"./ContentCopy-caJ7vqeg.chunk.mjs";import{c as Ee,N as Ne,s as Pe}from"./index-Dzo4H_NA.chunk.mjs";import{N as X}from"./NcSelect-Czzsi3P_-wYuKB0zM.chunk.mjs";import{_ as ce}from"./TrashCanOutline-DKx7CxBb.chunk.mjs";import{c as U}from"./index-D9L8KHF3.chunk.mjs";import{g as R}from"./createElementId-DhjFt1I9-Bjk2333q.chunk.mjs";import{N as Re}from"./index-1IDLJUNm.chunk.mjs";import"./PencilOutline-BPy7Lagu.chunk.mjs";import"./NcBreadcrumbs-DYfGaSjT-kISKYtAK.chunk.mjs";import"./NcDateTime.vue_vue_type_script_setup_true_lang-BhB8yA4U-Bb9gAlar.chunk.mjs";import"./NcAvatar-DmUGApWA-JvdYd-8p.chunk.mjs";import"./NcRichText-CBMtJzE_-DhwkZADF.chunk.mjs";import"./index-6_gsQFyp.chunk.mjs";import{N as P}from"./NcCheckboxRadioSwitch-BCSKF7Tk-BDM2s1GW.chunk.mjs";import{N as Fe}from"./NcChip-D8tGFzRl-BmzaEo05.chunk.mjs";import"./NcColorPicker-Kc0JqRtp-DZI9oazy.chunk.mjs";import"./TrayArrowDown-zMGl3y4Q.chunk.mjs";import"./NcEmojiPicker-pM4Pg2yq-BDMmjn1X.chunk.mjs";/* empty css */import"./NcInputField-Bwsh2aHY-Bf_22pmD.chunk.mjs";import{N as Be}from"./NcPasswordField-djttkA5Q-DvTgf1Bu.chunk.mjs";import"./index-CqGlcBjK.chunk.mjs";import{N as Le}from"./NcUserBubble-DPAmU2_J-B8QraJ_f.chunk.mjs";import"./NcUserStatusIcon-CGEf7fej-CR1VhaiT.chunk.mjs";import"./colors-Go3zmZRD-Bml2X1sg.chunk.mjs";import{_ as _e}from"./AuthMechanismRsa-Bd11WxBh.chunk.mjs";import{C as me,a as D,M as L,S as j,b as je,c as De}from"./types-DD622x-I.chunk.mjs";import{a as pe,P as H}from"./index-Buqk-yLP.chunk.mjs";import{d as ee,a as ae}from"./index-JpgrUA2Z-D4yQFKNw.chunk.mjs";import{l as fe}from"./logger-CrDakPzW.chunk.mjs";import"./string_decoder-BO00msnV.chunk.mjs";const He='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-account-group-outline" viewBox="0 0 24 24"><path d="M12,5A3.5,3.5 0 0,0 8.5,8.5A3.5,3.5 0 0,0 12,12A3.5,3.5 0 0,0 15.5,8.5A3.5,3.5 0 0,0 12,5M12,7A1.5,1.5 0 0,1 13.5,8.5A1.5,1.5 0 0,1 12,10A1.5,1.5 0 0,1 10.5,8.5A1.5,1.5 0 0,1 12,7M5.5,8A2.5,2.5 0 0,0 3,10.5C3,11.44 3.53,12.25 4.29,12.68C4.65,12.88 5.06,13 5.5,13C5.94,13 6.35,12.88 6.71,12.68C7.08,12.47 7.39,12.17 7.62,11.81C6.89,10.86 6.5,9.7 6.5,8.5C6.5,8.41 6.5,8.31 6.5,8.22C6.2,8.08 5.86,8 5.5,8M18.5,8C18.14,8 17.8,8.08 17.5,8.22C17.5,8.31 17.5,8.41 17.5,8.5C17.5,9.7 17.11,10.86 16.38,11.81C16.5,12 16.63,12.15 16.78,12.3C16.94,12.45 17.1,12.58 17.29,12.68C17.65,12.88 18.06,13 18.5,13C18.94,13 19.35,12.88 19.71,12.68C20.47,12.25 21,11.44 21,10.5A2.5,2.5 0 0,0 18.5,8M12,14C9.66,14 5,15.17 5,17.5V19H19V17.5C19,15.17 14.34,14 12,14M4.71,14.55C2.78,14.78 0,15.76 0,17.5V19H3V17.07C3,16.06 3.69,15.22 4.71,14.55M19.29,14.55C20.31,15.22 21,16.06 21,17.07V19H24V17.5C24,15.76 21.22,14.78 19.29,14.55M12,16C13.53,16 15.24,16.5 16.23,17H7.77C8.76,16.5 10.47,16 12,16Z" /></svg>',W=we(new Map);function ge(s){const a=C(()=>Y(s).map(l=>({id:`user:${l}`,user:l,displayName:W.get(l)||l})));return Z(async()=>{const l=Y(s).filter(r=>!W.has(r));if(l.length>0){const{data:r}=await U.post(R("/displaynames"),{users:l});for(const[c,_]of Object.entries(r.users))W.set(c,_)}}),a}function Ge(s){return C(()=>Y(s).map(ve))}function ve(s){return{id:s,isNoUser:!0,displayName:s,iconSvg:He}}const Ie=$({__name:"ApplicableEntities",props:{groups:{default:()=>[]},groupsModifiers:{},users:{default:()=>[]},usersModifiers:{}},emits:["update:groups","update:users"],setup(s){const a=B(s,"groups"),l=B(s,"users"),r=M([]),c=ge(l),_=Ge(a),o=C({get(){return[..._.value,...c.value]},set(p){l.value=p.filter(d=>d.user).map(d=>d.user),a.value=p.filter(d=>d.isNoUser).map(d=>d.id)}}),i=Ee(t,500);async function t(p){const{data:d}=await U.get(R("apps/files_external/ajax/applicable"),{params:{pattern:p,limit:20}}),m=[...r.value.map(f=>[f.id,f]),...Object.entries(d.groups).map(([f,g])=>[f,{...ve(f),displayName:g}]),...Object.entries(d.users).map(([f,g])=>[`user:${f}`,{id:`user:${f}`,user:f,displayName:g}])];r.value=[...new Map(m).values()]}return(p,d)=>(u(),V(e(Re),{modelValue:o.value,"onUpdate:modelValue":d[0]||(d[0]=m=>o.value=m),keepOpen:"",multiple:"",options:r.value,inputLabel:e(n)("files_external","Restrict to"),onSearch:e(i)},null,8,["modelValue","options","inputLabel","onSearch"]))}}),Qe=$({__name:"AuthMechanismConfiguration",props:Q({authMechanism:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(s){const a=B(s,"modelValue"),l=s,r=C(()=>{if(!l.authMechanism.configuration)return;const t=Object.entries(l.authMechanism.configuration).filter(([,p])=>!(p.flags&D.UserProvided));return Object.fromEntries(t)}),c=C(()=>window.OCA.FilesExternal.AuthMechanism.getHandler(l.authMechanism)),_=C(()=>{if(!r.value)return!1;for(const t of Object.values(r.value))if(!(t.flags&D.Hidden||t.flags&D.UserProvided))return!0;return!1}),o=M(!1);Z(async()=>{c.value&&(o.value=!0,await window.customElements.whenDefined(c.value.tagName),o.value=!1)}),I(r,()=>{for(const t in r.value)t in a.value||(a.value[t]=r.value[t]?.type===me.Boolean?!1:"")});function i(t){const p=[t.detail].flat()[0];a.value={...a.value,...p}}return(t,p)=>_.value?(u(),h("fieldset",{key:0,class:x(t.$style.authMechanismConfiguration)},[y("legend",null,v(e(n)("files_external","Authentication")),1),c.value?(u(),h(S,{key:0},[o.value?(u(),V(e(ue),{key:0})):(u(),V(Ve(c.value.tagName),{key:1,".modelValue":a.value,".authMechanism":s.authMechanism,"onUpdate:modelValue":i},null,40,[".modelValue",".authMechanism"]))],64)):(u(!0),h(S,{key:1},q(r.value,(d,m)=>z((u(),V(_e,{key:d.value,modelValue:a.value[m],"onUpdate:modelValue":f=>a.value[m]=f,"config-key":m,"config-option":d},null,8,["modelValue","onUpdate:modelValue","config-key","config-option"])),[[K,!(d.flags&e(D).Hidden)]])),128))],2)):T("",!0)}}),Ze="_authMechanismConfiguration_kpcpy_2",ze={authMechanismConfiguration:Ze},Ke={$style:ze},We=O(Qe,[["__cssModules",Ke]]),Je=$({__name:"BackendConfiguration",props:Q({configuration:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(s){const a=B(s,"modelValue"),l=s;return I(()=>l.configuration,()=>{for(const r in l.configuration)r in a.value||(a.value[r]=l.configuration[r]?.type===me.Boolean?!1:"")}),(r,c)=>(u(),h("fieldset",{class:x(r.$style.backendConfiguration)},[y("legend",null,v(e(n)("files_external","Storage configuration")),1),(u(!0),h(S,null,q(s.configuration,(_,o)=>z((u(),V(_e,{key:_.value,modelValue:a.value[o],"onUpdate:modelValue":i=>a.value[o]=i,configKey:o,configOption:_},null,8,["modelValue","onUpdate:modelValue","configKey","configOption"])),[[K,!(_.flags&e(D).Hidden)]])),128))],2))}}),Ye="_backendConfiguration_1sf6y_2",Xe={backendConfiguration:Ye},ea={$style:Xe},aa=O(Je,[["__cssModules",ea]]),la=["id","aria-labelledby"],ta=$({__name:"MountOptions",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(s){const a=B(s,"modelValue");Z(()=>{Object.keys(a.value).length===0&&(a.value.encrypt=!0,a.value.previews=!0,a.value.enable_sharing=!1,a.value.filesystem_check_changes=L.OncePerRequest,a.value.encoding_compatibility=!1,a.value.readonly=!1)});const{hasEncryption:l}=A("files_external","settings"),r=ne(),c=ne(),_=M(!1),o=[{label:n("files_external","Never"),value:L.Never},{label:n("files_external","Once every direct access"),value:L.OncePerRequest},{label:n("files_external","Always"),value:L.Always}],i=C({get(){return o.find(t=>t.value===a.value.filesystem_check_changes)},set(t){a.value.filesystem_check_changes=t?.value??L.OncePerRequest}});return(t,p)=>(u(),h("div",{class:x(t.$style.mountOptions)},[b(e(N),{id:e(r),"aria-controls":e(c),"aria-expanded":_.value,variant:"tertiary-no-background",onClick:p[0]||(p[0]=d=>_.value=!_.value)},{icon:w(()=>[b(e(F),{directional:"",path:_.value?e(Ce):e(Me)},null,8,["path"])]),default:w(()=>[k(" "+v(e(n)("files_external","Mount options")),1)]),_:1},8,["id","aria-controls","aria-expanded"]),z(y("fieldset",{id:e(c),class:x(t.$style.mountOptions__fieldset),"aria-labelledby":e(r)},[b(e(X),{modelValue:i.value,"onUpdate:modelValue":p[1]||(p[1]=d=>i.value=d),inputLabel:e(n)("files_external","Check filesystem changes"),options:o},null,8,["modelValue","inputLabel"]),b(e(P),{modelValue:s.modelValue.readonly,"onUpdate:modelValue":p[2]||(p[2]=d=>s.modelValue.readonly=d),type:"switch"},{default:w(()=>[k(v(e(n)("files_external","Read only")),1)]),_:1},8,["modelValue"]),b(e(P),{modelValue:s.modelValue.previews,"onUpdate:modelValue":p[3]||(p[3]=d=>s.modelValue.previews=d),type:"switch"},{default:w(()=>[k(v(e(n)("files_external","Enable previews")),1)]),_:1},8,["modelValue"]),b(e(P),{modelValue:s.modelValue.enable_sharing,"onUpdate:modelValue":p[4]||(p[4]=d=>s.modelValue.enable_sharing=d),type:"switch"},{default:w(()=>[k(v(e(n)("files_external","Enable sharing")),1)]),_:1},8,["modelValue"]),e(l)?(u(),V(e(P),{key:0,modelValue:s.modelValue.encrypt,"onUpdate:modelValue":p[5]||(p[5]=d=>s.modelValue.encrypt=d),type:"switch"},{default:w(()=>[k(v(e(n)("files_external","Enable encryption")),1)]),_:1},8,["modelValue"])):T("",!0),b(e(P),{modelValue:s.modelValue.encoding_compatibility,"onUpdate:modelValue":p[6]||(p[6]=d=>s.modelValue.encoding_compatibility=d),type:"switch"},{default:w(()=>[k(v(e(n)("files_external","Compatibility with Mac NFD encoding (slow)")),1)]),_:1},8,["modelValue"])],10,la),[[K,_.value]])],2))}}),sa="_mountOptions_1fqyb_2",na="_mountOptions__fieldset_1fqyb_12",oa={mountOptions:sa,mountOptions__fieldset:na},ia={$style:oa},ra=O(ta,[["__cssModules",ia]]),{isAdmin:ie}=A("files_external","settings"),ua=A("files_external","allowedBackends"),re=A("files_external","backends").filter(s=>ua.includes(s.identifier)),da=A("files_external","authMechanisms"),ca=$({__name:"AddExternalStorageDialog",props:Q({storage:{default:()=>({backendOptions:{},mountOptions:{},type:ie?"system":"personal"})}},{open:{type:Boolean,default:!0},openModifiers:{}}),emits:Q(["close"],["update:open"]),setup(s){const a=B(s,"open"),l=M(structuredClone(G(s.storage)));Z(()=>{a.value&&(l.value=structuredClone(G(s.storage)))});const r=C({get(){return re.find(o=>o.identifier===l.value.backend)},set(o){l.value.backend=o?.identifier}}),c=C(()=>da.filter(({scheme:o})=>r.value?.authSchemes[o])),_=C({get(){return c.value.find(o=>o.identifier===l.value.authMechanism)},set(o){l.value.authMechanism=o?.identifier}});return I(c,()=>{c.value.length===1&&(l.value.authMechanism=c.value[0].identifier)}),(o,i)=>(u(),V(e(Ne),{open:a.value,"onUpdate:open":[i[9]||(i[9]=t=>a.value=t),i[11]||(i[11]=t=>t||o.$emit("close"))],isForm:"",contentClasses:o.$style.externalStorageDialog,name:l.value.id?e(n)("files_external","Edit storage"):e(n)("files_external","Add storage"),onSubmit:i[10]||(i[10]=t=>o.$emit("close",l.value))},{actions:w(()=>[s.storage.id?(u(),V(e(N),{key:0,onClick:i[8]||(i[8]=t=>o.$emit("close"))},{default:w(()=>[k(v(e(n)("files_external","Cancel")),1)]),_:1})):T("",!0),b(e(N),{variant:"primary",type:"submit"},{default:w(()=>[k(v(s.storage.id?e(n)("files_external","Edit"):e(n)("files_external","Create")),1)]),_:1})]),default:w(()=>[b(e(ce),{modelValue:l.value.mountPoint,"onUpdate:modelValue":i[0]||(i[0]=t=>l.value.mountPoint=t),label:e(n)("files_external","Folder name"),required:""},null,8,["modelValue","label"]),b(ra,{modelValue:l.value.mountOptions,"onUpdate:modelValue":i[1]||(i[1]=t=>l.value.mountOptions=t)},null,8,["modelValue"]),e(ie)?(u(),V(Ie,{key:0,groups:l.value.applicableGroups,"onUpdate:groups":i[2]||(i[2]=t=>l.value.applicableGroups=t),users:l.value.applicableUsers,"onUpdate:users":i[3]||(i[3]=t=>l.value.applicableUsers=t)},null,8,["groups","users"])):T("",!0),b(e(X),{modelValue:r.value,"onUpdate:modelValue":i[4]||(i[4]=t=>r.value=t),options:e(re),disabled:!!(l.value.id&&l.value.backend),inputLabel:e(n)("files_external","External storage"),label:"name",required:""},null,8,["modelValue","options","disabled","inputLabel"]),b(e(X),{modelValue:_.value,"onUpdate:modelValue":i[5]||(i[5]=t=>_.value=t),options:c.value,disabled:!l.value.backend||c.value.length<=1||!!(l.value.id&&l.value.authMechanism),inputLabel:e(n)("files_external","Authentication"),label:"name",required:""},null,8,["modelValue","options","disabled","inputLabel"]),r.value?(u(),V(aa,{key:1,modelValue:l.value.backendOptions,"onUpdate:modelValue":i[6]||(i[6]=t=>l.value.backendOptions=t),class:x(o.$style.externalStorageDialog__configuration),configuration:r.value.configuration},null,8,["modelValue","class","configuration"])):T("",!0),_.value?(u(),V(We,{key:2,modelValue:l.value.backendOptions,"onUpdate:modelValue":i[7]||(i[7]=t=>l.value.backendOptions=t),class:x(o.$style.externalStorageDialog__configuration),authMechanism:_.value},null,8,["modelValue","class","authMechanism"])):T("",!0)]),_:1},8,["open","contentClasses","name"]))}}),_a="_externalStorageDialog_9wew8_2",ma="_externalStorageDialog__configuration_9wew8_9",pa={externalStorageDialog:_a,externalStorageDialog__configuration:ma},fa={$style:pa},be=O(ca,[["__cssModules",fa]]),{isAdmin:ga}=A("files_external","settings"),le=he("files_external--storages",()=>{const s=M([]),a=M([]);async function l(m){const f=R("apps/files_external/globalstorages"),{data:g}=await U.post(f,G(m),{confirmPassword:H.Strict});s.value.push(g)}async function r(m){const f=R("apps/files_external/userstorages"),{data:g}=await U.post(f,G(m),{confirmPassword:H.Strict});a.value.push(g)}async function c(m){await U.delete(p(m),{confirmPassword:H.Strict}),m.type==="personal"?a.value=a.value.filter(f=>f.id!==m.id):s.value=s.value.filter(f=>f.id!==m.id)}async function _(m){const{data:f}=await U.put(p(m),G(m),{confirmPassword:H.Strict});d(f)}async function o(m){const{data:f}=await U.get(p(m));d(f)}return t(),{globalStorages:s,userStorages:a,createGlobalStorage:l,createUserStorage:r,deleteStorage:c,reloadStorage:o,updateStorage:_};async function i(m){const f=`apps/files_external/${m}`,{data:g}=await U.get(R(f));return Object.values(g)}async function t(){pe(U),ga?s.value=await i("globalstorages"):(a.value=await i("userstorages"),s.value=await i("userglobalstorages"))}function p(m){const f=m.type==="personal"?"userstorages":"globalstorages";return R(`apps/files_external/${f}/${m.id}`)}function d(m){if(m.type==="personal"){const f=a.value.findIndex(g=>g.id===m.id);a.value.splice(f,1,m)}else{const f=s.value.findIndex(g=>g.id===m.id);s.value.splice(f,1,m)}}}),va={class:"hidden-visually"},ba={key:0},ya=$({__name:"ExternalStorageTableRow",props:{storage:{},isAdmin:{type:Boolean}},setup(s){const a=s,l=le(),r=A("files_external","backends"),c=C(()=>r.find(g=>g.identifier===a.storage.backend).name),_=A("files_external","authMechanisms"),o=C(()=>_.find(g=>g.identifier===a.storage.authMechanism).name),i=M(!1),t=C(()=>{if(i.value)return{icon:"loading",label:n("files_external","Checking …")};const g=a.storage.status??j.Indeterminate,te=a.storage.statusMessage||je[g],E=De[g],se=g===j.NetworkError||g===j.Timeout,ye=!se&&g!==j.Success&&g!==j.Indeterminate;return{icon:E,label:te,isWarning:se,isError:ye}}),p=ge(()=>a.storage.applicableUsers||[]);async function d(){await l.deleteStorage(a.storage)}async function m(){const g=await Pe(be,{storage:a.storage});g&&await l.updateStorage(g)}async function f(){i.value=!0;try{await l.reloadStorage(a.storage)}finally{i.value=!1}}return(g,te)=>(u(),h("tr",{class:x(g.$style.storageTableRow)},[y("td",null,[y("span",va,v(t.value.label),1),b(e(N),{"aria-label":e(n)("files_external","Recheck status"),title:t.value.label,variant:"tertiary-no-background",onClick:f},{icon:w(()=>[t.value.icon==="loading"?(u(),V(e(ue),{key:0})):(u(),V(e(F),{key:1,class:x({[g.$style.storageTableRow__status_error]:t.value.isError,[g.$style.storageTableRow__status_warning]:t.value.isWarning}),path:t.value.icon},null,8,["class","path"]))]),_:1},8,["aria-label","title"])]),y("td",null,v(s.storage.mountPoint),1),y("td",null,v(c.value),1),y("td",null,v(o.value),1),s.isAdmin?(u(),h("td",ba,[y("div",{class:x(g.$style.storageTableRow__cellApplicable)},[(u(!0),h(S,null,q(s.storage.applicableGroups,E=>(u(),V(e(Fe),{key:E,iconPath:e(Ae),noClose:"",text:E},null,8,["iconPath","text"]))),128)),(u(!0),h(S,null,q(e(p),E=>(u(),V(e(Le),{key:E.user,displayName:E.displayName,size:24,user:E.user},null,8,["displayName","user"]))),128))],2)])):T("",!0),y("td",null,[s.isAdmin||s.storage.type==="personal"?(u(),h("div",{key:0,class:x(g.$style.storageTableRow__cellActions)},[b(e(N),{"aria-label":e(n)("files_external","Edit"),title:e(n)("files_external","Edit"),onClick:m},{icon:w(()=>[b(e(F),{path:e(Ue)},null,8,["path"])]),_:1},8,["aria-label","title"]),b(e(N),{"aria-label":e(n)("files_external","Delete"),title:e(n)("files_external","Delete"),variant:"error",onClick:d},{icon:w(()=>[b(e(F),{path:e($e)},null,8,["path"])]),_:1},8,["aria-label","title"])],2)):(u(),V(e(F),{key:1,inline:"",path:e(Te),name:e(n)("files_external","System provided storage"),title:e(n)("files_external","System provided storage")},null,8,["path","name","title"]))])],2))}}),ha="_storageTableRow__cellActions_1k62p_2",xa="_storageTableRow__cellApplicable_1k62p_7",wa="_storageTableRow__status_warning_1k62p_17",Va="_storageTableRow__status_error_1k62p_21",ka={storageTableRow__cellActions:ha,storageTableRow__cellApplicable:xa,storageTableRow__status_warning:wa,storageTableRow__status_error:Va},Sa={$style:ka},Ca=O(ya,[["__cssModules",Sa]]),Ma=["aria-label"],Aa={class:"hidden-visually"},Ua={key:0},$a={class:"hidden-visually"},Ta=$({__name:"ExternalStorageTable",setup(s){const a=le(),{isAdmin:l}=A("files_external","settings"),r=C(()=>l?a.globalStorages:[...a.userStorages,...a.globalStorages]);return(c,_)=>(u(),h("table",{class:x(c.$style.storageTable),"aria-label":e(n)("files_external","External storages")},[y("thead",{class:x(c.$style.storageTable__header)},[y("tr",null,[y("th",{class:x(c.$style.storageTable__headerStatus)},[y("span",Aa,v(e(n)("files_external","Status")),1)],2),y("th",{class:x(c.$style.storageTable__headerFolder)},v(e(n)("files_external","Folder name")),3),y("th",{class:x(c.$style.storageTable__headerBackend)},v(e(n)("files_external","External storage")),3),y("th",{class:x(c.$style.storageTable__headerAuthentication)},v(e(n)("files_external","Authentication")),3),e(l)?(u(),h("th",Ua,v(e(n)("files_external","Restricted to")),1)):T("",!0),y("th",{class:x(c.$style.storageTable__headerActions)},[y("span",$a,v(e(n)("files_external","Actions")),1)],2)])],2),y("tbody",null,[(u(!0),h(S,null,q(r.value,o=>(u(),V(Ca,{key:o.id,isAdmin:e(l),storage:o},null,8,["isAdmin","storage"]))),128))])],10,Ma))}}),qa="_storageTable_1dqte_2",Oa="_storageTable__header_1dqte_11",Ea="_storageTable__headerStatus_1dqte_16",Na="_storageTable__headerFolder_1dqte_20",Pa="_storageTable__headerBackend_1dqte_24",Ra="_storageTable__headerFAuthentication_1dqte_28",Fa="_storageTable__headerActions_1dqte_32",Ba={storageTable:qa,storageTable__header:Oa,storageTable__headerStatus:Ea,storageTable__headerFolder:Na,storageTable__headerBackend:Pa,storageTable__headerFAuthentication:Ra,storageTable__headerActions:Fa},La={$style:Ba},ja=O(Ta,[["__cssModules",La]]),Da=$({__name:"UserMountSettings",setup(s){const a=A("files_external","user-mounting"),l=A("files_external","backends"),r=M(a.allowUserMounting),c=M(a.allowedBackends);return I(r,()=>{const _=!r.value;window.OCP.AppConfig.setValue("files_external","allow_user_mounting",r.value?"yes":"no",{success:()=>ee(n("files_external","Saved")),error:()=>{r.value=_,ae(n("files_external","Error while saving"))}})}),I(c,(_,o)=>{window.OCP.AppConfig.setValue("files_external","user_mounting_backends",_.join(","),{success:()=>ee(n("files_external","Saved allowed backends")),error:()=>{ae(n("files_external","Failed to save allowed backends")),c.value=o}})}),(_,o)=>(u(),h("form",null,[y("h3",{class:x(_.$style.userMountSettings__heading)},v(e(n)("files_external","Advanced options for external storage mounts")),3),b(e(P),{modelValue:r.value,"onUpdate:modelValue":o[0]||(o[0]=i=>r.value=i),type:"switch"},{default:w(()=>[k(v(e(n)("files_external","Allow people to mount external storage")),1)]),_:1},8,["modelValue"]),z(y("fieldset",{class:x(_.$style.userMountSettings__backends)},[y("legend",null,v(e(n)("files_external","External storage backends people are allowed to mount")),1),(u(!0),h(S,null,q(e(l),i=>(u(),V(e(P),{key:i.identifier,modelValue:c.value,"onUpdate:modelValue":o[1]||(o[1]=t=>c.value=t),value:i.identifier,name:"allowUserMountingBackends[]"},{default:w(()=>[k(v(i.name),1)]),_:2},1032,["modelValue","value"]))),128))],2),[[K,r.value]])]))}}),Ha="_userMountSettings__heading_59moz_2",Ga="_userMountSettings__backends_59moz_9",Ia={userMountSettings__heading:Ha,userMountSettings__backends:Ga},Qa={$style:Ia},Za=O(Da,[["__cssModules",Qa]]);const za=["aria-label"],Ka=$({__name:"ExternalStoragesSection",setup(s){const a=A("files_external","settings",{docUrl:"",dependencyIssues:{messages:null,modules:null},isAdmin:!1}),l=le(),r=a.dependencyIssues?.messages??[],c=a.dependencyIssues?.modules??{},_=M(!1),o=M();async function i(t){if(_.value=!1,!!t)try{a.isAdmin?await l.createGlobalStorage(t):await l.createUserStorage(t),o.value=void 0}catch(p){fe.error("Failed to add external storage",{error:p}),_.value=!0}}return(t,p)=>(u(),V(e(de),{docUrl:e(a).docUrl,name:e(n)("files_external","External storage"),description:e(n)("files_external","External storage enables you to mount external storage services and devices as secondary Nextcloud storage devices.")+(e(a).isAdmin?" "+e(n)("files_external","You may also allow people to mount their own external storage services."):"")},{default:w(()=>[(u(!0),h(S,null,q(e(r),(d,m)=>(u(),V(e(oe),{key:m,type:"error"},{default:w(()=>[k(v(d),1)]),_:2},1024))),128)),(u(!0),h(S,null,q(e(c),(d,m)=>(u(),V(e(oe),{key:m,type:"warning"},{default:w(()=>[y("p",null,[m==="curl"?(u(),h(S,{key:0},[k(v(e(n)("files_external","The cURL support in PHP is not enabled or installed.")),1)],64)):m==="ftp"?(u(),h(S,{key:1},[k(v(e(n)("files_external","The FTP support in PHP is not enabled or installed.")),1)],64)):(u(),h(S,{key:2},[k(v(e(n)("files_external","{module} is not installed.",{module:m})),1)],64)),k(" "+v(e(Oe)("files_external","Please ask your system administrator to install it as otherwise mounting the following backend is not possible:","Please ask your system administrator to install it as otherwise mounting the following backends is not possible:",d.length)),1)]),y("ul",{class:x(t.$style.externalStoragesSection__dependantList),"aria-label":e(n)("files_external","Dependant backends")},[(u(!0),h(S,null,q(d,f=>(u(),h("li",{key:f},v(f),1))),128))],10,za)]),_:2},1024))),128)),T("",!0),b(ja),b(e(N),{class:x(t.$style.externalStoragesSection__newStorageButton),variant:"primary",onClick:p[0]||(p[0]=d=>_.value=!_.value)},{icon:w(()=>[b(e(F),{path:e(qe)},null,8,["path"])]),default:w(()=>[k(" "+v(e(n)("files_external","Add external storage")),1)]),_:1},8,["class"]),b(be,{modelValue:o.value,"onUpdate:modelValue":p[1]||(p[1]=d=>o.value=d),open:_.value,"onUpdate:open":p[2]||(p[2]=d=>_.value=d),onClose:i},null,8,["modelValue","open"]),e(a).isAdmin?(u(),V(Za,{key:1})):T("",!0)]),_:1},8,["docUrl","name","description"]))}}),Wa="_externalStoragesSection__dependantList_atsmn_2",Ja="_externalStoragesSection__newStorageButton_atsmn_7",Ya={externalStoragesSection__dependantList:Wa,externalStoragesSection__newStorageButton:Ja},Xa={$style:Ya},el=O(Ka,[["__cssModules",Xa]]),al=$({__name:"GlobalCredentialsSection",setup(s){const a=A("files_external","global-credentials"),l=M(!1),r=M(a.user),c=M(a.password);pe(U);async function _(){try{l.value=!0;const{data:o}=await U.post(R("apps/files_external/globalcredentials"),{uid:a.uid,user:r.value,password:c.value},{confirmPassword:H.Strict});if(o){ee(n("files_external","Global credentials saved"));return}}catch(o){fe.error(o)}finally{l.value=!1}ae(n("files_external","Could not save global credentials")),r.value=a.user,c.value=a.password}return(o,i)=>(u(),V(e(de),{name:e(n)("files_external","Global credentials"),description:e(n)("files_external","Global credentials can be used to authenticate with multiple external storages that have the same credentials.")},{default:w(()=>[y("form",{id:"global_credentials",class:x(o.$style.globalCredentialsSectionForm),autocomplete:"false",onSubmit:ke(_,["prevent"])},[b(e(ce),{modelValue:r.value,"onUpdate:modelValue":i[0]||(i[0]=t=>r.value=t),name:"username",autocomplete:"false",label:e(n)("files_external","Login")},null,8,["modelValue","label"]),b(e(Be),{modelValue:c.value,"onUpdate:modelValue":i[1]||(i[1]=t=>c.value=t),name:"password",autocomplete:"false",label:e(n)("files_external","Password")},null,8,["modelValue","label"]),b(e(N),{class:x(o.$style.globalCredentialsSectionForm__submit),disabled:l.value,variant:"primary",type:"submit"},{default:w(()=>[k(v(l.value?e(n)("files_external","Saving …"):e(n)("files_external","Save")),1)]),_:1},8,["class","disabled"])],34)]),_:1},8,["name","description"]))}}),ll="_globalCredentialsSectionForm_bgjv2_2",tl="_globalCredentialsSectionForm__submit_bgjv2_10",sl={globalCredentialsSectionForm:ll,globalCredentialsSectionForm__submit:tl},nl={$style:sl},ol=O(al,[["__cssModules",nl]]),il=$({__name:"FilesExternalSettings",setup(s){return(a,l)=>(u(),h(S,null,[b(el),b(ol)],64))}}),rl=xe(),J=Se(il);J.config.idPrefix="files-external",J.use(rl),J.mount("#files-external");
//# sourceMappingURL=files_external-settings.mjs.map