2024-11-05 12:32:35 +03:00
|
|
|
(()=>{"use strict";var t,e,n,i={26436:(t,e,n)=>{var i,r=n(32981),s=n(53334),o=n(35810),a=n(63814),l=n(85168),u=n(65043),d=n(85471);!function(t){t[t.SUCCESS=0]="SUCCESS",t[t.ERROR=1]="ERROR",t[t.INDETERMINATE=2]="INDETERMINATE",t[t.INCOMPLETE_CONF=3]="INCOMPLETE_CONF",t[t.UNAUTHORIZED=4]="UNAUTHORIZED",t[t.TIMEOUT=5]="TIMEOUT",t[t.NETWORK_ERROR=6]="NETWORK_ERROR"}(i||(i={}));const c=function(t){return!(!t.status||t.status===i.SUCCESS)&&(t.userProvided||"password::global::user"===t.authMechanism)},p=function(t){if(t.type===o.pt.File)return!1;const e=t.attributes;return!(!e.scope||!e.backend||"personal"!==e.scope&&"system"!==e.scope)},h=new o.hY({id:"credentials-external-storage",displayName:()=>(0,s.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:t=>{if(1!==t.length)return!1;const e=t[0];if(!p(e))return!1;const n=e.attributes?.config||{};return!!c(n)},async exec(t){const{login:e,password:r}=await new Promise((t=>(0,l.Ss)((0,d.$V)((()=>Promise.all([n.e(4208),n.e(5203)]).then(n.bind(n,95203)))),{},(e=>{t(e)}))));return e&&r?await async function(t,e,n){const r=(await u.Ay.put((0,a.Jv)("apps/files_external/userglobalstorages/{id}",{id:t.attributes.id}),{backendOptions:{user:e,password:n}})).data;return r.status!==i.SUCCESS?((0,l.Qg)((0,s.Tl)("files_external","Unable to update this external storage config. {statusMessage}",{statusMessage:r?.statusMessage||""})),null):((0,l.Te)((0,s.Tl)("files_external","New configuration successfully saved")),d.Ay.set(t.attributes,"config",r),!0)}(t,e,r):null},order:-1e3,default:o.m9.DEFAULT,inline:()=>!0});var f=n(85072),g=n.n(f),m=n(97825),E=n.n(m),w=n(77659),N=n.n(w),v=n(55056),b=n.n(v),A=n(10540),x=n.n(A),I=n(41113),y=n.n(I),T=n(64755),O={};O.styleTagTransform=y(),O.setAttributes=b(),O.insert=N().bind(null,"head"),O.domAPI=E(),O.insertStyleElement=x(),g()(T.A,O),T.A&&T.A.locals&&T.A.locals;var _=n(21777);const R=`/files/${(0,_.HW)()?.uid}`,C=t=>{const e=(t.path+"/"+t.name).replace(/^\//gm,"");return new o.vd({id:t.id,source:(0,a.dC)("dav"+R+"/"+e),root:R,owner:(0,_.HW)()?.uid||null,permissions:t.config.status!==i.SUCCESS?o.aX.NONE:t?.permissions||o.aX.READ,attributes:{displayName:e,...t}})},L=new o.hY({id:"check-external-storage",displayName:()=>"",iconSvgInline:()=>"",enabled:t=>t.every((t=>!0===p(t))),exec:async()=>null,async renderInline(t){let e=null;try{const n=await function(t){const e=arguments.length>1&&void 0!==arguments[1]&&!arguments[1]?"userstorages":"userglobalstorages";return u.Ay.get((0,a.Jv)(`apps/files_external/${e}/${t}?testOnly=false`))}(t.attributes.id,"system"===t.attributes.scope);if(e=n.data,d.Ay.set(t.attributes,"config",e),e.status!==i.SUCCESS)throw new Error(e?.statusMessage||(0,s.Tl)("files_external","There was an error with this external storage."));return null}catch(n){if(n.response&&!e)return(0,l.I9)((0,s.Tl)("files_external","We were unable to check the external storage {basename}",{basename:t.basename})),null;const i=c(e),r=document.createElement("span");r.classList.add("files-list__row-status--"+(i?"warning":"error"));const o=document.createElement("span");return o.className="files-list__row-status",i||(o.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>',o.title=n.message),o.prepend(r),o}},order:10}),S=new o.hY({id:"open-in-files-external-storage",displayName:t=>(t?.[0]?.attributes?.config||{status:i.INDETERMINATE}).status!==i.SUCCESS?(0,s.Tl)("files_external","Examine this faulty external storage configuration"):(0,s.Tl)("files","Open in Files"),iconSvgInline:()=>"",enabled:(t,e)=>"extstoragemounts"===e.id,async exec(t){const e=t.attributes.config;return e?.status!==i.SUCCESS?(window.OC.dialogs.confirm((0,s.Tl)("files_external","There was an error with
|