2025-10-22 12:27:14 -04:00
|
|
|
(()=>{"use strict";var e,t,n,r={61876:(e,t,n)=>{var r,s=n(81222),a=n(53334),i=n(35810),o=n(56760),l=n(63814),c=n(85168),u=n(19051),d=n(85471);!function(e){e[e.SUCCESS=0]="SUCCESS",e[e.ERROR=1]="ERROR",e[e.INDETERMINATE=2]="INDETERMINATE",e[e.INCOMPLETE_CONF=3]="INCOMPLETE_CONF",e[e.UNAUTHORIZED=4]="UNAUTHORIZED",e[e.TIMEOUT=5]="TIMEOUT",e[e.NETWORK_ERROR=6]="NETWORK_ERROR"}(r||(r={}));const f=function(e){return!(!e.status||e.status===r.SUCCESS)&&(e.userProvided||"password::global::user"===e.authMechanism)},p=function(e){if(e.type===i.pt.File)return!1;const t=e.attributes;return!(!t.scope||!t.backend||"personal"!==t.scope&&"system"!==t.scope)};(0,o.IF)(u.Ay);const A=new i.hY({id:"credentials-external-storage",displayName:()=>(0,a.Tl)("files","Enter missing credentials"),iconSvgInline:()=>'<svg xmlns="http://www.w3.org/2000/svg" id="mdi-login" viewBox="0 0 24 24"><path d="M11 7L9.6 8.4L12.2 11H2V13H12.2L9.6 15.6L11 17L16 12L11 7M20 19H12V21H20C21.1 21 22 20.1 22 19V5C22 3.9 21.1 3 20 3H12V5H20V19Z" /></svg>',enabled:e=>{if(1!==e.length)return!1;const t=e[0];if(!p(t))return!1;const n=t.attributes?.config||{};return!!f(n)},async exec(e){const{login:t,password:s}=await new Promise(e=>(0,c.Ss)((0,d.$V)(()=>Promise.all([n.e(4208),n.e(4040)]).then(n.bind(n,74040))),{},t=>{e(t)}));if(t&&s)try{await async function(e,t,n){const s=(await u.Ay.request({method:"PUT",url:(0,l.Jv)("apps/files_external/userglobalstorages/{id}",{id:e.attributes.id}),confirmPassword:o.mH.Strict,data:{backendOptions:{user:t,password:n}}})).data;return s.status!==r.SUCCESS?((0,c.Qg)((0,a.Tl)("files_external","Unable to update this external storage config. {statusMessage}",{statusMessage:s?.statusMessage||""})),null):((0,c.Te)((0,a.Tl)("files_external","New configuration successfully saved")),d.Ay.set(e.attributes,"config",s),!0)}(e,t,s),(0,c.Te)((0,a.Tl)("files_external","Credentials successfully set"))}catch(e){(0,c.Qg)((0,a.Tl)("files_external","Error while setting credentials: {error}",{error:e.message}))}return null},order:-1e3,default:i.m9.DEFAULT,inline:()=>!0});var g=n(85072),m=n.n(g),h=n(97825),w=n.n(h),C=n(77659),b=n.n(C),v=n(55056),x=n.n(v),y=n(10540),T=n.n(y),E=n(41113),_=n.n(E),S=n(64755),H={};H.styleTagTransform=_(),H.setAttributes=x(),H.insert=b().bind(null,"head"),H.domAPI=w(),H.insertStyleElement=T(),m()(S.A,H),S.A&&S.A.locals&&S.A.locals;var O=n(21777);const N=`/files/${(0,O.HW)()?.uid}`,k=e=>{const t=(e.path+"/"+e.name).replace(/^\//gm,"");return new i.vd({id:e.id,source:(0,l.dC)("dav"+N+"/"+t),root:N,owner:(0,O.HW)()?.uid||null,permissions:e.config.status!==r.SUCCESS?i.aX.NONE:e?.permissions||i.aX.READ,attributes:{displayName:t,...e}})},P=new i.hY({id:"check-external-storage",displayName:()=>"",iconSvgInline:()=>"",enabled:e=>e.every(e=>!0===p(e)),exec:async()=>null,async renderInline(e){const t=document.createElement("span");t.className="files-list__row-status",t.innerHTML=(0,a.Tl)("files_external","Checking storage …");let n=null;return function(e,t=!0){const n=t?"userglobalstorages":"userstorages";return u.Ay.get((0,l.Jv)(`apps/files_external/${n}/${e}?testOnly=false`))}(e.attributes.id,"system"===e.attributes.scope).then(s=>{if(n=s.data,d.Ay.set(e.attributes,"config",n),n.status!==r.SUCCESS)throw new Error(n?.statusMessage||(0,a.Tl)("files_external","There was an error with this external storage."));t.remove()}).catch(r=>{r.response&&!n&&(0,c.I9)((0,a.Tl)("files_external","We were unable to check the external storage {basename}",{basename:e.basename})),t.innerHTML="";const s=!!n&&f(n),i=document.createElement("span");i.classList.add("files-list__row-status--"+(s?"warning":"error")),s||(t.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-alert-circle" viewBox="0 0 24 24"><path d="M13,13H11V7H13M13,17H11V15H13M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2Z" /></svg>',t.title=r.message),t.prepend(i)}),t},order:10}),I=new i.hY({id:"open-in-files-external-storage",displayName:e=>(e?.[0]?.attributes?.config||{status:r.INDETERMINATE}).status!==r.SUCCESS?(0,a.Tl)("files_external","Examine this faulty ex
|