0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-05-18 04:01:41 +00:00
nextcloud_server/dist/files_external-init.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

2 lines
54 KiB
JavaScript
Raw Permalink Normal View History

(()=>{"use strict";var t,e,n,r={26436:(t,e,n)=>{var r,i=n(32981),s=n(53334),o=n(35810),a=n(56760),l=n(63814),u=n(85168),c=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"}(r||(r={}));const h=function(t){return!(!t.status||t.status===r.SUCCESS)&&(t.userProvided||"password::global::user"===t.authMechanism)},f=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)};(0,a.IF)(c.Ay);const 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=>{if(1!==t.length)return!1;const e=t[0];if(!f(e))return!1;const n=e.attributes?.config||{};return!!h(n)},async exec(t){const{login:e,password:i}=await new Promise((t=>(0,u.Ss)((0,d.$V)((()=>Promise.all([n.e(4208),n.e(7367)]).then(n.bind(n,7367)))),{},(e=>{t(e)}))));if(e&&i)try{await async function(t,e,n){const i=(await c.Ay.request({method:"PUT",url:(0,l.Jv)("apps/files_external/userglobalstorages/{id}",{id:t.attributes.id}),confirmPassword:a.mH.Strict,data:{backendOptions:{user:e,password:n}}})).data;return i.status!==r.SUCCESS?((0,u.Qg)((0,s.Tl)("files_external","Unable to update this external storage config. {statusMessage}",{statusMessage:i?.statusMessage||""})),null):((0,u.Te)((0,s.Tl)("files_external","New configuration successfully saved")),d.Ay.set(t.attributes,"config",i),!0)}(t,e,i),(0,u.Te)((0,s.Tl)("files_external","Credentials successfully set"))}catch(t){(0,u.Qg)((0,s.Tl)("files_external","Error while setting credentials: {error}",{error:t.message}))}return null},order:-1e3,default:o.m9.DEFAULT,inline:()=>!0});var g=n(85072),E=n.n(g),m=n(97825),N=n.n(m),w=n(77659),A=n.n(w),v=n(55056),b=n.n(v),x=n(10540),I=n.n(x),T=n(41113),y=n.n(T),O=n(64755),C={};C.styleTagTransform=y(),C.setAttributes=b(),C.insert=A().bind(null,"head"),C.domAPI=N(),C.insertStyleElement=I(),E()(O.A,C),O.A&&O.A.locals&&O.A.locals;var R=n(21777);const L=`/files/${(0,R.HW)()?.uid}`,_=t=>{const e=(t.path+"/"+t.name).replace(/^\//gm,"");return new o.vd({id:t.id,source:(0,l.dC)("dav"+L+"/"+e),root:L,owner:(0,R.HW)()?.uid||null,permissions:t.config.status!==r.SUCCESS?o.aX.NONE:t?.permissions||o.aX.READ,attributes:{displayName:e,...t}})},S=new o.hY({id:"check-external-storage",displayName:()=>"",iconSvgInline:()=>"",enabled:t=>t.every((t=>!0===f(t))),exec:async()=>null,async renderInline(t){const e=document.createElement("span");e.className="files-list__row-status",e.innerHTML=(0,s.Tl)("files_external","Checking storage …");let n=null;return function(t){const e=arguments.length>1&&void 0!==arguments[1]&&!arguments[1]?"userstorages":"userglobalstorages";return c.Ay.get((0,l.Jv)(`apps/files_external/${e}/${t}?testOnly=false`))}(t.attributes.id,"system"===t.attributes.scope).then((i=>{if(n=i.data,d.Ay.set(t.attributes,"config",n),n.status!==r.SUCCESS)throw new Error(n?.statusMessage||(0,s.Tl)("files_external","There was an error with this external storage."));e.remove()})).catch((r=>{r.response&&!n&&(0,u.I9)((0,s.Tl)("files_external","We were unable to check the external storage {basename}",{basename:t.basename})),e.innerHTML="";const i=!!n&&h(n),o=document.createElement("span");o.classList.add("files-list__row-status--"+(i?"warning":"error")),i||(e.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>',e.title=r.message),e.prepend(o)})),e},order:10}),P=new o.hY({id:"open-in-files-external-storage",displayName:t=>(t?.[0]?.attributes?.config||{status:r.INDETERMINATE}).status!
//# sourceMappingURL=files_external-init.js.map?v=edd8ed716db8caef6c00