You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nextcloud/dist/files_external-init.js

3 lines
51 KiB
JavaScript

/*! For license information please see files_external-init.js.license?v=54017e1061d02cb19e80 */
(()=>{"use strict";var t,e,n,i={26436:(t,e,n)=>{var i,r=n(38613),s=n(53334),o=n(35810),a=n(63814),l=n(85168),u=n(26287),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)},h=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)},p=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=>{var e;if(1!==t.length)return!1;const n=t[0];if(!h(n))return!1;const i=(null===(e=n.attributes)||void 0===e?void 0:e.config)||{};return!!c(i)},async exec(t){const e=await fetch((0,a.KT)("/apps/files_external/api/v1/auth"),{headers:new Headers({Accept:"application/json"}),credentials:"include"}),n=await(null==e?void 0:e.json())||{};if(n.ocs.data.user&&n.ocs.data.password){const e=(await u.A.put((0,a.Jv)("apps/files_external/userglobalstorages/{id}",t.attributes),{backendOptions:n.ocs.data})).data;if(e.status!==i.SUCCESS)return(0,l.Qg)((0,s.Tl)("files_external","Unable to update this external storage config. {statusMessage}",{statusMessage:(null==e?void 0:e.statusMessage)||""})),null;(0,l.Te)((0,s.Tl)("files_external","New configuration successfully saved")),d.Ay.set(t.attributes,"config",e)}return null},order:-1e3,default:o.m9.DEFAULT,inline:()=>!0});var f=n(85072),g=n.n(f),m=n(97825),w=n.n(m),v=n(77659),b=n.n(v),x=n(55056),y=n.n(x),E=n(10540),A=n.n(E),N=n(41113),_=n.n(N),T=n(64755),C={};C.styleTagTransform=_(),C.setAttributes=y(),C.insert=b().bind(null,"head"),C.domAPI=w(),C.insertStyleElement=A(),g()(T.A,C),T.A&&T.A.locals&&T.A.locals;var O,I=n(92457);const S="/files/".concat(null===(O=(0,I.HW)())||void 0===O?void 0:O.uid),P=t=>{var e;const n=(t.path+"/"+t.name).replace(/^\//gm,"");return new o.vd({id:t.id,source:(0,a.dC)("dav"+S+"/"+n),root:S,owner:(null===(e=(0,I.HW)())||void 0===e?void 0:e.uid)||null,permissions:t.config.status!==i.SUCCESS?o.aX.NONE:(null==t?void 0:t.permissions)||o.aX.READ,attributes:{displayName:n,...t}})},D=new o.hY({id:"check-external-storage",displayName:()=>"",iconSvgInline:()=>"",enabled:t=>t.every((t=>!0===h(t))),exec:async()=>null,async renderInline(t){let e=null;try{const r=await function(t){const e=arguments.length>1&&void 0!==arguments[1]&&!arguments[1]?"userstorages":"userglobalstorages";return u.A.get((0,a.Jv)("apps/files_external/".concat(e,"/").concat(t,"?testOnly=false")))}(t.attributes.id,"system"===t.attributes.scope);var n;if(e=r.data,d.Ay.set(t.attributes,"config",e),e.status!==i.SUCCESS)throw new Error((null===(n=e)||void 0===n?void 0:n.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--".concat(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}),k=new o.hY({id:"open-in-files-external-storage",displayName:t=>{var e;return((null==t||null===(e=t[0])||void 0===e||null===(e=e.attributes)||void 0===e?void 0:e.config)||{status:i.INDETERMINATE}).status!==i.SUCCESS?(0,s.Tl)("files_external","Exa
//# sourceMappingURL=files_external-init.js.map?v=54017e1061d02cb19e80