mirror of
https://github.com/nextcloud/server.git
synced 2026-03-28 13:23:49 -04:00
2 lines
26 KiB
JavaScript
2 lines
26 KiB
JavaScript
import{d as ke,c as Ve}from"./pinia-CBvB36LD.chunk.mjs";import{a9 as K,j as ee,Q as Se,F as M,f as $,B,o as u,g as k,u as e,r as C,i as Z,c as h,A as x,b as y,t as v,H as S,N as Me,I as O,K as W,L as Y,e as T,E as z,_ as Q,a3 as ie,h as b,w,v as V,M as Ce,x as Ae}from"./runtime-dom.esm-bundler-CKxgtjB6.chunk.mjs";import{l as Ue,n as $e,o as Te,p as Oe,f as Ne,q as qe,N as re,e as Pe}from"./mdi--cNatcgF.chunk.mjs";import{a as N,l as A}from"./index-BgmsSgl5.chunk.mjs";import{t as n,b as Ee}from"./translation-DoG5ZELJ-XUrtIRvk.chunk.mjs";import{N as P}from"./autolink-U5pBzLgI-D1NMH9bI.chunk.mjs";import"./NcEmptyContent-CDgWCt_m-Dz_uR0NU.chunk.mjs";import{g as R,N as F}from"./createElementId-DhjFt1I9-DdwCqgaq.chunk.mjs";import{N as ce}from"./ContentCopy-ljx8CODs.chunk.mjs";import{N as Re,s as Fe}from"./index-CrY7NZWO.chunk.mjs";import{N as ae}from"./NcSelect-B1uITk_3-0e2p8qEi.chunk.mjs";import{_ as _e}from"./TrashCanOutline-DmYYOQ4b.chunk.mjs";import{c as U}from"./index-2a6kOrDy.chunk.mjs";import{N as Be}from"./index-DblWoJ6I.chunk.mjs";import{u as Le}from"./index-BShhF1iS.chunk.mjs";import"./PencilOutline-Qk8GS-l0.chunk.mjs";import"./NcBreadcrumbs-5gl8Syfa-DJcXDkmn.chunk.mjs";import"./NcDateTime.vue_vue_type_script_setup_true_lang-B4upiZjL-CDFdx-HI.chunk.mjs";import"./NcModal-kyWZ3UFC-CC38MZrD.chunk.mjs";import"./NcAvatar-ruClKRzS-gxaDTlsM.chunk.mjs";import"./NcContent-D69ktIEB-CM64XV1n.chunk.mjs";import{N as me}from"./Web-DS-WBH9c.chunk.mjs";import"./index-Bndk0DrU.chunk.mjs";import{N as E}from"./NcCheckboxRadioSwitch-D0gFwEVl-BbcIGLyw.chunk.mjs";import{N as je}from"./Plus-BtJ3xjfW.chunk.mjs";import"./NcColorPicker-D07Se8Xb-D3qyscwi.chunk.mjs";import"./TrayArrowDown-D7fMRVjO.chunk.mjs";import"./NcEmojiPicker-DGgqTnHp-BmMIlAzR.chunk.mjs";import"./NcRichText-D_ssz6sB-ByGnwwpX.chunk.mjs";/* empty css */import"./NcInputField-CPL-a_MM-R1bsVnGI.chunk.mjs";import{N as De}from"./NcPasswordField-BOLzDHBJ-CKSnPt2n.chunk.mjs";import"./index-CqVYsIAH.chunk.mjs";import{N as He}from"./NcUserBubble-BE6yD-R0-BAJg1c4w.chunk.mjs";import"./NcUserStatusIcon-JWiuiAXe-DUOABbOJ.chunk.mjs";import"./colors-BfjxNgsx-YlZbKUzS.chunk.mjs";import{_ as pe}from"./AuthMechanismRsa-CX_mdruD.chunk.mjs";import{C as ge,a as H,M as G,S as L,b as Ge,c as Ie}from"./types-Dild8a3G.chunk.mjs";import{a as fe,P as I}from"./index-BJDJuif3.chunk.mjs";import{a as te,d as le}from"./index-C1xmmKTZ-DF4bDPEh.chunk.mjs";import{l as ve}from"./logger-resIultJ.chunk.mjs";import"./index-sH3U_332.chunk.mjs";const Qe='<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(t){const a=M(()=>ee(t).map(l=>({id:`user:${l}`,user:l,displayName:J.get(l)||l})));return K(async()=>{const l=ee(t).filter(r=>!J.has(r));if(l.length>0){const{data:r}=await U.post(R("/displaynames"),{users:l});for(const[d,c]of Object.entries(r.users))J.set(d,c)}}),a}function Ze(t){return M(()=>ee(t).map(ye))}function ye(t){return{id:t,isNoUser:!0,displayName:t,iconSvg:Qe}}const ze=$({__name:"ApplicableEntities",props:{groups:{default:()=>[]},groupsModifiers:{},users:{default:()=>[]},usersModifiers:{}},emits:["update:groups","update:users"],setup(t){const a=B(t,"groups"),l=B(t,"users"),r=C([]),d=be(l),c=Ze(a),o=M({get(){return[...c.value,...d.value]},set(p){l.value=p.filter(_=>_.user).map(_=>_.user),a.value=p.filter(_=>_.isNoUser).map(_=>_.id)}}),i=Le(s,500);async function s(p){const{data:_}=await U.get(R("apps/files_external/ajax/applicable"),{params:{pattern:p,limit:20}}),m=[...r.value.map(g=>[g.id,g]),...Object.entries(_.groups).map(([g,f])=>[g,{...ye(g),displayName:f}]),...Object.entries(_.users).map(([g,f])=>[`user:${g}`,{id:`user:${g}`,user:g,displayName:f}])];r.value=[...new Map(m).values()]}return(p,_)=>(u(),k(e(Be),{modelValue:o.value,"onUpdate:modelValue":_[0]||(_[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"]))}}),Ke=$({__name:"AuthMechanismConfiguration",props:z({authMechanism:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const a=B(t,"modelValue"),l=t,r=M(()=>{if(!l.authMechanism.configuration)return;const s=Object.entries(l.authMechanism.configuration).filter(([,p])=>!(p.flags&H.UserProvided));return Object.fromEntries(s)}),d=M(()=>window.OCA.FilesExternal.AuthMechanism.getHandler(l.authMechanism)),c=M(()=>{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}),o=C(!1);K(async()=>{d.value&&(o.value=!0,await window.customElements.whenDefined(d.value.tagName),o.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 i(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},[o.value?(u(),k(e(me),{key:0})):(u(),k(Me(d.value.tagName),{key:1,".modelValue":a.value,".authMechanism":t.authMechanism,"onUpdate:modelValue":i},null,40,[".modelValue",".authMechanism"]))],64)):(u(!0),h(S,{key:1},O(r.value,(_,m)=>W((u(),k(pe,{key:_.value,modelValue:a.value[m],"onUpdate:modelValue":g=>a.value[m]=g,"config-key":m,"config-option":_},null,8,["modelValue","onUpdate:modelValue","config-key","config-option"])),[[Y,!(_.flags&e(H).Hidden)]])),128))],2)):T("",!0)}}),We="_authMechanismConfiguration_kpcpy_2",Ye={authMechanismConfiguration:We},Je={$style:Ye},Xe=N(Ke,[["__cssModules",Je]]),ea=$({__name:"BackendConfiguration",props:z({configuration:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(t){const a=B(t,"modelValue"),l=t;return Z(()=>l.configuration,()=>{for(const r in l.configuration)r in a.value||(a.value[r]=l.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(t.configuration,(c,o)=>W((u(),k(pe,{key:c.value,modelValue:a.value[o],"onUpdate:modelValue":i=>a.value[o]=i,configKey:o,configOption:c},null,8,["modelValue","onUpdate:modelValue","configKey","configOption"])),[[Y,!(c.flags&e(H).Hidden)]])),128))],2))}}),aa="_backendConfiguration_1sf6y_2",ta={backendConfiguration:aa},la={$style:ta},sa=N(ea,[["__cssModules",la]]),{isAdmin:na}=A("files_external","settings"),se=ke("files_external--storages",()=>{const t=C([]),a=C([]);async function l(m){const g=R("apps/files_external/globalstorages"),{data:f}=await U.post(g,Q(m),{confirmPassword:I.Strict});t.value.push(j(f))}async function r(m){const g=R("apps/files_external/userstorages"),{data:f}=await U.post(g,Q(m),{confirmPassword:I.Strict});a.value.push(j(f))}async function d(m){await U.delete(p(m),{confirmPassword:I.Strict}),m.type==="personal"?a.value=a.value.filter(g=>g.id!==m.id):t.value=t.value.filter(g=>g.id!==m.id)}async function c(m){const{data:g}=await U.put(p(m),Q(m),{confirmPassword:I.Strict});_(j(g))}async function o(m){const{data:g}=await U.get(p(m));_(j(g))}return s(),{globalStorages:t,userStorages:a,createGlobalStorage:l,createUserStorage:r,deleteStorage:d,reloadStorage:o,updateStorage:c};async function i(m){const g=`apps/files_external/${m}`,{data:f}=await U.get(R(g));return Object.values(f).map(j)}async function s(){fe(U),na?t.value=await i("globalstorages"):(a.value=await i("userstorages"),t.value=await i("userglobalstorages"))}function p(m){const g=m.type==="personal"?"userstorages":"globalstorages";return R(`apps/files_external/${g}/${m.id}`)}function _(m){if(m.type==="personal"){const g=a.value.findIndex(f=>f.id===m.id);a.value.splice(g,1,m)}else{const g=t.value.findIndex(f=>f.id===m.id);t.value.splice(g,1,m)}}});function j(t){return{...t,mountOptions:he(t.mountOptions)}}function he(t){const a={...t};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(t,a=!1){return t===void 0?a:t===!0||t==="true"||t==="1"}const oa=["id","aria-labelledby"],ia=$({__name:"MountOptions",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(t){const a=B(t,"modelValue");K(()=>{Object.keys(a.value).length===0&&(a.value=he(a.value))});const{hasEncryption:l}=A("files_external","settings"),r=ie(),d=ie(),c=C(!1),o=[{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}],i=M({get(){return o.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]=_=>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:i.value,"onUpdate:modelValue":p[1]||(p[1]=_=>i.value=_),inputLabel:e(n)("files_external","Check filesystem changes"),options:o},null,8,["modelValue","inputLabel"]),b(e(E),{modelValue:t.modelValue.readonly,"onUpdate:modelValue":p[2]||(p[2]=_=>t.modelValue.readonly=_),type:"switch"},{default:w(()=>[V(v(e(n)("files_external","Read only")),1)]),_:1},8,["modelValue"]),b(e(E),{modelValue:t.modelValue.previews,"onUpdate:modelValue":p[3]||(p[3]=_=>t.modelValue.previews=_),type:"switch"},{default:w(()=>[V(v(e(n)("files_external","Enable previews")),1)]),_:1},8,["modelValue"]),b(e(E),{modelValue:t.modelValue.enable_sharing,"onUpdate:modelValue":p[4]||(p[4]=_=>t.modelValue.enable_sharing=_),type:"switch"},{default:w(()=>[V(v(e(n)("files_external","Enable sharing")),1)]),_:1},8,["modelValue"]),e(l)?(u(),k(e(E),{key:0,modelValue:t.modelValue.encrypt,"onUpdate:modelValue":p[5]||(p[5]=_=>t.modelValue.encrypt=_),type:"switch"},{default:w(()=>[V(v(e(n)("files_external","Enable encryption")),1)]),_:1},8,["modelValue"])):T("",!0),b(e(E),{modelValue:t.modelValue.encoding_compatibility,"onUpdate:modelValue":p[6]||(p[6]=_=>t.modelValue.encoding_compatibility=_),type:"switch"},{default:w(()=>[V(v(e(n)("files_external","Compatibility with Mac NFD encoding (slow)")),1)]),_:1},8,["modelValue"])],10,oa),[[Y,c.value]])],2))}}),ra="_mountOptions_1fqyb_2",ua="_mountOptions__fieldset_1fqyb_12",da={mountOptions:ra,mountOptions__fieldset:ua},ca={$style:da},_a=N(ia,[["__cssModules",ca]]),{isAdmin:ue}=A("files_external","settings"),ma=A("files_external","allowedBackends"),de=A("files_external","backends").filter(t=>ma.includes(t.identifier)),pa=A("files_external","authMechanisms"),ga=$({__name:"AddExternalStorageDialog",props:z({storage:{default:()=>({backendOptions:{},mountOptions:{},type:ue?"system":"personal"})}},{open:{type:Boolean,default:!0},openModifiers:{}}),emits:z(["close"],["update:open"]),setup(t){const a=B(t,"open"),l=C(structuredClone(Q(t.storage)));K(()=>{a.value&&(l.value=structuredClone(Q(t.storage)))});const r=M({get(){return de.find(o=>o.identifier===l.value.backend)},set(o){l.value.backend=o?.identifier}}),d=M(()=>pa.filter(({scheme:o})=>r.value?.authSchemes[o])),c=M({get(){return d.value.find(o=>o.identifier===l.value.authMechanism)},set(o){l.value.authMechanism=o?.identifier}});return Z(d,()=>{d.value.length===1&&(l.value.authMechanism=d.value[0].identifier)}),(o,i)=>(u(),k(e(Re),{open:a.value,"onUpdate:open":[i[9]||(i[9]=s=>a.value=s),i[11]||(i[11]=s=>s||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]=s=>o.$emit("close",l.value))},{actions:w(()=>[t.storage.id?(u(),k(e(P),{key:0,onClick:i[8]||(i[8]=s=>o.$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(t.storage.id?e(n)("files_external","Edit"):e(n)("files_external","Create")),1)]),_:1})]),default:w(()=>[b(e(_e),{modelValue:l.value.mountPoint,"onUpdate:modelValue":i[0]||(i[0]=s=>l.value.mountPoint=s),label:e(n)("files_external","Folder name"),required:""},null,8,["modelValue","label"]),b(_a,{modelValue:l.value.mountOptions,"onUpdate:modelValue":i[1]||(i[1]=s=>l.value.mountOptions=s)},null,8,["modelValue"]),e(ue)?(u(),k(ze,{key:0,groups:l.value.applicableGroups,"onUpdate:groups":i[2]||(i[2]=s=>l.value.applicableGroups=s),users:l.value.applicableUsers,"onUpdate:users":i[3]||(i[3]=s=>l.value.applicableUsers=s)},null,8,["groups","users"])):T("",!0),b(e(ae),{modelValue:r.value,"onUpdate:modelValue":i[4]||(i[4]=s=>r.value=s),options:e(de),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(ae),{modelValue:c.value,"onUpdate:modelValue":i[5]||(i[5]=s=>c.value=s),options:d.value,disabled:!l.value.backend||d.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&&l.value.backendOptions?(u(),k(sa,{key:1,modelValue:l.value.backendOptions,"onUpdate:modelValue":i[6]||(i[6]=s=>l.value.backendOptions=s),class:x(o.$style.externalStorageDialog__configuration),configuration:r.value.configuration},null,8,["modelValue","class","configuration"])):T("",!0),c.value&&l.value.backendOptions?(u(),k(Xe,{key:2,modelValue:l.value.backendOptions,"onUpdate:modelValue":i[7]||(i[7]=s=>l.value.backendOptions=s),class:x(o.$style.externalStorageDialog__configuration),authMechanism:c.value},null,8,["modelValue","class","authMechanism"])):T("",!0)]),_:1},8,["open","contentClasses","name"]))}}),fa="_externalStorageDialog_9wew8_2",va="_externalStorageDialog__configuration_9wew8_9",ba={externalStorageDialog:fa,externalStorageDialog__configuration:va},ya={$style:ba},xe=N(ga,[["__cssModules",ya]]),ha={class:"hidden-visually"},xa={key:0},wa=$({__name:"ExternalStorageTableRow",props:{storage:{},isAdmin:{type:Boolean}},setup(t){const a=t,l=se(),r=A("files_external","backends"),d=M(()=>r.find(f=>f.identifier===a.storage.backend).name),c=A("files_external","authMechanisms"),o=M(()=>c.find(f=>f.identifier===a.storage.authMechanism).name),i=C(!1),s=M(()=>{if(i.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 _(){await l.deleteStorage(a.storage)}async function m(){const f=await Fe(xe,{storage:a.storage});f&&await l.updateStorage(f)}async function g(){i.value=!0;try{await l.reloadStorage(a.storage)}finally{i.value=!1}}return(f,ne)=>(u(),h("tr",{class:x(f.$style.storageTableRow)},[y("td",null,[y("span",ha,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(me),{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(t.storage.mountPoint),1),y("td",null,v(d.value),1),y("td",null,v(o.value),1),t.isAdmin?(u(),h("td",xa,[y("div",{class:x(f.$style.storageTableRow__cellApplicable)},[(u(!0),h(S,null,O(t.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,[t.isAdmin||t.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:m},{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:_},{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))}}),ka="_storageTableRow__cellActions_1k62p_2",Va="_storageTableRow__cellApplicable_1k62p_7",Sa="_storageTableRow__status_warning_1k62p_17",Ma="_storageTableRow__status_error_1k62p_21",Ca={storageTableRow__cellActions:ka,storageTableRow__cellApplicable:Va,storageTableRow__status_warning:Sa,storageTableRow__status_error:Ma},Aa={$style:Ca},Ua=N(wa,[["__cssModules",Aa]]),$a=["aria-label"],Ta={class:"hidden-visually"},Oa={key:0},Na={class:"hidden-visually"},qa=$({__name:"ExternalStorageTable",setup(t){const a=se(),{isAdmin:l}=A("files_external","settings"),r=M(()=>l?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",Ta,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(l)?(u(),h("th",Oa,v(e(n)("files_external","Restricted to")),1)):T("",!0),y("th",{class:x(d.$style.storageTable__headerActions)},[y("span",Na,v(e(n)("files_external","Actions")),1)],2)])],2),y("tbody",null,[(u(!0),h(S,null,O(r.value,o=>(u(),k(Ua,{key:o.id,isAdmin:e(l),storage:o},null,8,["isAdmin","storage"]))),128))])],10,$a))}}),Pa="_storageTable_1dqte_2",Ea="_storageTable__header_1dqte_11",Ra="_storageTable__headerStatus_1dqte_16",Fa="_storageTable__headerFolder_1dqte_20",Ba="_storageTable__headerBackend_1dqte_24",La="_storageTable__headerFAuthentication_1dqte_28",ja="_storageTable__headerActions_1dqte_32",Da={storageTable:Pa,storageTable__header:Ea,storageTable__headerStatus:Ra,storageTable__headerFolder:Fa,storageTable__headerBackend:Ba,storageTable__headerFAuthentication:La,storageTable__headerActions:ja},Ha={$style:Da},Ga=N(qa,[["__cssModules",Ha]]),Ia=$({__name:"UserMountSettings",setup(t){const a=A("files_external","user-mounting"),l=A("files_external","backends").filter(c=>c.identifier!=="local"),r=C(a.allowUserMounting),d=C(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,o)=>{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=o}})}),(c,o)=>(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":o[0]||(o[0]=i=>r.value=i),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(l),i=>(u(),k(e(E),{key:i.identifier,modelValue:d.value,"onUpdate:modelValue":o[1]||(o[1]=s=>d.value=s),value:i.identifier,name:"allowUserMountingBackends[]"},{default:w(()=>[V(v(i.name),1)]),_:2},1032,["modelValue","value"]))),128))],2),[[Y,r.value]])]))}}),Qa="_userMountSettings__heading_59moz_2",Za="_userMountSettings__backends_59moz_9",za={userMountSettings__heading:Qa,userMountSettings__backends:Za},Ka={$style:za},Wa=N(Ia,[["__cssModules",Ka]]);const Ya=["aria-label"],Ja=$({__name:"ExternalStoragesSection",setup(t){const a=A("files_external","settings",{docUrl:"",dependencyIssues:{messages:null,modules:null},isAdmin:!1}),l=se(),r=a.dependencyIssues?.messages??[],d=a.dependencyIssues?.modules??{},c=C(!1),o=C();async function i(s){if(c.value=!1,!!s)try{a.isAdmin?await l.createGlobalStorage(s):await l.createUserStorage(s),o.value=void 0}catch(p){ve.error("Failed to add external storage",{error:p,storage:s}),o.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:m,type:"error"},{default:w(()=>[V(v(_),1)]),_:2},1024))),128)),(u(!0),h(S,null,O(e(d),(_,m)=>(u(),k(e(re),{key:m,type:"warning"},{default:w(()=>[y("p",null,[m==="curl"?(u(),h(S,{key:0},[V(v(e(n)("files_external","The cURL support in PHP is not enabled or installed.")),1)],64)):m==="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:m})),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:",_.length)),1)]),y("ul",{class:x(s.$style.externalStoragesSection__dependantList),"aria-label":e(n)("files_external","Dependant backends")},[(u(!0),h(S,null,O(_,g=>(u(),h("li",{key:g},v(g),1))),128))],10,Ya)]),_:2},1024))),128)),T("",!0),b(Ga),b(e(P),{class:x(s.$style.externalStoragesSection__newStorageButton),variant:"primary",onClick:p[0]||(p[0]=_=>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]=_=>c.value=_),storage:o.value,onClose:i},null,8,["open","storage"]),e(a).isAdmin?(u(),k(Wa,{key:1})):T("",!0)]),_:1},8,["docUrl","name","description"]))}}),Xa="_externalStoragesSection__dependantList_atsmn_2",et="_externalStoragesSection__newStorageButton_atsmn_7",at={externalStoragesSection__dependantList:Xa,externalStoragesSection__newStorageButton:et},tt={$style:at},lt=N(Ja,[["__cssModules",tt]]),st=$({__name:"GlobalCredentialsSection",setup(t){const a=A("files_external","global-credentials"),l=C(!1),r=C(a.user),d=C(a.password);fe(U);async function c(){try{l.value=!0;const{data:o}=await U.post(R("apps/files_external/globalcredentials"),{uid:a.uid,user:r.value,password:d.value},{confirmPassword:I.Strict});if(o){le(n("files_external","Global credentials saved"));return}}catch(o){ve.error(o)}finally{l.value=!1}te(n("files_external","Could not save global credentials")),r.value=a.user,d.value=a.password}return(o,i)=>(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(o.$style.globalCredentialsSectionForm),autocomplete:"false",onSubmit:Ce(c,["prevent"])},[b(e(_e),{modelValue:r.value,"onUpdate:modelValue":i[0]||(i[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":i[1]||(i[1]=s=>d.value=s),name:"password",autocomplete:"false",label:e(n)("files_external","Password")},null,8,["modelValue","label"]),b(e(P),{class:x(o.$style.globalCredentialsSectionForm__submit),disabled:l.value,variant:"primary",type:"submit"},{default:w(()=>[V(v(l.value?e(n)("files_external","Saving …"):e(n)("files_external","Save")),1)]),_:1},8,["class","disabled"])],34)]),_:1},8,["name","description"]))}}),nt="_globalCredentialsSectionForm_bgjv2_2",ot="_globalCredentialsSectionForm__submit_bgjv2_10",it={globalCredentialsSectionForm:nt,globalCredentialsSectionForm__submit:ot},rt={$style:it},ut=N(st,[["__cssModules",rt]]),dt=$({__name:"FilesExternalSettings",setup(t){return(a,l)=>(u(),h(S,null,[b(lt),b(ut)],64))}}),ct=Ve(),X=Ae(dt);X.config.idPrefix="files-external",X.use(ct),X.mount("#files-external");
|
||
//# sourceMappingURL=files_external-settings.mjs.map
|