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
50 KiB
JavaScript

/*! For license information please see files_external-init.js.LICENSE.txt */
(()=>{"use strict";var t,e,n,i={5220:(t,e,n)=>{var i,r=n(43554),s=n(31352),o=n(5656),a=n(79753),l=n(64024),u=n(93664),c=n(20144);!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 d=function(t){return!(!t.status||t.status===i.SUCCESS)&&(t.userProvided||"password::global::user"===t.authMechanism)},p=function(t){if(t.type===o.Tv.File)return!1;const e=t.attributes;return!(!e.scope||!e.backend||"personal"!==e.scope&&"system"!==e.scope)},h=new o.p$({id:"credentials-external-storage",displayName:()=>(0,s.Iu)("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!!d(n)},async exec(t){const e=await fetch((0,a.generateOcsUrl)("/apps/files_external/api/v1/auth"),{headers:new Headers({Accept:"application/json"}),credentials:"include"}),n=await(e?.json())||{};if(n.ocs.data.user&&n.ocs.data.password){const e=(await u.Z.put((0,a.generateUrl)("apps/files_external/userglobalstorages/{id}",t.attributes),{backendOptions:n.ocs.data})).data;if(e.status!==i.SUCCESS)return(0,l.x2)((0,s.Iu)("files_external","Unable to update this external storage config. {statusMessage}",{statusMessage:e?.statusMessage||""})),null;(0,l.s$)((0,s.Iu)("files_external","New configuration successfully saved")),c.default.set(t.attributes,"config",e)}return null},order:-1e3,default:o.DT.DEFAULT,inline:()=>!0});var f=n(93379),g=n.n(f),m=n(7795),w=n.n(m),v=n(90569),b=n.n(v),x=n(3565),y=n.n(x),E=n(19216),A=n.n(E),N=n(44589),_=n.n(N),T=n(17150),C={};C.styleTagTransform=_(),C.setAttributes=y(),C.insert=b().bind(null,"head"),C.domAPI=w(),C.insertStyleElement=A(),g()(T.Z,C),T.Z&&T.Z.locals&&T.Z.locals;var I=n(77958);const O=`/files/${(0,I.ts)()?.uid}`,S=t=>{const e=(t.path+"/"+t.name).replace(/^\//gm,"");return new o.gt({id:t.id,source:(0,a.generateRemoteUrl)("dav"+O+"/"+e),root:O,owner:(0,I.ts)()?.uid||null,permissions:t.config.status!==i.SUCCESS?o.y3.NONE:t?.permissions||o.y3.READ,attributes:{displayName:e,...t}})},P=new o.p$({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.Z.get((0,a.generateUrl)(`apps/files_external/${e}/${t}?testOnly=false`))}(t.attributes.id,"system"===t.attributes.scope);if(e=n.data,c.default.set(t.attributes,"config",e),e.status!==i.SUCCESS)throw new Error(e?.statusMessage||(0,s.Iu)("files_external","There was an error with this external storage."));return null}catch(n){if(n.response&&!e)return(0,l.K2)((0,s.Iu)("files_external","We were unable to check the external storage {basename}",{basename:t.basename})),null;const i=d(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}),D=new o.p$({id:"open-in-files-external-storage",displayName:t=>(t?.[0]?.attributes?.config||{status:i.INDETERMINATE}).status!==i.SUCCESS?(0,s.Iu)("files_external","Examine this faulty external storage configuration"):(0,s.Iu)("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.Iu)(
//# sourceMappingURL=files_external-init.js.map?v=9c59d33c79a8e6b4e46f