mirror of
https://github.com/nextcloud/server.git
synced 2026-06-28 10:01:35 -04:00
2 lines
26 KiB
JavaScript
2 lines
26 KiB
JavaScript
import{d as ke,c as Ve}from"./pinia-Bn5aG74F.chunk.mjs";import{H as K,a9 as ee,R as Se,v as C,b as $,n as B,o as u,c as k,u as e,l as M,z,f as h,y as x,g as y,t as v,F as S,C as Ce,B as O,L as W,M as Y,h as T,s as Z,a1 as Q,U as ie,k as b,w,j as V,N as Me,e as Ae}from"./Web-ByHSuvRG.chunk.mjs";import{s as Ue,g as $e,t as Te,u as Oe,l as Ne,v as qe,N as re,k as Pe}from"./mdi-Ci0zJ0QG.chunk.mjs";import{_ as N,l as A}from"./public-C1mLBHT3.chunk.mjs";import{t as n,a as Ee}from"./translation-DoG5ZELJ-C5oC8Tcn.chunk.mjs";import{N as P}from"./logger-D3RVzcfQ-B261d025.chunk.mjs";import"./NcEmptyContent-CGAPqk4S-q4HLj68a.chunk.mjs";import{N as F}from"./createElementId-DhjFt1I9-CZ2eH1SD.chunk.mjs";import{N as ce}from"./ContentCopy-DX69rUn6.chunk.mjs";import{N as Re,s as Fe}from"./index-BRuD4Qrz.chunk.mjs";import{N as ae}from"./index-C13i_MTM.chunk.mjs";import{_ as me}from"./NcTextField.vue_vue_type_script_setup_true_lang-BQHjkK8r-Dv0_ThWG.chunk.mjs";import{c as U}from"./index-D-iKxf2E.chunk.mjs";import{b as R}from"./index-C6ey-Mhx.chunk.mjs";import{N as Be}from"./NcTextArea-Dxzj4zdb-BLv5JT3R.chunk.mjs";import{b as Le}from"./index-Bm5HdBcE.chunk.mjs";import"./PencilOutline-DJX4SP_q.chunk.mjs";import"./NcBreadcrumbs-5gl8Syfa-M1WEN1lc.chunk.mjs";import"./NcDateTime.vue_vue_type_script_setup_true_lang-BJuPH7S7-BRczm9CK.chunk.mjs";import"./NcModal-DUWLRm_F-C0gD58QY.chunk.mjs";/* empty css */import"./NcAvatar-M3-CbKbq-DbNpmr-b.chunk.mjs";import"./NcContent-BhMoPROW-DsKLJ41z.chunk.mjs";import{N as _e}from"./TrashCanOutline-CW4_EEhq.chunk.mjs";import{N as E}from"./NcCheckboxRadioSwitch-D8Dfv4iw-B_doZ1-m.chunk.mjs";import{N as je}from"./Plus-Dpju2rIw.chunk.mjs";import"./index-BWDoVtMf.chunk.mjs";import"./TrayArrowDown-BRoulKIv.chunk.mjs";import"./index-B2gPRygg.chunk.mjs";import"./NcEmojiPicker-Bpw-68QP-DLh7rUK8.chunk.mjs";import"./index-CwsnDr9r.chunk.mjs";/* empty css */import"./NcInputField-B1bGxYHt-DVZQKody.chunk.mjs";import{N as De}from"./NcPasswordField-Be5_qcfm-DrwSQ-mu.chunk.mjs";import"./index-B7f4H-mg.chunk.mjs";import"./NcSelectTags-D7qWNjXa-DmaYJhIo.chunk.mjs";import{N as He}from"./NcUserBubble-CDQa0hGy-DMYvkftD.chunk.mjs";import"./NcUserStatusIcon-DsviB2Cr-CJ45dJff.chunk.mjs";import"./emoji-C8k9NUlo-D9ZtzMuc.chunk.mjs";import"./colors-BDeMBgfq-D1xNHBAd.chunk.mjs";import{_ as pe}from"./AuthMechanismRsa-swc1j5xR.chunk.mjs";import{C as H,a as ge,M as G,S as L,b as Ge,c as Ie}from"./types-D2JNyhvY.chunk.mjs";import{a as fe,P as I}from"./index-BTFugZfg.chunk.mjs";import{p as Qe}from"./externalStorageUtils-CpkXDsx2.chunk.mjs";import{a as te,d as le}from"./index-DL1yHC1K-orb-zzee.chunk.mjs";import{l as ve}from"./logger-D6wJPO9M.chunk.mjs";import"./util-djQ-4xJ5.chunk.mjs";import"./ArrowRight-BgQTbtKu.chunk.mjs";const ze='<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>',J=Se(new Map);function be(l){const a=C(()=>ee(l).map(t=>({id:`user:${t}`,user:t,displayName:J.get(t)||t})));return K(async()=>{const t=ee(l).filter(r=>!J.has(r));if(t.length>0){const{data:r}=await U.post(R("/displaynames"),{users:t});for(const[d,c]of Object.entries(r.users))J.set(d,c)}}),a}function Ze(l){return C(()=>ee(l).map(ye))}function ye(l){return{id:l,isNoUser:!0,displayName:l,iconSvg:ze}}const Ke=$({__name:"ApplicableEntities",props:{groups:{default:()=>[]},groupsModifiers:{},users:{default:()=>[]},usersModifiers:{}},emits:["update:groups","update:users"],setup(l){const a=B(l,"groups"),t=B(l,"users"),r=M([]),d=be(t),c=Ze(a),i=C({get(){return[...c.value,...d.value]},set(p){t.value=p.filter(m=>m.user).map(m=>m.user),a.value=p.filter(m=>m.isNoUser).map(m=>m.id)}}),o=Le(s,500);async function s(p){const{data:m}=await U.get(R("apps/files_external/ajax/applicable"),{params:{pattern:p,limit:20}}),_=[...r.value.map(g=>[g.id,g]),...Object.entries(m.groups).map(([g,f])=>[g,{...ye(g),displayName:f}]),...Object.entries(m.users).map(([g,f])=>[`user:${g}`,{id:`user:${g}`,user:g,displayName:f}])];r.value=[...new Map(_).values()]}return(p,m)=>(u(),k(e(Be),{modelValue:i.value,"onUpdate:modelValue":m[0]||(m[0]=_=>i.value=_),keepOpen:"",multiple:"",options:r.value,inputLabel:e(n)("files_external","Restrict to"),onSearch:e(o)},null,8,["modelValue","options","inputLabel","onSearch"]))}}),We=$({__name:"AuthMechanismConfiguration",props:Z({authMechanism:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const a=B(l,"modelValue"),t=l,r=C(()=>{if(!t.authMechanism.configuration)return;const s=Object.entries(t.authMechanism.configuration).filter(([,p])=>!(p.flags&H.UserProvided));return Object.fromEntries(s)}),d=C(()=>window.OCA.FilesExternal.AuthMechanism.getHandler(t.authMechanism)),c=C(()=>{if(!r.value)return!1;for(const s of Object.values(r.value))if(!(s.flags&H.Hidden||s.flags&H.UserProvided))return!0;return!1}),i=M(!1);K(async()=>{d.value&&(i.value=!0,await window.customElements.whenDefined(d.value.tagName),i.value=!1)}),z(r,()=>{for(const s in r.value)s in a.value||(a.value[s]=r.value[s]?.type===ge.Boolean?!1:"")});function o(s){const p=[s.detail].flat()[0];a.value={...a.value,...p}}return(s,p)=>c.value?(u(),h("fieldset",{key:0,class:x(s.$style.authMechanismConfiguration)},[y("legend",null,v(e(n)("files_external","Authentication")),1),d.value?(u(),h(S,{key:0},[i.value?(u(),k(e(_e),{key:0})):(u(),k(Ce(d.value.tagName),{key:1,".modelValue":a.value,".authMechanism":l.authMechanism,"onUpdate:modelValue":o},null,40,[".modelValue",".authMechanism"]))],64)):(u(!0),h(S,{key:1},O(r.value,(m,_)=>W((u(),k(pe,{key:m.value,modelValue:a.value[_],"onUpdate:modelValue":g=>a.value[_]=g,"config-key":_,"config-option":m},null,8,["modelValue","onUpdate:modelValue","config-key","config-option"])),[[Y,!(m.flags&e(H).Hidden)]])),128))],2)):T("",!0)}}),Ye="_authMechanismConfiguration_kpcpy_2",Je={authMechanismConfiguration:Ye},Xe={$style:Je},ea=N(We,[["__cssModules",Xe]]),aa=$({__name:"BackendConfiguration",props:Z({configuration:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const a=B(l,"modelValue"),t=l;return z(()=>t.configuration,()=>{for(const r in t.configuration)r in a.value||(a.value[r]=t.configuration[r]?.defaultValue??(t.configuration[r]?.type===ge.Boolean?!1:""))},{immediate:!0}),(r,d)=>(u(),h("fieldset",{class:x(r.$style.backendConfiguration)},[y("legend",null,v(e(n)("files_external","Storage configuration")),1),(u(!0),h(S,null,O(l.configuration,(c,i)=>W((u(),k(pe,{key:c.value,modelValue:a.value[i],"onUpdate:modelValue":o=>a.value[i]=o,configKey:i,configOption:c},null,8,["modelValue","onUpdate:modelValue","configKey","configOption"])),[[Y,!(c.flags&e(H).Hidden)]])),128))],2))}}),ta="_backendConfiguration_1sf6y_2",la={backendConfiguration:ta},sa={$style:la},na=N(aa,[["__cssModules",sa]]),{isAdmin:oa}=A("files_external","settings"),se=ke("files_external--storages",()=>{const l=M([]),a=M([]);async function t(_){const g=R("apps/files_external/globalstorages"),{data:f}=await U.post(g,Q(_),{confirmPassword:I.Strict});l.value.push(j(f))}async function r(_){const g=R("apps/files_external/userstorages"),{data:f}=await U.post(g,Q(_),{confirmPassword:I.Strict});a.value.push(j(f))}async function d(_){await U.delete(p(_),{confirmPassword:I.Strict}),_.type==="personal"?a.value=a.value.filter(g=>g.id!==_.id):l.value=l.value.filter(g=>g.id!==_.id)}async function c(_){const{data:g}=await U.put(p(_),Q(_),{confirmPassword:I.Strict});m(j(g))}async function i(_){const{data:g}=await U.get(p(_));m(j(g))}return s(),{globalStorages:l,userStorages:a,createGlobalStorage:t,createUserStorage:r,deleteStorage:d,reloadStorage:i,updateStorage:c};async function o(_){const g=`apps/files_external/${_}`,{data:f}=await U.get(R(g));return Object.values(f).map(j)}async function s(){fe(U),oa?l.value=await o("globalstorages"):(a.value=await o("userstorages"),l.value=await o("userglobalstorages"))}function p(_){const g=_.type==="personal"?"userstorages":"globalstorages";return R(`apps/files_external/${g}/${_.id}`)}function m(_){if(_.type==="personal"){const g=a.value.findIndex(f=>f.id===_.id);a.value.splice(g,1,_)}else{const g=l.value.findIndex(f=>f.id===_.id);l.value.splice(g,1,_)}}});function j(l){return{...l,mountOptions:he(l.mountOptions)}}function he(l){const a={...l};return a.encrypt=D(a.encrypt,!0),a.previews=D(a.previews,!0),a.enable_sharing=D(a.enable_sharing,!1),a.filesystem_check_changes=typeof a.filesystem_check_changes=="string"?Number.parseInt(a.filesystem_check_changes):a.filesystem_check_changes??G.OncePerRequest,a.encoding_compatibility=D(a.encoding_compatibility,!1),a.readonly=D(a.readonly,!1),a}function D(l,a=!1){return l===void 0?a:l===!0||l==="true"||l==="1"}const ia=["id","aria-labelledby"],ra=$({__name:"MountOptions",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(l){const a=B(l,"modelValue");K(()=>{Object.keys(a.value).length===0&&(a.value=he(a.value))});const{hasEncryption:t}=A("files_external","settings"),r=ie(),d=ie(),c=M(!1),i=[{label:n("files_external","Never"),value:G.Never},{label:n("files_external","Once every direct access"),value:G.OncePerRequest},{label:n("files_external","Always"),value:G.Always}],o=C({get(){return i.find(s=>s.value===a.value.filesystem_check_changes)},set(s){a.value.filesystem_check_changes=s?.value??G.OncePerRequest}});return(s,p)=>(u(),h("div",{class:x(s.$style.mountOptions)},[b(e(P),{id:e(r),"aria-controls":e(d),"aria-expanded":c.value,variant:"tertiary-no-background",onClick:p[0]||(p[0]=m=>c.value=!c.value)},{icon:w(()=>[b(e(F),{directional:"",path:c.value?e(Ue):e($e)},null,8,["path"])]),default:w(()=>[V(" "+v(e(n)("files_external","Mount options")),1)]),_:1},8,["id","aria-controls","aria-expanded"]),W(y("fieldset",{id:e(d),class:x(s.$style.mountOptions__fieldset),"aria-labelledby":e(r)},[b(e(ae),{modelValue:o.value,"onUpdate:modelValue":p[1]||(p[1]=m=>o.value=m),inputLabel:e(n)("files_external","Check filesystem changes"),options:i},null,8,["modelValue","inputLabel"]),b(e(E),{modelValue:l.modelValue.readonly,"onUpdate:modelValue":p[2]||(p[2]=m=>l.modelValue.readonly=m),type:"switch"},{default:w(()=>[V(v(e(n)("files_external","Read only")),1)]),_:1},8,["modelValue"]),b(e(E),{modelValue:l.modelValue.previews,"onUpdate:modelValue":p[3]||(p[3]=m=>l.modelValue.previews=m),type:"switch"},{default:w(()=>[V(v(e(n)("files_external","Enable previews")),1)]),_:1},8,["modelValue"]),b(e(E),{modelValue:l.modelValue.enable_sharing,"onUpdate:modelValue":p[4]||(p[4]=m=>l.modelValue.enable_sharing=m),type:"switch"},{default:w(()=>[V(v(e(n)("files_external","Enable sharing")),1)]),_:1},8,["modelValue"]),e(t)?(u(),k(e(E),{key:0,modelValue:l.modelValue.encrypt,"onUpdate:modelValue":p[5]||(p[5]=m=>l.modelValue.encrypt=m),type:"switch"},{default:w(()=>[V(v(e(n)("files_external","Enable encryption")),1)]),_:1},8,["modelValue"])):T("",!0),b(e(E),{modelValue:l.modelValue.encoding_compatibility,"onUpdate:modelValue":p[6]||(p[6]=m=>l.modelValue.encoding_compatibility=m),type:"switch"},{default:w(()=>[V(v(e(n)("files_external","Compatibility with Mac NFD encoding (slow)")),1)]),_:1},8,["modelValue"])],10,ia),[[Y,c.value]])],2))}}),ua="_mountOptions_1fqyb_2",da="_mountOptions__fieldset_1fqyb_12",ca={mountOptions:ua,mountOptions__fieldset:da},ma={$style:ca},_a=N(ra,[["__cssModules",ma]]),{isAdmin:ue}=A("files_external","settings"),pa=A("files_external","allowedBackends"),de=A("files_external","backends").filter(l=>pa.includes(l.identifier)),ga=A("files_external","authMechanisms"),fa=$({__name:"AddExternalStorageDialog",props:Z({storage:{default:()=>({backendOptions:{},mountOptions:{},type:ue?"system":"personal"})}},{open:{type:Boolean,default:!0},openModifiers:{}}),emits:Z(["close"],["update:open"]),setup(l){const a=B(l,"open"),t=M(structuredClone(Q(l.storage)));K(()=>{a.value&&(t.value=structuredClone(Q(l.storage)))});const r=C({get(){return de.find(i=>i.identifier===t.value.backend)},set(i){t.value.backend=i?.identifier}}),d=C(()=>ga.filter(({scheme:i})=>r.value?.authSchemes[i])),c=C({get(){return d.value.find(i=>i.identifier===t.value.authMechanism)},set(i){const o=d.value.find(s=>s.identifier===t.value.authMechanism);o&&o.identifier!==i?.identifier&&t.value.backendOptions&&Qe(t.value.backendOptions,o.configuration,[i?.configuration,r.value?.configuration]),t.value.authMechanism=i?.identifier}});return z(d,()=>{d.value.length===1&&(t.value.authMechanism=d.value[0].identifier)}),(i,o)=>(u(),k(e(Re),{open:a.value,"onUpdate:open":[o[9]||(o[9]=s=>a.value=s),o[11]||(o[11]=s=>s||i.$emit("close"))],isForm:"",contentClasses:i.$style.externalStorageDialog,name:t.value.id?e(n)("files_external","Edit storage"):e(n)("files_external","Add storage"),onSubmit:o[10]||(o[10]=s=>i.$emit("close",t.value))},{actions:w(()=>[l.storage.id?(u(),k(e(P),{key:0,onClick:o[8]||(o[8]=s=>i.$emit("close"))},{default:w(()=>[V(v(e(n)("files_external","Cancel")),1)]),_:1})):T("",!0),b(e(P),{variant:"primary",type:"submit"},{default:w(()=>[V(v(l.storage.id?e(n)("files_external","Edit"):e(n)("files_external","Create")),1)]),_:1})]),default:w(()=>[b(e(me),{modelValue:t.value.mountPoint,"onUpdate:modelValue":o[0]||(o[0]=s=>t.value.mountPoint=s),label:e(n)("files_external","Folder name"),required:""},null,8,["modelValue","label"]),b(_a,{modelValue:t.value.mountOptions,"onUpdate:modelValue":o[1]||(o[1]=s=>t.value.mountOptions=s)},null,8,["modelValue"]),e(ue)?(u(),k(Ke,{key:0,groups:t.value.applicableGroups,"onUpdate:groups":o[2]||(o[2]=s=>t.value.applicableGroups=s),users:t.value.applicableUsers,"onUpdate:users":o[3]||(o[3]=s=>t.value.applicableUsers=s)},null,8,["groups","users"])):T("",!0),b(e(ae),{modelValue:r.value,"onUpdate:modelValue":o[4]||(o[4]=s=>r.value=s),options:e(de),disabled:!!(t.value.id&&t.value.backend),inputLabel:e(n)("files_external","External storage"),label:"name",required:""},null,8,["modelValue","options","disabled","inputLabel"]),b(e(ae),{modelValue:c.value,"onUpdate:modelValue":o[5]||(o[5]=s=>c.value=s),options:d.value,disabled:!t.value.backend||d.value.length<=1,inputLabel:e(n)("files_external","Authentication"),label:"name",required:""},null,8,["modelValue","options","disabled","inputLabel"]),r.value&&t.value.backendOptions?(u(),k(na,{key:1,modelValue:t.value.backendOptions,"onUpdate:modelValue":o[6]||(o[6]=s=>t.value.backendOptions=s),class:x(i.$style.externalStorageDialog__configuration),configuration:r.value.configuration},null,8,["modelValue","class","configuration"])):T("",!0),c.value&&t.value.backendOptions?(u(),k(ea,{key:2,modelValue:t.value.backendOptions,"onUpdate:modelValue":o[7]||(o[7]=s=>t.value.backendOptions=s),class:x(i.$style.externalStorageDialog__configuration),authMechanism:c.value},null,8,["modelValue","class","authMechanism"])):T("",!0)]),_:1},8,["open","contentClasses","name"]))}}),va="_externalStorageDialog_9wew8_2",ba="_externalStorageDialog__configuration_9wew8_9",ya={externalStorageDialog:va,externalStorageDialog__configuration:ba},ha={$style:ya},xe=N(fa,[["__cssModules",ha]]),xa={class:"hidden-visually"},wa={key:0},ka=$({__name:"ExternalStorageTableRow",props:{storage:{},isAdmin:{type:Boolean}},setup(l){const a=l,t=se(),r=A("files_external","backends"),d=C(()=>r.find(f=>f.identifier===a.storage.backend).name),c=A("files_external","authMechanisms"),i=C(()=>c.find(f=>f.identifier===a.storage.authMechanism).name),o=M(!1),s=C(()=>{if(o.value)return{icon:"loading",label:n("files_external","Checking …")};const f=a.storage.status??L.Indeterminate,ne=a.storage.statusMessage||Ge[f],q=Ie[f],oe=f===L.NetworkError||f===L.Timeout,we=!oe&&f!==L.Success&&f!==L.Indeterminate;return{icon:q,label:ne,isWarning:oe,isError:we}}),p=be(()=>a.storage.applicableUsers||[]);async function m(){await t.deleteStorage(a.storage)}async function _(){const f=await Fe(xe,{storage:a.storage});f&&await t.updateStorage(f)}async function g(){o.value=!0;try{await t.reloadStorage(a.storage)}finally{o.value=!1}}return(f,ne)=>(u(),h("tr",{class:x(f.$style.storageTableRow)},[y("td",null,[y("span",xa,v(s.value.label),1),b(e(P),{"aria-label":e(n)("files_external","Recheck status"),title:s.value.label,variant:"tertiary-no-background",onClick:g},{icon:w(()=>[s.value.icon==="loading"?(u(),k(e(_e),{key:0})):(u(),k(e(F),{key:1,class:x({[f.$style.storageTableRow__status_error]:s.value.isError,[f.$style.storageTableRow__status_warning]:s.value.isWarning}),path:s.value.icon},null,8,["class","path"]))]),_:1},8,["aria-label","title"])]),y("td",null,v(l.storage.mountPoint),1),y("td",null,v(d.value),1),y("td",null,v(i.value),1),l.isAdmin?(u(),h("td",wa,[y("div",{class:x(f.$style.storageTableRow__cellApplicable)},[(u(!0),h(S,null,O(l.storage.applicableGroups,q=>(u(),k(e(je),{key:q,iconPath:e(Te),noClose:"",text:q},null,8,["iconPath","text"]))),128)),(u(!0),h(S,null,O(e(p),q=>(u(),k(e(He),{key:q.user,displayName:q.displayName,size:24,user:q.user},null,8,["displayName","user"]))),128))],2)])):T("",!0),y("td",null,[l.isAdmin||l.storage.type==="personal"?(u(),h("div",{key:0,class:x(f.$style.storageTableRow__cellActions)},[b(e(P),{"aria-label":e(n)("files_external","Edit"),title:e(n)("files_external","Edit"),onClick:_},{icon:w(()=>[b(e(F),{path:e(Oe)},null,8,["path"])]),_:1},8,["aria-label","title"]),b(e(P),{"aria-label":e(n)("files_external","Delete"),title:e(n)("files_external","Delete"),variant:"error",onClick:m},{icon:w(()=>[b(e(F),{path:e(Ne)},null,8,["path"])]),_:1},8,["aria-label","title"])],2)):(u(),k(e(F),{key:1,inline:"",path:e(qe),name:e(n)("files_external","System provided storage"),title:e(n)("files_external","System provided storage")},null,8,["path","name","title"]))])],2))}}),Va="_storageTableRow__cellActions_1k62p_2",Sa="_storageTableRow__cellApplicable_1k62p_7",Ca="_storageTableRow__status_warning_1k62p_17",Ma="_storageTableRow__status_error_1k62p_21",Aa={storageTableRow__cellActions:Va,storageTableRow__cellApplicable:Sa,storageTableRow__status_warning:Ca,storageTableRow__status_error:Ma},Ua={$style:Aa},$a=N(ka,[["__cssModules",Ua]]),Ta=["aria-label"],Oa={class:"hidden-visually"},Na={key:0},qa={class:"hidden-visually"},Pa=$({__name:"ExternalStorageTable",setup(l){const a=se(),{isAdmin:t}=A("files_external","settings"),r=C(()=>t?a.globalStorages:[...a.userStorages,...a.globalStorages]);return(d,c)=>(u(),h("table",{class:x(d.$style.storageTable),"aria-label":e(n)("files_external","External storages")},[y("thead",{class:x(d.$style.storageTable__header)},[y("tr",null,[y("th",{class:x(d.$style.storageTable__headerStatus)},[y("span",Oa,v(e(n)("files_external","Status")),1)],2),y("th",{class:x(d.$style.storageTable__headerFolder)},v(e(n)("files_external","Folder name")),3),y("th",{class:x(d.$style.storageTable__headerBackend)},v(e(n)("files_external","External storage")),3),y("th",{class:x(d.$style.storageTable__headerAuthentication)},v(e(n)("files_external","Authentication")),3),e(t)?(u(),h("th",Na,v(e(n)("files_external","Restricted to")),1)):T("",!0),y("th",{class:x(d.$style.storageTable__headerActions)},[y("span",qa,v(e(n)("files_external","Actions")),1)],2)])],2),y("tbody",null,[(u(!0),h(S,null,O(r.value,i=>(u(),k($a,{key:i.id,isAdmin:e(t),storage:i},null,8,["isAdmin","storage"]))),128))])],10,Ta))}}),Ea="_storageTable_1dqte_2",Ra="_storageTable__header_1dqte_11",Fa="_storageTable__headerStatus_1dqte_16",Ba="_storageTable__headerFolder_1dqte_20",La="_storageTable__headerBackend_1dqte_24",ja="_storageTable__headerFAuthentication_1dqte_28",Da="_storageTable__headerActions_1dqte_32",Ha={storageTable:Ea,storageTable__header:Ra,storageTable__headerStatus:Fa,storageTable__headerFolder:Ba,storageTable__headerBackend:La,storageTable__headerFAuthentication:ja,storageTable__headerActions:Da},Ga={$style:Ha},Ia=N(Pa,[["__cssModules",Ga]]),Qa=$({__name:"UserMountSettings",setup(l){const a=A("files_external","user-mounting"),t=A("files_external","backends").filter(c=>c.identifier!=="local"),r=M(a.allowUserMounting),d=M(a.allowedBackends);return z(r,()=>{const c=!r.value;window.OCP.AppConfig.setValue("files_external","allow_user_mounting",r.value?"yes":"no",{success:()=>le(n("files_external","Saved")),error:()=>{r.value=c,te(n("files_external","Error while saving"))}})}),z(d,(c,i)=>{window.OCP.AppConfig.setValue("files_external","user_mounting_backends",c.join(","),{success:()=>le(n("files_external","Saved allowed backends")),error:()=>{te(n("files_external","Failed to save allowed backends")),d.value=i}})}),(c,i)=>(u(),h("form",null,[y("h3",{class:x(c.$style.userMountSettings__heading)},v(e(n)("files_external","Advanced options for external storage mounts")),3),b(e(E),{modelValue:r.value,"onUpdate:modelValue":i[0]||(i[0]=o=>r.value=o),type:"switch"},{default:w(()=>[V(v(e(n)("files_external","Allow people to mount external storage")),1)]),_:1},8,["modelValue"]),W(y("fieldset",{class:x(c.$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,O(e(t),o=>(u(),k(e(E),{key:o.identifier,modelValue:d.value,"onUpdate:modelValue":i[1]||(i[1]=s=>d.value=s),value:o.identifier,name:"allowUserMountingBackends[]"},{default:w(()=>[V(v(o.name),1)]),_:2},1032,["modelValue","value"]))),128))],2),[[Y,r.value]])]))}}),za="_userMountSettings__heading_59moz_2",Za="_userMountSettings__backends_59moz_9",Ka={userMountSettings__heading:za,userMountSettings__backends:Za},Wa={$style:Ka},Ya=N(Qa,[["__cssModules",Wa]]);const Ja=["aria-label"],Xa=$({__name:"ExternalStoragesSection",setup(l){const a=A("files_external","settings",{docUrl:"",dependencyIssues:{messages:null,modules:null},isAdmin:!1}),t=se(),r=a.dependencyIssues?.messages??[],d=a.dependencyIssues?.modules??{},c=M(!1),i=M();async function o(s){if(c.value=!1,!!s)try{a.isAdmin?await t.createGlobalStorage(s):await t.createUserStorage(s),i.value=void 0}catch(p){ve.error("Failed to add external storage",{error:p,storage:s}),i.value={...s},c.value=!0}}return(s,p)=>(u(),k(e(ce),{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,O(e(r),(m,_)=>(u(),k(e(re),{key:_,type:"error"},{default:w(()=>[V(v(m),1)]),_:2},1024))),128)),(u(!0),h(S,null,O(e(d),(m,_)=>(u(),k(e(re),{key:_,type:"warning"},{default:w(()=>[y("p",null,[_==="curl"?(u(),h(S,{key:0},[V(v(e(n)("files_external","The cURL support in PHP is not enabled or installed.")),1)],64)):_==="ftp"?(u(),h(S,{key:1},[V(v(e(n)("files_external","The FTP support in PHP is not enabled or installed.")),1)],64)):(u(),h(S,{key:2},[V(v(e(n)("files_external","{module} is not installed.",{module:_})),1)],64)),V(" "+v(e(Ee)("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:",m.length)),1)]),y("ul",{class:x(s.$style.externalStoragesSection__dependantList),"aria-label":e(n)("files_external","Dependant backends")},[(u(!0),h(S,null,O(m,g=>(u(),h("li",{key:g},v(g),1))),128))],10,Ja)]),_:2},1024))),128)),T("",!0),b(Ia),b(e(P),{class:x(s.$style.externalStoragesSection__newStorageButton),variant:"primary",onClick:p[0]||(p[0]=m=>c.value=!c.value)},{icon:w(()=>[b(e(F),{path:e(Pe)},null,8,["path"])]),default:w(()=>[V(" "+v(e(n)("files_external","Add external storage")),1)]),_:1},8,["class"]),b(xe,{open:c.value,"onUpdate:open":p[1]||(p[1]=m=>c.value=m),storage:i.value,onClose:o},null,8,["open","storage"]),e(a).isAdmin?(u(),k(Ya,{key:1})):T("",!0)]),_:1},8,["docUrl","name","description"]))}}),et="_externalStoragesSection__dependantList_atsmn_2",at="_externalStoragesSection__newStorageButton_atsmn_7",tt={externalStoragesSection__dependantList:et,externalStoragesSection__newStorageButton:at},lt={$style:tt},st=N(Xa,[["__cssModules",lt]]),nt=$({__name:"GlobalCredentialsSection",setup(l){const a=A("files_external","global-credentials"),t=M(!1),r=M(a.user),d=M(a.password);fe(U);async function c(){try{t.value=!0;const{data:i}=await U.post(R("apps/files_external/globalcredentials"),{uid:a.uid,user:r.value,password:d.value},{confirmPassword:I.Strict});if(i){le(n("files_external","Global credentials saved"));return}}catch(i){ve.error(i)}finally{t.value=!1}te(n("files_external","Could not save global credentials")),r.value=a.user,d.value=a.password}return(i,o)=>(u(),k(e(ce),{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(i.$style.globalCredentialsSectionForm),autocomplete:"false",onSubmit:Me(c,["prevent"])},[b(e(me),{modelValue:r.value,"onUpdate:modelValue":o[0]||(o[0]=s=>r.value=s),name:"username",autocomplete:"false",label:e(n)("files_external","Login")},null,8,["modelValue","label"]),b(e(De),{modelValue:d.value,"onUpdate:modelValue":o[1]||(o[1]=s=>d.value=s),name:"password",autocomplete:"false",label:e(n)("files_external","Password")},null,8,["modelValue","label"]),b(e(P),{class:x(i.$style.globalCredentialsSectionForm__submit),disabled:t.value,variant:"primary",type:"submit"},{default:w(()=>[V(v(t.value?e(n)("files_external","Saving …"):e(n)("files_external","Save")),1)]),_:1},8,["class","disabled"])],34)]),_:1},8,["name","description"]))}}),ot="_globalCredentialsSectionForm_bgjv2_2",it="_globalCredentialsSectionForm__submit_bgjv2_10",rt={globalCredentialsSectionForm:ot,globalCredentialsSectionForm__submit:it},ut={$style:rt},dt=N(nt,[["__cssModules",ut]]),ct=$({__name:"FilesExternalSettings",setup(l){return(a,t)=>(u(),h(S,null,[b(st),b(dt)],64))}}),mt=Ve(),X=Ae(ct);X.config.idPrefix="files-external",X.use(mt),X.mount("#files-external");
|
||
//# sourceMappingURL=files_external-settings.mjs.map
|